]> OCCT Git - occt.git/commitdiff
Minor improvement to manipulator aspect (SIE01-4)
authormzernova <mzernova@opencascade.com>
Fri, 21 Apr 2023 13:41:51 +0000 (14:41 +0100)
committermzernova <mzernova@opencascade.com>
Fri, 21 Apr 2023 13:41:51 +0000 (14:41 +0100)
src/AIS/AIS_Manipulator.cxx
src/AIS/AIS_Manipulator.hxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx

index 12bad5b00488b41575150da99764c21e6abf4bea..e671599905bb7040c6ea59cc11b1803725c087f8 100644 (file)
@@ -371,6 +371,16 @@ void AIS_Manipulator::SetArrowHeadLength (const Standard_ShortReal theArrowHeadL
   SetToUpdate();
 }
 
+//=======================================================================
+//function : SetArrowHeadRadius
+//purpose  : 
+//=======================================================================
+void AIS_Manipulator::SetArrowHeadRadius (const Standard_ShortReal theArrowHeadRadius)
+{
+  myArrowHeadRadius = theArrowHeadRadius;
+  SetToUpdate();
+}
+
 //=======================================================================
 //function : SetDragPlaneSize
 //purpose  : 
@@ -999,6 +1009,7 @@ void AIS_Manipulator::setSize (const Standard_ShortReal theSideLength)
   myDragPlaneSize = myInnerRadius * 0.5f;
   myAxisRadius = myBoxSize / 4.0f;
   myArrowHeadLength = myLength * 0.25f;
+  myArrowHeadRadius = myAxisRadius * 1.5f,
 
   SetToUpdate();
 }
@@ -1577,7 +1588,7 @@ void AIS_Manipulator::Axis::Compute (const Handle(PrsMgr_PresentationManager)& t
     myTriangleArray = Prs3d_Arrow::DrawShaded (gp_Ax1(gp::Origin(), myReferenceAxis.Direction()),
                                                anAxisRadius,
                                                aLenght,
-                                               anAxisRadius * 1.5,
+                                               theManipulator->ArrowHeadRadius(),
                                                anArrowHeadLength,
                                                myFacettesNumber);
     myTranslatorGroup = thePrs->NewGroup();
index 8cc1a6c82a75c39a6b0ae3775842c2629b0bdc2e..898ae4f446a2046368f6a9f30a0f96c1d99d8c83 100644 (file)
@@ -320,6 +320,12 @@ public: //! @name Setters for parameters
   //! Sets length of the arrow tip of the translation axis.
   Standard_EXPORT void SetArrowHeadLength (const Standard_ShortReal theArrowHeadLength);
 
+  //! Gets radius of the head of the translation arrow axis.
+  Standard_ShortReal ArrowHeadRadius() const { return myArrowHeadRadius; }
+
+  //! Sets radius of the head of the translation arrow axis.
+  Standard_EXPORT void SetArrowHeadRadius (const Standard_ShortReal theValue);
+
   //! Gets size of drag plane.
   Standard_ShortReal DragPlaneSize() const { return myDragPlaneSize; }
 
@@ -709,6 +715,7 @@ protected:
   Standard_ShortReal myLength;          //!< Length of translation axis.
   Standard_ShortReal myArrowHeadLength; //!< Length of the arrow tip.
   Standard_ShortReal myAxisRadius;      //!< Radius of axis.
+  Standard_ShortReal myArrowHeadRadius; //!< Radius of the arrow tip.
 
   Standard_ShortReal myBoxSize;         //!< Size of scaling cube.
 
index 942cb8a6f952c53df2eada902f0e534bcbe10f63..12e5a61ef831d18341cdb1bfa735b94b783213ea 100644 (file)
@@ -12862,6 +12862,7 @@ static int VManipulator (Draw_Interpretor& theDi,
   aCmd.AddOption ("parts",             "... all mode {0|1} - set visual part");
   aCmd.AddOption ("angle",             "... startAngle endAngle - set arc angle");
   aCmd.AddOption ("axisrad",           "... radius - set axis radius");
+  aCmd.AddOption ("arrheadrad",        "... radius - set arrow head radius");
   aCmd.AddOption ("diskthickness",     "... value - set disk thickness");
   aCmd.AddOption ("innerrad",          "... radius - set axis radius");
   aCmd.AddOption ("arrlen",            "... len - set axis lenght");
@@ -13004,6 +13005,16 @@ static int VManipulator (Draw_Interpretor& theDi,
     }
     aManipulator->SetAxisRadius (aRadius);
   }
+  if (aCmd.HasOption("arrheadrad", 1, Standard_True))
+  {
+    Standard_ShortReal aRadius = aCmd.ArgFloat ("arrheadrad", 0);
+    if (aRadius <= 0)
+    {
+      Message::SendFail("Syntax error: radius value should be positive");
+      return 1;
+    }
+    aManipulator->SetArrowHeadRadius (aRadius);
+  }
   if (aCmd.HasOption("diskthickness", 1, Standard_True))
   {
     Standard_ShortReal aDiskThickness = aCmd.ArgFloat ("diskthickness", 0);
@@ -15009,14 +15020,15 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
       "\n      '-gap value'                      - set gap between sub-parts"
       "\n      '-part axis mode    {0|1}'        - set visual part"
       "\n      '-parts mode        {0|1}'        - set visual part"
-      "\n      '-angle startAngle endAngle       - set arc angle"
-      "\n      '-axisrad radius                  - set axis radius"
-      "\n      '-diskthickness value             - set disk thickness"
-      "\n      '-innerrad radius                 - set axis radius"
-      "\n      '-arrlen len                      - set axis lenght"
-      "\n      '-arrheadlen len                  - set length of the arrow tip"
-      "\n      '-dragplanesize size              - set size of the drag plane"
-      "\n      '-boxsize size                    - set size os scaling box"
+      "\n      '-angle startAngle endAngle'      - set arc angle"
+      "\n      '-axisrad radius'                 - set axis radius"
+      "\n      '-arrheadrad radius'              - set arrow head radius"
+      "\n      '-diskthickness value'            - set disk thickness"
+      "\n      '-innerrad radius'                - set axis radius"
+      "\n      '-arrlen len'                     - set axis lenght"
+      "\n      '-arrheadlen len'                 - set length of the arrow tip"
+      "\n      '-dragplanesize size'             - set size of the drag plane"
+      "\n      '-boxsize size'                   - set size os scaling box"
       "\n      '-pos x y z [nx ny nz [xx xy xz]' - set position of manipulator"
       //"\n      '-size value'                     - set size of manipulator"
       "\n      '-zoomable {0|1}'                 - set zoom persistence",