mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0031117: Visualization, AIS_ViewCube - additional properties for visualization of trihedron of a View Cube
AIS_ViewCube has been extended by additional properties (previously hard-coded): - radius of axes of the trihedron - radius of cones of the axes of the trihedron - radius of a sphere (central point) of the trihedron ViewerTest command vviewcube has been extended to support new parameters: -axesradius, -axesconeradius, -axessphereradius.
This commit is contained in:
parent
f7fc0c03be
commit
6466cc9eb1
@ -137,6 +137,9 @@ AIS_ViewCube::AIS_ViewCube()
|
||||
myBoxEdgeGap (0.0),
|
||||
myBoxFacetExtension (1.0),
|
||||
myAxesPadding (1.0),
|
||||
myAxesRadius (1.0),
|
||||
myAxesConeRadius (3.0),
|
||||
myAxesSphereRadius (4.0),
|
||||
myCornerMinSize (2.0),
|
||||
myRoundRadius (0.0),
|
||||
myToDisplayAxes (true),
|
||||
@ -599,7 +602,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
anAxisGroup->SetGroupPrimitivesAspect (aDatumAspect->ShadingAspect (aPart)->Aspect());
|
||||
|
||||
const Standard_Real anArrowLength = 0.2 * anAxisSize;
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTriangleArray = Prs3d_Arrow::DrawShaded (anAx1, 1.0, anAxisSize, 3.0, anArrowLength, THE_NB_ARROW_FACETTES);
|
||||
Handle(Graphic3d_ArrayOfTriangles) aTriangleArray = Prs3d_Arrow::DrawShaded (anAx1, myAxesRadius, anAxisSize, myAxesConeRadius, anArrowLength, THE_NB_ARROW_FACETTES);
|
||||
anAxisGroup->AddPrimitiveArray (aTriangleArray);
|
||||
|
||||
TCollection_AsciiString anAxisLabel;
|
||||
@ -621,7 +624,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
|
||||
Handle(Prs3d_ShadingAspect) anAspectCen = new Prs3d_ShadingAspect();
|
||||
anAspectCen->SetColor (Quantity_NOC_WHITE);
|
||||
aGroup->SetGroupPrimitivesAspect (anAspectCen->Aspect());
|
||||
Prs3d_ToolSphere aTool (4.0, THE_NB_DISK_SLICES, THE_NB_DISK_SLICES);
|
||||
Prs3d_ToolSphere aTool (myAxesSphereRadius, THE_NB_DISK_SLICES, THE_NB_DISK_SLICES);
|
||||
gp_Trsf aTrsf;
|
||||
aTrsf.SetTranslation (gp_Vec (gp::Origin(), aLocation));
|
||||
Handle(Graphic3d_ArrayOfTriangles) aCenterArray;
|
||||
|
@ -189,6 +189,45 @@ public: //! @name Geometry management API
|
||||
//! The value should be within [0, 0.5] range.
|
||||
Standard_EXPORT void SetRoundRadius (const Standard_Real theValue);
|
||||
|
||||
//! Returns radius of axes of the trihedron; 1.0 by default.
|
||||
Standard_Real AxesRadius() const { return myAxesRadius; }
|
||||
|
||||
//! Sets radius of axes of the trihedron.
|
||||
void SetAxesRadius (const Standard_Real theRadius)
|
||||
{
|
||||
if (Abs (myAxesRadius - theRadius) > Precision::Confusion())
|
||||
{
|
||||
myAxesRadius = theRadius;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! Returns radius of cone of axes of the trihedron; 3.0 by default.
|
||||
Standard_Real AxesConeRadius() const { return myAxesConeRadius; }
|
||||
|
||||
//! Sets radius of cone of axes of the trihedron.
|
||||
void SetAxesConeRadius (Standard_Real theRadius)
|
||||
{
|
||||
if (Abs (myAxesConeRadius - theRadius) > Precision::Confusion())
|
||||
{
|
||||
myAxesConeRadius = theRadius;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! Returns radius of sphere (central point) of the trihedron; 4.0 by default.
|
||||
Standard_Real AxesSphereRadius() const { return myAxesSphereRadius; }
|
||||
|
||||
//! Sets radius of sphere (central point) of the trihedron.
|
||||
void SetAxesSphereRadius (Standard_Real theRadius)
|
||||
{
|
||||
if (Abs (myAxesSphereRadius - theRadius) > Precision::Confusion())
|
||||
{
|
||||
myAxesSphereRadius = theRadius;
|
||||
SetToUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
//! @return TRUE if trihedron is drawn; TRUE by default.
|
||||
Standard_Boolean ToDrawAxes() const { return myToDisplayAxes; }
|
||||
|
||||
@ -621,6 +660,9 @@ protected:
|
||||
Standard_Real myBoxEdgeGap; //!< gap between box side and box edge
|
||||
Standard_Real myBoxFacetExtension; //!< box facet extension
|
||||
Standard_Real myAxesPadding; //!< Padding between box and axes
|
||||
Standard_Real myAxesRadius; //!< radius of axes of the trihedron; 1.0 by default
|
||||
Standard_Real myAxesConeRadius; //!< radius of cone of axes of the trihedron; 3.0 by default
|
||||
Standard_Real myAxesSphereRadius; //!< radius of sphere (central point) of the trihedron; 4.0 by default
|
||||
Standard_Real myCornerMinSize; //!< minimal size of box corner
|
||||
Standard_Real myRoundRadius; //!< relative round radius within [0; 0.5] range
|
||||
Standard_Boolean myToDisplayAxes; //!< trihedron visibility
|
||||
|
@ -13680,6 +13680,21 @@ static int VViewCube (Draw_Interpretor& ,
|
||||
{
|
||||
aViewCube->SetDuration (Draw::Atof (theArgVec[++anArgIter]));
|
||||
}
|
||||
else if (anArgIter + 1 < theNbArgs
|
||||
&& anArg == "-axesradius")
|
||||
{
|
||||
aViewCube->SetAxesRadius (Draw::Atof (theArgVec[++anArgIter]));
|
||||
}
|
||||
else if (anArgIter + 1 < theNbArgs
|
||||
&& anArg == "-axesconeradius")
|
||||
{
|
||||
aViewCube->SetAxesConeRadius (Draw::Atof (theArgVec[++anArgIter]));
|
||||
}
|
||||
else if (anArgIter + 1 < theNbArgs
|
||||
&& anArg == "-axessphereradius")
|
||||
{
|
||||
aViewCube->SetAxesSphereRadius (Draw::Atof (theArgVec[++anArgIter]));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Syntax error: unknown argument '" << anArg << "'\n";
|
||||
@ -14543,6 +14558,9 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
|
||||
"\n\t\t: -boxCornerMinSize Value minimal box corner size"
|
||||
"\n\t\t: -axesPadding Value padding between box and arrows"
|
||||
"\n\t\t: -roundRadius Value relative radius of corners of sides within [0.0, 0.5] range"
|
||||
"\n\t\t: -axesRadius Value radius of axes of the trihedron"
|
||||
"\n\t\t: -axesConeRadius Value radius of the cone (arrow) of the trihedron"
|
||||
"\n\t\t: -axesSphereRadius Value radius of the sphere (central point) of trihedron"
|
||||
"\n\t\t: -fixedanimation {0|1} uninterruptible animation loop"
|
||||
"\n\t\t: -duration Seconds animation duration in seconds",
|
||||
__FILE__, VViewCube, group);
|
||||
|
Loading…
x
Reference in New Issue
Block a user