From 24f9d04c728bc00e0286788fd2f7e0a5fd6609c3 Mon Sep 17 00:00:00 2001 From: kgv Date: Thu, 5 Nov 2020 12:30:46 +0300 Subject: [PATCH] 0031909: Visualization, AIS_Trihedron - replace maps with arrays Prs3d_DatumAspect, AIS_Trihedron - redundant maps have been replaced by explicitly sized arrays. AIS_Trihedron::myHasOwnDatumAspect - removed unused class field. Prs3d_DatumAttribute, Prs3d_DatumParts, Prs3d_DatumAxes - enumeration values have been renamed to have full name prefix. vzbufftrihedron - fixed no more necessary Quantity_Color -> Quantity_NameOfColor convertion. --- src/AIS/AIS_Axis.cxx | 42 +-- src/AIS/AIS_GraphicTool.cxx | 6 +- src/AIS/AIS_InteractiveContext.cxx | 10 +- src/AIS/AIS_Plane.cxx | 24 +- src/AIS/AIS_PlaneTrihedron.cxx | 32 ++- src/AIS/AIS_Trihedron.cxx | 272 +++++++++---------- src/AIS/AIS_Trihedron.hxx | 110 ++++---- src/AIS/AIS_ViewCube.cxx | 14 +- src/AIS/AIS_ViewCube.hxx | 6 +- src/DsgPrs/DsgPrs_DatumPrs.cxx | 18 +- src/Prs3d/Prs3d_DatumAspect.cxx | 102 +++---- src/Prs3d/Prs3d_DatumAspect.hxx | 144 +++++----- src/Prs3d/Prs3d_DatumAttribute.hxx | 29 +- src/Prs3d/Prs3d_DatumAxes.hxx | 35 ++- src/Prs3d/Prs3d_DatumParts.hxx | 36 ++- src/Prs3d/Prs3d_Drawer.cxx | 6 +- src/ViewerTest/ViewerTest_ObjectCommands.cxx | 66 ++--- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 4 +- 18 files changed, 477 insertions(+), 479 deletions(-) diff --git a/src/AIS/AIS_Axis.cxx b/src/AIS/AIS_Axis.cxx index 5c1d8c3767..27e691cc06 100644 --- a/src/AIS/AIS_Axis.cxx +++ b/src/AIS/AIS_Axis.cxx @@ -82,9 +82,9 @@ myIsXYZAxis(Standard_True) } DA->SetAxisLength(aLength,aLength,aLength); Quantity_Color col (Quantity_NOC_TURQUOISE); - DA->LineAspect(Prs3d_DP_XAxis)->SetColor(col); - DA->LineAspect(Prs3d_DP_YAxis)->SetColor(col); - DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(col); + DA->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(col); + DA->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(col); + DA->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor(col); myDrawer->SetDatumAspect(DA); ComputeFields(); @@ -207,9 +207,9 @@ void AIS_Axis::SetColor(const Quantity_Color &aCol) myDrawer->LineAspect()->SetColor(aCol); const Handle(Prs3d_DatumAspect)& DA = myDrawer->DatumAspect(); - DA->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol); - DA->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol); - DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(aCol); + DA->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(aCol); + DA->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(aCol); + DA->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor(aCol); SynchronizeAspects(); } @@ -225,9 +225,9 @@ void AIS_Axis::SetWidth(const Standard_Real aValue) myDrawer->LineAspect()->SetWidth(aValue); const Handle(Prs3d_DatumAspect)& DA = myDrawer->DatumAspect(); - DA->LineAspect(Prs3d_DP_XAxis)->SetWidth(aValue); - DA->LineAspect(Prs3d_DP_YAxis)->SetWidth(aValue); - DA->LineAspect(Prs3d_DP_ZAxis)->SetWidth(aValue); + DA->LineAspect(Prs3d_DatumParts_XAxis)->SetWidth(aValue); + DA->LineAspect(Prs3d_DatumParts_YAxis)->SetWidth(aValue); + DA->LineAspect(Prs3d_DatumParts_ZAxis)->SetWidth(aValue); SynchronizeAspects(); } @@ -253,27 +253,27 @@ void AIS_Axis::ComputeFields() case AIS_TOAX_XAxis: { oX.Coord(x,y,z); - myVal = DA->AxisLength(Prs3d_DP_XAxis); + myVal = DA->AxisLength(Prs3d_DatumParts_XAxis); myDir = oX; - myLineAspect = DA->LineAspect(Prs3d_DP_XAxis); + myLineAspect = DA->LineAspect(Prs3d_DatumParts_XAxis); myText = Standard_CString ("X"); break; } case AIS_TOAX_YAxis: { oY.Coord(x,y,z); - myVal = DA->AxisLength(Prs3d_DP_YAxis); + myVal = DA->AxisLength(Prs3d_DatumParts_YAxis); myDir = oY; - myLineAspect = DA->LineAspect(Prs3d_DP_YAxis); + myLineAspect = DA->LineAspect(Prs3d_DatumParts_YAxis); myText = Standard_CString ("Y"); break; } case AIS_TOAX_ZAxis: { oZ.Coord(x,y,z); - myVal = DA->AxisLength(Prs3d_DP_ZAxis); + myVal = DA->AxisLength(Prs3d_DatumParts_ZAxis); myDir = oZ; - myLineAspect = DA->LineAspect(Prs3d_DP_ZAxis); + myLineAspect = DA->LineAspect(Prs3d_DatumParts_ZAxis); myText = Standard_CString ("Z"); break; } @@ -306,9 +306,9 @@ void AIS_Axis::UnsetColor() myDrawer->LineAspect()->SetColor(Quantity_NOC_RED); hasOwnColor = Standard_False; - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Quantity_NOC_TURQUOISE); - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(Quantity_NOC_TURQUOISE); - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetColor(Quantity_NOC_TURQUOISE); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(Quantity_NOC_TURQUOISE); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(Quantity_NOC_TURQUOISE); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor(Quantity_NOC_TURQUOISE); SynchronizeAspects(); } //======================================================================= @@ -320,8 +320,8 @@ void AIS_Axis::UnsetWidth() { myOwnWidth = 0.0f; myDrawer->LineAspect()->SetWidth(1.); - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetWidth(1.); - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetWidth(1.); - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetWidth(1.); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis)->SetWidth(1.); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_YAxis)->SetWidth(1.); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_ZAxis)->SetWidth(1.); SynchronizeAspects(); } diff --git a/src/AIS/AIS_GraphicTool.cxx b/src/AIS/AIS_GraphicTool.cxx index 0c339be9f5..0b31453cf1 100644 --- a/src/AIS/AIS_GraphicTool.cxx +++ b/src/AIS/AIS_GraphicTool.cxx @@ -60,11 +60,11 @@ static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr, case AIS_TOA_FaceBoundary: return Dr->FaceBoundaryAspect(); case AIS_TOA_FirstAxis: - return Dr->DatumAspect()->LineAspect(Prs3d_DP_XAxis); + return Dr->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis); case AIS_TOA_SecondAxis: - return Dr->DatumAspect()->LineAspect(Prs3d_DP_YAxis); + return Dr->DatumAspect()->LineAspect(Prs3d_DatumParts_YAxis); case AIS_TOA_ThirdAxis: - return Dr->DatumAspect()->LineAspect(Prs3d_DP_ZAxis); + return Dr->DatumAspect()->LineAspect(Prs3d_DatumParts_ZAxis); } Handle(Prs3d_LineAspect) bid; return bid; diff --git a/src/AIS/AIS_InteractiveContext.cxx b/src/AIS/AIS_InteractiveContext.cxx index fe54d23a4e..441ad8a75e 100644 --- a/src/AIS/AIS_InteractiveContext.cxx +++ b/src/AIS/AIS_InteractiveContext.cxx @@ -95,7 +95,7 @@ namespace theDrawer->FreeBoundaryAspect()->SetColor (theColor); theDrawer->UnFreeBoundaryAspect()->SetColor (theColor); theDrawer->PointAspect()->SetColor (theColor); - for (Standard_Integer aPartIter = 0; aPartIter < Prs3d_DP_None; ++aPartIter) + for (Standard_Integer aPartIter = 0; aPartIter < Prs3d_DatumParts_None; ++aPartIter) { if (Handle(Prs3d_LineAspect) aLineAsp = theDrawer->DatumAspect()->LineAspect ((Prs3d_DatumParts )aPartIter)) { @@ -2197,9 +2197,9 @@ void AIS_InteractiveContext::InitAttributes() const Standard_Real aLength = 100.0; aTrihAspect->SetAxisLength (aLength, aLength, aLength); const Quantity_Color aColor = Quantity_NOC_LIGHTSTEELBLUE4; - aTrihAspect->LineAspect(Prs3d_DP_XAxis)->SetColor (aColor); - aTrihAspect->LineAspect(Prs3d_DP_YAxis)->SetColor (aColor); - aTrihAspect->LineAspect(Prs3d_DP_ZAxis)->SetColor (aColor); + aTrihAspect->LineAspect(Prs3d_DatumParts_XAxis)->SetColor (aColor); + aTrihAspect->LineAspect(Prs3d_DatumParts_YAxis)->SetColor (aColor); + aTrihAspect->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor (aColor); Handle(Prs3d_PlaneAspect) aPlaneAspect = myDefaultDrawer->PlaneAspect(); const Standard_Real aPlaneLength = 200.0; @@ -2213,7 +2213,7 @@ void AIS_InteractiveContext::InitAttributes() //======================================================================= Standard_Real AIS_InteractiveContext::TrihedronSize() const { - return myDefaultDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis); + return myDefaultDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis); } //======================================================================= diff --git a/src/AIS/AIS_Plane.cxx b/src/AIS/AIS_Plane.cxx index 0c630246a5..169a59f88c 100644 --- a/src/AIS/AIS_Plane.cxx +++ b/src/AIS/AIS_Plane.cxx @@ -405,9 +405,9 @@ void AIS_Plane::UnsetSize() new Prs3d_DatumAspect(); myDrawer->PlaneAspect()->SetPlaneLength(PA->PlaneXLength(),PA->PlaneYLength()); - myDrawer->DatumAspect()->SetAxisLength(DA->AxisLength(Prs3d_DP_XAxis), - DA->AxisLength(Prs3d_DP_YAxis), - DA->AxisLength(Prs3d_DP_ZAxis)); + myDrawer->DatumAspect()->SetAxisLength(DA->AxisLength(Prs3d_DatumParts_XAxis), + DA->AxisLength(Prs3d_DatumParts_YAxis), + DA->AxisLength(Prs3d_DatumParts_ZAxis)); } myHasOwnSize = Standard_False; @@ -453,9 +453,9 @@ void AIS_Plane::SetColor(const Quantity_Color &aCol) } PA->EdgesAspect()->SetColor(aCol); - DA->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol); - DA->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol); - DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(aCol); + DA->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(aCol); + DA->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(aCol); + DA->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor(aCol); if(!yenavaitPA) myDrawer->SetPlaneAspect(PA); @@ -485,9 +485,9 @@ void AIS_Plane::UnsetColor() Quantity_Color Col = PA->EdgesAspect()->Aspect()->Color(); myDrawer->PlaneAspect()->EdgesAspect()->SetColor(Col); - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Col); - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(Col); - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetColor(Col); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(Col); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(Col); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_ZAxis)->SetColor(Col); } @@ -542,9 +542,9 @@ void AIS_Plane::ComputeFields() oX.Coord(x1,y1,z1); oY.Coord(x2,y2,z2); oZ.Coord(x3,y3,z3); - Standard_Real DS1 = DA->AxisLength(Prs3d_DP_XAxis); - Standard_Real DS2 = DA->AxisLength(Prs3d_DP_YAxis); - Standard_Real DS3 = DA->AxisLength(Prs3d_DP_ZAxis); + Standard_Real DS1 = DA->AxisLength(Prs3d_DatumParts_XAxis); + Standard_Real DS2 = DA->AxisLength(Prs3d_DatumParts_YAxis); + Standard_Real DS3 = DA->AxisLength(Prs3d_DatumParts_ZAxis); // gp_Pnt aPt2,aPt3; switch (myTypeOfPlane) { diff --git a/src/AIS/AIS_PlaneTrihedron.cxx b/src/AIS/AIS_PlaneTrihedron.cxx index e668b22ce8..f2a479a344 100644 --- a/src/AIS/AIS_PlaneTrihedron.cxx +++ b/src/AIS/AIS_PlaneTrihedron.cxx @@ -67,9 +67,9 @@ AIS_PlaneTrihedron::AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane) Standard_Real aLength = UnitsAPI::AnyToLS (100. ,"mm"); DA->SetAxisLength(aLength,aLength,aLength); Quantity_Color col (Quantity_NOC_ROYALBLUE1); - DA->LineAspect(Prs3d_DP_XAxis)->SetColor(col); - DA->LineAspect(Prs3d_DP_YAxis)->SetColor(col); - DA->SetDrawDatumAxes(Prs3d_DA_XYAxis); + DA->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(col); + DA->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(col); + DA->SetDrawDatumAxes(Prs3d_DatumAxes_XYAxes); myDrawer->SetDatumAspect(DA); // odl - specific is created because it is modified myShapes[0] = Position(); myShapes[1] = XAxis(); @@ -142,7 +142,7 @@ void AIS_PlaneTrihedron::SetLength(const Standard_Real theLength) { } Standard_Real AIS_PlaneTrihedron::GetLength() const { - return myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis); + return myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis); } //======================================================================= @@ -156,7 +156,7 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&, aPresentation->SetDisplayPriority(5); // drawing axis in X direction gp_Pnt first, last; - Standard_Real value = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis); + Standard_Real value = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis); gp_Dir xDir = myPlane->Position().Ax2().XDirection(); gp_Pnt orig = myPlane->Position().Ax2().Location(); @@ -166,15 +166,23 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&, first.SetCoord( xo, yo, zo ); last.SetCoord( xo + x * value, yo + y * value, zo + z * value ); - DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis), myDrawer->ArrowAspect(), myDrawer->TextAspect(), xDir, value, myXLabel.ToCString(), first, last ); + DsgPrs_XYZAxisPresentation::Add (aPresentation, + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis), + myDrawer->ArrowAspect(), + myDrawer->TextAspect(), + xDir, value, myXLabel.ToCString(), first, last); // drawing axis in Y direction - value = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_YAxis); + value = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_YAxis); gp_Dir yDir = myPlane->Position().Ax2().YDirection(); yDir.Coord( x, y, z ); last.SetCoord( xo + x * value, yo + y * value, zo + z * value ); - DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis), myDrawer->ArrowAspect(), myDrawer->TextAspect(), yDir, value, myYLabel.ToCString(), first, last ); + DsgPrs_XYZAxisPresentation::Add (aPresentation, + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis), + myDrawer->ArrowAspect(), + myDrawer->TextAspect(), + yDir, value, myYLabel.ToCString(), first, last); aPresentation->SetInfiniteState (Standard_True); } @@ -238,8 +246,8 @@ void AIS_PlaneTrihedron::SetColor(const Quantity_Color &aCol) { hasOwnColor=Standard_True; myDrawer->SetColor (aCol); - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol); - myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_XAxis)->SetColor(aCol); + myDrawer->DatumAspect()->LineAspect(Prs3d_DatumParts_YAxis)->SetColor(aCol); SynchronizeAspects(); } @@ -254,12 +262,12 @@ void ExtremityPoints(TColgp_Array1OfPnt& PP,const Handle(Geom_Plane)& myPlane,c gp_Ax2 theax(myPlane->Position().Ax2()); PP(1) = theax.Location(); - Standard_Real len = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis); + Standard_Real len = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis); gp_Vec vec = theax.XDirection(); vec *= len; PP(2) = PP(1).Translated(vec); - len = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_YAxis); + len = myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_YAxis); vec = theax.YDirection(); vec *= len; PP(3) = PP(1).Translated(vec); diff --git a/src/AIS/AIS_Trihedron.cxx b/src/AIS/AIS_Trihedron.cxx index def2623aee..58432b1c39 100644 --- a/src/AIS/AIS_Trihedron.cxx +++ b/src/AIS/AIS_Trihedron.cxx @@ -52,31 +52,32 @@ IMPLEMENT_STANDARD_RTTIEXT(AIS_Trihedron, AIS_InteractiveObject) //purpose : //======================================================================= AIS_Trihedron::AIS_Trihedron (const Handle(Geom_Axis2Placement)& theComponent) -: myHasOwnSize (Standard_False), - myHasOwnTextColor (Standard_False), - myHasOwnArrowColor (Standard_False), +: myComponent (theComponent), myTrihDispMode (Prs3d_DM_WireFrame), - myComponent (theComponent) + myHasOwnSize (Standard_False), + myHasOwnTextColor (Standard_False), + myHasOwnArrowColor (Standard_False) { myAutoHilight = Standard_False; // selection priorities - mySelectionPriority.Bind (Prs3d_DP_None, 5); // complete triedron: priority 5 (same as faces) - mySelectionPriority.Bind (Prs3d_DP_Origin, 8); // origin: priority 8 - for (int aPartIter = Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis; ++aPartIter) + memset (mySelectionPriority, 0, sizeof(mySelectionPriority)); + mySelectionPriority[Prs3d_DatumParts_None] = 5; // complete trihedron: priority 5 (same as faces) + mySelectionPriority[Prs3d_DatumParts_Origin] = 8; // origin: priority 8 + for (int aPartIter = Prs3d_DatumParts_XAxis; aPartIter <= Prs3d_DatumParts_ZAxis; ++aPartIter) { - mySelectionPriority.Bind ((Prs3d_DatumParts )aPartIter, 7); // axes: priority: 7 + mySelectionPriority[aPartIter] = 7; // axes: priority: 7 } - for (int aPartIter = Prs3d_DP_XOYAxis; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter) + for (int aPartIter = Prs3d_DatumParts_XOYAxis; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter) { - mySelectionPriority.Bind ((Prs3d_DatumParts )aPartIter, 5); // planes: priority: 5 + mySelectionPriority[aPartIter] = 5; // planes: priority: 5 } myHiddenLineAspect = new Graphic3d_AspectLine3d (Quantity_NOC_WHITE, Aspect_TOL_EMPTY, 1.0f); // trihedron labels - myLabel.Bind (Prs3d_DP_XAxis, "X"); - myLabel.Bind (Prs3d_DP_YAxis, "Y"); - myLabel.Bind (Prs3d_DP_ZAxis, "Z"); + myLabels[Prs3d_DatumParts_XAxis] = "X"; + myLabels[Prs3d_DatumParts_YAxis] = "Y"; + myLabels[Prs3d_DatumParts_ZAxis] = "Z"; } //======================================================================= @@ -96,32 +97,35 @@ void AIS_Trihedron::SetComponent (const Handle(Geom_Axis2Placement)& theComponen void AIS_Trihedron::setOwnDatumAspect() { if (myDrawer->HasOwnDatumAspect()) + { return; + } Handle(Prs3d_DatumAspect) aNewAspect = new Prs3d_DatumAspect(); - myDrawer->SetDatumAspect(aNewAspect); - + myDrawer->SetDatumAspect (aNewAspect); if (myDrawer->Link().IsNull()) + { return; + } - myDrawer->DatumAspect()->SetDrawArrows (myDrawer->Link()->DatumAspect()->ToDrawArrows()); - myDrawer->DatumAspect()->SetDrawLabels (myDrawer->Link()->DatumAspect()->ToDrawLabels()); - *myDrawer->DatumAspect()->TextAspect()->Aspect() = - *myDrawer->Link()->DatumAspect()->TextAspect()->Aspect(); - *myDrawer->DatumAspect()->PointAspect()->Aspect() = - *myDrawer->Link()->DatumAspect()->PointAspect()->Aspect(); - *myDrawer->DatumAspect()->ArrowAspect()->Aspect() = - *myDrawer->Link()->DatumAspect()->ArrowAspect()->Aspect(); + const Handle(Prs3d_DatumAspect)& aLinkAspect = myDrawer->Link()->DatumAspect(); + aNewAspect->SetDrawArrows (aLinkAspect->ToDrawArrows()); + aNewAspect->SetDrawLabels (aLinkAspect->ToDrawLabels()); + *aNewAspect->TextAspect()->Aspect() = *aLinkAspect->TextAspect()->Aspect(); + *aNewAspect->PointAspect()->Aspect() = *aLinkAspect->PointAspect()->Aspect(); + *aNewAspect->ArrowAspect()->Aspect() = *aLinkAspect->ArrowAspect()->Aspect(); - for (int aPartIter = Prs3d_DP_Origin; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter) + for (int aPartIter = Prs3d_DatumParts_Origin; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter; - if (!aNewAspect->LineAspect(aPart).IsNull()) - *myDrawer->DatumAspect()->LineAspect(aPart)->Aspect() = - *myDrawer->Link()->DatumAspect()->LineAspect(aPart)->Aspect(); - if (!aNewAspect->ShadingAspect(aPart).IsNull()) - *myDrawer->DatumAspect()->ShadingAspect(aPart)->Aspect() = - *myDrawer->Link()->DatumAspect()->ShadingAspect(aPart)->Aspect(); + if (!aNewAspect->LineAspect (aPart).IsNull()) + { + *aNewAspect->LineAspect (aPart)->Aspect() = *aLinkAspect->LineAspect (aPart)->Aspect(); + } + if (!aNewAspect->ShadingAspect (aPart).IsNull()) + { + *aNewAspect->ShadingAspect (aPart)->Aspect() = *aLinkAspect->ShadingAspect (aPart)->Aspect(); + } } } @@ -129,12 +133,12 @@ void AIS_Trihedron::setOwnDatumAspect() //function : SetSize //purpose : //======================================================================= -void AIS_Trihedron::SetSize(const Standard_Real aValue) +void AIS_Trihedron::SetSize(const Standard_Real theValue) { myHasOwnSize = Standard_True; setOwnDatumAspect(); - myDrawer->DatumAspect()->SetAxisLength(aValue, aValue, aValue); + myDrawer->DatumAspect()->SetAxisLength (theValue, theValue, theValue); SetToUpdate(); UpdateSelection(); @@ -157,9 +161,9 @@ void AIS_Trihedron::UnsetSize() const Handle(Prs3d_DatumAspect) DA = myDrawer->HasLink() ? myDrawer->Link()->DatumAspect() : new Prs3d_DatumAspect(); - myDrawer->DatumAspect()->SetAxisLength (DA->AxisLength (Prs3d_DP_XAxis), - DA->AxisLength (Prs3d_DP_YAxis), - DA->AxisLength (Prs3d_DP_ZAxis)); + myDrawer->DatumAspect()->SetAxisLength (DA->AxisLength (Prs3d_DatumParts_XAxis), + DA->AxisLength (Prs3d_DatumParts_YAxis), + DA->AxisLength (Prs3d_DatumParts_ZAxis)); } else { @@ -174,7 +178,7 @@ void AIS_Trihedron::UnsetSize() //======================================================================= Standard_Real AIS_Trihedron::Size() const { - return myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis); + return myDrawer->DatumAspect()->AxisLength(Prs3d_DatumParts_XAxis); } //======================================================================= @@ -210,10 +214,9 @@ void AIS_Trihedron::ComputeSelection (const Handle(SelectMgr_Selection)& theSele { case AIS_TrihedronSelectionMode_EntireObject: { - Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner ( - this, mySelectionPriority.Find (Prs3d_DP_None)); + Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this, mySelectionPriority[Prs3d_DatumParts_None]); const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded; - for (int aPartIter = isShadingMode ? Prs3d_DP_Origin : Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis; + for (int aPartIter = isShadingMode ? Prs3d_DatumParts_Origin : Prs3d_DatumParts_XAxis; aPartIter <= Prs3d_DatumParts_ZAxis; ++aPartIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter; @@ -227,11 +230,10 @@ void AIS_Trihedron::ComputeSelection (const Handle(SelectMgr_Selection)& theSele } case AIS_TrihedronSelectionMode_Origin: { - const Prs3d_DatumParts aPart = Prs3d_DP_Origin; + const Prs3d_DatumParts aPart = Prs3d_DatumParts_Origin; if (anAspect->DrawDatumPart (aPart)) { - Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart, - mySelectionPriority.Find (aPart)); + Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart, mySelectionPriority[aPart]); Handle(Graphic3d_ArrayOfPrimitives) aPrimitives = arrayOfPrimitives(aPart); theSelection->Add (createSensitiveEntity (aPart, anOwner)); } @@ -239,15 +241,14 @@ void AIS_Trihedron::ComputeSelection (const Handle(SelectMgr_Selection)& theSele } case AIS_TrihedronSelectionMode_Axes: { - for (int aPartIter = Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis; ++aPartIter) + for (int aPartIter = Prs3d_DatumParts_XAxis; aPartIter <= Prs3d_DatumParts_ZAxis; ++aPartIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter; if (!anAspect->DrawDatumPart (aPart)) { continue; } - Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart, - mySelectionPriority.Find (aPart)); + Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart, mySelectionPriority[aPart]); theSelection->Add (createSensitiveEntity (aPart, anOwner)); } break; @@ -256,15 +257,14 @@ void AIS_Trihedron::ComputeSelection (const Handle(SelectMgr_Selection)& theSele { // create owner for each trihedron plane { - for (int aPartIter = Prs3d_DP_XOYAxis; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter) + for (int aPartIter = Prs3d_DatumParts_XOYAxis; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter; if (!anAspect->DrawDatumPart (aPart)) { continue; } - Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart, - mySelectionPriority.Find (aPart)); + Handle(SelectMgr_EntityOwner) anOwner = new AIS_TrihedronOwner (this, aPart, mySelectionPriority[aPart]); theSelection->Add (createSensitiveEntity (aPart, anOwner)); } } @@ -284,7 +284,7 @@ void AIS_Trihedron::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManag Handle(AIS_TrihedronOwner) anOwner = Handle(AIS_TrihedronOwner)::DownCast (theOwner); if (anOwner.IsNull()) { - /// default 0 selection mode + // default 0 selection mode Standard_Integer aHiMode = HasHilightMode() ? HilightMode() : 0; thePM->Color (this, theStyle, aHiMode, NULL, Graphic3d_ZLayerId_Top); return; @@ -299,7 +299,7 @@ void AIS_Trihedron::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManag aPresentation->Clear(); const Prs3d_DatumParts aPart = anOwner->DatumPart(); Handle(Graphic3d_Group) aGroup = aPresentation->CurrentGroup(); - if (aPart >= Prs3d_DP_XOYAxis && aPart <= Prs3d_DP_XOZAxis) + if (aPart >= Prs3d_DatumParts_XOYAxis && aPart <= Prs3d_DatumParts_XOZAxis) { // planes selection is equal in both shading and wireframe mode aGroup->SetGroupPrimitivesAspect (theStyle->LineAspect()->Aspect()); @@ -312,7 +312,7 @@ void AIS_Trihedron::HilightOwnerWithColor (const Handle(PrsMgr_PresentationManag } else { - if (aPart == Prs3d_DP_Origin) + if (aPart == Prs3d_DatumParts_Origin) { aGroup->SetGroupPrimitivesAspect (theStyle->PointAspect()->Aspect()); } @@ -360,14 +360,15 @@ void AIS_Trihedron::HilightSelected (const Handle(PrsMgr_PresentationManager3d)& } const Prs3d_DatumParts aPart = aTrihedronOwner->DatumPart(); - Handle(Graphic3d_Group) aGroup; - if (mySelectedParts.Contains (aPart) || !myPartToGroup.Find (aPart, aGroup)) + if (myPartToGroup[aPart].IsNull() + || mySelectedParts.Contains (aPart)) { continue; } - if (aPart >= Prs3d_DP_XOYAxis - && aPart <= Prs3d_DP_XOZAxis) + const Handle(Graphic3d_Group)& aGroup = myPartToGroup[aPart]; + if (aPart >= Prs3d_DatumParts_XOYAxis + && aPart <= Prs3d_DatumParts_XOZAxis) { aGroup->SetGroupPrimitivesAspect (anAspect->LineAspect()->Aspect()); } @@ -379,7 +380,7 @@ void AIS_Trihedron::HilightSelected (const Handle(PrsMgr_PresentationManager3d)& } else { - if (aPart == Prs3d_DP_Origin) + if (aPart == Prs3d_DatumParts_Origin) { aGroup->SetGroupPrimitivesAspect (anAspect->PointAspect()->Aspect()); } @@ -405,9 +406,9 @@ void AIS_Trihedron::ClearSelected() anIterator.Next()) { const Prs3d_DatumParts aPart = anIterator.Value(); - Handle(Graphic3d_Group) aGroup = myPartToGroup.Find (aPart); - if (aPart >= Prs3d_DP_XOYAxis - && aPart <= Prs3d_DP_XOZAxis) + const Handle(Graphic3d_Group)& aGroup = myPartToGroup[aPart]; + if (aPart >= Prs3d_DatumParts_XOYAxis + && aPart <= Prs3d_DatumParts_XOZAxis) { aGroup->SetGroupPrimitivesAspect (myHiddenLineAspect); } @@ -417,7 +418,7 @@ void AIS_Trihedron::ClearSelected() } else { - if (aPart == Prs3d_DP_Origin) + if (aPart == Prs3d_DatumParts_Origin) { aGroup->SetGroupPrimitivesAspect (anAspect->PointAspect()->Aspect()); } @@ -437,17 +438,21 @@ void AIS_Trihedron::ClearSelected() void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager3d)& /*thePrsMgr*/, const Handle(Prs3d_Presentation)& thePrs) { - myPartToGroup.Clear(); + for (Standard_Integer aPartIter = 0; aPartIter < Prs3d_DatumParts_NB; ++aPartIter) + { + myPartToGroup[aPartIter].Nullify(); + } + Handle(Prs3d_DatumAspect) anAspect = myDrawer->DatumAspect(); const bool isShadingMode = myTrihDispMode == Prs3d_DM_Shaded; // display origin { // Origin is visualized only in shading mode Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); - const Prs3d_DatumParts aPart = Prs3d_DP_Origin; + const Prs3d_DatumParts aPart = Prs3d_DatumParts_Origin; if (anAspect->DrawDatumPart(aPart)) { - myPartToGroup.Bind (aPart, aGroup); + myPartToGroup[aPart] = aGroup; if (isShadingMode) { aGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (aPart)->Aspect()); @@ -462,7 +467,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager // display axes { - for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter) + for (Standard_Integer anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { Prs3d_DatumParts aPart = (Prs3d_DatumParts )anAxisIter; if (!anAspect->DrawDatumPart (aPart)) @@ -471,7 +476,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager } Handle(Graphic3d_Group) anAxisGroup = thePrs->NewGroup(); - myPartToGroup.Bind (aPart, anAxisGroup); + myPartToGroup[aPart] = anAxisGroup; if (isShadingMode) { anAxisGroup->SetGroupPrimitivesAspect (anAspect->ShadingAspect (aPart)->Aspect()); @@ -500,7 +505,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager { Handle(Geom_Axis2Placement) aComponent = myComponent; const gp_Pnt anOrigin = aComponent->Location(); - for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter) + for (Standard_Integer anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts )anAxisIter; if (!anAspect->DrawDatumPart (aPart)) @@ -509,13 +514,13 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager } const Standard_Real anAxisLength = anAspect->AxisLength (aPart); - const TCollection_ExtendedString& aLabel = myLabel.Find (aPart); + const TCollection_ExtendedString& aLabel = myLabels[aPart]; gp_Dir aDir; switch (aPart) { - case Prs3d_DP_XAxis: aDir = aComponent->XDirection(); break; - case Prs3d_DP_YAxis: aDir = aComponent->YDirection(); break; - case Prs3d_DP_ZAxis: aDir = aComponent->Direction(); break; + case Prs3d_DatumParts_XAxis: aDir = aComponent->XDirection(); break; + case Prs3d_DatumParts_YAxis: aDir = aComponent->YDirection(); break; + case Prs3d_DatumParts_ZAxis: aDir = aComponent->Direction(); break; default: break; } Handle(Graphic3d_Group) aLabelGroup = thePrs->NewGroup(); @@ -525,7 +530,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager } // planes invisible group for planes selection - for (Standard_Integer anAxisIter = Prs3d_DP_XOYAxis; anAxisIter <= Prs3d_DP_XOZAxis; ++anAxisIter) + for (Standard_Integer anAxisIter = Prs3d_DatumParts_XOYAxis; anAxisIter <= Prs3d_DatumParts_XOZAxis; ++anAxisIter) { Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter; if (!anAspect->DrawDatumPart(aPart)) @@ -534,7 +539,7 @@ void AIS_Trihedron::computePresentation (const Handle(PrsMgr_PresentationManager } Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); - myPartToGroup.Bind (aPart, aGroup); + myPartToGroup[aPart] = aGroup; aGroup->AddPrimitiveArray (arrayOfPrimitives (aPart)); aGroup->SetGroupPrimitivesAspect (myHiddenLineAspect); @@ -551,7 +556,7 @@ void AIS_Trihedron::SetDatumPartColor (const Prs3d_DatumParts thePart, setOwnDatumAspect(); myDrawer->DatumAspect()->ShadingAspect (thePart)->SetColor (theColor); - if (thePart != Prs3d_DP_Origin) + if (thePart != Prs3d_DatumParts_Origin) { myDrawer->DatumAspect()->LineAspect (thePart)->SetColor (theColor); } @@ -591,7 +596,7 @@ void AIS_Trihedron::SetOriginColor (const Quantity_Color& theColor) { if (myTrihDispMode == Prs3d_DM_Shaded) { - SetDatumPartColor (Prs3d_DP_Origin, theColor); + SetDatumPartColor (Prs3d_DatumParts_Origin, theColor); } } @@ -601,7 +606,7 @@ void AIS_Trihedron::SetOriginColor (const Quantity_Color& theColor) //======================================================================= void AIS_Trihedron::SetXAxisColor (const Quantity_Color& theColor) { - SetDatumPartColor (Prs3d_DP_XAxis, theColor); + SetDatumPartColor (Prs3d_DatumParts_XAxis, theColor); } //======================================================================= @@ -610,7 +615,7 @@ void AIS_Trihedron::SetXAxisColor (const Quantity_Color& theColor) //======================================================================= void AIS_Trihedron::SetYAxisColor (const Quantity_Color& theColor) { - SetDatumPartColor (Prs3d_DP_YAxis, theColor); + SetDatumPartColor (Prs3d_DatumParts_YAxis, theColor); } //======================================================================= @@ -619,7 +624,7 @@ void AIS_Trihedron::SetYAxisColor (const Quantity_Color& theColor) //======================================================================= void AIS_Trihedron::SetAxisColor (const Quantity_Color& theColor) { - SetDatumPartColor (Prs3d_DP_ZAxis, theColor); + SetDatumPartColor (Prs3d_DatumParts_ZAxis, theColor); } //======================================================================= @@ -631,10 +636,10 @@ void AIS_Trihedron::SetColor (const Quantity_Color& theColor) hasOwnColor = Standard_True; myDrawer->SetColor (theColor); - SetDatumPartColor (Prs3d_DP_Origin, theColor); - SetDatumPartColor (Prs3d_DP_XAxis, theColor); - SetDatumPartColor (Prs3d_DP_YAxis, theColor); - SetDatumPartColor (Prs3d_DP_ZAxis, theColor); + SetDatumPartColor (Prs3d_DatumParts_Origin, theColor); + SetDatumPartColor (Prs3d_DatumParts_XAxis, theColor); + SetDatumPartColor (Prs3d_DatumParts_YAxis, theColor); + SetDatumPartColor (Prs3d_DatumParts_ZAxis, theColor); } //======================================================================= @@ -721,8 +726,8 @@ Handle(Select3D_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs return Handle(Select3D_SensitiveEntity)(); } - if (thePart >= Prs3d_DP_XOYAxis - && thePart <= Prs3d_DP_XOZAxis) + if (thePart >= Prs3d_DatumParts_XOYAxis + && thePart <= Prs3d_DatumParts_XOZAxis) { // plane const gp_Pnt anXYZ1 = aPrimitives->Vertice (1); const gp_Pnt anXYZ2 = aPrimitives->Vertice (2); @@ -751,18 +756,6 @@ Handle(Select3D_SensitiveEntity) AIS_Trihedron::createSensitiveEntity (const Prs return Handle(Select3D_SensitiveEntity)(); } -// ======================================================================= -// function : arrayOfPrimitives -// purpose : -// ======================================================================= -Handle(Graphic3d_ArrayOfPrimitives) AIS_Trihedron::arrayOfPrimitives( - Prs3d_DatumParts theDatumPart) const -{ - Handle(Graphic3d_ArrayOfPrimitives) anArray; - myPrimitives.Find(theDatumPart, anArray); - return anArray; -} - // ======================================================================= // function : updatePrimitives // purpose : @@ -774,16 +767,19 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect, const gp_Dir& theYDirection, const gp_Dir& theZDirection) { - myPrimitives.Clear(); + for (Standard_Integer aPartIter = 0; aPartIter < Prs3d_DatumParts_NB; ++aPartIter) + { + myPrimitives[aPartIter].Nullify(); + } NCollection_DataMap anAxisDirs; - anAxisDirs.Bind(Prs3d_DP_XAxis, theXDirection); - anAxisDirs.Bind(Prs3d_DP_YAxis, theYDirection); - anAxisDirs.Bind(Prs3d_DP_ZAxis, theZDirection); + anAxisDirs.Bind(Prs3d_DatumParts_XAxis, theXDirection); + anAxisDirs.Bind(Prs3d_DatumParts_YAxis, theYDirection); + anAxisDirs.Bind(Prs3d_DatumParts_ZAxis, theZDirection); NCollection_DataMap anAxisPoints; gp_XYZ anXYZOrigin = theOrigin.XYZ(); - for (int anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter) + for (int anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter; anAxisPoints.Bind(aPart, gp_Pnt(anXYZOrigin + anAxisDirs.Find(aPart).XYZ() * @@ -793,14 +789,14 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect, if (theMode == Prs3d_DM_WireFrame) { // origin - if (theAspect->DrawDatumPart(Prs3d_DP_Origin)) + if (theAspect->DrawDatumPart(Prs3d_DatumParts_Origin)) { Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPoints(1); aPrims->AddVertex(theOrigin); - myPrimitives.Bind(Prs3d_DP_Origin, aPrims); + myPrimitives[Prs3d_DatumParts_Origin] = aPrims; } // axes - for (int aPartIter = Prs3d_DP_XAxis; aPartIter <= Prs3d_DP_ZAxis; ++aPartIter) + for (int aPartIter = Prs3d_DatumParts_XAxis; aPartIter <= Prs3d_DatumParts_ZAxis; ++aPartIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPartIter; if (theAspect->DrawDatumPart(aPart)) @@ -808,17 +804,16 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect, Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfSegments(2); aPrims->AddVertex(theOrigin); aPrims->AddVertex(anAxisPoints.Find(aPart)); - myPrimitives.Bind(aPart, aPrims); + myPrimitives[aPart] = aPrims; } Prs3d_DatumParts anArrowPart = theAspect->ArrowPartForAxis(aPart); if (theAspect->DrawDatumPart(anArrowPart)) { - myPrimitives.Bind(anArrowPart, - Prs3d_Arrow::DrawSegments(anAxisPoints.Find(aPart), anAxisDirs.Find(aPart), - theAspect->ArrowAspect()->Angle(), - theAspect->AxisLength(aPart) * theAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent), - (Standard_Integer) theAspect->Attribute(Prs3d_DP_ShadingNumberOfFacettes))); + myPrimitives[anArrowPart] = Prs3d_Arrow::DrawSegments (anAxisPoints.Find(aPart), anAxisDirs.Find(aPart), + theAspect->ArrowAspect()->Angle(), + theAspect->AxisLength(aPart) * theAspect->Attribute(Prs3d_DatumAttribute_ShadingConeLengthPercent), + (Standard_Integer) theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes)); } } } @@ -826,25 +821,24 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect, { // shading mode // origin - if (theAspect->DrawDatumPart(Prs3d_DP_Origin)) + if (theAspect->DrawDatumPart(Prs3d_DatumParts_Origin)) { - const Standard_Real aSphereRadius = theAspect->AxisLength(Prs3d_DP_XAxis) * - theAspect->Attribute(Prs3d_DP_ShadingOriginRadiusPercent); + const Standard_Real aSphereRadius = theAspect->AxisLength(Prs3d_DatumParts_XAxis) * + theAspect->Attribute(Prs3d_DatumAttribute_ShadingOriginRadiusPercent); const Standard_Integer aNbOfFacettes = - (Standard_Integer)theAspect->Attribute(Prs3d_DP_ShadingNumberOfFacettes); + (Standard_Integer)theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes); gp_Trsf aSphereTransform; aSphereTransform.SetTranslationPart(gp_Vec(gp::Origin(), theOrigin)); - myPrimitives.Bind(Prs3d_DP_Origin, Prs3d_ToolSphere::Create(aSphereRadius, aNbOfFacettes, - aNbOfFacettes, aSphereTransform)); + myPrimitives[Prs3d_DatumParts_Origin] = Prs3d_ToolSphere::Create (aSphereRadius, aNbOfFacettes, aNbOfFacettes, aSphereTransform); } // axes { const Standard_Integer aNbOfFacettes = - (Standard_Integer)theAspect->Attribute(Prs3d_DP_ShadingNumberOfFacettes); - const Standard_Real aTubeRadiusPercent = theAspect->Attribute(Prs3d_DP_ShadingTubeRadiusPercent); - const Standard_Real aConeLengthPercent = theAspect->Attribute(Prs3d_DP_ShadingConeLengthPercent); - const Standard_Real aConeRadiusPercent = theAspect->Attribute(Prs3d_DP_ShadingConeRadiusPercent); - for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter) + (Standard_Integer)theAspect->Attribute(Prs3d_DatumAttribute_ShadingNumberOfFacettes); + const Standard_Real aTubeRadiusPercent = theAspect->Attribute(Prs3d_DatumAttribute_ShadingTubeRadiusPercent); + const Standard_Real aConeLengthPercent = theAspect->Attribute(Prs3d_DatumAttribute_ShadingConeLengthPercent); + const Standard_Real aConeRadiusPercent = theAspect->Attribute(Prs3d_DatumAttribute_ShadingConeRadiusPercent); + for (Standard_Integer anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts)anAxisIter; const Prs3d_DatumParts anArrowPart = theAspect->ArrowPartForAxis(aPart); @@ -855,24 +849,23 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect, if (theAspect->DrawDatumPart(aPart)) { // draw cylinder - myPrimitives.Bind(aPart, - Prs3d_Arrow::DrawShaded(anAxis, anAxisLength * aTubeRadiusPercent, - aDrawArrow ? anAxisLength - anAxisLength * aConeLengthPercent : anAxisLength, - 0.0, 0.0, aNbOfFacettes)); + myPrimitives[aPart] = Prs3d_Arrow::DrawShaded (anAxis, anAxisLength * aTubeRadiusPercent, + aDrawArrow ? (anAxisLength - anAxisLength * aConeLengthPercent) : anAxisLength, + 0.0, 0.0, aNbOfFacettes); } // draw arrow if (aDrawArrow) { - myPrimitives.Bind(anArrowPart, Prs3d_Arrow::DrawShaded(anAxis, 0.0, anAxisLength, - anAxisLength * aConeRadiusPercent, - anAxisLength * aConeLengthPercent, aNbOfFacettes)); + myPrimitives[anArrowPart] = Prs3d_Arrow::DrawShaded (anAxis, 0.0, anAxisLength, + anAxisLength * aConeRadiusPercent, + anAxisLength * aConeLengthPercent, aNbOfFacettes); } } } } // planes - for (Standard_Integer aPlaneIter = Prs3d_DP_XOYAxis; aPlaneIter <= Prs3d_DP_XOZAxis; ++aPlaneIter) + for (Standard_Integer aPlaneIter = Prs3d_DatumParts_XOYAxis; aPlaneIter <= Prs3d_DatumParts_XOZAxis; ++aPlaneIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts)aPlaneIter; if (!theAspect->DrawDatumPart(aPart)) @@ -883,25 +876,25 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect, Handle(Graphic3d_ArrayOfPrimitives) aPrims = new Graphic3d_ArrayOfPolylines(4); aPrims->AddVertex(theOrigin); - Prs3d_DatumParts aPart1 = Prs3d_DP_XAxis, aPart2 = Prs3d_DP_XAxis; + Prs3d_DatumParts aPart1 = Prs3d_DatumParts_XAxis, aPart2 = Prs3d_DatumParts_XAxis; switch(aPart) { - case Prs3d_DP_XOYAxis: + case Prs3d_DatumParts_XOYAxis: { - aPart1 = Prs3d_DP_XAxis; - aPart2 = Prs3d_DP_YAxis; + aPart1 = Prs3d_DatumParts_XAxis; + aPart2 = Prs3d_DatumParts_YAxis; break; } - case Prs3d_DP_YOZAxis: + case Prs3d_DatumParts_YOZAxis: { - aPart1 = Prs3d_DP_YAxis; - aPart2 = Prs3d_DP_ZAxis; + aPart1 = Prs3d_DatumParts_YAxis; + aPart2 = Prs3d_DatumParts_ZAxis; break; } - case Prs3d_DP_XOZAxis: + case Prs3d_DatumParts_XOZAxis: { - aPart1 = Prs3d_DP_XAxis; - aPart2 = Prs3d_DP_ZAxis; + aPart1 = Prs3d_DatumParts_XAxis; + aPart2 = Prs3d_DatumParts_ZAxis; break; } default: break; @@ -910,7 +903,7 @@ void AIS_Trihedron::updatePrimitives(const Handle(Prs3d_DatumAspect)& theAspect, aPrims->AddVertex(anAxisPoints.Find(aPart2)); aPrims->AddVertex(theOrigin); - myPrimitives.Bind(aPart, aPrims); + myPrimitives[aPart] = aPrims; } } @@ -927,6 +920,5 @@ void AIS_Trihedron::DumpJson (Standard_OStream& theOStream, Standard_Integer the OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnSize) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnTextColor) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnArrowColor) - OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myHasOwnDatumAspect) OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myTrihDispMode) } diff --git a/src/AIS/AIS_Trihedron.hxx b/src/AIS/AIS_Trihedron.hxx index d239b2aeea..327136df4a 100644 --- a/src/AIS/AIS_Trihedron.hxx +++ b/src/AIS/AIS_Trihedron.hxx @@ -60,12 +60,12 @@ public: //! Initializes a trihedron entity. Standard_EXPORT AIS_Trihedron (const Handle(Geom_Axis2Placement)& theComponent); - //! Sets Shading or Wireframe display mode, triangle or segment graphic group is used relatively. - void SetDatumDisplayMode (Prs3d_DatumMode theMode) { myTrihDispMode = theMode; } - //! Returns datum display mode. Prs3d_DatumMode DatumDisplayMode() const { return myTrihDispMode; } + //! Sets Shading or Wireframe display mode, triangle or segment graphic group is used relatively. + void SetDatumDisplayMode (Prs3d_DatumMode theMode) { myTrihDispMode = theMode; } + //! Returns the right-handed coordinate system set in SetComponent. const Handle(Geom_Axis2Placement)& Component() const { return myComponent; } @@ -76,8 +76,10 @@ public: //! than the default size of 100 mm. along each axis. Standard_Boolean HasOwnSize() const { return myHasOwnSize; } - //! Sets the size aValue for the trihedron object. - //! The default value is 100 mm. + //! Returns the size of trihedron object; 100.0 by DEFAULT. + Standard_EXPORT Standard_Real Size() const; + + //! Sets the size of trihedron object. Standard_EXPORT void SetSize (const Standard_Real theValue); //! Removes any non-default settings for size of this trihedron object. @@ -85,34 +87,14 @@ public: //! drawer is reproduced, otherwise DatumAspect becomes null. Standard_EXPORT void UnsetSize(); - Standard_EXPORT Standard_Real Size() const; - - //! Returns true if the display mode selected, aMode, is valid for trihedron datums. - virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE - { - return theMode == 0; - } - - //! Returns index 3, selection of the planes XOY, YOZ, XOZ. - virtual Standard_Integer Signature() const Standard_OVERRIDE { return 3; } - - //! Indicates that the type of Interactive Object is datum. - virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; } - - //! Sets the color theColor for this trihedron object, it changes color of axes. - Standard_EXPORT void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; - - //! Sets color of label of trihedron axes. - Standard_EXPORT void SetTextColor (const Quantity_Color& theColor); - //! Returns true if trihedron has own text color Standard_Boolean HasTextColor() const { return myHasOwnTextColor; } //! Returns trihedron text color Standard_EXPORT Quantity_Color TextColor() const; - //! Sets color of arrow of trihedron axes. Used only in wireframe mode - Standard_EXPORT void SetArrowColor (const Quantity_Color& theColor); + //! Sets color of label of trihedron axes. + Standard_EXPORT void SetTextColor (const Quantity_Color& theColor); //! Returns true if trihedron has own arrow color Standard_Boolean HasArrowColor() const { return myHasOwnArrowColor; } @@ -120,17 +102,16 @@ public: //! Returns trihedron arrow color Standard_EXPORT Quantity_Color ArrowColor() const; - //! Removes the settings for color. - Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; + //! Sets color of arrow of trihedron axes. Used only in wireframe mode + Standard_EXPORT void SetArrowColor (const Quantity_Color& theColor); + + //! Returns color of datum part: origin or some of trihedron axes. + Standard_EXPORT Quantity_Color DatumPartColor (Prs3d_DatumParts thePart); //! Sets color of datum part: origin or some of trihedron axes. //! If presentation is shading mode, this color is set for both sides of facing model Standard_EXPORT void SetDatumPartColor (const Prs3d_DatumParts thePart, const Quantity_Color& theColor); - - //! Returns color of datum part: origin or some of trihedron axes. - Standard_EXPORT Quantity_Color DatumPartColor (Prs3d_DatumParts thePart); - //! Sets color of origin. //! Standard_DEPRECATED("This method is deprecated - SetColor() should be called instead") Standard_EXPORT void SetOriginColor (const Quantity_Color& theColor); @@ -153,32 +134,46 @@ public: //! Sets whether to draw the arrows in visualization Standard_EXPORT void SetDrawArrows (const Standard_Boolean theToDraw); + //! Returns priority of selection for owner of the given type + Standard_Integer SelectionPriority (Prs3d_DatumParts thePart) { return mySelectionPriority[thePart]; } + //! Sets priority of selection for owner of the given type void SetSelectionPriority (Prs3d_DatumParts thePart, Standard_Integer thePriority) { - mySelectionPriority.Bind (thePart, thePriority); - } - - //! Sets priority of selection for owner of the given type - Standard_Integer SelectionPriority (Prs3d_DatumParts thePart) - { - return mySelectionPriority.Find (thePart); - } - - //! Sets text label for trihedron axis. Parameter thePart should be XAxis, YAxis or ZAxis - void SetLabel (const Prs3d_DatumParts thePart, - const TCollection_ExtendedString& thePriority) - { - myLabel.Bind (thePart, thePriority); + mySelectionPriority[thePart] = thePriority; } //! Returns text of axis. Parameter thePart should be XAxis, YAxis or ZAxis - const TCollection_ExtendedString& Label (Prs3d_DatumParts thePart) + const TCollection_ExtendedString& Label (Prs3d_DatumParts thePart) { return myLabels[thePart]; } + + //! Sets text label for trihedron axis. Parameter thePart should be XAxis, YAxis or ZAxis + void SetLabel (const Prs3d_DatumParts thePart, + const TCollection_ExtendedString& theName) { - return myLabel.Find (thePart); + myLabels[thePart] = theName; } +public: + + //! Sets the color theColor for this trihedron object, it changes color of axes. + Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE; + + //! Returns true if the display mode selected, aMode, is valid for trihedron datums. + virtual Standard_Boolean AcceptDisplayMode (const Standard_Integer theMode) const Standard_OVERRIDE + { + return theMode == 0; + } + + //! Returns index 3, selection of the planes XOY, YOZ, XOZ. + virtual Standard_Integer Signature() const Standard_OVERRIDE { return 3; } + + //! Indicates that the type of Interactive Object is datum. + virtual AIS_KindOfInteractive Type() const Standard_OVERRIDE { return AIS_KOI_Datum; } + + //! Removes the settings for color. + Standard_EXPORT virtual void UnsetColor() Standard_OVERRIDE; + public: //! Method which clear all selected owners belonging @@ -223,8 +218,7 @@ protected: Standard_EXPORT void setOwnDatumAspect(); //! Returns primitives. - Standard_EXPORT Handle(Graphic3d_ArrayOfPrimitives) arrayOfPrimitives( - Prs3d_DatumParts thePart) const; + const Handle(Graphic3d_ArrayOfPrimitives)& arrayOfPrimitives (Prs3d_DatumParts thePart) const { return myPrimitives[thePart]; } //! Updates graphic groups for the current datum mode //! Parameters of datum position and orientation @@ -236,22 +230,20 @@ protected: const gp_Dir& theZDir); protected: + Handle(Geom_Axis2Placement) myComponent; + Prs3d_DatumMode myTrihDispMode; Standard_Boolean myHasOwnSize; Standard_Boolean myHasOwnTextColor; Standard_Boolean myHasOwnArrowColor; - Standard_Boolean myHasOwnDatumAspect; - Prs3d_DatumMode myTrihDispMode; - Handle(Geom_Axis2Placement) myComponent; + TCollection_ExtendedString myLabels[Prs3d_DatumParts_NB]; + Standard_Integer mySelectionPriority[Prs3d_DatumParts_NB]; - NCollection_DataMap mySelectionPriority; - NCollection_DataMap myLabel; - - NCollection_DataMap myPartToGroup; + Handle(Graphic3d_Group) myPartToGroup[Prs3d_DatumParts_NB]; NCollection_List mySelectedParts; Handle(Graphic3d_AspectLine3d) myHiddenLineAspect; - NCollection_DataMap myPrimitives; + Handle(Graphic3d_ArrayOfPrimitives) myPrimitives[Prs3d_DatumParts_NB]; }; DEFINE_STANDARD_HANDLE(AIS_Trihedron, AIS_InteractiveObject) diff --git a/src/AIS/AIS_ViewCube.cxx b/src/AIS/AIS_ViewCube.cxx index 76a23a6db3..f1b39c0784 100644 --- a/src/AIS/AIS_ViewCube.cxx +++ b/src/AIS/AIS_ViewCube.cxx @@ -177,9 +177,9 @@ AIS_ViewCube::AIS_ViewCube() myBoxSideLabels.Bind (V3d_TypeOfOrientation_Zup_Left, "LEFT"); myBoxSideLabels.Bind (V3d_TypeOfOrientation_Zup_Right, "RIGHT"); - myAxesLabels.Bind (Prs3d_DP_XAxis, "X"); - myAxesLabels.Bind (Prs3d_DP_YAxis, "Y"); - myAxesLabels.Bind (Prs3d_DP_ZAxis, "Z"); + myAxesLabels.Bind (Prs3d_DatumParts_XAxis, "X"); + myAxesLabels.Bind (Prs3d_DatumParts_YAxis, "Y"); + myAxesLabels.Bind (Prs3d_DatumParts_ZAxis, "Z"); // define default size SetSize (70.0); @@ -580,7 +580,7 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& , { const Standard_Real anAxisSize = mySize + 2.0 * myBoxFacetExtension + myAxesPadding; const Handle(Prs3d_DatumAspect)& aDatumAspect = myDrawer->DatumAspect(); - for (Standard_Integer anAxisIter = Prs3d_DP_XAxis; anAxisIter <= Prs3d_DP_ZAxis; ++anAxisIter) + for (Standard_Integer anAxisIter = Prs3d_DatumParts_XAxis; anAxisIter <= Prs3d_DatumParts_ZAxis; ++anAxisIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts )anAxisIter; if (!aDatumAspect->DrawDatumPart (aPart)) @@ -591,9 +591,9 @@ void AIS_ViewCube::Compute (const Handle(PrsMgr_PresentationManager3d)& , gp_Ax1 anAx1; switch (aPart) { - case Prs3d_DP_XAxis: anAx1 = gp_Ax1 (aLocation, gp::DX()); break; - case Prs3d_DP_YAxis: anAx1 = gp_Ax1 (aLocation, gp::DY()); break; - case Prs3d_DP_ZAxis: anAx1 = gp_Ax1 (aLocation, gp::DZ()); break; + case Prs3d_DatumParts_XAxis: anAx1 = gp_Ax1 (aLocation, gp::DX()); break; + case Prs3d_DatumParts_YAxis: anAx1 = gp_Ax1 (aLocation, gp::DY()); break; + case Prs3d_DatumParts_ZAxis: anAx1 = gp_Ax1 (aLocation, gp::DZ()); break; default: break; } diff --git a/src/AIS/AIS_ViewCube.hxx b/src/AIS/AIS_ViewCube.hxx index f1b65ed0fe..cd153f9634 100644 --- a/src/AIS/AIS_ViewCube.hxx +++ b/src/AIS/AIS_ViewCube.hxx @@ -402,9 +402,9 @@ public: //! @name Style management API const TCollection_AsciiString& theY, const TCollection_AsciiString& theZ) { - myAxesLabels.Bind (Prs3d_DP_XAxis, theX); - myAxesLabels.Bind (Prs3d_DP_YAxis, theY); - myAxesLabels.Bind (Prs3d_DP_ZAxis, theZ); + myAxesLabels.Bind (Prs3d_DatumParts_XAxis, theX); + myAxesLabels.Bind (Prs3d_DatumParts_YAxis, theY); + myAxesLabels.Bind (Prs3d_DatumParts_ZAxis, theZ); SetToUpdate(); } diff --git a/src/DsgPrs/DsgPrs_DatumPrs.cxx b/src/DsgPrs/DsgPrs_DatumPrs.cxx index 6c122d87d1..c3aefbf702 100644 --- a/src/DsgPrs/DsgPrs_DatumPrs.cxx +++ b/src/DsgPrs/DsgPrs_DatumPrs.cxx @@ -49,27 +49,27 @@ void DsgPrs_DatumPrs::Add (const Handle(Prs3d_Presentation)& thePresentation, Handle(Prs3d_ArrowAspect) anArrowAspect = aDatumAspect->ArrowAspect(); Handle(Prs3d_TextAspect) aTextAspect = theDrawer->TextAspect(); - if ((anAxes & Prs3d_DA_XAxis) != 0) + if ((anAxes & Prs3d_DatumAxes_XAxis) != 0) { - anAxisLength = aDatumAspect->Attribute (Prs3d_DA_XAxisLength); + anAxisLength = aDatumAspect->Attribute (Prs3d_DatumAttribute_XAxisLength); const gp_Pnt aPoint1 (anOrigin.XYZ() + aXDir.XYZ()*anAxisLength); - DsgPrs_XYZAxisPresentation::Add (thePresentation, aDatumAspect->LineAspect(Prs3d_DP_XAxis), anArrowAspect, + DsgPrs_XYZAxisPresentation::Add (thePresentation, aDatumAspect->LineAspect(Prs3d_DatumParts_XAxis), anArrowAspect, aTextAspect, aXDir, anAxisLength, toDrawLabels ? "X" : "", anOrigin, aPoint1); } - if ((anAxes & Prs3d_DA_YAxis) != 0) + if ((anAxes & Prs3d_DatumAxes_YAxis) != 0) { - anAxisLength = aDatumAspect->Attribute (Prs3d_DA_YAxisLength); + anAxisLength = aDatumAspect->Attribute (Prs3d_DatumAttribute_YAxisLength); const gp_Pnt aPoint2 (anOrigin.XYZ() + aYDir.XYZ()*anAxisLength); - DsgPrs_XYZAxisPresentation::Add (thePresentation, aDatumAspect->LineAspect(Prs3d_DP_YAxis), anArrowAspect, + DsgPrs_XYZAxisPresentation::Add (thePresentation, aDatumAspect->LineAspect(Prs3d_DatumParts_YAxis), anArrowAspect, aTextAspect, aYDir, anAxisLength, toDrawLabels ? "Y" : "", anOrigin, aPoint2); } - if ((anAxes & Prs3d_DA_ZAxis) != 0) + if ((anAxes & Prs3d_DatumAxes_ZAxis) != 0) { - anAxisLength = aDatumAspect->Attribute (Prs3d_DA_ZAxisLength); + anAxisLength = aDatumAspect->Attribute (Prs3d_DatumAttribute_ZAxisLength); const gp_Pnt aPoint3 (anOrigin.XYZ() + aZDir.XYZ()*anAxisLength); - DsgPrs_XYZAxisPresentation::Add (thePresentation, aDatumAspect->LineAspect(Prs3d_DP_ZAxis), anArrowAspect, + DsgPrs_XYZAxisPresentation::Add (thePresentation, aDatumAspect->LineAspect(Prs3d_DatumParts_ZAxis), anArrowAspect, aTextAspect, aZDir, anAxisLength, toDrawLabels ? "Z" : "", anOrigin, aPoint3); } } diff --git a/src/Prs3d/Prs3d_DatumAspect.cxx b/src/Prs3d/Prs3d_DatumAspect.cxx index db7b7e1569..e90785864a 100644 --- a/src/Prs3d/Prs3d_DatumAspect.cxx +++ b/src/Prs3d/Prs3d_DatumAspect.cxx @@ -23,63 +23,39 @@ IMPLEMENT_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect) // purpose : // ======================================================================= Prs3d_DatumAspect::Prs3d_DatumAspect() -: myAxes (Prs3d_DA_XYZAxis), +: myAxes (Prs3d_DatumAxes_XYZAxes), myToDrawLabels (Standard_True), myToDrawArrows (Standard_True) { - Standard_Real aDefaultLength = 100.0; // default axis length, the same as in context - Quantity_Color aDefaultColor(Quantity_NOC_LIGHTSTEELBLUE4); // default axis color + const Standard_Real aDefaultLength = 100.0; // default axis length, the same as in context + const Quantity_Color aDefaultColor (Quantity_NOC_LIGHTSTEELBLUE4); // default axis color - myAttributes.Bind (Prs3d_DA_XAxisLength, aDefaultLength); - myAttributes.Bind (Prs3d_DA_YAxisLength, aDefaultLength); - myAttributes.Bind (Prs3d_DA_ZAxisLength, aDefaultLength); - myAttributes.Bind (Prs3d_DP_ShadingTubeRadiusPercent, 0.02); - myAttributes.Bind (Prs3d_DP_ShadingConeRadiusPercent, 0.04); - myAttributes.Bind (Prs3d_DP_ShadingConeLengthPercent, 0.1); - myAttributes.Bind (Prs3d_DP_ShadingOriginRadiusPercent, 0.015); - myAttributes.Bind (Prs3d_DP_ShadingNumberOfFacettes, 12.0); + myAttributes[Prs3d_DatumAttribute_XAxisLength] = aDefaultLength; + myAttributes[Prs3d_DatumAttribute_YAxisLength] = aDefaultLength; + myAttributes[Prs3d_DatumAttribute_ZAxisLength] = aDefaultLength; + myAttributes[Prs3d_DatumAttribute_ShadingTubeRadiusPercent] = 0.02; + myAttributes[Prs3d_DatumAttribute_ShadingConeRadiusPercent] = 0.04; + myAttributes[Prs3d_DatumAttribute_ShadingConeLengthPercent] = 0.1; + myAttributes[Prs3d_DatumAttribute_ShadingOriginRadiusPercent] = 0.015; + myAttributes[Prs3d_DatumAttribute_ShadingNumberOfFacettes] = 12.0; - Aspect_TypeOfLine aLineType = Aspect_TOL_SOLID; - Standard_Real aWidth = 1.0; - for (int aPartIter = Prs3d_DP_Origin; aPartIter <= Prs3d_DP_XOZAxis; ++aPartIter) + for (int aPartIter = Prs3d_DatumParts_Origin; aPartIter <= Prs3d_DatumParts_XOZAxis; ++aPartIter) { const Prs3d_DatumParts aPart = (Prs3d_DatumParts )aPartIter; - if (aPart != Prs3d_DP_Origin) // origin point is used only in shading mode + if (aPart != Prs3d_DatumParts_Origin) // origin point is used only in shading mode { - myLineAspects.Bind (aPart, new Prs3d_LineAspect (aDefaultColor, aLineType, aWidth)); + myLineAspects[aPart] = new Prs3d_LineAspect (aDefaultColor, Aspect_TOL_SOLID, 1.0); } Handle(Prs3d_ShadingAspect) aShadingAspect = new Prs3d_ShadingAspect(); aShadingAspect->SetColor (aDefaultColor); - myShadedAspects.Bind (aPart, aShadingAspect); + myShadedAspects[aPart] = aShadingAspect; } myTextAspect = new Prs3d_TextAspect(); myPointAspect = new Prs3d_PointAspect (Aspect_TOM_EMPTY, aDefaultColor, 1.0); myArrowAspect = new Prs3d_ArrowAspect(); } -// ======================================================================= -// function : LineAspect -// purpose : -// ======================================================================= -Handle(Prs3d_LineAspect) Prs3d_DatumAspect::LineAspect (Prs3d_DatumParts thePart) const -{ - Handle(Prs3d_LineAspect) aLineAspect; - myLineAspects.Find (thePart, aLineAspect); - return aLineAspect; -} - -// ======================================================================= -// function : ShadingAspect -// purpose : -// ======================================================================= -Handle(Prs3d_ShadingAspect) Prs3d_DatumAspect::ShadingAspect (Prs3d_DatumParts thePart) const -{ - Handle(Prs3d_ShadingAspect) aShadingAspect; - myShadedAspects.Find (thePart, aShadingAspect); - return aShadingAspect; -} - // ======================================================================= // function : SetDrawFirstAndSecondAxis // purpose : @@ -88,11 +64,11 @@ void Prs3d_DatumAspect::SetDrawFirstAndSecondAxis (Standard_Boolean theToDraw) { if (theToDraw) { - myAxes = ((myAxes & Prs3d_DA_ZAxis) != 0 ? Prs3d_DA_XYZAxis : Prs3d_DA_XYAxis); + myAxes = ((myAxes & Prs3d_DatumAxes_ZAxis) != 0 ? Prs3d_DatumAxes_XYZAxes : Prs3d_DatumAxes_XYAxes); } else { - myAxes = Prs3d_DA_ZAxis; + myAxes = Prs3d_DatumAxes_ZAxis; } } @@ -104,11 +80,11 @@ void Prs3d_DatumAspect::SetDrawThirdAxis (Standard_Boolean theToDraw) { if (theToDraw) { - myAxes = ((myAxes & Prs3d_DA_XYAxis) != 0 ? Prs3d_DA_XYZAxis : Prs3d_DA_ZAxis); + myAxes = ((myAxes & Prs3d_DatumAxes_XYAxes) != 0 ? Prs3d_DatumAxes_XYZAxes : Prs3d_DatumAxes_ZAxis); } else { - myAxes = Prs3d_DA_XYAxis; + myAxes = Prs3d_DatumAxes_XYAxes; } } @@ -120,19 +96,19 @@ bool Prs3d_DatumAspect::DrawDatumPart (Prs3d_DatumParts thePart) const { switch (thePart) { - case Prs3d_DP_Origin: return true; - case Prs3d_DP_XAxis: return (myAxes & Prs3d_DA_XAxis) != 0; - case Prs3d_DP_XArrow: return (myAxes & Prs3d_DA_XAxis) != 0 && myToDrawArrows; - case Prs3d_DP_YAxis: return (myAxes & Prs3d_DA_YAxis) != 0; - case Prs3d_DP_YArrow: return (myAxes & Prs3d_DA_YAxis) != 0 && myToDrawArrows; - case Prs3d_DP_ZAxis: return (myAxes & Prs3d_DA_ZAxis) != 0; - case Prs3d_DP_ZArrow: return (myAxes & Prs3d_DA_ZAxis) != 0 && myToDrawArrows; - case Prs3d_DP_XOYAxis: return DrawDatumPart (Prs3d_DP_XAxis) - && DrawDatumPart (Prs3d_DP_YAxis); - case Prs3d_DP_YOZAxis: return DrawDatumPart (Prs3d_DP_YAxis) - && DrawDatumPart (Prs3d_DP_ZAxis); - case Prs3d_DP_XOZAxis: return DrawDatumPart (Prs3d_DP_XAxis) - && DrawDatumPart (Prs3d_DP_ZAxis); + case Prs3d_DatumParts_Origin: return true; + case Prs3d_DatumParts_XAxis: return (myAxes & Prs3d_DatumAxes_XAxis) != 0; + case Prs3d_DatumParts_XArrow: return (myAxes & Prs3d_DatumAxes_XAxis) != 0 && myToDrawArrows; + case Prs3d_DatumParts_YAxis: return (myAxes & Prs3d_DatumAxes_YAxis) != 0; + case Prs3d_DatumParts_YArrow: return (myAxes & Prs3d_DatumAxes_YAxis) != 0 && myToDrawArrows; + case Prs3d_DatumParts_ZAxis: return (myAxes & Prs3d_DatumAxes_ZAxis) != 0; + case Prs3d_DatumParts_ZArrow: return (myAxes & Prs3d_DatumAxes_ZAxis) != 0 && myToDrawArrows; + case Prs3d_DatumParts_XOYAxis: return DrawDatumPart (Prs3d_DatumParts_XAxis) + && DrawDatumPart (Prs3d_DatumParts_YAxis); + case Prs3d_DatumParts_YOZAxis: return DrawDatumPart (Prs3d_DatumParts_YAxis) + && DrawDatumPart (Prs3d_DatumParts_ZAxis); + case Prs3d_DatumParts_XOZAxis: return DrawDatumPart (Prs3d_DatumParts_XAxis) + && DrawDatumPart (Prs3d_DatumParts_ZAxis); default: break; } return false; @@ -146,9 +122,9 @@ Standard_Real Prs3d_DatumAspect::AxisLength (Prs3d_DatumParts thePart) const { switch (thePart) { - case Prs3d_DP_XAxis: return myAttributes.Find (Prs3d_DA_XAxisLength); - case Prs3d_DP_YAxis: return myAttributes.Find (Prs3d_DA_YAxisLength); - case Prs3d_DP_ZAxis: return myAttributes.Find (Prs3d_DA_ZAxisLength); + case Prs3d_DatumParts_XAxis: return myAttributes[Prs3d_DatumAttribute_XAxisLength]; + case Prs3d_DatumParts_YAxis: return myAttributes[Prs3d_DatumAttribute_YAxisLength]; + case Prs3d_DatumParts_ZAxis: return myAttributes[Prs3d_DatumAttribute_ZAxisLength]; default: break; } return 0.0; @@ -162,12 +138,12 @@ Prs3d_DatumParts Prs3d_DatumAspect::ArrowPartForAxis (Prs3d_DatumParts thePart) { switch (thePart) { - case Prs3d_DP_XAxis: return Prs3d_DP_XArrow; - case Prs3d_DP_YAxis: return Prs3d_DP_YArrow; - case Prs3d_DP_ZAxis: return Prs3d_DP_ZArrow; + case Prs3d_DatumParts_XAxis: return Prs3d_DatumParts_XArrow; + case Prs3d_DatumParts_YAxis: return Prs3d_DatumParts_YArrow; + case Prs3d_DatumParts_ZAxis: return Prs3d_DatumParts_ZArrow; default: break; } - return Prs3d_DP_None; + return Prs3d_DatumParts_None; } // ======================================================================= diff --git a/src/Prs3d/Prs3d_DatumAspect.hxx b/src/Prs3d/Prs3d_DatumAspect.hxx index d739c79f0b..d4e364a635 100644 --- a/src/Prs3d/Prs3d_DatumAspect.hxx +++ b/src/Prs3d/Prs3d_DatumAspect.hxx @@ -34,14 +34,14 @@ class Prs3d_DatumAspect : public Prs3d_BasicAspect DEFINE_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect) public: - //! An empty framework to define the display of datums. + //! An empty constructor. Standard_EXPORT Prs3d_DatumAspect(); - //! Returns the right-handed coordinate system set in SetComponent. - Standard_EXPORT Handle(Prs3d_LineAspect) LineAspect (Prs3d_DatumParts thePart) const; + //! Returns line aspect for specified part. + const Handle(Prs3d_LineAspect)& LineAspect (Prs3d_DatumParts thePart) const { return myLineAspects[thePart]; } - //! Returns the right-handed coordinate system set in SetComponent. - Standard_EXPORT Handle(Prs3d_ShadingAspect) ShadingAspect (Prs3d_DatumParts thePart) const; + //! Returns shading aspect for specified part. + const Handle(Prs3d_ShadingAspect)& ShadingAspect (Prs3d_DatumParts thePart) const { return myShadedAspects[thePart]; } //! Returns the text attributes for rendering labels. const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspect; } @@ -61,38 +61,6 @@ public: //! Sets the arrow aspect of presentation void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) { myArrowAspect = theAspect; } - //! Returns the attributes for display of the first axis. - Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead") - const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myLineAspects.Find (Prs3d_DP_XAxis); } - - //! Returns the attributes for display of the second axis. - Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead") - const Handle(Prs3d_LineAspect)& SecondAxisAspect() const { return myLineAspects.Find (Prs3d_DP_YAxis); } - - //! Returns the attributes for display of the third axis. - Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead") - const Handle(Prs3d_LineAspect)& ThirdAxisAspect() const { return myLineAspects.Find (Prs3d_DP_ZAxis); } - - //! Sets the DrawFirstAndSecondAxis attributes to active. - Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead") - Standard_EXPORT void SetDrawFirstAndSecondAxis (Standard_Boolean theToDraw); - - //! Returns true if the first and second axes can be drawn. - Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead") - Standard_Boolean DrawFirstAndSecondAxis() const - { - return (myAxes & Prs3d_DA_XAxis) != 0 - && (myAxes & Prs3d_DA_YAxis) != 0; - } - - //! Sets the DrawThirdAxis attributes to active. - Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead") - Standard_EXPORT void SetDrawThirdAxis (Standard_Boolean theToDraw); - - //! Returns true if the third axis can be drawn. - Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead") - Standard_Boolean DrawThirdAxis() const { return (myAxes & Prs3d_DA_ZAxis) != 0; } - //! Returns true if the given part is used in axes of aspect Standard_EXPORT Standard_Boolean DrawDatumPart (Prs3d_DatumParts thePart) const; @@ -102,40 +70,22 @@ public: //! Returns axes used in the datum aspect Prs3d_DatumAxes DatumAxes() const { return myAxes; } - //! Sets the attribute of the datum type - void SetAttribute (Prs3d_DatumAttribute theType, const Standard_Real& theValue) - { - myAttributes.Bind (theType, theValue); - } - //! Returns the attribute of the datum type - Standard_Real Attribute (Prs3d_DatumAttribute theType) const - { - return myAttributes.Find (theType); - } + Standard_Real Attribute (Prs3d_DatumAttribute theType) const { return myAttributes[theType]; } - //! Sets the lengths of the three axes. - void SetAxisLength (Standard_Real theL1, Standard_Real theL2, Standard_Real theL3) - { - myAttributes.Bind (Prs3d_DA_XAxisLength, theL1); - myAttributes.Bind (Prs3d_DA_YAxisLength, theL2); - myAttributes.Bind (Prs3d_DA_ZAxisLength, theL3); - } + //! Sets the attribute of the datum type + void SetAttribute (Prs3d_DatumAttribute theType, const Standard_Real theValue) { myAttributes[theType] = theValue; } //! Returns the length of the displayed first axis. Standard_EXPORT Standard_Real AxisLength (Prs3d_DatumParts thePart) const; - //! Returns the length of the displayed first axis. - Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead") - Standard_Real FirstAxisLength() const { return myAttributes.Find (Prs3d_DA_XAxisLength); } - - //! Returns the length of the displayed second axis. - Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead") - Standard_Real SecondAxisLength() const { return myAttributes.Find (Prs3d_DA_YAxisLength); } - - //! Returns the length of the displayed third axis. - Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead") - Standard_Real ThirdAxisLength() const { return myAttributes.Find (Prs3d_DA_ZAxisLength); } + //! Sets the lengths of the three axes. + void SetAxisLength (Standard_Real theL1, Standard_Real theL2, Standard_Real theL3) + { + myAttributes[Prs3d_DatumAttribute_XAxisLength] = theL1; + myAttributes[Prs3d_DatumAttribute_YAxisLength] = theL2; + myAttributes[Prs3d_DatumAttribute_ZAxisLength] = theL3; + } //! @return true if axes labels are drawn; TRUE by default. Standard_Boolean ToDrawLabels() const { return myToDrawLabels; } @@ -156,18 +106,64 @@ public: //! Dumps the content of me into the stream Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE; +public: + + //! Returns the attributes for display of the first axis. + Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead") + const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myLineAspects[Prs3d_DatumParts_XAxis]; } + + //! Returns the attributes for display of the second axis. + Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead") + const Handle(Prs3d_LineAspect)& SecondAxisAspect() const { return myLineAspects[Prs3d_DatumParts_YAxis]; } + + //! Returns the attributes for display of the third axis. + Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead") + const Handle(Prs3d_LineAspect)& ThirdAxisAspect() const { return myLineAspects[Prs3d_DatumParts_ZAxis]; } + + //! Sets the DrawFirstAndSecondAxis attributes to active. + Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead") + Standard_EXPORT void SetDrawFirstAndSecondAxis (Standard_Boolean theToDraw); + + //! Returns true if the first and second axes can be drawn. + Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead") + Standard_Boolean DrawFirstAndSecondAxis() const + { + return (myAxes & Prs3d_DatumAxes_XAxis) != 0 + && (myAxes & Prs3d_DatumAxes_YAxis) != 0; + } + + //! Sets the DrawThirdAxis attributes to active. + Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead") + Standard_EXPORT void SetDrawThirdAxis (Standard_Boolean theToDraw); + + //! Returns true if the third axis can be drawn. + Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead") + Standard_Boolean DrawThirdAxis() const { return (myAxes & Prs3d_DatumAxes_ZAxis) != 0; } + + //! Returns the length of the displayed first axis. + Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead") + Standard_Real FirstAxisLength() const { return myAttributes[Prs3d_DatumAttribute_XAxisLength]; } + + //! Returns the length of the displayed second axis. + Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead") + Standard_Real SecondAxisLength() const { return myAttributes[Prs3d_DatumAttribute_YAxisLength]; } + + //! Returns the length of the displayed third axis. + Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead") + Standard_Real ThirdAxisLength() const { return myAttributes[Prs3d_DatumAttribute_ZAxisLength]; } + private: - Prs3d_DatumAxes myAxes; - Standard_Boolean myToDrawLabels; - Standard_Boolean myToDrawArrows; - NCollection_DataMap myAttributes; - NCollection_DataMap myShadedAspects; - NCollection_DataMap myLineAspects; + Handle(Prs3d_ShadingAspect) myShadedAspects[Prs3d_DatumParts_NB]; + Handle(Prs3d_LineAspect) myLineAspects[Prs3d_DatumParts_NB]; + Handle(Prs3d_TextAspect) myTextAspect; + Handle(Prs3d_PointAspect) myPointAspect; + Handle(Prs3d_ArrowAspect) myArrowAspect; + Standard_Real myAttributes[Prs3d_DatumAttribute_NB]; + Prs3d_DatumAxes myAxes; + Standard_Boolean myToDrawLabels; + Standard_Boolean myToDrawArrows; - Handle(Prs3d_TextAspect) myTextAspect; - Handle(Prs3d_PointAspect) myPointAspect; - Handle(Prs3d_ArrowAspect) myArrowAspect; }; DEFINE_STANDARD_HANDLE(Prs3d_DatumAspect, Prs3d_BasicAspect) diff --git a/src/Prs3d/Prs3d_DatumAttribute.hxx b/src/Prs3d/Prs3d_DatumAttribute.hxx index d76e2eafaf..ba3946e5be 100644 --- a/src/Prs3d/Prs3d_DatumAttribute.hxx +++ b/src/Prs3d/Prs3d_DatumAttribute.hxx @@ -14,17 +14,28 @@ #ifndef _Prs3d_DatumAttribute_HeaderFile #define _Prs3d_DatumAttribute_HeaderFile -//! Enumeration defining a part of datum aspect, see Prs3d_Datum. +//! Enumeration defining a datum attribute, see Prs3d_Datum. enum Prs3d_DatumAttribute { - Prs3d_DA_XAxisLength = 0, - Prs3d_DA_YAxisLength, - Prs3d_DA_ZAxisLength, - Prs3d_DP_ShadingTubeRadiusPercent, - Prs3d_DP_ShadingConeRadiusPercent, - Prs3d_DP_ShadingConeLengthPercent, - Prs3d_DP_ShadingOriginRadiusPercent, - Prs3d_DP_ShadingNumberOfFacettes + Prs3d_DatumAttribute_XAxisLength = 0, + Prs3d_DatumAttribute_YAxisLength, + Prs3d_DatumAttribute_ZAxisLength, + Prs3d_DatumAttribute_ShadingTubeRadiusPercent, + Prs3d_DatumAttribute_ShadingConeRadiusPercent, + Prs3d_DatumAttribute_ShadingConeLengthPercent, + Prs3d_DatumAttribute_ShadingOriginRadiusPercent, + Prs3d_DatumAttribute_ShadingNumberOfFacettes, + + // old aliases + Prs3d_DA_XAxisLength = Prs3d_DatumAttribute_XAxisLength, + Prs3d_DA_YAxisLength = Prs3d_DatumAttribute_YAxisLength, + Prs3d_DA_ZAxisLength = Prs3d_DatumAttribute_ZAxisLength, + Prs3d_DP_ShadingTubeRadiusPercent = Prs3d_DatumAttribute_ShadingTubeRadiusPercent, + Prs3d_DP_ShadingConeRadiusPercent = Prs3d_DatumAttribute_ShadingConeRadiusPercent, + Prs3d_DP_ShadingConeLengthPercent = Prs3d_DatumAttribute_ShadingConeLengthPercent, + Prs3d_DP_ShadingOriginRadiusPercent = Prs3d_DatumAttribute_ShadingOriginRadiusPercent, + Prs3d_DP_ShadingNumberOfFacettes = Prs3d_DatumAttribute_ShadingNumberOfFacettes }; +enum { Prs3d_DatumAttribute_NB = Prs3d_DatumAttribute_ShadingNumberOfFacettes + 1 }; #endif // _Prs3d_DatumAttribute_HeaderFile diff --git a/src/Prs3d/Prs3d_DatumAxes.hxx b/src/Prs3d/Prs3d_DatumAxes.hxx index 02665512e0..435402784e 100644 --- a/src/Prs3d/Prs3d_DatumAxes.hxx +++ b/src/Prs3d/Prs3d_DatumAxes.hxx @@ -14,21 +14,30 @@ #ifndef _Prs3d_DatumAxes_HeaderFile #define _Prs3d_DatumAxes_HeaderFile -//! Enumeration defining an axes used in datum aspect, see Prs3d_Datum. +//! Enumeration defining axes used in datum aspect, see Prs3d_Datum. enum Prs3d_DatumAxes { - Prs3d_DA_XAxis = 0x00000001, //!< X axis of the datum - Prs3d_DA_YAxis = 0x00000002, //!< Y axis of the datum - Prs3d_DA_ZAxis = 0x00000004, //!< Z axis of the datum - Prs3d_DA_XYAxis = Prs3d_DA_XAxis - | Prs3d_DA_YAxis, //!< XOY 2D axes - Prs3d_DA_YZAxis = Prs3d_DA_YAxis - | Prs3d_DA_ZAxis, //!< YOZ 2D axes - Prs3d_DA_XZAxis = Prs3d_DA_XAxis - | Prs3d_DA_ZAxis, //!< XOZ 2D axes - Prs3d_DA_XYZAxis = Prs3d_DA_XAxis - | Prs3d_DA_YAxis - | Prs3d_DA_ZAxis //!< XYZ 3D axes + Prs3d_DatumAxes_XAxis = 0x01, //!< X axis of the datum + Prs3d_DatumAxes_YAxis = 0x02, //!< Y axis of the datum + Prs3d_DatumAxes_ZAxis = 0x04, //!< Z axis of the datum + Prs3d_DatumAxes_XYAxes = Prs3d_DatumAxes_XAxis + | Prs3d_DatumAxes_YAxis, //!< XOY 2D axes + Prs3d_DatumAxes_YZAxes = Prs3d_DatumAxes_YAxis + | Prs3d_DatumAxes_ZAxis, //!< YOZ 2D axes + Prs3d_DatumAxes_XZAxes = Prs3d_DatumAxes_XAxis + | Prs3d_DatumAxes_ZAxis, //!< XOZ 2D axes + Prs3d_DatumAxes_XYZAxes = Prs3d_DatumAxes_XAxis + | Prs3d_DatumAxes_YAxis + | Prs3d_DatumAxes_ZAxis, //!< XYZ 3D axes + + // old aliases + Prs3d_DA_XAxis = Prs3d_DatumAxes_XAxis, + Prs3d_DA_YAxis = Prs3d_DatumAxes_YAxis, + Prs3d_DA_ZAxis = Prs3d_DatumAxes_ZAxis, + Prs3d_DA_XYAxis = Prs3d_DatumAxes_XYAxes, + Prs3d_DA_YZAxis = Prs3d_DatumAxes_YZAxes, + Prs3d_DA_XZAxis = Prs3d_DatumAxes_XZAxes, + Prs3d_DA_XYZAxis = Prs3d_DatumAxes_XYZAxes }; #endif // _Prs3d_DatumParts_HeaderFile diff --git a/src/Prs3d/Prs3d_DatumParts.hxx b/src/Prs3d/Prs3d_DatumParts.hxx index e784a374bf..eae1ffd13d 100644 --- a/src/Prs3d/Prs3d_DatumParts.hxx +++ b/src/Prs3d/Prs3d_DatumParts.hxx @@ -17,17 +17,31 @@ //! Enumeration defining a part of datum aspect, see Prs3d_Datum. enum Prs3d_DatumParts { - Prs3d_DP_Origin = 0, - Prs3d_DP_XAxis, - Prs3d_DP_YAxis, - Prs3d_DP_ZAxis, - Prs3d_DP_XArrow, - Prs3d_DP_YArrow, - Prs3d_DP_ZArrow, - Prs3d_DP_XOYAxis, - Prs3d_DP_YOZAxis, - Prs3d_DP_XOZAxis, - Prs3d_DP_None + Prs3d_DatumParts_Origin = 0, + Prs3d_DatumParts_XAxis, + Prs3d_DatumParts_YAxis, + Prs3d_DatumParts_ZAxis, + Prs3d_DatumParts_XArrow, + Prs3d_DatumParts_YArrow, + Prs3d_DatumParts_ZArrow, + Prs3d_DatumParts_XOYAxis, + Prs3d_DatumParts_YOZAxis, + Prs3d_DatumParts_XOZAxis, + Prs3d_DatumParts_None, + + // old aliases + Prs3d_DP_Origin = Prs3d_DatumParts_Origin, + Prs3d_DP_XAxis = Prs3d_DatumParts_XAxis, + Prs3d_DP_YAxis = Prs3d_DatumParts_YAxis, + Prs3d_DP_ZAxis = Prs3d_DatumParts_ZAxis, + Prs3d_DP_XArrow = Prs3d_DatumParts_XArrow, + Prs3d_DP_YArrow = Prs3d_DatumParts_YArrow, + Prs3d_DP_ZArrow = Prs3d_DatumParts_ZArrow, + Prs3d_DP_XOYAxis = Prs3d_DatumParts_XOYAxis, + Prs3d_DP_YOZAxis = Prs3d_DatumParts_YOZAxis, + Prs3d_DP_XOZAxis = Prs3d_DatumParts_XOZAxis, + Prs3d_DP_None = Prs3d_DatumParts_None }; +enum { Prs3d_DatumParts_NB = Prs3d_DatumParts_None + 1 }; #endif // _Prs3d_DatumParts_HeaderFile diff --git a/src/Prs3d/Prs3d_Drawer.cxx b/src/Prs3d/Prs3d_Drawer.cxx index 4d5e0a8891..dbc32b8282 100644 --- a/src/Prs3d/Prs3d_Drawer.cxx +++ b/src/Prs3d/Prs3d_Drawer.cxx @@ -1308,9 +1308,9 @@ bool Prs3d_Drawer::SetShaderProgram (const Handle(Graphic3d_ShaderProgram)& theP } if (myHasOwnDatumAspect) { - setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DP_XAxis)); - setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DP_YAxis)); - setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DP_ZAxis)); + setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DatumParts_XAxis)); + setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DatumParts_YAxis)); + setAspectProgram (theProgram, true, myDatumAspect->LineAspect(Prs3d_DatumParts_ZAxis)); } setAspectProgram (theProgram, myHasOwnArrowAspect, myArrowAspect); return isUpdateNeeded; diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index cf6f8abf5e..e71edd7ccf 100644 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -181,17 +181,17 @@ namespace { TCollection_AsciiString aValue = theValue; aValue.LowerCase(); - if (aValue == "origin") theDatumPart = Prs3d_DP_Origin; - else if (aValue == "xaxis") theDatumPart = Prs3d_DP_XAxis; - else if (aValue == "yaxis") theDatumPart = Prs3d_DP_YAxis; - else if (aValue == "zaxis") theDatumPart = Prs3d_DP_ZAxis; - else if (aValue == "xarrow") theDatumPart = Prs3d_DP_XArrow; - else if (aValue == "yarrow") theDatumPart = Prs3d_DP_YArrow; - else if (aValue == "zarrow") theDatumPart = Prs3d_DP_ZArrow; - else if (aValue == "xoyaxis") theDatumPart = Prs3d_DP_XOYAxis; - else if (aValue == "yozaxis") theDatumPart = Prs3d_DP_YOZAxis; - else if (aValue == "xozaxis") theDatumPart = Prs3d_DP_XOZAxis; - else if (aValue == "whole") theDatumPart = Prs3d_DP_None; + if (aValue == "origin") theDatumPart = Prs3d_DatumParts_Origin; + else if (aValue == "xaxis") theDatumPart = Prs3d_DatumParts_XAxis; + else if (aValue == "yaxis") theDatumPart = Prs3d_DatumParts_YAxis; + else if (aValue == "zaxis") theDatumPart = Prs3d_DatumParts_ZAxis; + else if (aValue == "xarrow") theDatumPart = Prs3d_DatumParts_XArrow; + else if (aValue == "yarrow") theDatumPart = Prs3d_DatumParts_YArrow; + else if (aValue == "zarrow") theDatumPart = Prs3d_DatumParts_ZArrow; + else if (aValue == "xoyaxis") theDatumPart = Prs3d_DatumParts_XOYAxis; + else if (aValue == "yozaxis") theDatumPart = Prs3d_DatumParts_YOZAxis; + else if (aValue == "xozaxis") theDatumPart = Prs3d_DatumParts_XOZAxis; + else if (aValue == "whole") theDatumPart = Prs3d_DatumParts_None; else { return false; @@ -204,7 +204,7 @@ namespace { TCollection_AsciiString aValue = theValue; const Standard_Integer aSplitPos = theValue.Search ("|"); - Prs3d_DatumParts aPart = Prs3d_DP_None; + Prs3d_DatumParts aPart = Prs3d_DatumParts_None; if (aSplitPos > 0) { convertToDatumParts (theValue.SubString (aSplitPos + 1, theValue.Length()), theParts); @@ -225,14 +225,14 @@ namespace { TCollection_AsciiString aValue = theValue; aValue.LowerCase(); - if (aValue == "xaxislength") theAttribute = Prs3d_DA_XAxisLength; - else if (aValue == "yaxislength") theAttribute = Prs3d_DA_YAxisLength; - else if (aValue == "zaxislength") theAttribute = Prs3d_DA_ZAxisLength; - else if (aValue == "tuberadiuspercent") theAttribute = Prs3d_DP_ShadingTubeRadiusPercent; - else if (aValue == "coneradiuspercent") theAttribute = Prs3d_DP_ShadingConeRadiusPercent; - else if (aValue == "conelengthpercent") theAttribute = Prs3d_DP_ShadingConeLengthPercent; - else if (aValue == "originradiuspercent") theAttribute = Prs3d_DP_ShadingOriginRadiusPercent; - else if (aValue == "shadingnumberoffacettes") theAttribute = Prs3d_DP_ShadingNumberOfFacettes; + if (aValue == "xaxislength") theAttribute = Prs3d_DatumAttribute_XAxisLength; + else if (aValue == "yaxislength") theAttribute = Prs3d_DatumAttribute_YAxisLength; + else if (aValue == "zaxislength") theAttribute = Prs3d_DatumAttribute_ZAxisLength; + else if (aValue == "tuberadiuspercent") theAttribute = Prs3d_DatumAttribute_ShadingTubeRadiusPercent; + else if (aValue == "coneradiuspercent") theAttribute = Prs3d_DatumAttribute_ShadingConeRadiusPercent; + else if (aValue == "conelengthpercent") theAttribute = Prs3d_DatumAttribute_ShadingConeLengthPercent; + else if (aValue == "originradiuspercent") theAttribute = Prs3d_DatumAttribute_ShadingOriginRadiusPercent; + else if (aValue == "shadingnumberoffacettes") theAttribute = Prs3d_DatumAttribute_ShadingNumberOfFacettes; else return false; return true; @@ -243,7 +243,7 @@ namespace { TCollection_AsciiString aValue = theValue; const Standard_Integer aSplitPos = theValue.Search ("|"); - Prs3d_DatumAttribute anAttribute = Prs3d_DA_XAxisLength; + Prs3d_DatumAttribute anAttribute = Prs3d_DatumAttribute_XAxisLength; if (aSplitPos > 0) { convertToDatumAttributes (theValue.SubString (aSplitPos + 1, theValue.Length()), theAttributes); @@ -264,13 +264,13 @@ namespace { TCollection_AsciiString aValue = theValue; aValue.LowerCase(); - if (aValue == "x") theDatumAxes = Prs3d_DA_XAxis; - else if (aValue == "y") theDatumAxes = Prs3d_DA_YAxis; - else if (aValue == "z") theDatumAxes = Prs3d_DA_ZAxis; - else if (aValue == "xy") theDatumAxes = Prs3d_DA_XYAxis; - else if (aValue == "zy") theDatumAxes = Prs3d_DA_YZAxis; - else if (aValue == "xz") theDatumAxes = Prs3d_DA_XZAxis; - else if (aValue == "xyz") theDatumAxes = Prs3d_DA_XYZAxis; + if (aValue == "x") theDatumAxes = Prs3d_DatumAxes_XAxis; + else if (aValue == "y") theDatumAxes = Prs3d_DatumAxes_YAxis; + else if (aValue == "z") theDatumAxes = Prs3d_DatumAxes_ZAxis; + else if (aValue == "xy") theDatumAxes = Prs3d_DatumAxes_XYAxes; + else if (aValue == "zy") theDatumAxes = Prs3d_DatumAxes_YZAxes; + else if (aValue == "xz") theDatumAxes = Prs3d_DatumAxes_XZAxes; + else if (aValue == "xyz") theDatumAxes = Prs3d_DatumAxes_XYZAxes; else { return false; @@ -413,7 +413,7 @@ namespace for (NCollection_List::Iterator anIterator (aParts); anIterator.More(); anIterator.Next()) { Prs3d_DatumParts aDatumPart = anIterator.Value(); - if (aDatumPart == Prs3d_DP_None) + if (aDatumPart == Prs3d_DatumParts_None) { theTrihedron->SetColor (aColor); } @@ -479,11 +479,11 @@ namespace if (aMapOfArgs.Find ("labels", aValues) || aMapOfArgs.Find ("label", aValues)) { - Prs3d_DatumParts aDatumPart = Prs3d_DP_None; + Prs3d_DatumParts aDatumPart = Prs3d_DatumParts_None; if (aValues->Size() >= 2 && convertToDatumPart(aValues->Value(1), aDatumPart) - && aDatumPart >= Prs3d_DP_XAxis - && aDatumPart <= Prs3d_DP_ZAxis) // labels are set to axes only + && aDatumPart >= Prs3d_DatumParts_XAxis + && aDatumPart <= Prs3d_DatumParts_ZAxis) // labels are set to axes only { theTrihedron->SetLabel (aDatumPart, aValues->Value (2)); } @@ -496,7 +496,7 @@ namespace if (aMapOfArgs.Find ("drawaxes", aValues)) { - Prs3d_DatumAxes aDatumAxes = Prs3d_DA_XAxis; + Prs3d_DatumAxes aDatumAxes = Prs3d_DatumAxes_XAxis; if (aValues->Size() < 1 || !convertToDatumAxes (aValues->Value (1), aDatumAxes)) { diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 42486337d8..00478aa5f5 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -4187,9 +4187,9 @@ static int VZBuffTrihedron (Draw_Interpretor& /*theDI*/, } } - aView->ZBufferTriedronSetup (anArrowColorX.Name(), anArrowColorY.Name(), anArrowColorZ.Name(), + aView->ZBufferTriedronSetup (anArrowColorX, anArrowColorY, anArrowColorZ, aSizeRatio, anArrowDiam, aNbFacets); - aView->TriedronDisplay (aPosition, aLabelsColor.Name(), aScale, aVisType); + aView->TriedronDisplay (aPosition, aLabelsColor, aScale, aVisType); aView->ZFitAll(); return 0; }