]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue 1299 Angle presentation: proving arrow hide (to have better visualization for...
authornds <nds@opencascade.com>
Wed, 16 Mar 2016 14:50:50 +0000 (17:50 +0300)
committernds <nds@opencascade.com>
Wed, 16 Mar 2016 14:50:50 +0000 (17:50 +0300)
src/SketcherPrs/AIS_AngleDimension.cxx
src/SketcherPrs/AIS_AngleDimension.hxx
src/SketcherPrs/SketcherPrs_Angle.cpp

index a9b83a87cc344050087946e63926e8e947549166..492dabbbaeb37be811777397e3a11d7556b38b3f 100755 (executable)
@@ -278,6 +278,7 @@ void AIS_AngleDimension::SetMeasuredGeometry (const TopoDS_Face& theFirstFace,
 void AIS_AngleDimension::Init()
 {
   SetGeometryOrientedAngle (Standard_False, Standard_False);
+  SetArrowVisible(Standard_True, Standard_True);
   SetSpecialSymbol (THE_DEGREE_SYMBOL);
   SetDisplaySpecialSymbol (AIS_DSS_After);
   SetFlyout (15.0);
@@ -339,8 +340,8 @@ void AIS_AngleDimension::DrawArc (const Handle(Prs3d_Presentation)& thePresentat
 
   gp_Pln aPlane = aConstructPlane.Value();
   if (myGeometryOrientedAngle) {
-    gp_Dir aCPlaneDir = aPlane.Axis().Direction();
-    bool aCPlaneDirToReverse = aCPlaneDir.X() < 0 || aCPlaneDir.Y() < 0 || aCPlaneDir.Z() < 0;
+    gp_Dir aCPlaneDir = GetPlane().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();
@@ -714,8 +715,8 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
       if (theMode == ComputeMode_All || theMode == ComputeMode_Line)
       {
         DrawArc (thePresentation,
-                 isArrowsExternal ? aFirstAttach : aFirstArrowEnd,
-                 isArrowsExternal ? aSecondAttach : aSecondArrowEnd,
+                 (isArrowsExternal || !myFirstArrowVisible) ? aFirstAttach : aFirstArrowEnd,
+                 (isArrowsExternal || !mySecondArrowVisible) ? aSecondAttach : aSecondArrowEnd,
                  myCenterPoint,
                  Abs (GetFlyout()),
                  theMode);
@@ -727,7 +728,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
     {
       DrawExtension (thePresentation,
                      anExtensionSize,
-                     isArrowsExternal ? aFirstArrowEnd : aFirstAttach,
+                     (isArrowsExternal && myFirstArrowVisible) ? aFirstArrowEnd : aFirstAttach,
                      aFirstExtensionDir,
                      aLabelString,
                      aLabelWidth,
@@ -740,7 +741,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
     {
       DrawExtension (thePresentation,
                      anExtensionSize,
-                     isArrowsExternal ? aSecondArrowEnd : aSecondAttach,
+                     (isArrowsExternal && mySecondArrowVisible) ? aSecondArrowEnd : aSecondAttach,
                      aSecondExtensionDir,
                      aLabelString,
                      aLabelWidth,
@@ -756,8 +757,8 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
     Prs3d_Root::NewGroup (thePresentation);
 
     DrawArc (thePresentation,
-             isArrowsExternal ? aFirstAttach  : aFirstArrowEnd,
-             isArrowsExternal ? aSecondAttach : aSecondArrowEnd,
+             (isArrowsExternal || !myFirstArrowVisible) ? aFirstAttach  : aFirstArrowEnd,
+             (isArrowsExternal || !mySecondArrowVisible) ? aSecondAttach : aSecondArrowEnd,
              myCenterPoint,
              Abs(GetFlyout ()),
              theMode);
@@ -768,15 +769,17 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
   {
     Prs3d_Root::NewGroup (thePresentation);
 
-    DrawArrow (thePresentation, aFirstArrowBegin,  gp_Dir (aFirstArrowVec));
-    DrawArrow (thePresentation, aSecondArrowBegin, gp_Dir (aSecondArrowVec));
+    if (myFirstArrowVisible)
+      DrawArrow (thePresentation, aFirstArrowBegin,  gp_Dir (aFirstArrowVec));
+    if (mySecondArrowVisible)
+      DrawArrow (thePresentation, aSecondArrowBegin, gp_Dir (aSecondArrowVec));
   }
 
   if ((theMode == ComputeMode_All || theMode == ComputeMode_Line) && isArrowsExternal)
   {
     Prs3d_Root::NewGroup (thePresentation);
 
-    if (aHPosition != LabelPosition_Left)
+    if (aHPosition != LabelPosition_Left && myFirstArrowVisible)
     {
       DrawExtension (thePresentation,
                      aDimensionAspect->ArrowTailSize(),
@@ -788,7 +791,7 @@ void AIS_AngleDimension::Compute (const Handle(PrsMgr_PresentationManager3d)& /*
                      LabelPosition_None);
     }
 
-    if (aHPosition != LabelPosition_Right)
+    if (aHPosition != LabelPosition_Right && mySecondArrowVisible)
     {
       DrawExtension (thePresentation,
                      aDimensionAspect->ArrowTailSize(),
@@ -1260,6 +1263,17 @@ void AIS_AngleDimension::SetGeometryOrientedAngle(const Standard_Boolean& theSta
   myUseReverse = theUseReverse;
 }
 
+//=======================================================================
+//function : SetArrowVisible
+//purpose  : 
+//=======================================================================
+void AIS_AngleDimension::SetArrowVisible(const Standard_Boolean& theFirstArrowVisible,
+                                         const Standard_Boolean& theSecondArrowVisible)
+{
+  myFirstArrowVisible = theFirstArrowVisible;
+  mySecondArrowVisible = theSecondArrowVisible;
+}
+
 //=======================================================================
 //function : AdjustParameters
 //purpose  : 
index 35851393c6947a992854812eed97b572f9f583fa..acf4299a72b45938bc4ac2fe10c67426e031093f 100755 (executable)
@@ -212,6 +212,12 @@ public:
   //! @param theSecondAttach [in] the second attachment point.
   void SetGeometryOrientedAngle(const Standard_Boolean& theState, const Standard_Boolean& theUseReverse);
 
+  //! Sets visible state of angle arrows. Default value is true for both
+  //! @param theFirstArrowVisible [in] the visibility of the first arrow.
+  //! @param theSecondArrowVisible [in] the visibility of the second arrow.
+  void SetArrowVisible(const Standard_Boolean& theFirstArrowVisible,
+                       const Standard_Boolean& theSecondArrowVisible);
+
 public:
 
   DEFINE_STANDARD_RTTI (AIS_AngleDimension)
@@ -343,6 +349,9 @@ private:
   Standard_Boolean myGeometryOrientedAngle;
   Standard_Boolean myUseReverse;
 
+  Standard_Boolean myFirstArrowVisible;
+  Standard_Boolean mySecondArrowVisible;
+
   gp_Pnt myFirstPoint;
   gp_Pnt mySecondPoint;
   gp_Pnt myCenterPoint;
index aa33c558e130d064030b9de6391ee5feba381a8f..8d91021bc7e2d4a9137bf19e2c56e1bb634bd404 100644 (file)
@@ -117,6 +117,7 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP
   switch (anAngleType) {
     case ANGLE_DIRECT: {
       SetGeometryOrientedAngle(true, false);
+      SetArrowVisible(Standard_False, Standard_True);
       SetMeasuredGeometry(aEdge1, aEdge2);
     }
     break;
@@ -129,11 +130,13 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP
       gp_Pnt aSecondPnt = SecondPoint();
       double anEdge2Length = aCenterPnt.Distance(aSecondPnt);
       aSecondPnt = aCenterPnt.Translated (gp_Vec(aCenterPnt, aSecondPnt).Normalized() * (-anEdge2Length));
+      SetArrowVisible(Standard_True, Standard_False);
       SetMeasuredGeometry(aFirstPnt, aCenterPnt, aSecondPnt);
     }
     break;
     case ANGLE_BACKWARD: {
       SetGeometryOrientedAngle(true, true);
+      SetArrowVisible(Standard_False, Standard_True);
       SetMeasuredGeometry(aEdge1, aEdge2);
     }
     break;