+ std::shared_ptr<GeomDataAPI_Point2D> aStartA = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aLineA->attribute(SketchPlugin_Line::START_ID()));
+ std::shared_ptr<GeomDataAPI_Point2D> aEndA = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aLineA->attribute(SketchPlugin_Line::END_ID()));
+ std::shared_ptr<GeomDataAPI_Point2D> aStartB = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aLineB->attribute(SketchPlugin_Line::START_ID()));
+ std::shared_ptr<GeomDataAPI_Point2D> aEndB = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aLineB->attribute(SketchPlugin_Line::END_ID()));
+
+ std::shared_ptr<GeomAPI_Angle2d> anAng;
+ bool isFirstPnt = aData->attribute(
+ SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID())->isInitialized();
+ bool isSecondPnt = aData->attribute(
+ SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID())->isInitialized();
+ if (!isFirstPnt || !isSecondPnt)
+ anAng = std::shared_ptr<GeomAPI_Angle2d>(new GeomAPI_Angle2d(
+ aStartA->pnt(), aEndA->pnt(), aStartB->pnt(), aEndB->pnt()));
+ else {
+ std::shared_ptr<GeomAPI_Lin2d> aLine1(new GeomAPI_Lin2d(aStartA->pnt(), aEndA->pnt()));
+ bool isReversed1 =
+ aData->boolean(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_FIRST_LINE_ID())->value();
+ std::shared_ptr<GeomAPI_Lin2d> aLine2(new GeomAPI_Lin2d(aStartB->pnt(), aEndB->pnt()));
+ bool isReversed2 =
+ aData->boolean(SketchPlugin_ConstraintAngle::ANGLE_REVERSED_SECOND_LINE_ID())->value();
+ anAng = std::shared_ptr<GeomAPI_Angle2d>(
+ new GeomAPI_Angle2d(aLine1, isReversed1, aLine2, isReversed2));
+ }
+
+ gp_Pnt2d aFirstPoint = anAng->firstPoint()->impl<gp_Pnt2d>();
+ std::shared_ptr<GeomAPI_Pnt> aPoint = thePlane->to3D(aFirstPoint.X(), aFirstPoint.Y());
+ theFirstPoint = aPoint->impl<gp_Pnt>();
+
+ gp_Pnt2d aCenterPoint = anAng->center()->impl<gp_Pnt2d>();
+ aPoint = thePlane->to3D(aCenterPoint.X(), aCenterPoint.Y());
+ theCenterPoint = aPoint->impl<gp_Pnt>();
+
+ gp_Pnt2d aSecondPoint = anAng->secondPoint()->impl<gp_Pnt2d>();
+ aPoint = thePlane->to3D(aSecondPoint.X(), aSecondPoint.Y());
+ theSecondPoint = aPoint->impl<gp_Pnt>();
+
+ return true;
+}
+
+
+void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+ const Handle(Prs3d_Presentation)& thePresentation,
+ const Standard_Integer theMode)
+{
+ gp_Pnt aFirstPoint, aSecondPoint, aCenterPoint;
+ bool aReadyToDisplay = readyToDisplay(myConstraint, mySketcherPlane,
+ aFirstPoint, aSecondPoint, aCenterPoint);
+ if (aReadyToDisplay) {
+ myFirstPoint = aFirstPoint;
+ mySecondPoint = aSecondPoint;
+ myCenterPoint = aCenterPoint;
+
+ DataPtr aData = myConstraint->data();
+ AttributeDoublePtr anAttributeValue =
+ aData->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID());
+ myValue.init(anAttributeValue);