X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketcherPrs%2FSketcherPrs_Angle.cpp;h=f5bcf8e3de258adabb2791c2ae02b9090f5b3ed4;hb=ea593bc59e7e9461f6c4e2afd3f24d621edb1011;hp=a7f366dd9714c0aab15eee3757b6b5c727c76221;hpb=6e421e939851e0de46554ae45a3ca0e1f67cd91d;p=modules%2Fshaper.git diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index a7f366dd9..f5bcf8e3d 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -54,9 +54,9 @@ extern void updateArrows(Handle(Prs3d_DimensionAspect) theDimAspect, IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Angle, AIS_AngleDimension); SketcherPrs_Angle::SketcherPrs_Angle(ModelAPI_Feature* theConstraint, - const std::shared_ptr& thePlane) + SketchPlugin_Sketch* theSketcher) : AIS_AngleDimension(gp_Pnt(0,0,0), gp_Pnt(1,0,0), gp_Pnt(0,1,0)), myConstraint(theConstraint), - mySketcherPlane(thePlane), + mySketcher(theSketcher), myFirstPoint(gp_Pnt(0,0,0)), myCenterPoint(gp_Pnt(1,0,0)), mySecondPoint(gp_Pnt(0,1,0)), myValue(90., false, ""), myFlyOutPoint(0, 0.5, 0) { @@ -165,8 +165,10 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode) { + if (!plane().get()) + return; gp_Pnt aFirstPoint, aSecondPoint, aCenterPoint; - bool aReadyToDisplay = readyToDisplay(myConstraint, mySketcherPlane, + bool aReadyToDisplay = readyToDisplay(myConstraint, plane(), aFirstPoint, aSecondPoint, aCenterPoint); if (aReadyToDisplay) { myFirstPoint = aFirstPoint; @@ -182,7 +184,7 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP std::dynamic_pointer_cast (aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT())); std::shared_ptr aFlyoutPnt = - mySketcherPlane->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); + plane()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y()); myFlyOutPoint = aFlyoutPnt->impl(); } @@ -287,12 +289,12 @@ void SketcherPrs_Angle::ComputeSelection(const Handle(SelectMgr_Selection)& aSel bool SketcherPrs_Angle::isAnglePlaneReversedToSketchPlane() { bool aReversed = false; - if (!mySketcherPlane.get()) + if (!plane().get()) return aReversed; gp_Pln aPlane = GetPlane(); gp_Dir aDir = aPlane.Axis().Direction(); - double aDot = mySketcherPlane->normal()->dot( + double aDot = plane()->normal()->dot( std::shared_ptr(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()))); return aDot < 0; }