From: nds Date: Wed, 16 Mar 2016 14:05:11 +0000 (+0300) Subject: Angle presentation: proving clockwise and counterclockwise angles. X-Git-Tag: V_2.3.0~382 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0cc80021f29eff8586d7b5f22f274185bb9241e3;p=modules%2Fshaper.git Angle presentation: proving clockwise and counterclockwise angles. --- diff --git a/src/SketcherPrs/AIS_AngleDimension.cxx b/src/SketcherPrs/AIS_AngleDimension.cxx index 4e2673625..a9b83a87c 100755 --- a/src/SketcherPrs/AIS_AngleDimension.cxx +++ b/src/SketcherPrs/AIS_AngleDimension.cxx @@ -277,7 +277,7 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theFirstFace, //======================================================================= void AIS_AngleDimension::Init() { - SetGeometryOrientedAngle (Standard_False); + SetGeometryOrientedAngle (Standard_False, Standard_False); SetSpecialSymbol (THE_DEGREE_SYMBOL); SetDisplaySpecialSymbol (AIS_DSS_After); SetFlyout (15.0); @@ -339,10 +339,22 @@ void AIS_AngleDimension::DrawArc (const Handle(Prs3d_Presentation)& thePresentat gp_Pln aPlane = aConstructPlane.Value(); if (myGeometryOrientedAngle) { - gp_Ax1 anAxis = aPlane.Axis(); - gp_Dir aDir = anAxis.Direction(); - aDir.Reverse(); - aPlane.SetAxis(gp_Ax1(anAxis.Location(), aDir)); + gp_Dir aCPlaneDir = aPlane.Axis().Direction(); + bool aCPlaneDirToReverse = aCPlaneDir.X() < 0 || aCPlaneDir.Y() < 0 || aCPlaneDir.Z() < 0; + // have similar direction for all cases + if (!aCPlaneDirToReverse && myUseReverse) { + gp_Ax1 anAxis = aPlane.Axis(); + gp_Dir aDir = anAxis.Direction(); + aDir.Reverse(); + aPlane.SetAxis(gp_Ax1(anAxis.Location(), aDir)); + } + + if (aCPlaneDirToReverse && !myUseReverse) { + gp_Ax1 anAxis = aPlane.Axis(); + gp_Dir aDir = anAxis.Direction(); + aDir.Reverse(); + aPlane.SetAxis(gp_Ax1(anAxis.Location(), aDir)); + } } // construct circle forming the arc @@ -355,8 +367,7 @@ void AIS_AngleDimension::DrawArc (const Handle(Prs3d_Presentation)& thePresentat gp_Circ aCircle = aConstructCircle.Value(); // construct the arc - Standard_Boolean isArcSense = !myGeometryOrientedAngle; - GC_MakeArcOfCircle aConstructArc(aCircle, theFirstAttach, theSecondAttach, isArcSense); + GC_MakeArcOfCircle aConstructArc(aCircle, theFirstAttach, theSecondAttach, Standard_True); if (!aConstructArc.IsDone()) { return; @@ -1242,9 +1253,11 @@ void AIS_AngleDimension::SetTextPosition (const gp_Pnt& theTextPos) //function : SetGeometryOrientedAngle //purpose : //======================================================================= -void AIS_AngleDimension::SetGeometryOrientedAngle(const Standard_Boolean& theState) +void AIS_AngleDimension::SetGeometryOrientedAngle(const Standard_Boolean& theState, + const Standard_Boolean& theUseReverse) { myGeometryOrientedAngle = theState; + myUseReverse = theUseReverse; } //======================================================================= diff --git a/src/SketcherPrs/AIS_AngleDimension.hxx b/src/SketcherPrs/AIS_AngleDimension.hxx index 5e2c13390..35851393c 100755 --- a/src/SketcherPrs/AIS_AngleDimension.hxx +++ b/src/SketcherPrs/AIS_AngleDimension.hxx @@ -210,7 +210,7 @@ public: //! Sets state if the create arc should be built depending on the input geometry orientation //! or to be always oriented in [0,0,1]. The last case propose angles more than 180 degree. //! @param theSecondAttach [in] the second attachment point. - void SetGeometryOrientedAngle(const Standard_Boolean& theState); + void SetGeometryOrientedAngle(const Standard_Boolean& theState, const Standard_Boolean& theUseReverse); public: @@ -341,6 +341,7 @@ protected: private: Standard_Boolean myGeometryOrientedAngle; + Standard_Boolean myUseReverse; gp_Pnt myFirstPoint; gp_Pnt mySecondPoint; diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index d5f3cff71..aa33c558e 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -116,13 +116,13 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP switch (anAngleType) { case ANGLE_DIRECT: { - SetGeometryOrientedAngle(false); + SetGeometryOrientedAngle(true, false); SetMeasuredGeometry(aEdge1, aEdge2); } break; case ANGLE_SUPPLEMENTARY: { // to calculate center, first and end points - SetGeometryOrientedAngle(false); + SetGeometryOrientedAngle(false, false); SetMeasuredGeometry(aEdge1, aEdge2); gp_Pnt aCenterPnt = CenterPoint(); gp_Pnt aFirstPnt = FirstPoint(); @@ -133,7 +133,7 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP } break; case ANGLE_BACKWARD: { - SetGeometryOrientedAngle(true); + SetGeometryOrientedAngle(true, true); SetMeasuredGeometry(aEdge1, aEdge2); } break;