From 166845748bd070a796be939baffc886bd8f10bf3 Mon Sep 17 00:00:00 2001 From: mzernova Date: Fri, 21 Apr 2023 14:41:51 +0100 Subject: [PATCH] Minor improvement to manipulator aspect (SIE01-4) --- src/AIS/AIS_Manipulator.cxx | 13 ++++++++- src/AIS/AIS_Manipulator.hxx | 7 +++++ src/ViewerTest/ViewerTest_ViewerCommands.cxx | 28 ++++++++++++++------ 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/src/AIS/AIS_Manipulator.cxx b/src/AIS/AIS_Manipulator.cxx index 12bad5b004..e671599905 100644 --- a/src/AIS/AIS_Manipulator.cxx +++ b/src/AIS/AIS_Manipulator.cxx @@ -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(); diff --git a/src/AIS/AIS_Manipulator.hxx b/src/AIS/AIS_Manipulator.hxx index 8cc1a6c82a..898ae4f446 100644 --- a/src/AIS/AIS_Manipulator.hxx +++ b/src/AIS/AIS_Manipulator.hxx @@ -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. diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 942cb8a6f9..12e5a61ef8 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -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",