+void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+ const Handle(Prs3d_Presentation)& thePresentation,
+ const Standard_Integer theMode)
+{
+ if (!plane().get())
+ return;
+ gp_Pnt aFirstPoint, aSecondPoint, aCenterPoint;
+ bool aReadyToDisplay = readyToDisplay(myConstraint, plane(),
+ 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);
+
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>
+ (aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+ std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt =
+ plane()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y());
+ myFlyOutPoint = aFlyoutPnt->impl<gp_Pnt>();
+ }
+
+ DataPtr aData = myConstraint->data();
+ std::shared_ptr<ModelAPI_AttributeInteger> aTypeAttr = std::dynamic_pointer_cast<
+ ModelAPI_AttributeInteger>(aData->attribute(SketchPlugin_ConstraintAngle::TYPE_ID()));
+ SketcherPrs_Tools::AngleType anAngleType = (SketcherPrs_Tools::AngleType)(aTypeAttr->value());
+
+ double aDist = -1;
+ switch (anAngleType) {
+ case SketcherPrs_Tools::ANGLE_DIRECT: {
+#ifndef COMPILATION_CORRECTION
+ SetArrowsVisibility(AIS_TOAV_Second);
+#endif
+ SetMeasuredGeometry(myFirstPoint, myCenterPoint, mySecondPoint);
+#ifndef COMPILATION_CORRECTION
+ bool isReversedPlanes = isAnglePlaneReversedToSketchPlane();
+ SetType(!isReversedPlanes ? AIS_TOA_Exterior : AIS_TOA_Interior);
+#endif
+ }
+ break;
+ case SketcherPrs_Tools::ANGLE_COMPLEMENTARY: {
+ double anEdge1Length = aCenterPoint.Distance(myFirstPoint);
+ //aDist = calculateDistanceToFlyoutPoint();
+ gp_Pnt aFirstPoint = aCenterPoint.Translated(
+ gp_Vec(myCenterPoint, myFirstPoint).Normalized() * (-anEdge1Length));
+ SetMeasuredGeometry(aFirstPoint, myCenterPoint, mySecondPoint);
+#ifndef COMPILATION_CORRECTION
+ SetType(AIS_TOA_Interior);
+#endif
+ }
+ break;
+ case SketcherPrs_Tools::ANGLE_BACKWARD: {
+#ifndef COMPILATION_CORRECTION
+ SetArrowsVisibility(AIS_TOAV_Second);
+#endif
+ SetMeasuredGeometry(myFirstPoint, myCenterPoint, mySecondPoint);
+ bool isReversedPlanes = isAnglePlaneReversedToSketchPlane();
+#ifndef COMPILATION_CORRECTION
+ SetType(isReversedPlanes ? AIS_TOA_Exterior : AIS_TOA_Interior);
+#endif
+ }
+ break;
+ default:
+ break;
+ }
+ if (aDist < 0) /// it was not calculated yet
+ aDist = calculateDistanceToFlyoutPoint();