From 6262338c4b22ed7f9f64110d374d4aa5f40c3cae Mon Sep 17 00:00:00 2001 From: osa Date: Mon, 2 Mar 2015 16:17:29 +0300 Subject: [PATCH] 0025773: Visualization - remove AIS_Drawer class and transfer its Link() logic to Prs3d_Drawer --- .../Common/ISession/ISession_Curve.cpp | 2 +- .../occtdemo/Common/OCCDemo_Presentation.cpp | 2 +- samples/mfc/occtdemo/HLR/HLR_Presentation.cpp | 2 +- .../Intersections_Presentation.cpp | 2 +- .../SplitShape/SplitShape_Presentation.cpp | 2 +- .../Textures/Textures_Presentation.cpp | 2 +- .../Transform/Transform_Presentation.cpp | 4 +- .../standard/01_Geometry/src/GeomSources.cpp | 2 +- .../src/ISession2D/ISession_Curve.cpp | 2 +- .../src/ISession2D/ISession_Surface.cpp | 2 +- samples/mfc/standard/01_Geometry/src/StdAfx.h | 2 +- .../02_Modeling/src/ISession_Direction.cpp | 2 +- samples/mfc/standard/03_Viewer2d/src/StdAfx.h | 2 +- .../standard/03_Viewer2d/src/Viewer2dDoc.cpp | 2 +- .../04_Viewer3d/src/ISession_Curve.cpp | 2 +- .../04_Viewer3d/src/OCCDemo_Presentation.cpp | 2 +- .../mfc/standard/05_ImportExport/src/StdAfx.h | 2 +- samples/mfc/standard/06_Ocaf/src/StdAfx.h | 2 +- .../07_Triangulation/src/ISession_Curve.cpp | 2 +- .../src/OCCDemo_Presentation.cpp | 2 +- samples/mfc/standard/08_HLR/src/StdAfx.h | 2 +- .../mfc/standard/09_Animation/src/StdAfx.h | 2 +- .../src/ISession/ISession_Curve.cpp | 2 +- .../10_Convert/src/OCCDemo_Presentation.cpp | 2 +- samples/mfc/standard/Common/AISDialogs.cpp | 6 +- samples/mfc/standard/Common/StdAfx.h | 1 - src/AIS/AIS.cdl | 6 +- src/AIS/AIS.cxx | 42 +- src/AIS/AIS_AngleDimension.cxx | 1 - src/AIS/AIS_Axis.cxx | 1 - src/AIS/AIS_Chamf2dDimension.cxx | 1 - src/AIS/AIS_Chamf3dDimension.cxx | 1 - src/AIS/AIS_Circle.cxx | 21 +- src/AIS/AIS_ColoredShape.cxx | 23 +- src/AIS/AIS_ColoredShape.hxx | 8 +- src/AIS/AIS_ConnectedInteractive.cxx | 1 - src/AIS/AIS_Dimension.hxx | 2 +- src/AIS/AIS_Drawer.cdl | 682 ----------- src/AIS/AIS_Drawer.cxx | 418 ------- src/AIS/AIS_Drawer.lxx | 180 --- src/AIS/AIS_EqualDistanceRelation.cdl | 8 +- src/AIS/AIS_EqualDistanceRelation.cxx | 8 +- src/AIS/AIS_EqualRadiusRelation.cxx | 2 +- src/AIS/AIS_IdenticRelation.cxx | 1 - src/AIS/AIS_InteractiveContext.cdl | 5 +- src/AIS/AIS_InteractiveContext.cxx | 2 +- src/AIS/AIS_InteractiveObject.cdl | 14 +- src/AIS/AIS_InteractiveObject.cxx | 100 +- src/AIS/AIS_InteractiveObject.lxx | 4 - src/AIS/AIS_LengthDimension.hxx | 3 +- src/AIS/AIS_Line.cxx | 21 +- src/AIS/AIS_MaxRadiusDimension.cxx | 1 - src/AIS/AIS_MidPointRelation.cxx | 1 - src/AIS/AIS_MinRadiusDimension.cxx | 1 - src/AIS/AIS_OffsetDimension.cxx | 1 - src/AIS/AIS_ParallelRelation.cxx | 1 - src/AIS/AIS_Plane.cxx | 33 +- src/AIS/AIS_PlaneTrihedron.cxx | 1 - src/AIS/AIS_Point.cxx | 8 +- src/AIS/AIS_PointCloud.cxx | 50 +- src/AIS/AIS_Relation.cxx | 26 +- src/AIS/AIS_Shape.cdl | 31 +- src/AIS/AIS_Shape.cxx | 159 ++- src/AIS/AIS_Shape.lxx | 2 +- src/AIS/AIS_SymmetricRelation.cxx | 1 - src/AIS/AIS_TexturedShape.cxx | 2 +- src/AIS/AIS_Triangulation.cxx | 2 +- src/AIS/AIS_Trihedron.cdl | 2 +- src/AIS/AIS_Trihedron.cxx | 28 +- .../DPrsStd_AISPresentationCommands.cxx | 1 - ...MPrsStd_AISPresentationRetrievalDriver.cxx | 1 - ...rsStd_AISPresentationRetrievalDriver_1.cxx | 1 - .../MPrsStd_AISPresentationStorageDriver.cxx | 1 - src/MeshVS/MeshVS_NodalColorPrsBuilder.cxx | 10 +- src/Prs3d/FILES | 2 + src/Prs3d/Prs3d.cdl | 6 +- src/Prs3d/Prs3d_Drawer.cdl | 601 --------- src/Prs3d/Prs3d_Drawer.cxx | 1071 ++++++++++++----- src/Prs3d/Prs3d_Drawer.hxx | 910 ++++++++++++++ src/Prs3d/Prs3d_IsoAspect.cdl | 2 +- src/QABugs/QABugs_17.cxx | 53 +- src/QABugs/QABugs_4.cxx | 4 +- src/QABugs/QABugs_MyText.cxx | 2 +- src/QABugs/QABugs_PresentableObject.cxx | 2 +- src/SelectMgr/SelectMgr_SelectableObject.cdl | 13 + src/SelectMgr/SelectMgr_SelectableObject.cxx | 34 +- src/SelectMgr/SelectMgr_SelectableObject.lxx | 3 + src/StdPrs/StdPrs_ShadedShape.cxx | 2 +- src/TPrsStd/TPrsStd.cdl | 3 +- src/TPrsStd/TPrsStd_AISPresentation.cdl | 2 +- src/TPrsStd/TPrsStd_AxisDriver.cxx | 1 - src/TPrsStd/TPrsStd_ConstraintDriver.cxx | 1 - src/TPrsStd/TPrsStd_ConstraintTools.cxx | 6 +- src/TPrsStd/TPrsStd_GeometryDriver.cxx | 1 - src/TPrsStd/TPrsStd_PlaneDriver.cxx | 1 - src/TPrsStd/TPrsStd_PointDriver.cxx | 1 - src/ViewerTest/ViewerTest.cxx | 277 ++++- src/ViewerTest/ViewerTest_ObjectCommands.cxx | 10 +- src/ViewerTest/ViewerTest_OpenGlCommands.cxx | 2 +- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 2 +- src/XCAFPrs/XCAFPrs_AISObject.cxx | 61 +- src/XCAFPrs/XCAFPrs_AISObject.hxx | 6 +- src/XDEDRAW/XDEDRAW.cxx | 4 +- tests/bugs/vis/bug25773 | 26 + 104 files changed, 2470 insertions(+), 2615 deletions(-) delete mode 100644 src/AIS/AIS_Drawer.cdl delete mode 100644 src/AIS/AIS_Drawer.cxx delete mode 100644 src/AIS/AIS_Drawer.lxx delete mode 100644 src/Prs3d/Prs3d_Drawer.cdl create mode 100644 src/Prs3d/Prs3d_Drawer.hxx create mode 100644 tests/bugs/vis/bug25773 diff --git a/samples/mfc/occtdemo/Common/ISession/ISession_Curve.cpp b/samples/mfc/occtdemo/Common/ISession/ISession_Curve.cpp index f20037920e..814474a9b5 100755 --- a/samples/mfc/occtdemo/Common/ISession/ISession_Curve.cpp +++ b/samples/mfc/occtdemo/Common/ISession/ISession_Curve.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include diff --git a/samples/mfc/occtdemo/Common/OCCDemo_Presentation.cpp b/samples/mfc/occtdemo/Common/OCCDemo_Presentation.cpp index b8e91292d3..091c20c413 100755 --- a/samples/mfc/occtdemo/Common/OCCDemo_Presentation.cpp +++ b/samples/mfc/occtdemo/Common/OCCDemo_Presentation.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/samples/mfc/occtdemo/HLR/HLR_Presentation.cpp b/samples/mfc/occtdemo/HLR/HLR_Presentation.cpp index 4a8c1ec531..d27724fd0e 100755 --- a/samples/mfc/occtdemo/HLR/HLR_Presentation.cpp +++ b/samples/mfc/occtdemo/HLR/HLR_Presentation.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/samples/mfc/occtdemo/Intersections/Intersections_Presentation.cpp b/samples/mfc/occtdemo/Intersections/Intersections_Presentation.cpp index 0b04e12ea2..d5d259efe3 100755 --- a/samples/mfc/occtdemo/Intersections/Intersections_Presentation.cpp +++ b/samples/mfc/occtdemo/Intersections/Intersections_Presentation.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include diff --git a/samples/mfc/occtdemo/SplitShape/SplitShape_Presentation.cpp b/samples/mfc/occtdemo/SplitShape/SplitShape_Presentation.cpp index 60bc0c6c00..8fc4c9044b 100755 --- a/samples/mfc/occtdemo/SplitShape/SplitShape_Presentation.cpp +++ b/samples/mfc/occtdemo/SplitShape/SplitShape_Presentation.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/samples/mfc/occtdemo/Textures/Textures_Presentation.cpp b/samples/mfc/occtdemo/Textures/Textures_Presentation.cpp index f4d079f75c..ccbbe01023 100755 --- a/samples/mfc/occtdemo/Textures/Textures_Presentation.cpp +++ b/samples/mfc/occtdemo/Textures/Textures_Presentation.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/samples/mfc/occtdemo/Transform/Transform_Presentation.cpp b/samples/mfc/occtdemo/Transform/Transform_Presentation.cpp index 6ac2e35cad..08c69961a9 100755 --- a/samples/mfc/occtdemo/Transform/Transform_Presentation.cpp +++ b/samples/mfc/occtdemo/Transform/Transform_Presentation.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include @@ -231,7 +231,7 @@ void Transform_Presentation::sample1() gp_Ax2 ax2(ax1Pnt.Translated(gp_Vec(0,0,70)),ax1Dir); Handle(Geom_Curve) aCirc = new Geom_TrimmedCurve(new Geom_Circle(ax2,20),0,angle); Handle(AIS_InteractiveObject) aICirc = drawCurve(aCirc,Quantity_NOC_WHITE,Standard_False); - Handle(AIS_Drawer) aDrawer = new AIS_Drawer; + Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer; aDrawer->Link()->SetLineArrowDraw(Standard_True); aDrawer->Link()->ArrowAspect()->SetLength(2); getAISContext()->SetLocalAttributes (aICirc, aDrawer); diff --git a/samples/mfc/standard/01_Geometry/src/GeomSources.cpp b/samples/mfc/standard/01_Geometry/src/GeomSources.cpp index 24af7f88de..5e948d1957 100755 --- a/samples/mfc/standard/01_Geometry/src/GeomSources.cpp +++ b/samples/mfc/standard/01_Geometry/src/GeomSources.cpp @@ -955,7 +955,7 @@ if(NbResults>0){ \n\ DisplayPoint(aDoc,N,aString.ToCString(),false,0.5,0,-0.6); Handle(ISession_Surface) aSurface = new ISession_Surface(SP); - Handle (AIS_Drawer) CurDrawer = aSurface->Attributes(); + Handle(Prs3d_Drawer) CurDrawer = aSurface->Attributes(); CurDrawer->UIsoAspect()->SetNumber(10); CurDrawer->VIsoAspect()->SetNumber(10); aDoc->GetAISContext()->SetLocalAttributes(aSurface, CurDrawer); diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp index e649376a2d..1a25812aa9 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Curve.cpp @@ -35,7 +35,7 @@ void ISession_Curve::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPres const Standard_Integer aMode) { GeomAdaptor_Curve anAdaptorCurve(myCurve); - Handle(AIS_Drawer) aDrawer = new AIS_Drawer(); + Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer(); aDrawer->LineAspect()->SetColor(Quantity_NOC_RED); switch (aMode) diff --git a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp index dccb298efc..2c4a106340 100755 --- a/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp +++ b/samples/mfc/standard/01_Geometry/src/ISession2D/ISession_Surface.cpp @@ -39,7 +39,7 @@ void ISession_Surface::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPr GeomAdaptor_Surface anAdaptorSurface(mySurface); Handle(GeomAdaptor_HSurface) anAdaptorHSurface = new GeomAdaptor_HSurface(mySurface); - Handle(AIS_Drawer) aDrawer = new AIS_Drawer(); + Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer(); aDrawer->LineAspect()->SetColor(Quantity_NOC_YELLOW3); switch (aMode) diff --git a/samples/mfc/standard/01_Geometry/src/StdAfx.h b/samples/mfc/standard/01_Geometry/src/StdAfx.h index 9a0a9262b2..0a91b8fd85 100755 --- a/samples/mfc/standard/01_Geometry/src/StdAfx.h +++ b/samples/mfc/standard/01_Geometry/src/StdAfx.h @@ -84,7 +84,6 @@ #include #include #include -#include #include #include #include @@ -216,6 +215,7 @@ #include #include #include +#include #include #include #include diff --git a/samples/mfc/standard/02_Modeling/src/ISession_Direction.cpp b/samples/mfc/standard/02_Modeling/src/ISession_Direction.cpp index ab99968773..97a5c53709 100755 --- a/samples/mfc/standard/02_Modeling/src/ISession_Direction.cpp +++ b/samples/mfc/standard/02_Modeling/src/ISession_Direction.cpp @@ -15,7 +15,7 @@ IMPLEMENT_STANDARD_RTTIEXT(ISession_Direction,AIS_InteractiveObject) #include "DsgPrs_LengthPresentation.hxx" #include "Prs3d_ArrowAspect.hxx" -#include "AIS_Drawer.hxx" +#include "Prs3d_Drawer.hxx" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// diff --git a/samples/mfc/standard/03_Viewer2d/src/StdAfx.h b/samples/mfc/standard/03_Viewer2d/src/StdAfx.h index 25988578f8..257f72db8c 100755 --- a/samples/mfc/standard/03_Viewer2d/src/StdAfx.h +++ b/samples/mfc/standard/03_Viewer2d/src/StdAfx.h @@ -72,7 +72,6 @@ # pragma comment (lib,"TKernel.lib") */ -#include #include #include #include @@ -121,6 +120,7 @@ #include #include #include +#include #include #include #include diff --git a/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp b/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp index 6e7881ec17..d567d6e8ae 100755 --- a/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp +++ b/samples/mfc/standard/03_Viewer2d/src/Viewer2dDoc.cpp @@ -197,7 +197,7 @@ void CViewer2dDoc::OnBUTTONTestLine() TopoDS_Face F = BRepBuilderAPI_MakeFace(W); Handle_AIS_Shape aRect = new AIS_Shape(F); //set attributes of boundaries - Handle(AIS_Drawer) aDrawer = new AIS_Drawer(); + Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer(); Handle(Prs3d_LineAspect) aLineAttrib = new Prs3d_LineAspect(Quantity_NOC_YELLOW, (Aspect_TypeOfLine)(Aspect_TOL_SOLID+j),1); diff --git a/samples/mfc/standard/04_Viewer3d/src/ISession_Curve.cpp b/samples/mfc/standard/04_Viewer3d/src/ISession_Curve.cpp index 58ad7b7dc3..97a4326955 100755 --- a/samples/mfc/standard/04_Viewer3d/src/ISession_Curve.cpp +++ b/samples/mfc/standard/04_Viewer3d/src/ISession_Curve.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include IMPLEMENT_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject) diff --git a/samples/mfc/standard/04_Viewer3d/src/OCCDemo_Presentation.cpp b/samples/mfc/standard/04_Viewer3d/src/OCCDemo_Presentation.cpp index d49d65f834..0abe4a7000 100755 --- a/samples/mfc/standard/04_Viewer3d/src/OCCDemo_Presentation.cpp +++ b/samples/mfc/standard/04_Viewer3d/src/OCCDemo_Presentation.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/samples/mfc/standard/05_ImportExport/src/StdAfx.h b/samples/mfc/standard/05_ImportExport/src/StdAfx.h index 96e806eb54..debe0e2210 100755 --- a/samples/mfc/standard/05_ImportExport/src/StdAfx.h +++ b/samples/mfc/standard/05_ImportExport/src/StdAfx.h @@ -41,7 +41,6 @@ #include #pragma warning( default : 4244 ) // Issue warning 4244 -#include #include #include #include @@ -90,6 +89,7 @@ #include #include #include +#include #include #include #include diff --git a/samples/mfc/standard/06_Ocaf/src/StdAfx.h b/samples/mfc/standard/06_Ocaf/src/StdAfx.h index 4a8af24a66..89edb6e681 100755 --- a/samples/mfc/standard/06_Ocaf/src/StdAfx.h +++ b/samples/mfc/standard/06_Ocaf/src/StdAfx.h @@ -39,7 +39,6 @@ #include #pragma warning( default : 4244 ) // Issue warning 4244 -#include #include #include #include @@ -86,6 +85,7 @@ #include #include #include +#include #include #include #include diff --git a/samples/mfc/standard/07_Triangulation/src/ISession_Curve.cpp b/samples/mfc/standard/07_Triangulation/src/ISession_Curve.cpp index 58ad7b7dc3..97a4326955 100755 --- a/samples/mfc/standard/07_Triangulation/src/ISession_Curve.cpp +++ b/samples/mfc/standard/07_Triangulation/src/ISession_Curve.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include IMPLEMENT_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject) diff --git a/samples/mfc/standard/07_Triangulation/src/OCCDemo_Presentation.cpp b/samples/mfc/standard/07_Triangulation/src/OCCDemo_Presentation.cpp index 3732e01b8d..9ec17d72c9 100755 --- a/samples/mfc/standard/07_Triangulation/src/OCCDemo_Presentation.cpp +++ b/samples/mfc/standard/07_Triangulation/src/OCCDemo_Presentation.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/samples/mfc/standard/08_HLR/src/StdAfx.h b/samples/mfc/standard/08_HLR/src/StdAfx.h index f7347b9bd6..540aa5a53c 100755 --- a/samples/mfc/standard/08_HLR/src/StdAfx.h +++ b/samples/mfc/standard/08_HLR/src/StdAfx.h @@ -106,7 +106,6 @@ # pragma comment (lib,"TKXS214.lib") */ -#include #include #include #include @@ -144,6 +143,7 @@ #include #include #include +#include #include #include #include diff --git a/samples/mfc/standard/09_Animation/src/StdAfx.h b/samples/mfc/standard/09_Animation/src/StdAfx.h index 4a3b5ed00d..4e70e4c70f 100755 --- a/samples/mfc/standard/09_Animation/src/StdAfx.h +++ b/samples/mfc/standard/09_Animation/src/StdAfx.h @@ -117,7 +117,6 @@ enum CurrentAction3d { */ -#include #include #include #include @@ -155,6 +154,7 @@ enum CurrentAction3d { #include #include #include +#include #include #include #include diff --git a/samples/mfc/standard/10_Convert/src/ISession/ISession_Curve.cpp b/samples/mfc/standard/10_Convert/src/ISession/ISession_Curve.cpp index 58ad7b7dc3..97a4326955 100755 --- a/samples/mfc/standard/10_Convert/src/ISession/ISession_Curve.cpp +++ b/samples/mfc/standard/10_Convert/src/ISession/ISession_Curve.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include IMPLEMENT_STANDARD_HANDLE(ISession_Curve,AIS_InteractiveObject) diff --git a/samples/mfc/standard/10_Convert/src/OCCDemo_Presentation.cpp b/samples/mfc/standard/10_Convert/src/OCCDemo_Presentation.cpp index ea8b4d076d..89ceabb9d6 100755 --- a/samples/mfc/standard/10_Convert/src/OCCDemo_Presentation.cpp +++ b/samples/mfc/standard/10_Convert/src/OCCDemo_Presentation.cpp @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/samples/mfc/standard/Common/AISDialogs.cpp b/samples/mfc/standard/Common/AISDialogs.cpp index a80b1ad41e..969561b0f7 100755 --- a/samples/mfc/standard/Common/AISDialogs.cpp +++ b/samples/mfc/standard/Common/AISDialogs.cpp @@ -89,7 +89,7 @@ void CAISNbrIsosDialog::OnDeltaposSpinaisisosv(NMHDR* pNMHDR, LRESULT* pResult) #include -#include +#include void CAISNbrIsosDialog::UpdateIsos () { @@ -99,8 +99,8 @@ void CAISNbrIsosDialog::UpdateIsos () myCurrentIC->MoreCurrent (); myCurrentIC->NextSelected ()) { - Handle (AIS_InteractiveObject) CurObject; - Handle (AIS_Drawer) CurDrawer; + Handle(AIS_InteractiveObject) CurObject; + Handle(Prs3d_Drawer) CurDrawer; CurObject = myCurrentIC->Current(); diff --git a/samples/mfc/standard/Common/StdAfx.h b/samples/mfc/standard/Common/StdAfx.h index 7b16de8717..2415a82ceb 100755 --- a/samples/mfc/standard/Common/StdAfx.h +++ b/samples/mfc/standard/Common/StdAfx.h @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/src/AIS/AIS.cdl b/src/AIS/AIS.cdl index 657e746594..063593d907 100644 --- a/src/AIS/AIS.cdl +++ b/src/AIS/AIS.cdl @@ -328,8 +328,6 @@ is imported ColoredShape; imported TexturedShape; - class Drawer; - class InteractiveContext; class GraphicTool; @@ -681,7 +679,7 @@ is ComputeProjEdgePresentation(aPres : Presentation from Prs3d; - aDrawer : Drawer from AIS; + aDrawer : Drawer from Prs3d; anEdge : Edge from TopoDS; ProjCurve: Curve from Geom; FirstP : Pnt from gp; @@ -692,7 +690,7 @@ is aCallTOL : TypeOfLine from Aspect = Aspect_TOL_DOT); ComputeProjVertexPresentation(aPres : Presentation from Prs3d; - aDrawer : Drawer from AIS; + aDrawer : Drawer from Prs3d; aVertex : Vertex from TopoDS; ProjPoint: Pnt from gp; aColor : NameOfColor from Quantity = Quantity_NOC_PURPLE; diff --git a/src/AIS/AIS.cxx b/src/AIS/AIS.cxx index fe606a701d..1886bf0e36 100644 --- a/src/AIS/AIS.cxx +++ b/src/AIS/AIS.cxx @@ -1390,18 +1390,18 @@ gp_Pnt AIS::NearestApex(const gp_Elips & elips, //purpose : //======================================================================= -void AIS::ComputeProjEdgePresentation( const Handle( Prs3d_Presentation )& aPresentation, - const Handle( AIS_Drawer )& aDrawer, - const TopoDS_Edge& anEdge, - const Handle( Geom_Curve )& ProjCurve, - const gp_Pnt& FirstP, - const gp_Pnt& LastP, - const Quantity_NameOfColor aColor, - const Standard_Real aWidth, - const Aspect_TypeOfLine aProjTOL, - const Aspect_TypeOfLine aCallTOL ) +void AIS::ComputeProjEdgePresentation (const Handle(Prs3d_Presentation)& aPresentation, + const Handle(Prs3d_Drawer)& aDrawer, + const TopoDS_Edge& anEdge, + const Handle(Geom_Curve)& ProjCurve, + const gp_Pnt& FirstP, + const gp_Pnt& LastP, + const Quantity_NameOfColor aColor, + const Standard_Real aWidth, + const Aspect_TypeOfLine aProjTOL, + const Aspect_TypeOfLine aCallTOL) { - if (!aDrawer->HasWireAspect()){ + if (!aDrawer->HasOwnWireAspect()){ aDrawer->SetWireAspect(new Prs3d_LineAspect(aColor,aProjTOL,2.));} else { // CLE @@ -1493,16 +1493,16 @@ void AIS::ComputeProjEdgePresentation( const Handle( Prs3d_Presentation )& aPres //purpose : //======================================================================= -void AIS::ComputeProjVertexPresentation( const Handle( Prs3d_Presentation )& aPresentation, - const Handle( AIS_Drawer )& aDrawer, - const TopoDS_Vertex& aVertex, - const gp_Pnt& ProjPoint, - const Quantity_NameOfColor aColor, - const Standard_Real aWidth, - const Aspect_TypeOfMarker aProjTOM, - const Aspect_TypeOfLine aCallTOL ) +void AIS::ComputeProjVertexPresentation (const Handle( Prs3d_Presentation )& aPresentation, + const Handle( Prs3d_Drawer )& aDrawer, + const TopoDS_Vertex& aVertex, + const gp_Pnt& ProjPoint, + const Quantity_NameOfColor aColor, + const Standard_Real aWidth, + const Aspect_TypeOfMarker aProjTOM, + const Aspect_TypeOfLine aCallTOL) { - if (!aDrawer->HasPointAspect()){ + if (!aDrawer->HasOwnPointAspect()){ aDrawer->SetPointAspect(new Prs3d_PointAspect(aProjTOM, aColor,1));} else { // CLE @@ -1516,7 +1516,7 @@ void AIS::ComputeProjVertexPresentation( const Handle( Prs3d_Presentation )& aPr // calculate the projection StdPrs_Point::Add(aPresentation, new Geom_CartesianPoint(ProjPoint), aDrawer); - if (!aDrawer->HasWireAspect()){ + if (!aDrawer->HasOwnWireAspect()){ aDrawer->SetWireAspect(new Prs3d_LineAspect(aColor,aCallTOL,2.));} else { // CLE diff --git a/src/AIS/AIS_AngleDimension.cxx b/src/AIS/AIS_AngleDimension.cxx index 5f543d0afb..2767e03107 100644 --- a/src/AIS/AIS_AngleDimension.cxx +++ b/src/AIS/AIS_AngleDimension.cxx @@ -17,7 +17,6 @@ #include #include -#include #include #include #include diff --git a/src/AIS/AIS_Axis.cxx b/src/AIS/AIS_Axis.cxx index b35d7011e3..9202253743 100644 --- a/src/AIS/AIS_Axis.cxx +++ b/src/AIS/AIS_Axis.cxx @@ -32,7 +32,6 @@ #include #include #include -#include #include #include diff --git a/src/AIS/AIS_Chamf2dDimension.cxx b/src/AIS/AIS_Chamf2dDimension.cxx index 1b69a80cf2..4a36258f11 100644 --- a/src/AIS/AIS_Chamf2dDimension.cxx +++ b/src/AIS/AIS_Chamf2dDimension.cxx @@ -52,7 +52,6 @@ #include #include -#include #include #include diff --git a/src/AIS/AIS_Chamf3dDimension.cxx b/src/AIS/AIS_Chamf3dDimension.cxx index 9df9e61ea4..0405edcdf5 100644 --- a/src/AIS/AIS_Chamf3dDimension.cxx +++ b/src/AIS/AIS_Chamf3dDimension.cxx @@ -52,7 +52,6 @@ #include #include -#include #include #include diff --git a/src/AIS/AIS_Circle.cxx b/src/AIS/AIS_Circle.cxx index 1bc4635eea..f7c4ac3ca4 100644 --- a/src/AIS/AIS_Circle.cxx +++ b/src/AIS/AIS_Circle.cxx @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -128,10 +127,12 @@ void AIS_Circle::SetColor(const Quantity_Color &aCol) hasOwnColor=Standard_True; myOwnColor=aCol; - Standard_Real WW = HasWidth()? myOwnWidth: - AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line); + Standard_Real WW = HasWidth() ? myOwnWidth : + myDrawer->HasLink() ? + AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : + 1.; - if (!myDrawer->HasLineAspect ()) + if (!myDrawer->HasOwnLineAspect ()) myDrawer->SetLineAspect (new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW)); else myDrawer->LineAspect()->SetColor(aCol); @@ -147,10 +148,10 @@ void AIS_Circle::SetWidth(const Standard_Real aValue) { myOwnWidth=aValue; - if (!myDrawer->HasLineAspect ()) { - Quantity_Color CC; + if (!myDrawer->HasOwnLineAspect ()) { + Quantity_Color CC = Quantity_NOC_YELLOW; if( HasColor() ) CC = myOwnColor; - else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC); + else if(myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC); myDrawer->SetLineAspect (new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,aValue)); } else myDrawer->LineAspect()->SetWidth(aValue); @@ -169,9 +170,9 @@ void AIS_Circle::UnsetColor() if (!HasWidth()) myDrawer->SetLineAspect(NullAsp); else{ - Quantity_Color CC; + Quantity_Color CC = Quantity_NOC_YELLOW;; if( HasColor() ) CC = myOwnColor; - else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC); + else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC); myDrawer->LineAspect()->SetColor(CC); myOwnColor = CC; } @@ -187,7 +188,7 @@ void AIS_Circle::UnsetWidth() if (!HasColor()) myDrawer->SetLineAspect(NullAsp); else{ - Standard_Real WW = AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line); + Standard_Real WW = myDrawer->HasLink() ? AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line) : 1.; myDrawer->LineAspect()->SetWidth(WW); myOwnWidth = WW; } diff --git a/src/AIS/AIS_ColoredShape.cxx b/src/AIS/AIS_ColoredShape.cxx index de89c423ac..7e31948068 100644 --- a/src/AIS/AIS_ColoredShape.cxx +++ b/src/AIS/AIS_ColoredShape.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -41,8 +42,8 @@ #include #include -IMPLEMENT_STANDARD_HANDLE (AIS_ColoredDrawer, AIS_Drawer) -IMPLEMENT_STANDARD_RTTIEXT(AIS_ColoredDrawer, AIS_Drawer) +IMPLEMENT_STANDARD_HANDLE (AIS_ColoredDrawer, Prs3d_Drawer) +IMPLEMENT_STANDARD_RTTIEXT(AIS_ColoredDrawer, Prs3d_Drawer) IMPLEMENT_STANDARD_HANDLE (AIS_ColoredShape, AIS_Shape) IMPLEMENT_STANDARD_RTTIEXT(AIS_ColoredShape, AIS_Shape) @@ -203,15 +204,15 @@ void AIS_ColoredShape::SetColor (const Quantity_Color& theColor) continue; } - if (aDrawer->HasShadingAspect()) + if (aDrawer->HasOwnShadingAspect()) { aDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel); } - if (aDrawer->HasLineAspect()) + if (aDrawer->HasOwnLineAspect()) { aDrawer->LineAspect()->SetColor (theColor); } - if (aDrawer->HasWireAspect()) + if (aDrawer->HasOwnWireAspect()) { aDrawer->WireAspect()->SetColor (theColor); } @@ -237,11 +238,11 @@ void AIS_ColoredShape::SetWidth (const Standard_Real theLineWidth) continue; } - if (aDrawer->HasLineAspect()) + if (aDrawer->HasOwnLineAspect()) { aDrawer->LineAspect()->SetWidth (theLineWidth); } - if (aDrawer->HasWireAspect()) + if (aDrawer->HasOwnWireAspect()) { aDrawer->WireAspect()->SetWidth (theLineWidth); } @@ -261,8 +262,8 @@ void AIS_ColoredShape::SetTransparency (const Standard_Real theValue) LoadRecomputable (AIS_Shaded); for (DataMapOfShapeColor::Iterator anIter (myShapeColors); anIter.More(); anIter.Next()) { - const Handle(AIS_Drawer)& aDrawer = anIter.Value(); - if (aDrawer->HasShadingAspect()) + const Handle(Prs3d_Drawer)& aDrawer = anIter.Value(); + if (aDrawer->HasOwnShadingAspect()) { aDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel); } @@ -284,7 +285,7 @@ void AIS_ColoredShape::SetMaterial (const Graphic3d_MaterialAspect& theMaterial) { const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value(); //if (aDrawer->HasOwnMaterial()) continue; - if (aDrawer->HasShadingAspect()) + if (aDrawer->HasOwnShadingAspect()) { setMaterial (aDrawer, theMaterial, aDrawer->HasOwnColor(), Standard_False); // aDrawer->IsTransparent() } @@ -377,7 +378,7 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation { const TopoDS_Shape& aShapeKey = aMapIter.Key(); // key shape with detailed color or a base shape const TopoDS_Compound& aShapeDraw = aMapIter.Value(); // compound of subshapes with type - Handle(AIS_Drawer) aDrawer; + Handle(Prs3d_Drawer) aDrawer; if (myShapeColors.Find (aShapeKey, aCustomDrawer)) { aDrawer = aCustomDrawer; diff --git a/src/AIS/AIS_ColoredShape.hxx b/src/AIS/AIS_ColoredShape.hxx index 08300047fb..5fb4a3edf8 100644 --- a/src/AIS/AIS_ColoredShape.hxx +++ b/src/AIS/AIS_ColoredShape.hxx @@ -16,7 +16,7 @@ #ifndef _AIS_ColoredShape_HeaderFile #define _AIS_ColoredShape_HeaderFile -#include +#include #include #include @@ -26,11 +26,11 @@ #include //! Customizable properties. -class AIS_ColoredDrawer : public AIS_Drawer +class AIS_ColoredDrawer : public Prs3d_Drawer { public: - AIS_ColoredDrawer (const Handle(AIS_Drawer)& theLink) + AIS_ColoredDrawer (const Handle(Prs3d_Drawer)& theLink) : myIsHidden (Standard_False), myHasOwnColor (Standard_False), myHasOwnWidth (Standard_False) @@ -58,7 +58,7 @@ public: }; -DEFINE_STANDARD_HANDLE(AIS_ColoredDrawer, AIS_Drawer) +DEFINE_STANDARD_HANDLE(AIS_ColoredDrawer, Prs3d_Drawer) //! Presentation of the shape with customizable sub-shapes properties. class AIS_ColoredShape : public AIS_Shape diff --git a/src/AIS/AIS_ConnectedInteractive.cxx b/src/AIS/AIS_ConnectedInteractive.cxx index 74c2dc898f..10a7368765 100644 --- a/src/AIS/AIS_ConnectedInteractive.cxx +++ b/src/AIS/AIS_ConnectedInteractive.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/src/AIS/AIS_Dimension.hxx b/src/AIS/AIS_Dimension.hxx index a71e552bd1..03ad7d01b1 100755 --- a/src/AIS/AIS_Dimension.hxx +++ b/src/AIS/AIS_Dimension.hxx @@ -23,12 +23,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/AIS/AIS_Drawer.cdl b/src/AIS/AIS_Drawer.cdl deleted file mode 100644 index bda1a86e5f..0000000000 --- a/src/AIS/AIS_Drawer.cdl +++ /dev/null @@ -1,682 +0,0 @@ --- Created on: 1992-09-18 --- Created by: Odile Olivier --- Copyright (c) 1992-1999 Matra Datavision --- Copyright (c) 1999-2014 OPEN CASCADE SAS --- --- This file is part of Open CASCADE Technology software library. --- --- This library is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License version 2.1 as published --- by the Free Software Foundation, with special exception defined in the file --- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT --- distribution for complete text of the license and disclaimer of any warranty. --- --- Alternatively, this file may be used under the terms of Open CASCADE --- commercial license or contractual agreement. - -class Drawer from AIS inherits Drawer from Prs3d - - ---Purpose: - -- A framework to manage display attributes of interactive objects. - -- An interactive object can have a certain number of - -- display attributes specific to it. These include - -- visualization mode, color, material - -- and so on. To deal with this information, the - -- interactive context has a Drawer attribute manager - -- which is valid by default for the objects it - -- controls. When an interactive object is visualized, the - -- required graphic display attributes are first taken from - -- its own Drawer if it has the ones required, or from the - -- context drawer for those it does not have them. - -- The set of display attributes of an interactive object is - -- stocked in an AIS_Drawer, which is, in fact, a - -- Prs3d_Drawer with the possibility of a link to another - -- display attribute manager. This drawer then manages - -- the stocked graphic display attributes by specifying - -- how the presentation algorithms compute the - -- presentation of a specific kind of object. These - -- factors involved include color, width and type of line, - -- and maximal chordal deviation. The Drawer includes - -- instances of the aspect classes providing the default - -- values for them. - -- Prs3d_Drawer completes AIS_Drawer by adding - -- functions for setting deviation angle and deviation - -- coefficient in presentations using hidden line removal. - -uses - Drawer from Prs3d, - DatumAspect from Prs3d, - LineAspect from Prs3d, - TextAspect from Prs3d, - PointAspect from Prs3d, - ShadingAspect from Prs3d, - IsoAspect from Prs3d, - DimensionAspect from Prs3d, - PlaneAspect from Prs3d, - ArrowAspect from Prs3d, - TypeOfDeflection from Aspect, - NameOfColor from Quantity, - PlaneAngle from Quantity, - Length from Quantity, - DimensionUnits from Prs3d, - VertexDrawMode from Prs3d, - AsciiString from TCollection, - TypeOfHLR from Prs3d, - Ax2 from gp - -is - Create returns Drawer from AIS; - ---Purpose: - -- Constructs an empty attribute management framework. - TypeOfDeflection(me) returns TypeOfDeflection from Aspect - is redefined static; - --- Purpose: - -- Returns the type of chordal deflection: relative to the - -- size of the object or absolute. - - MaximalChordialDeviation (me) returns Length from Quantity - ---Purpose: Returns the maximal chordal deviation. The default - -- value is 0.1. Drawings of curves or patches are - -- made with respect to an absolute maximal chordal deviation. - is redefined static; - - ------------------------------------------------------------- - SetDeviationCoefficient(me: mutable) ; - ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_False - ---C++: inline - - SetHLRDeviationCoefficient(me: mutable) ; - ---Purpose: Sets the deviation coefficient aCoefficient for - -- removal of hidden lines created by different - -- viewpoints in different presentations. The Default value is 0.02. - ---C++: inline - - SetDeviationAngle(me: mutable) ; - ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_False - ---C++: inline - - SetHLRAngle(me: mutable) ; - ---Purpose: Sets the angle of maximum chordal deviation for - -- removal of hidden lines created by different viewpoints - -- in different presentations. The default value is 20*PI/180. - ---C++: inline - - SetDeviationCoefficient(me: mutable; aCoefficient: Real from Standard ) - ---Purpose: Sets the hasOwnDeviationCoefficient flag to Standard_True, - -- sets myOwnDeviationCoefficient and myPreviousDeviationCoefficient - is redefined static; - - SetHLRDeviationCoefficient(me: mutable; aCoefficient: Real from Standard ) - ---Purpose: Sets the hasOwnHLRDeviationCoefficient flag to Standard_True, - -- sets myOwnHLRDeviationCoefficient and myPreviousHLRDeviationCoefficient - is redefined static; - - SetDeviationAngle(me: mutable; anAngle: Real from Standard ) is redefined ; - ---Purpose: Sets the hasOwnDeviationAngle flag to Standard_True, - -- sets myOwnDeviationAngle and myPreviousDeviationAngle - - SetHLRAngle(me: mutable; anAngle: Real from Standard ) - ---Purpose: Sets the hasOwnHLRDeviationAngle flag to Standard_True, - -- sets myOwnHLRDeviationAngle and myPreviousHLRDeviationAngle - is redefined static; - - SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d) - is redefined; - ---Purpose: Sets the type of HLR algorithm - -- used by drawer's interactive objects - ---C++: inline - - TypeOfHLR(me) returns TypeOfHLR from Prs3d - is redefined; - ---Purpose: Returns the type of HLR algorithm currently in use. - ---C++: inline - - DeviationCoefficient(me) returns Real from Standard - ---Purpose: Drawings of curves or patches are made with respect - -- to a maximal chordal deviation. A Deviation coefficient - -- is used in the shading display mode. The shape is - -- seen decomposed into triangles. These are used to - -- calculate reflection of light from the surface of the - -- object. The triangles are formed from chords of the - -- curves in the shape. The deviation coefficient gives - -- the highest value of the angle with which a chord can - -- deviate from a tangent to a curve. If this limit is - -- reached, a new triangle is begun. - -- This deviation is absolute and is set through the - -- method: SetMaximalChordialDeviation. The default value is 0.001. - -- In drawing shapes, however, you are allowed to ask - -- for a relative deviation. This deviation will be: - -- SizeOfObject * DeviationCoefficient. - is redefined static; - - HLRDeviationCoefficient(me) returns Real from Standard - ---Purpose: Returns the real number value of the HLR deviation - -- coefficient in this framework, if the flag - -- hasOwnHLRDeviationCoefficient is true. - -- If hasOwnHLRDeviationCoefficient is false, the - -- shape's HLR deviation coefficient is used. - -- A Deviation coefficient is used in the shading display - -- mode. The shape is seen decomposed into triangles. - -- These are used to calculate reflection of light from the - -- surface of the object. - -- The triangles are formed from chords of the curves in - -- the shape. The deviation coefficient give the highest - -- value of the angle with which a chord can deviate - -- from a tangent to a curve. If this limit is reached, a - -- new triangle is begun. - -- To find the hidden lines, hidden line display mode - -- entails recalculation of the view at each different - -- projector perspective. - -- Since hidden lines entail calculations of more than - -- usual complexity to decompose them into these - -- triangles, a deviation coefficient allowing greater - -- tolerance is used. This increases efficiency in calculation. - -- The Default value is 0.02. - is redefined static; - - - DeviationAngle(me) returns Real from Standard - ---Purpose: Returns myOwnDeviationAngle if hasOwnDeviationAngle is True - -- else gets myDeviationAngle field from Prs3d_Drawer - is redefined; - - HLRAngle(me) returns Real from Standard - ---Purpose: Returns the real number value of the deviation angle - -- in hidden line removal views. The default value is 20*PI/180. - is redefined static; - - - PreviousDeviationCoefficient(me) returns Real from Standard - ---Purpose: Saves the previous value used for the chordal - -- deviation coefficient. The default value is 0.1. - ---C++: inline - is static; - - PreviousHLRDeviationCoefficient(me) returns Real from Standard - ---Purpose: returns myPreviousHLRDeviationCoefficient - ---C++: inline - is static; - - PreviousDeviationAngle(me) returns Real from Standard - ---Purpose: returns myPreviousDeviationAngle - ---C++: inline - is static; - - PreviousHLRDeviationAngle(me) returns Real from Standard - ---Purpose: returns myPreviousHLRDeviationAngle - ---C++: inline - is static; - - IsOwnDeviationCoefficient(me) returns Boolean from Standard; - ---Purpose: Returns true if the there is a local setting for deviation - -- coefficient in this framework for a specific interactive object. - ---C++: inline - - IsOwnHLRDeviationCoefficient(me) returns Boolean from Standard; - ---Purpose: Returns true if the there is a setting for HLR deviation - -- coefficient in this framework for a specific interactive object. - ---C++: inline - - IsOwnDeviationAngle(me) returns Boolean from Standard; - ---Purpose: Returns true if the there is a local setting for deviation - -- angle in this framework for a specific interactive object. - ---C++: inline - - IsOwnHLRDeviationAngle(me) returns Boolean from Standard; - ---Purpose: Returns true if the there is a setting for HLR deviation - -- angle in this framework for a specific interactive object. - ---C++: inline - - Discretisation(me) returns Integer from Standard - is redefined static; - ---Purpose: Draws algorithms using discretisation, a default - -- number of points has been set to 17. You can use the - -- method Prs3d_Drawer_SetDiscretisation to change this value. - - MaximalParameterValue(me) returns Real from Standard - is redefined static; - ---Purpose: - -- Sets the maximum value allowed for the first and last - -- parameters of an infinite curve. By default, this value is 500000. - - IsoOnPlane(me) returns Boolean from Standard - ---Purpose: returns True if the drawing of isos on planes is enabled. - is redefined static; - - --- --- Attributes for the U Isoparametric lines of patches. --- - UIsoAspect (me:mutable) returns IsoAspect from Prs3d - ---Purpose: Defines the attributes which are used when drawing an - -- U isoparametric curve of a face. Defines the number - -- of U isoparametric curves to be drawn for a single face. - -- The LineAspect for U isoparametric lines can be edited - -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber) - -- The default values are: - -- COLOR : Quantity_NOC_GRAY75 - -- TYPE OF LINE: Aspect_TOL_SOLID - -- WIDTH : 0.5 - -- These attributes are used by the following algorithms: - -- Prs3d_WFDeflectionSurface - -- Prs3d_WFDeflectionRestrictedFace - - - is redefined static; - - HasUIsoAspect (me) returns Boolean from Standard - ---Purpose: Returns true if the Drawer has a UIso aspect setting active. - ---C++: inline - is static; - --- Attributes for the V Isoparametric line of patches. - - - VIsoAspect (me:mutable) returns IsoAspect from Prs3d - ---Purpose: Defines the attributes which are used when drawing an - -- V isoparametric curve of a face. Defines the number - -- of V isoparametric curves to be drawn for a single face. - -- The LineAspect for V isoparametric lines can be edited - -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber) - -- The default values are: - -- COLOR : Quantity_NOC_GRAY82 - -- TYPE OF LINE: Aspect_TOL_SOLID - -- WIDTH : 0.5 - -- These attributes are used by the following algorithms: - -- Prs3d_WFDeflectionSurface - -- Prs3d_WFDeflectionRestrictedFace - is redefined static; - - HasVIsoAspect (me) returns Boolean from Standard - ---Purpose: Returns true if the Drawer has a VIso aspect setting active. - ---C++: inline - is static; - --- Attributes for the free boundaries - - FreeBoundaryAspect (me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns a link with - -- Prs3d_Drawer_FreeBoundaryAspect. Stores the - -- values for presentation of free boundaries, in other - -- words, boundaries which are not shared . The - -- LineAspect for the free boundaries can be edited. The - -- default values are: Color: Quantity_NOC_GREEN - -- Type of line: Aspect_TOL_SOLID Width: 1. - -- These attributes are used by Prs3d_WFShape. - is redefined static; - - HasFreeBoundaryAspect (me) returns Boolean from Standard - ---Purpose: Returns true if the Drawer has a free boundary aspect setting active. - ---C++: inline - is static; - - FreeBoundaryDraw(me) returns Boolean from Standard - ---Purpose: returns True if the drawing of the free boundaries is enabled. - is redefined static; - - --- Attributes for the wires - - WireAspect (me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns a link with Prs3d_Drawer_WireAspect. - -- This method provides wire aspect settings. - -- The LineAspect for wires can be edited. The default values are: - -- Color: Quantity_NOC_RED - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - -- These attributes are used by the following algorithms: - -- Prs3d_WFShape - is redefined static; - - HasLineAspect (me) returns Boolean from Standard - ---Purpose: Returns true if the Interactive Object has a line - -- visualization aspect. - ---C++: inline - is static; - - HasWireAspect (me) returns Boolean from Standard - ---Purpose: Returns true if the Drawer has a wire aspect setting active. - ---C++: inline - is static; - - WireDraw(me) returns Boolean from Standard - ---Purpose: Returns a link with Prs3d_Drawer_WireDraw. This - -- method returns true if drawing of wires is enabled. - -- The default setting is true. - is redefined static; - - --- Attributes for the unfree boundaries - - UnFreeBoundaryAspect (me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns a link with - -- Prs3d_Drawer_UnFreeBoundaryAspect, which - -- provides settings for shared boundary line aspects. - -- The LineAspect for shared boundaries can be edited. - -- The default values are: - -- Color: Quantity_NOC_YELLOW - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - -- These attributes are used by the following algorithms: - -- Prs3d_WFShape - is redefined static; - - HasUnFreeBoundaryAspect (me) returns Boolean from Standard - ---Purpose: Returns true if the Drawer has an unfree boundary aspect setting active. - ---C++: inline - is static; - - UnFreeBoundaryDraw(me) returns Boolean from Standard - ---Purpose: Returns True if the drawing of the shared boundaries - -- is enabled. True is the default setting. - is redefined static; - - --- --- Attributes for the lines. --- - - LineAspect(me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns a link with Prs3d_Drawer_LineAspect, - -- which provides settings for line aspects. These - -- settings can be edited. The default values are: - -- Color: Quantity_NOC_YELLOW - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - -- These attributes are used by the following algorithms: - -- Prs3d_Curve - -- Prs3d_Line - -- Prs3d_HLRShape - - is redefined static; - - - - HasTextAspect(me) returns Boolean from Standard - is static; - ---C++: inline - TextAspect(me:mutable) returns TextAspect from Prs3d - -- - -- Color: Quantity_NOC_YELLOW - is redefined static; - - LineArrowDraw(me) returns Boolean from Standard - ---Purpose: Returns True if the drawing of an arrow at the end of - -- each line is enabled. The default setting is False. - is redefined static; - - ArrowAspect(me:mutable) returns ArrowAspect from Prs3d - is redefined static; - - --- -- --- Attributes for the points --- - PointAspect(me:mutable) returns PointAspect from Prs3d - ---Purpose: Returns the point aspect setting. The default values - -- are: Color: Quantity_NOC_YELLOW - -- Type of marker: Aspect_TOM_PLUS - -- Scale: 1. - -- These attributes are used by the following algorithms: - -- Prs3d_Point - is redefined static; - - HasPointAspect (me) returns Boolean from Standard - ---Purpose: Returns true if the Drawer has a point aspect setting active. - is static; - ---C++: inline - - SetVertexDrawMode(me: mutable; theMode: VertexDrawMode from Prs3d) - ---Purpose: Sets the mode of visualization of vertices by AIS_Shape and helper algorithms. - -- By default, only isolated vertices not belonging to any face are drawn, - -- that corresponds to Prs3d_VDM_Isolated mode. - -- Switching to Prs3d_VDM_Isolated mode makes all shape's vertices visible. - -- To inherit this parameter from the global drawer instance ("the link") when it is present, - -- Prs3d_VDM_Inherited value should be used. - is redefined static; - - VertexDrawMode(me) returns VertexDrawMode from Prs3d - ---Purpose: Returns the current mode of visualization of vertices of a TopoDS_Shape instance. - is redefined static; - - IsOwnVertexDrawMode(me) returns Boolean from Standard; - ---Purpose: Returns true if the vertex draw mode is not equal to Prs3d_VDM_Inherited. - -- This means that individual vertex draw mode value (i.e. not inherited from the global - -- drawer) is used for a specific interactive object. - ---C++: inline - --- Attributes for the faces: --- - ShadingAspect (me:mutable) returns ShadingAspect from Prs3d - ---Purpose: - -- Returns a link with Prs3d_Drawer_ShadingAspect, - -- which provides settings for shading aspects. - -- These settings can be edited. The default values are: - -- Color: Quantity_NOC_YELLOW - -- Material: Graphic3d_NOM_BRASS - -- hading aspect is obtained through decomposition of - -- 3D faces into triangles, each side of each triangle - -- being a chord of the corresponding curved edge in - -- the face. Reflection of light in each projector - -- perspective is then calculated for each of the - -- resultant triangular planes. - is redefined static; - - HasShadingAspect (me) returns Boolean from Standard - ---C++: inline - ---Purpose: Returns True if the Drawer has shading aspect active. - is static; - - ShadingAspectGlobal(me) returns Boolean from Standard - is redefined static; - ---Purpose: Provides the attributes for hidden line removal. - - - DrawHiddenLine(me) returns Boolean from Standard - ---Purpose: Returns Standard_True if the hidden lines are to be drawn. - -- By default the hidden lines are not drawn. - is redefined static; - - HiddenLineAspect(me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns a link with - -- Prs3d_Drawer_HiddenLineAspect, which provides - -- settings for hidden line aspects. - -- These settings can be edited. The default values are: - -- Color: Quantity_NOC_YELLOW - -- Type of line: Aspect_TOL_DASH - -- Width: 1. - is redefined static; - - - SeenLineAspect(me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns a link with - -- Prs3d_Drawer_SeenLineAspect, which provides - -- settings for seen line aspects. - -- These settings can be edited. The default values are: - -- Color: Quantity_NOC_YELLOW - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - is redefined static; - - - HasPlaneAspect(me) returns Boolean from Standard; - ---C++: inline - - PlaneAspect(me:mutable) returns PlaneAspect from Prs3d - is redefined static; - ---Purpose: - -- Returns a link with Prs3d_Drawer_PlaneAspect. - -- This method provides settings for the appearance of planes. - - - VectorAspect(me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns a link with Prs3d_Drawer_VectorAspect, - -- which provides settings for the appearance of vectors. - -- These settings can be edited. The default values are: - -- Color: Quantity_NOC_SKYBLUE - -- Type of line: Aspect_TOL_SOLID Width: 1. - is redefined static; - - SetFaceBoundaryDraw (me : mutable; - theIsEnabled : Boolean from Standard) - is redefined static; - ---Purpose: Enables or disables drawing of face boundaries for shading presentations. - -- The method sets drawing flag owned by the drawer that will be used during - -- visualization instead of the one set in link. - -- theIsEnabled is a boolean flag indicating whether the face boundaries should be - -- drawn or not. - - IsFaceBoundaryDraw (me) returns Boolean from Standard - is redefined static; - ---Purpose: Checks whether the drawing of face boundaries is enabled or not. - - SetFaceBoundaryAspect (me : mutable; - theAspect : LineAspect from Prs3d) - is redefined static; - ---Purpose: Sets line aspect for face boundaries. - -- The method sets line aspect owned by the drawer that will be used during - -- visualization instead of the one set in link. - -- theAspect is the line aspect that determines the look of the face boundaries. - - FaceBoundaryAspect (me : mutable) returns LineAspect from Prs3d - is redefined static; - ---Purpose: Returns line aspect of face boundaries. - - IsOwnFaceBoundaryDraw (me) returns Boolean from Standard - is static; - ---Purpose: Returns true if the drawer has its own attribute for - -- "draw face boundaries" flag that overrides the one in the link. - ---C++: inline - - IsOwnFaceBoundaryAspect (me) returns Boolean from Standard - is static; - ---Purpose: Returns true if the drawer has its own attribute for - -- face boundaries aspect that overrides the one in the link. - ---C++: inline --- --- Attributes for the presentation of a Datum. --- - - HasDatumAspect(me) returns Boolean from Standard; - ---C++: inline - - DatumAspect(me:mutable) returns DatumAspect from Prs3d - ---Purpose: Returns a link with Prs3d_Drawer_DatumAspect, - -- which provides settings for the appearance of datums. - -- These settings can be edited. The default values for - -- the three axes are: - -- Color: Quantity_NOC_PEACHPUFF - -- Type of line: Aspect_TOL_SOLID Width: 1. - is redefined static; - --- --- Attributes for the presentation of a dimensions. --- - - DimensionAspect (me : mutable) returns DimensionAspect from Prs3d is redefined static; - ---Purpose: Returns a link with Prs3d_Drawer_DimensionAspect, - -- which provides settings for the appearance of dimensions. - - HasDimensionAspect (me) returns Boolean from Standard is static; - ---C++: inline - -- Purpose: Returns true if the Drawer has a dimension aspect setting active. - - SetDimLengthModelUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static; - ---Purpose: Sets dimension length model units for computing of dimension presentation. - - SetDimAngleModelUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static; - ---Purpose: Sets dimension angle model units for computing of dimension presentation. - - DimAngleModelUnits (me) returns AsciiString from TCollection is redefined static; - ---Purpose: Returns angle model units for the dimension presentation. - ---C++: return const & - - DimLengthModelUnits (me) returns AsciiString from TCollection is redefined static; - ---Purpose: Returns length model units for the dimension presentation. - ---C++: return const & - - SetDimLengthDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static; - ---Purpose: Sets length units in which value for dimension presentation is displayed. - - SetDimAngleDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is redefined static; - ---Purpose: Sets angle units in which value for dimension presentation is displayed. - - DimLengthDisplayUnits (me) returns AsciiString from TCollection is redefined static; - ---Purpose: Returns length units in which dimension presentation is displayed. - ---C++: return const & - - DimAngleDisplayUnits (me) returns AsciiString from TCollection is redefined static; - ---Purpose: Returns angle units in which dimension presentation is displayed. - ---C++: return const & - --- Attributes for the sections - - SectionAspect (me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns a link with Prs3d_Drawer_SectionAspect, - -- which provides settings for wires which highlight sections. - -- The LineAspect for the wire can be edited. - -- The default values are: - -- Color: Quantity_NOC_ORANGE - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - -- These attributes are used by the following algorithms: - -- Prs3d_WFShape - is redefined static; - - Link(me:mutable) returns any Drawer from Prs3d - is static; - ---C++: return const& - - HasLink(me) returns Boolean from Standard - is static; - ---C++: inline - - Link (me:mutable; aDrawer: Drawer from Prs3d) - is static; - ---C++: inline - - - ClearLocalAttributes(me:mutable) is virtual; - ---Purpose: Removes attributes stored in a Local Context. - - WasLastLocal(me) returns Boolean from Standard; - ---C++: inline - ---Purpose: Returns true if the last called attribute was local; false if it was global. - - HasLocalAttributes(me) returns Boolean from Standard; - ---C++: inline - ---Purpose: - -- Returns true if a Local Context has stored attributes - -- for Interactive Objects. - -fields - - myLink : Drawer from Prs3d; - hasLocalAttributes : Boolean from Standard; - - myhasOwnDeviationCoefficient : Boolean from Standard; - myOwnDeviationCoefficient : Real from Standard; - myPreviousDeviationCoefficient : Real from Standard; - - myhasOwnHLRDeviationCoefficient : Boolean from Standard; - myOwnHLRDeviationCoefficient : Real from Standard; - myPreviousHLRDeviationCoefficient: Real from Standard; - - myhasOwnDeviationAngle : Boolean from Standard; - myOwnDeviationAngle : Real from Standard; - myPreviousDeviationAngle : Real from Standard; - - myhasOwnHLRDeviationAngle : Boolean from Standard; - myOwnHLRDeviationAngle : Real from Standard; - myPreviousHLRDeviationAngle : Real from Standard; - myHasOwnFaceBoundaryDraw : Boolean from Standard; - - myHasOwnDimLengthModelUnits : Boolean from Standard; - myHasOwnDimLengthDisplayUnits : Boolean from Standard; - myHasOwnDimAngleModelUnits : Boolean from Standard; - myHasOwnDimAngleDisplayUnits : Boolean from Standard; - -end Drawer; - - diff --git a/src/AIS/AIS_Drawer.cxx b/src/AIS/AIS_Drawer.cxx deleted file mode 100644 index 1890ba5e95..0000000000 --- a/src/AIS/AIS_Drawer.cxx +++ /dev/null @@ -1,418 +0,0 @@ -// Copyright (c) 1998-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -#include -#include - -// ======================================================================= -// function : AIS_Drawer -// purpose : -// ======================================================================= -AIS_Drawer::AIS_Drawer() -: myLink (new Prs3d_Drawer()), - hasLocalAttributes (Standard_False), - myhasOwnDeviationCoefficient (Standard_False), - myPreviousDeviationCoefficient (0.1), - myhasOwnHLRDeviationCoefficient (Standard_False), - myhasOwnDeviationAngle (Standard_False), - myhasOwnHLRDeviationAngle (Standard_False), - myHasOwnFaceBoundaryDraw (Standard_False), - myHasOwnDimLengthModelUnits (Standard_False), - myHasOwnDimLengthDisplayUnits (Standard_False), - myHasOwnDimAngleModelUnits (Standard_False), - myHasOwnDimAngleDisplayUnits (Standard_False) -{ - SetMaximalParameterValue (500000.0); - myLink->SetMaximalParameterValue (500000.0); - SetTypeOfHLR (Prs3d_TOH_NotSet); - SetVertexDrawMode (Prs3d_VDM_Inherited); -} - -Aspect_TypeOfDeflection AIS_Drawer::TypeOfDeflection () const -{ - return myLink->TypeOfDeflection(); -} - -Standard_Boolean AIS_Drawer::IsoOnPlane() const -{ - return myLink->IsoOnPlane(); -} - -Standard_Integer AIS_Drawer::Discretisation() const -{ - return myLink->Discretisation(); -} - -Quantity_Length AIS_Drawer::MaximalChordialDeviation() const -{ - return myLink->MaximalChordialDeviation(); -} - - -//======================================================================= -//function : SetDeviationCoefficient -//purpose : -//======================================================================= - -void AIS_Drawer::SetDeviationCoefficient ( const Standard_Real aCoefficient ) -{ - myPreviousDeviationCoefficient = DeviationCoefficient() ; - myOwnDeviationCoefficient = aCoefficient ; - myhasOwnDeviationCoefficient = Standard_True; -} - - -//======================================================================= -//function : SetHLRDeviationCoefficient -//purpose : -//======================================================================= - -void AIS_Drawer::SetHLRDeviationCoefficient ( const Standard_Real aCoefficient ) -{ - myPreviousHLRDeviationCoefficient = HLRDeviationCoefficient() ; - myOwnHLRDeviationCoefficient = aCoefficient ; - myhasOwnHLRDeviationCoefficient = Standard_True; -} - -//======================================================================= -//function : SetDeviationAngle -//purpose : -//======================================================================= - -void AIS_Drawer::SetDeviationAngle ( const Standard_Real anAngle ) -{ - myPreviousDeviationAngle = DeviationAngle() ; - myOwnDeviationAngle = anAngle ; - myhasOwnDeviationAngle = Standard_True; -} - -//======================================================================= -//function : SetHLRAngle -//purpose : -//======================================================================= - -void AIS_Drawer::SetHLRAngle ( const Standard_Real anAngle ) -{ - myPreviousHLRDeviationAngle = HLRAngle() ; - myOwnHLRDeviationAngle = anAngle ; - myhasOwnHLRDeviationAngle = Standard_True; -} - -/////// Get -//======================================================================= -//function : DeviationCoefficient -//purpose : -//======================================================================= - -Standard_Real AIS_Drawer::DeviationCoefficient () const -{ - return myhasOwnDeviationCoefficient? myOwnDeviationCoefficient :myLink->DeviationCoefficient(); -} - -//======================================================================= -//function : HLRDeviationCoefficient -//purpose : -//======================================================================= - -Standard_Real AIS_Drawer::HLRDeviationCoefficient () const -{ - return myhasOwnHLRDeviationCoefficient?myOwnHLRDeviationCoefficient : myLink->HLRDeviationCoefficient() ; -} - -//======================================================================= -//function : DeviationAngle -//purpose : -//======================================================================= - -Standard_Real AIS_Drawer::DeviationAngle () const -{ - return myhasOwnDeviationAngle ? myOwnDeviationAngle : myLink->DeviationAngle(); -} - -//======================================================================= -//function : HLRAngle -//purpose : -//======================================================================= - -Standard_Real AIS_Drawer::HLRAngle () const -{ - - return myhasOwnHLRDeviationAngle ? myOwnHLRDeviationAngle : myLink->HLRAngle(); -} - -Standard_Real AIS_Drawer::MaximalParameterValue () const -{ return myLink->MaximalParameterValue();} - -Handle (Prs3d_IsoAspect) AIS_Drawer::UIsoAspect () -{ return myUIsoAspect.IsNull() ? myLink->UIsoAspect (): myUIsoAspect;} - -Handle (Prs3d_IsoAspect) AIS_Drawer::VIsoAspect () -{ return myVIsoAspect.IsNull() ? myLink->VIsoAspect (): myVIsoAspect;} - -Handle (Prs3d_LineAspect) AIS_Drawer::FreeBoundaryAspect () -{return myFreeBoundaryAspect.IsNull() ? myLink->FreeBoundaryAspect (): myFreeBoundaryAspect;} - -Standard_Boolean AIS_Drawer::FreeBoundaryDraw () const -{return myLink->FreeBoundaryDraw();} - -Handle (Prs3d_LineAspect) AIS_Drawer::UnFreeBoundaryAspect () -{return myUnFreeBoundaryAspect.IsNull() ? myLink->UnFreeBoundaryAspect (): myUnFreeBoundaryAspect;} - -Standard_Boolean AIS_Drawer::UnFreeBoundaryDraw () const -{return myLink->UnFreeBoundaryDraw ();} - -Handle (Prs3d_LineAspect) AIS_Drawer::WireAspect () -{ return myWireAspect.IsNull()? myLink->WireAspect (): myWireAspect;} - -Standard_Boolean AIS_Drawer::WireDraw () const -{ return myLink->WireDraw();} - -Handle (Prs3d_LineAspect) AIS_Drawer::LineAspect () -{ return myLineAspect.IsNull() ? myLink->LineAspect (): myLineAspect;} - -Handle (Prs3d_TextAspect) AIS_Drawer::TextAspect () -{ return myTextAspect.IsNull() ? myLink->TextAspect () : myTextAspect ;} - -Handle (Prs3d_ShadingAspect) AIS_Drawer::ShadingAspect () -{ -return myShadingAspect.IsNull() ? myLink->ShadingAspect () : myShadingAspect ; -} - -Standard_Boolean AIS_Drawer::ShadingAspectGlobal() const -{ return myLink->ShadingAspectGlobal();} - - -Standard_Boolean AIS_Drawer::LineArrowDraw () const -{ return myLink->LineArrowDraw();} - -Handle (Prs3d_ArrowAspect) AIS_Drawer::ArrowAspect() -{return myArrowAspect.IsNull()? myLink->ArrowAspect () : myArrowAspect;} - -Handle (Prs3d_PointAspect) AIS_Drawer::PointAspect() -{return myPointAspect.IsNull()? myLink->PointAspect () : myPointAspect;} - -void AIS_Drawer::SetVertexDrawMode (const Prs3d_VertexDrawMode theMode) -{ - // Assuming that myLink always exists --> Prs3d_VDM_Inherited value is acceptable. - // So we simply store the new mode, as opposed to Prs3d_Drawer::SetVertexDrawMode() - myVertexDrawMode = theMode; -} - -Prs3d_VertexDrawMode AIS_Drawer::VertexDrawMode () const -{ - return IsOwnVertexDrawMode() ? myVertexDrawMode : myLink->VertexDrawMode(); -} - -Standard_Boolean AIS_Drawer::DrawHiddenLine () const -{return myLink->DrawHiddenLine();} - -Handle (Prs3d_LineAspect) AIS_Drawer::HiddenLineAspect () -{return myHiddenLineAspect.IsNull()? myLink->HiddenLineAspect () : myHiddenLineAspect;} - -Handle (Prs3d_LineAspect) AIS_Drawer::SeenLineAspect () -{ return mySeenLineAspect.IsNull() ? myLink->SeenLineAspect (): mySeenLineAspect ;} - -Handle (Prs3d_LineAspect) AIS_Drawer::VectorAspect () -{return myVectorAspect.IsNull()? myLink->VectorAspect () : myVectorAspect;} - -Handle (Prs3d_DatumAspect) AIS_Drawer::DatumAspect () -{return myDatumAspect.IsNull()? myLink->DatumAspect () : myDatumAspect; } - -Handle (Prs3d_PlaneAspect) AIS_Drawer::PlaneAspect () -{return myPlaneAspect.IsNull() ? myLink->PlaneAspect (): myPlaneAspect;} - -// ======================================================================= -// function : DimensionAspect -// purpose : -// ======================================================================= -Handle (Prs3d_DimensionAspect) AIS_Drawer::DimensionAspect() -{ - return myDimensionAspect.IsNull()? myLink->DimensionAspect () : myDimensionAspect; -} - -// ======================================================================= -// function : DimAngleModelUnits -// purpose : -// ======================================================================= -const TCollection_AsciiString& AIS_Drawer::DimAngleModelUnits() const -{ - return myHasOwnDimAngleModelUnits - ? Prs3d_Drawer::DimAngleModelUnits() - : myLink->DimAngleModelUnits(); -} - -// ======================================================================= -// function : DimensionModelUnits -// purpose : -// ======================================================================= -const TCollection_AsciiString& AIS_Drawer::DimLengthModelUnits() const -{ - return myHasOwnDimLengthModelUnits - ? Prs3d_Drawer::DimLengthModelUnits() - : myLink->DimLengthModelUnits(); -} -// ======================================================================= -// function : SetDimLengthModelUnits -// purpose : -// ======================================================================= -void AIS_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits) -{ - myHasOwnDimLengthModelUnits = Standard_True; - Prs3d_Drawer::SetDimLengthModelUnits (theUnits); -} - -// ======================================================================= -// function : SetDimAngleModelUnits -// purpose : -// ======================================================================= -void AIS_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits) -{ - myHasOwnDimAngleModelUnits = Standard_True; - Prs3d_Drawer::SetDimAngleModelUnits (theUnits); -} - -// ======================================================================= -// function : DimAngleDisplayUnits -// purpose : -// ======================================================================= -const TCollection_AsciiString& AIS_Drawer::DimAngleDisplayUnits() const -{ - return myHasOwnDimAngleDisplayUnits - ? Prs3d_Drawer::DimAngleDisplayUnits() - : myLink->DimAngleDisplayUnits(); -} - -// ======================================================================= -// function : DimLengthDisplayUnits -// purpose : -// ======================================================================= -const TCollection_AsciiString& AIS_Drawer::DimLengthDisplayUnits() const -{ - return myHasOwnDimLengthDisplayUnits - ? Prs3d_Drawer::DimLengthDisplayUnits() - : myLink->DimLengthDisplayUnits(); -} - -// ======================================================================= -// function : SetDimLengthDisplayUnits -// purpose : -// ======================================================================= -void AIS_Drawer::SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits) -{ - myHasOwnDimLengthDisplayUnits = Standard_True; - Prs3d_Drawer::SetDimLengthDisplayUnits (theUnits); -} - -// ======================================================================= -// function : SetDimAngleDisplayUnits -// purpose : -// ======================================================================= -void AIS_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits) -{ - myHasOwnDimAngleDisplayUnits = Standard_True; - Prs3d_Drawer::SetDimAngleDisplayUnits (theUnits); -} - -Handle (Prs3d_LineAspect) AIS_Drawer::SectionAspect () -{return mySectionAspect.IsNull()? myLink->SectionAspect (): mySectionAspect;} - -const Handle (Prs3d_Drawer)& AIS_Drawer::Link() -{ - if(myLink.IsNull()) myLink = new Prs3d_Drawer(); - return myLink; - } - -void AIS_Drawer::ClearLocalAttributes() -{ - if(myLink.IsNull()) return; -// attention pas beau.... -// The Handles - - if(!myUIsoAspect.IsNull()) myUIsoAspect.Nullify(); - if(!myVIsoAspect.IsNull()) myVIsoAspect.Nullify(); - if(!myFreeBoundaryAspect.IsNull()) myFreeBoundaryAspect.Nullify(); - if(!myUnFreeBoundaryAspect.IsNull()) myUnFreeBoundaryAspect.Nullify(); - if(!myWireAspect.IsNull()) myWireAspect.Nullify(); - if(!myLineAspect.IsNull()) myLineAspect.Nullify(); - if(!myTextAspect.IsNull()) myTextAspect.Nullify(); - if(!myShadingAspect.IsNull()) myShadingAspect.Nullify(); - if(!myPointAspect.IsNull()) myPointAspect.Nullify(); - if(!myPlaneAspect.IsNull()) myPlaneAspect.Nullify(); - if(!myArrowAspect.IsNull()) myArrowAspect.Nullify(); - if(!myHiddenLineAspect.IsNull()) myHiddenLineAspect.Nullify(); - if(!mySeenLineAspect.IsNull()) mySeenLineAspect.Nullify(); - if(!myVectorAspect.IsNull()) myVectorAspect .Nullify(); - if(!myDatumAspect.IsNull()) myDatumAspect.Nullify(); - if(!myDimensionAspect.IsNull()) myDimensionAspect.Nullify(); - if(!mySectionAspect.IsNull()) mySectionAspect.Nullify(); - if( myhasOwnHLRDeviationCoefficient ) myhasOwnHLRDeviationCoefficient = Standard_False; - if(myhasOwnHLRDeviationAngle ) myhasOwnHLRDeviationAngle = Standard_False; - if (!myFaceBoundaryAspect.IsNull()) myFaceBoundaryAspect.Nullify(); - - myHasOwnFaceBoundaryDraw = Standard_False; - myHasOwnDimLengthModelUnits = Standard_False; - myHasOwnDimLengthDisplayUnits = Standard_False; - myHasOwnDimAngleModelUnits = Standard_False; - myHasOwnDimAngleDisplayUnits = Standard_False; - - hasLocalAttributes = Standard_False; - -} - -// ======================================================================= -// function : SetFaceBoundaryDraw -// purpose : -// ======================================================================= -void AIS_Drawer::SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled) -{ - myHasOwnFaceBoundaryDraw = Standard_True; - myFaceBoundaryDraw = theIsEnabled; -} - -// ======================================================================= -// function : IsFaceBoundaryDraw -// purpose : -// ======================================================================= -Standard_Boolean AIS_Drawer::IsFaceBoundaryDraw() const -{ - if (!IsOwnFaceBoundaryDraw ()) - { - return myLink->IsFaceBoundaryDraw (); - } - - return myFaceBoundaryDraw; -} - -// ======================================================================= -// function : SetFaceBoundaryAspect -// purpose : -// ======================================================================= -void AIS_Drawer::SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) -{ - myFaceBoundaryAspect = theAspect; -} - -// ======================================================================= -// function : FaceBoundaryAspect -// purpose : -// ======================================================================= -Handle(Prs3d_LineAspect) AIS_Drawer::FaceBoundaryAspect() -{ - if (!IsOwnFaceBoundaryAspect ()) - { - return myLink->FaceBoundaryAspect (); - } - - return myFaceBoundaryAspect; -} diff --git a/src/AIS/AIS_Drawer.lxx b/src/AIS/AIS_Drawer.lxx deleted file mode 100644 index 84643f6ae6..0000000000 --- a/src/AIS/AIS_Drawer.lxx +++ /dev/null @@ -1,180 +0,0 @@ -// Created on: 1996-12-19 -// Created by: Robert COUBLANC -// Copyright (c) 1996-1999 Matra Datavision -// Copyright (c) 1999-2014 OPEN CASCADE SAS -// -// This file is part of Open CASCADE Technology software library. -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License version 2.1 as published -// by the Free Software Foundation, with special exception defined in the file -// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT -// distribution for complete text of the license and disclaimer of any warranty. -// -// Alternatively, this file may be used under the terms of Open CASCADE -// commercial license or contractual agreement. - -inline Standard_Boolean AIS_Drawer::WasLastLocal() const -{ - return Standard_False; -} - -inline Standard_Boolean AIS_Drawer::HasLocalAttributes() const -{ - return hasLocalAttributes; -} - -inline Standard_Real AIS_Drawer::PreviousDeviationCoefficient() const -{ - return myhasOwnDeviationCoefficient ? myPreviousDeviationCoefficient : 0.0; -} - -inline Standard_Real AIS_Drawer::PreviousHLRDeviationCoefficient() const -{ - return myhasOwnHLRDeviationCoefficient ? myPreviousHLRDeviationCoefficient : 0.0; -} - -inline Standard_Real AIS_Drawer::PreviousDeviationAngle() const -{ - return myhasOwnDeviationAngle ? myPreviousDeviationAngle : 0.0; -} - -inline Standard_Real AIS_Drawer::PreviousHLRDeviationAngle() const -{ - return myhasOwnHLRDeviationAngle ? myPreviousHLRDeviationAngle : 0.0; -} - -inline void AIS_Drawer::Link (const Handle(Prs3d_Drawer)& theDrawer) -{ - myLink = theDrawer; -} - -inline Standard_Boolean AIS_Drawer::HasLink() const -{ - return !myLink.IsNull(); -} - -inline void AIS_Drawer::SetDeviationCoefficient() -{ - myhasOwnDeviationCoefficient = Standard_False; -} - -inline void AIS_Drawer::SetHLRDeviationCoefficient() -{ - myhasOwnHLRDeviationCoefficient = Standard_False; -} - -inline void AIS_Drawer::SetDeviationAngle() -{ - myhasOwnDeviationAngle = Standard_False; -} - -inline void AIS_Drawer::SetHLRAngle() -{ - myhasOwnHLRDeviationAngle = Standard_False; -} - -inline Standard_Boolean AIS_Drawer::IsOwnDeviationCoefficient() const -{ - return myhasOwnDeviationCoefficient; -} - -inline Standard_Boolean AIS_Drawer::IsOwnDeviationAngle() const -{ - return myhasOwnDeviationAngle; -} - -inline Standard_Boolean AIS_Drawer::IsOwnHLRDeviationCoefficient() const -{ - return myhasOwnHLRDeviationCoefficient; -} - -inline Standard_Boolean AIS_Drawer::IsOwnHLRDeviationAngle() const -{ - return myhasOwnHLRDeviationAngle; -} - -inline Standard_Boolean AIS_Drawer::HasTextAspect() const -{ - return !myTextAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::HasWireAspect() const -{ - return !myWireAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::HasLineAspect() const -{ - return !myLineAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::HasShadingAspect() const -{ - return !myShadingAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::HasPointAspect() const -{ - return !myPointAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::IsOwnVertexDrawMode() const -{ - return (myVertexDrawMode != Prs3d_VDM_Inherited); -} - -inline Standard_Boolean AIS_Drawer::HasDatumAspect() const -{ - return !myDatumAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::HasPlaneAspect() const -{ - return !myPlaneAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::HasUIsoAspect() const -{ - return !myUIsoAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::HasVIsoAspect() const -{ - return !myVIsoAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::HasFreeBoundaryAspect() const -{ - return !myFreeBoundaryAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::HasUnFreeBoundaryAspect() const -{ - return !myUnFreeBoundaryAspect.IsNull(); -} - -inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryDraw() const -{ - return myHasOwnFaceBoundaryDraw; -} - -inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryAspect() const -{ - return !myFaceBoundaryAspect.IsNull(); -} - -inline void AIS_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR) -{ - myTypeOfHLR = theTypeOfHLR; -} - -inline Prs3d_TypeOfHLR AIS_Drawer::TypeOfHLR() const -{ - return (myTypeOfHLR == Prs3d_TOH_NotSet) ? myLink->TypeOfHLR() : myTypeOfHLR; -} - -inline Standard_Boolean AIS_Drawer::HasDimensionAspect() const -{ - return !myDimensionAspect.IsNull(); -} diff --git a/src/AIS/AIS_EqualDistanceRelation.cdl b/src/AIS/AIS_EqualDistanceRelation.cdl index 823aa8cd75..fe9a1cb1d0 100644 --- a/src/AIS/AIS_EqualDistanceRelation.cdl +++ b/src/AIS/AIS_EqualDistanceRelation.cdl @@ -26,12 +26,12 @@ uses Shape from TopoDS, Plane from Geom, PresentationManager3d from PrsMgr, + Drawer from Prs3d, Presentation from Prs3d, Projector from Prs3d, Transformation from Geom, Selection from SelectMgr, Pnt from gp, - Drawer from AIS, ExtendedString from TCollection, Edge from TopoDS, Vertex from TopoDS, @@ -118,7 +118,7 @@ is -- ota -- begin ComputeTwoEdgesLength (myclass; aPresentation : Presentation from Prs3d; - aDrawer : Drawer from AIS; + aDrawer : Drawer from Prs3d; ArrowSize : Real from Standard; FirstEdge : Edge from TopoDS; SecondEdge : Edge from TopoDS; @@ -138,7 +138,7 @@ is ComputeTwoVerticesLength(myclass; aPresentation : Presentation from Prs3d; - aDrawer : Drawer from AIS; + aDrawer : Drawer from Prs3d; ArrowSize : Real from Standard; FirstVertex : Vertex from TopoDS; SecondVertex : Vertex from TopoDS; @@ -158,7 +158,7 @@ is ComputeOneEdgeOneVertexLength(myclass; aPresentation : Presentation from Prs3d; - aDrawer : Drawer from AIS; + aDrawer : Drawer from Prs3d; ArrowSize : Real from Standard; FirstShape : Shape from TopoDS; SecondShape : Shape from TopoDS; diff --git a/src/AIS/AIS_EqualDistanceRelation.cxx b/src/AIS/AIS_EqualDistanceRelation.cxx index 47767f66db..e4c7bcca51 100644 --- a/src/AIS/AIS_EqualDistanceRelation.cxx +++ b/src/AIS/AIS_EqualDistanceRelation.cxx @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include //======================================================================= //function : AIS_EqualDistanceRelation @@ -363,7 +363,7 @@ void AIS_EqualDistanceRelation::ComputeSelection( const Handle( SelectMgr_Select //purpose : //======================================================================= void AIS_EqualDistanceRelation::ComputeTwoEdgesLength( const Handle( Prs3d_Presentation )& aPresentation, - const Handle( AIS_Drawer )& aDrawer, + const Handle( Prs3d_Drawer )& aDrawer, const Standard_Real ArrowSize, const TopoDS_Edge & FirstEdge, const TopoDS_Edge & SecondEdge, @@ -591,7 +591,7 @@ void AIS_EqualDistanceRelation::ComputeTwoEdgesLength( const Handle( Prs3d_Prese //======================================================================= void AIS_EqualDistanceRelation::ComputeTwoVerticesLength( const Handle( Prs3d_Presentation )& aPresentation, - const Handle( AIS_Drawer )& aDrawer, + const Handle( Prs3d_Drawer )& aDrawer, const Standard_Real ArrowSize, const TopoDS_Vertex& FirstVertex, const TopoDS_Vertex& SecondVertex, @@ -682,7 +682,7 @@ void AIS_EqualDistanceRelation::ComputeTwoVerticesLength( const Handle( Prs3d_Pr //======================================================================= void AIS_EqualDistanceRelation::ComputeOneEdgeOneVertexLength( const Handle( Prs3d_Presentation )& aPresentation, - const Handle( AIS_Drawer )& aDrawer, + const Handle( Prs3d_Drawer )& aDrawer, const Standard_Real ArrowSize, const TopoDS_Shape & FirstShape, const TopoDS_Shape & SecondShape, diff --git a/src/AIS/AIS_EqualRadiusRelation.cxx b/src/AIS/AIS_EqualRadiusRelation.cxx index 0863d625a3..ff6e431237 100644 --- a/src/AIS/AIS_EqualRadiusRelation.cxx +++ b/src/AIS/AIS_EqualRadiusRelation.cxx @@ -32,7 +32,7 @@ #include #include #include -#include +#include //======================================================================= //function : AIS_EqualRadiusRelation diff --git a/src/AIS/AIS_IdenticRelation.cxx b/src/AIS/AIS_IdenticRelation.cxx index 2b6bb99b27..9947d35c4c 100644 --- a/src/AIS/AIS_IdenticRelation.cxx +++ b/src/AIS/AIS_IdenticRelation.cxx @@ -20,7 +20,6 @@ #include #include -#include #include diff --git a/src/AIS/AIS_InteractiveContext.cdl b/src/AIS/AIS_InteractiveContext.cdl index d8a5066d2d..a8ae057604 100644 --- a/src/AIS/AIS_InteractiveContext.cdl +++ b/src/AIS/AIS_InteractiveContext.cdl @@ -99,7 +99,6 @@ uses MapOfInteractive from AIS, InteractiveObject from AIS, DisplayMode from AIS, - Drawer from AIS, NameOfMaterial from Graphic3d, --NameOfPhysicalMaterial from Graphic3d, Filter from SelectMgr, @@ -607,7 +606,7 @@ is SetLocalAttributes(me : mutable; aniobj : InteractiveObject from AIS; - aDrawer : Drawer from AIS; + aDrawer : Drawer from Prs3d; updateviewer : Boolean from Standard = Standard_True); --- Purpose: -- Sets the attributes of the interactive object aniobj by @@ -946,7 +945,7 @@ is -- deviate from a tangent to a curve. If this limit is -- reached, a new triangle is begun. -- This deviation is absolute and is set through --- AIS_Drawer::SetMaximalChordialDeviation. The +-- Prs3d_Drawer::SetMaximalChordialDeviation. The -- default value is 0.001. -- In drawing shapes, however, you are allowed to ask -- for a relative deviation. This deviation will be: diff --git a/src/AIS/AIS_InteractiveContext.cxx b/src/AIS/AIS_InteractiveContext.cxx index f5a00cfb5c..ac165181bf 100644 --- a/src/AIS/AIS_InteractiveContext.cxx +++ b/src/AIS/AIS_InteractiveContext.cxx @@ -2131,7 +2131,7 @@ void AIS_InteractiveContext::SetSelectedAspect (const Handle(Prs3d_BasicAspect)& //purpose : //======================================================================= void AIS_InteractiveContext::SetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj, - const Handle(AIS_Drawer)& theDrawer, + const Handle(Prs3d_Drawer)& theDrawer, const Standard_Boolean theToUpdateViewer) { if (theIObj.IsNull()) diff --git a/src/AIS/AIS_InteractiveObject.cdl b/src/AIS/AIS_InteractiveObject.cdl index b3b43124f4..3bcaab262a 100644 --- a/src/AIS/AIS_InteractiveObject.cdl +++ b/src/AIS/AIS_InteractiveObject.cdl @@ -53,7 +53,6 @@ uses Box from Bnd, NameOfMaterial from Graphic3d, MaterialAspect from Graphic3d, - Drawer from AIS, PToContext from AIS, TypeOfPresentation3d from PrsMgr, InteractiveContext from AIS, @@ -485,16 +484,8 @@ is UnsetTransparency(me:mutable) is virtual; ---Purpose: Removes the transparency setting. The object is opaque by default. - - SetAttributes(me:mutable; aDrawer: Drawer from AIS) is virtual; - ---Purpose: Initializes the drawing tool aDrawer. - - Attributes(me) returns any Drawer from AIS; - ---C++: return const& - ---C++: inline - ---Purpose: Returns the attributes settings. - - UnsetAttributes(me:mutable) is virtual; + + UnsetAttributes(me:mutable) is redefined virtual; ---Purpose: Clears settings provided by the drawing tool aDrawer. ---Category: information about Prs to be recomputed @@ -597,7 +588,6 @@ fields -- The Information Fields - myDrawer : Drawer from AIS is protected ; myTransparency : Real from Standard is protected; myOwnColor : Color from Quantity is protected; myOwnMaterial : NameOfMaterial from Graphic3d is protected; diff --git a/src/AIS/AIS_InteractiveObject.cxx b/src/AIS/AIS_InteractiveObject.cxx index 89feda2e31..638729dc05 100644 --- a/src/AIS/AIS_InteractiveObject.cxx +++ b/src/AIS/AIS_InteractiveObject.cxx @@ -45,7 +45,6 @@ AIS_InteractiveObject:: AIS_InteractiveObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d): SelectMgr_SelectableObject(aTypeOfPresentation3d), -myDrawer(new AIS_Drawer()), myTransparency(0.), myOwnColor(Quantity_NOC_WHITE), myOwnMaterial(Graphic3d_NOM_DEFAULT), @@ -130,12 +129,6 @@ void AIS_InteractiveObject::SetContext(const Handle(AIS_InteractiveContext)& aCt myCTXPtr = aCtx.operator->(); if( aCtx.IsNull()) return; - if (myDrawer.IsNull()) { - myDrawer = new AIS_Drawer; -#ifdef OCCT_DEBUG - cout << "AIS_InteractiveObject::SetContext DRAWER NUL!" << endl; -#endif - } myDrawer->Link(aCtx->DefaultDrawer()); } @@ -285,15 +278,14 @@ void AIS_InteractiveObject::SetMaterial(const Graphic3d_NameOfMaterial aName) //void AIS_InteractiveObject::SetMaterial(const Graphic3d_NameOfPhysicalMaterial aName) { if( HasColor() || IsTransparent() || HasMaterial() ) - { - myDrawer->ShadingAspect()->SetMaterial(aName); - } - else - { - myDrawer->SetShadingAspect(new Prs3d_ShadingAspect()); - - myDrawer->ShadingAspect()->SetMaterial(aName); - } + { + myDrawer->ShadingAspect()->SetMaterial(aName); + } + else + { + myDrawer->SetShadingAspect(new Prs3d_ShadingAspect()); + myDrawer->ShadingAspect()->SetMaterial(aName); + } myOwnMaterial = aName; hasOwnMaterial = Standard_True; } @@ -304,17 +296,16 @@ void AIS_InteractiveObject::SetMaterial(const Graphic3d_NameOfMaterial aName) void AIS_InteractiveObject::SetMaterial(const Graphic3d_MaterialAspect& aMat) { - if( HasColor() || IsTransparent() || HasMaterial() ) - { - myDrawer->ShadingAspect()->SetMaterial(aMat); - } - else - { - myDrawer->SetShadingAspect(new Prs3d_ShadingAspect()); - myDrawer->ShadingAspect()->SetMaterial(aMat); - } + if (HasColor() || IsTransparent() || HasMaterial()) + { + myDrawer->ShadingAspect()->SetMaterial(aMat); + } + else + { + myDrawer->SetShadingAspect(new Prs3d_ShadingAspect()); + myDrawer->ShadingAspect()->SetMaterial(aMat); + } hasOwnMaterial = Standard_True; - } //======================================================================= //function : @@ -323,11 +314,14 @@ void AIS_InteractiveObject::SetMaterial(const Graphic3d_MaterialAspect& aMat) void AIS_InteractiveObject::UnsetMaterial() { if( !HasMaterial() ) return; - if( HasColor() || IsTransparent()) { - myDrawer->ShadingAspect()->SetMaterial( - AIS_GraphicTool::GetMaterial(myDrawer->Link())); - if( HasColor() ) SetColor(myOwnColor); - if( IsTransparent() ) SetTransparency(myTransparency); + if (HasColor() || IsTransparent()) + { + if(myDrawer->HasLink()) + { + myDrawer->ShadingAspect()->SetMaterial (AIS_GraphicTool::GetMaterial (myDrawer->Link())); + } + if (HasColor()) SetColor (myOwnColor); + if (IsTransparent()) SetTransparency (myTransparency); } else{ Handle(Prs3d_ShadingAspect) SA; @@ -342,12 +336,11 @@ void AIS_InteractiveObject::UnsetMaterial() //======================================================================= void AIS_InteractiveObject::SetTransparency(const Standard_Real aValue) { - - - if(!HasColor() && !IsTransparent() && !HasMaterial() ) { - myDrawer->SetShadingAspect(new Prs3d_ShadingAspect()); - if(!myDrawer->Link().IsNull()) - myDrawer->ShadingAspect()->SetMaterial(AIS_GraphicTool::GetMaterial(myDrawer->Link())); + if(!HasColor() && !IsTransparent() && !HasMaterial()) + { + myDrawer->SetShadingAspect(new Prs3d_ShadingAspect()); + if(myDrawer->HasLink()) + myDrawer->ShadingAspect()->SetMaterial(AIS_GraphicTool::GetMaterial(myDrawer->Link())); } Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial(); Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial(); @@ -363,14 +356,14 @@ void AIS_InteractiveObject::SetTransparency(const Standard_Real aValue) //======================================================================= void AIS_InteractiveObject::UnsetTransparency() { - if(HasColor() || HasMaterial() ) - { - Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial(); - Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial(); - FMat.SetTransparency(0.); BMat.SetTransparency(0.); - myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat); - myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat); - } + if(HasColor() || HasMaterial() ) + { + Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial(); + Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial(); + FMat.SetTransparency(0.); BMat.SetTransparency(0.); + myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat); + myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat); + } else{ Handle (Prs3d_ShadingAspect) SA; myDrawer->SetShadingAspect(SA); @@ -388,25 +381,14 @@ Standard_Real AIS_InteractiveObject::Transparency() const // return Mat.Transparency(); } -//======================================================================= -//function : SetAttributes -//purpose : -//======================================================================= - -void AIS_InteractiveObject::SetAttributes(const Handle(AIS_Drawer)& aDrawer) -{myDrawer = aDrawer;} - - //======================================================================= //function : UnsetAttributes //purpose : //======================================================================= void AIS_InteractiveObject::UnsetAttributes() { - Handle(AIS_Drawer) dr = new AIS_Drawer(); - if(myDrawer->HasLink()) - dr->Link(myDrawer->Link()); - myDrawer = dr; + SelectMgr_SelectableObject::UnsetAttributes(); + hasOwnColor = Standard_False; hasOwnMaterial = Standard_False; myOwnWidth = 0.0; @@ -588,7 +570,7 @@ void AIS_InteractiveObject::SetPolygonOffsets(const Standard_Integer aMode, Standard_Boolean AIS_InteractiveObject::HasPolygonOffsets() const { return !( myDrawer->ShadingAspect().IsNull() || - ( !myDrawer->Link().IsNull() && + ( myDrawer->HasLink() && myDrawer->ShadingAspect() == myDrawer->Link()->ShadingAspect() ) ); } diff --git a/src/AIS/AIS_InteractiveObject.lxx b/src/AIS/AIS_InteractiveObject.lxx index fd60459e0b..0f91cefdb4 100644 --- a/src/AIS/AIS_InteractiveObject.lxx +++ b/src/AIS/AIS_InteractiveObject.lxx @@ -78,10 +78,6 @@ inline Graphic3d_NameOfMaterial AIS_InteractiveObject::Material() const //inline Graphic3d_NameOfPhysicalMaterial AIS_InteractiveObject::Material() const {return myOwnMaterial;} -inline const Handle(AIS_Drawer)& -AIS_InteractiveObject::Attributes() const -{return myDrawer;} - inline Standard_Boolean AIS_InteractiveObject::HasHilightMode() const {return myHilightMode!=-1;} diff --git a/src/AIS/AIS_LengthDimension.hxx b/src/AIS/AIS_LengthDimension.hxx index c4c87857a3..281d62869c 100755 --- a/src/AIS/AIS_LengthDimension.hxx +++ b/src/AIS/AIS_LengthDimension.hxx @@ -16,13 +16,13 @@ #include #include -#include #include #include #include #include #include #include +#include #include #include #include @@ -44,7 +44,6 @@ class Prs3d_Presentation; class Prs3d_Projector; class Geom_Transformation; class SelectMgr_Selection; -class AIS_Drawer; class Bnd_Box; class gp_Dir; class TopoDS_Vertex; diff --git a/src/AIS/AIS_Line.cxx b/src/AIS/AIS_Line.cxx index f37626a226..08e5a03907 100644 --- a/src/AIS/AIS_Line.cxx +++ b/src/AIS/AIS_Line.cxx @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -167,9 +166,10 @@ void AIS_Line::SetColor(const Quantity_Color &aCol) myOwnColor=aCol; Standard_Real WW = HasWidth()? myOwnWidth: - AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line); + myDrawer->HasLink() ? + AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.; - if (!myDrawer->HasLineAspect ()) + if (!myDrawer->HasOwnLineAspect ()) myDrawer->SetLineAspect (new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW)); else myDrawer->LineAspect()->SetColor(aCol); @@ -188,9 +188,9 @@ void AIS_Line::UnsetColor() if (!HasWidth()) myDrawer->SetLineAspect(NullAsp); else{ - Quantity_Color CC; + Quantity_Color CC = Quantity_NOC_YELLOW; if( HasColor() ) CC = myOwnColor; - else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC); + else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC); myDrawer->LineAspect()->SetColor(CC); myOwnColor = CC; } @@ -204,11 +204,11 @@ void AIS_Line::SetWidth(const Standard_Real aValue) { myOwnWidth=aValue; - if (!myDrawer->HasLineAspect ()) { - Quantity_Color CC; + if (!myDrawer->HasOwnLineAspect ()) { + Quantity_Color CC = Quantity_NOC_YELLOW; if( HasColor() ) CC = myOwnColor; - else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC); - myDrawer->SetLineAspect (new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,aValue)); + else if(myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC); + myDrawer->SetLineAspect (new Prs3d_LineAspect (CC, Aspect_TOL_SOLID, aValue)); } else myDrawer->LineAspect()->SetWidth(aValue); } @@ -224,7 +224,8 @@ void AIS_Line::UnsetWidth() if (!HasColor()) myDrawer->SetLineAspect(NullAsp); else{ - Standard_Real WW = AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line); + Standard_Real WW = myDrawer->HasLink() ? + AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.; myDrawer->LineAspect()->SetWidth(WW); myOwnWidth = WW; } diff --git a/src/AIS/AIS_MaxRadiusDimension.cxx b/src/AIS/AIS_MaxRadiusDimension.cxx index adfc048b77..6ef3c3a205 100644 --- a/src/AIS/AIS_MaxRadiusDimension.cxx +++ b/src/AIS/AIS_MaxRadiusDimension.cxx @@ -56,7 +56,6 @@ #include #include -#include #include #include diff --git a/src/AIS/AIS_MidPointRelation.cxx b/src/AIS/AIS_MidPointRelation.cxx index be2f5440bb..8ec70b4e01 100644 --- a/src/AIS/AIS_MidPointRelation.cxx +++ b/src/AIS/AIS_MidPointRelation.cxx @@ -20,7 +20,6 @@ #include #include -#include #include #include diff --git a/src/AIS/AIS_MinRadiusDimension.cxx b/src/AIS/AIS_MinRadiusDimension.cxx index b03868c113..39f8426cc3 100644 --- a/src/AIS/AIS_MinRadiusDimension.cxx +++ b/src/AIS/AIS_MinRadiusDimension.cxx @@ -57,7 +57,6 @@ #include #include -#include #include #include diff --git a/src/AIS/AIS_OffsetDimension.cxx b/src/AIS/AIS_OffsetDimension.cxx index 99fc454adb..a799327d71 100644 --- a/src/AIS/AIS_OffsetDimension.cxx +++ b/src/AIS/AIS_OffsetDimension.cxx @@ -19,7 +19,6 @@ #include #include -#include #include #include #include diff --git a/src/AIS/AIS_ParallelRelation.cxx b/src/AIS/AIS_ParallelRelation.cxx index f5b00710bc..7b47bb2f51 100644 --- a/src/AIS/AIS_ParallelRelation.cxx +++ b/src/AIS/AIS_ParallelRelation.cxx @@ -31,7 +31,6 @@ #include #include -#include #include #include diff --git a/src/AIS/AIS_Plane.cxx b/src/AIS/AIS_Plane.cxx index 8d4bba6983..a72c8f2570 100644 --- a/src/AIS/AIS_Plane.cxx +++ b/src/AIS/AIS_Plane.cxx @@ -53,8 +53,6 @@ #include -#include - #include //======================================================================= @@ -375,10 +373,10 @@ void AIS_Plane::SetSize(const Standard_Real aXLength, DA = myDrawer->DatumAspect(); Standard_Boolean yenavaitPA(Standard_True),yenavaitDA(Standard_True); - if(myDrawer->Link()->PlaneAspect() == PA){ + if(myDrawer->HasLink() && myDrawer->Link()->PlaneAspect() == PA){ yenavaitPA = Standard_False; PA = new Prs3d_PlaneAspect();} - if(myDrawer->Link()->DatumAspect() == DA){ + if(myDrawer->HasLink() && myDrawer->Link()->DatumAspect() == DA){ yenavaitDA = Standard_False; DA = new Prs3d_DatumAspect(); } @@ -406,13 +404,16 @@ void AIS_Plane::UnsetSize() { if(!myHasOwnSize) return; - if(!hasOwnColor){ - myDrawer->PlaneAspect().Nullify(); - myDrawer->DatumAspect().Nullify(); + if(!hasOwnColor) + { + myDrawer->SetPlaneAspect (Handle(Prs3d_PlaneAspect)()); + myDrawer->SetDatumAspect (Handle(Prs3d_DatumAspect)()); } else{ - const Handle(Prs3d_PlaneAspect)& PA = myDrawer->Link()->PlaneAspect(); - const Handle(Prs3d_DatumAspect)& DA = myDrawer->Link()->DatumAspect(); + const Handle(Prs3d_PlaneAspect) PA = myDrawer->HasLink() ? myDrawer->Link()->PlaneAspect() : + new Prs3d_PlaneAspect(); + const Handle(Prs3d_DatumAspect) DA = myDrawer->HasLink() ? myDrawer->Link()->DatumAspect() : + new Prs3d_DatumAspect(); myDrawer->PlaneAspect()->SetPlaneLength(PA->PlaneXLength(),PA->PlaneYLength()); myDrawer->DatumAspect()->SetAxisLength(DA->FirstAxisLength(), @@ -461,10 +462,10 @@ void AIS_Plane::SetColor(const Quantity_Color &aCol) DA = myDrawer->DatumAspect(); Standard_Boolean yenavaitPA(Standard_True),yenavaitDA(Standard_True); - if(myDrawer->Link()->PlaneAspect() == PA){ + if(myDrawer->HasLink() && myDrawer->Link()->PlaneAspect() == PA){ yenavaitPA = Standard_False; PA = new Prs3d_PlaneAspect();} - if(myDrawer->Link()->DatumAspect() == DA){ + if(myDrawer->HasLink() && myDrawer->Link()->DatumAspect() == DA){ yenavaitDA = Standard_False; DA = new Prs3d_DatumAspect(); } @@ -491,12 +492,14 @@ void AIS_Plane::SetColor(const Quantity_Color &aCol) void AIS_Plane::UnsetColor() { if(!hasOwnColor) return; - if(!myHasOwnSize){ - myDrawer->PlaneAspect().Nullify(); - myDrawer->DatumAspect().Nullify(); + if(!myHasOwnSize) + { + myDrawer->SetPlaneAspect (Handle(Prs3d_PlaneAspect)()); + myDrawer->SetDatumAspect (Handle(Prs3d_DatumAspect)()); } else{ - const Handle(Prs3d_PlaneAspect)& PA = myDrawer->Link()->PlaneAspect(); + const Handle(Prs3d_PlaneAspect) PA = myDrawer->HasLink() ? myDrawer->Link()->PlaneAspect() : + new Prs3d_PlaneAspect(); // const Handle(Prs3d_DatumAspect)& DA = myDrawer->Link()->DatumAspect(); Quantity_Color C;Aspect_TypeOfLine T;Standard_Real W; PA->EdgesAspect()->Aspect()->Values(C,T,W); diff --git a/src/AIS/AIS_PlaneTrihedron.cxx b/src/AIS/AIS_PlaneTrihedron.cxx index c1b8aa3497..dfc50e87e3 100644 --- a/src/AIS/AIS_PlaneTrihedron.cxx +++ b/src/AIS/AIS_PlaneTrihedron.cxx @@ -43,7 +43,6 @@ #include #include #include -#include #include #include diff --git a/src/AIS/AIS_Point.cxx b/src/AIS/AIS_Point.cxx index a808066fc3..64f0a42b18 100644 --- a/src/AIS/AIS_Point.cxx +++ b/src/AIS/AIS_Point.cxx @@ -29,7 +29,6 @@ #include #include #include -#include #include //======================================================================= @@ -209,8 +208,9 @@ AcceptDisplayMode(const Standard_Integer aMode) const void AIS_Point::UpdatePointValues() { - if(!hasOwnColor && myOwnWidth==0.0 && !myHasTOM){ - myDrawer->PointAspect().Nullify(); + if(!hasOwnColor && myOwnWidth==0.0 && !myHasTOM) + { + myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)()); return; } Quantity_Color aCol; @@ -232,7 +232,7 @@ void AIS_Point::UpdatePointValues() if(myHasTOM) aTOM = myTOM; - if(myDrawer->HasPointAspect()){ + if(myDrawer->HasOwnPointAspect()){ // CLE // const Handle(Prs3d_PointAspect) PA = myDrawer->PointAspect(); Handle(Prs3d_PointAspect) PA = myDrawer->PointAspect(); diff --git a/src/AIS/AIS_PointCloud.cxx b/src/AIS/AIS_PointCloud.cxx index c9c588f426..8b91840245 100644 --- a/src/AIS/AIS_PointCloud.cxx +++ b/src/AIS/AIS_PointCloud.cxx @@ -15,11 +15,11 @@ #include -#include #include #include #include #include +#include #include #include #include @@ -153,15 +153,21 @@ void AIS_PointCloud::SetColor (const Quantity_Color& theColor) { AIS_InteractiveObject::SetColor(theColor); - if (!myDrawer->HasPointAspect()) + if (!myDrawer->HasOwnPointAspect()) { myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, theColor, 1.0)); - *myDrawer->PointAspect()->Aspect() = *myDrawer->Link()->PointAspect()->Aspect(); + if (myDrawer->HasLink()) + { + *myDrawer->PointAspect()->Aspect() = *myDrawer->Link()->PointAspect()->Aspect(); + } } - if (!myDrawer->HasShadingAspect()) + if (!myDrawer->HasOwnShadingAspect()) { myDrawer->SetShadingAspect (new Prs3d_ShadingAspect()); - *myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect(); + if (myDrawer->HasLink()) + { + *myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect(); + } } // Override color @@ -220,20 +226,32 @@ void AIS_PointCloud::UnsetColor() } else { - Quantity_Color aColor; + Quantity_Color aColor = Quantity_NOC_YELLOW; Aspect_TypeOfMarker aType = Aspect_TOM_POINT; Standard_Real aScale = 1.0; - myDrawer->Link()->PointAspect()->Aspect()->Values (aColor, aType, aScale); + if (myDrawer->HasLink()) + { + myDrawer->Link()->PointAspect()->Aspect()->Values (aColor, aType, aScale); + } myDrawer->PointAspect()->SetColor (aColor); } if (HasMaterial() || IsTransparent()) { - Graphic3d_MaterialAspect aMat = AIS_GraphicTool::GetMaterial (HasMaterial() ? myDrawer : myDrawer->Link()); + Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS); + Graphic3d_MaterialAspect aMat = aDefaultMat; + if (HasMaterial() || myDrawer->HasLink()) + { + aMat = AIS_GraphicTool::GetMaterial (HasMaterial() ? myDrawer : myDrawer->Link()); + } if (HasMaterial()) { - Quantity_Color aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel); + Quantity_Color aColor = aDefaultMat.AmbientColor(); + if (myDrawer->HasLink()) + { + aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel); + } aMat.SetColor (aColor); } if (IsTransparent()) @@ -298,10 +316,13 @@ void AIS_PointCloud::SetMaterial (const Graphic3d_NameOfMaterial theMatName) //======================================================================= void AIS_PointCloud::SetMaterial (const Graphic3d_MaterialAspect& theMat) { - if (!myDrawer->HasShadingAspect()) + if (!myDrawer->HasOwnShadingAspect()) { myDrawer->SetShadingAspect (new Prs3d_ShadingAspect()); - *myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect(); + if (myDrawer->HasLink()) + { + *myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect(); + } } hasOwnMaterial = Standard_True; @@ -350,7 +371,10 @@ void AIS_PointCloud::UnsetMaterial() if (HasColor() || IsTransparent()) { - myDrawer->ShadingAspect()->SetMaterial (myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel), + Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS); + myDrawer->ShadingAspect()->SetMaterial (myDrawer->HasLink() ? + myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel) : + aDefaultMat, myCurrentFacingModel); if (HasColor()) { @@ -408,7 +432,7 @@ void AIS_PointCloud::Compute (const Handle(PrsMgr_PresentationManager3d)& /*theP } Handle(Graphic3d_AspectMarker3d) aMarkerAspect = myDrawer->PointAspect()->Aspect(); - if (!myDrawer->HasPointAspect()) + if (!myDrawer->HasOwnPointAspect()) { aMarkerAspect->SetType (Aspect_TOM_POINT); } diff --git a/src/AIS/AIS_Relation.cxx b/src/AIS/AIS_Relation.cxx index 6c339af98f..c8185d0af8 100644 --- a/src/AIS/AIS_Relation.cxx +++ b/src/AIS/AIS_Relation.cxx @@ -19,7 +19,6 @@ #include -#include #include #include #include @@ -27,6 +26,7 @@ #include #include +#include #include #include #include @@ -81,7 +81,7 @@ void AIS_Relation::ComputeProjEdgePresentation(const Handle(Prs3d_Presentation)& const Aspect_TypeOfLine aProjTOL, const Aspect_TypeOfLine aCallTOL) const { - if (!myDrawer->HasWireAspect()){ + if (!myDrawer->HasOwnWireAspect()){ myDrawer->SetWireAspect(new Prs3d_LineAspect(aColor,aProjTOL,2.));} else { const Handle(Prs3d_LineAspect)& li = myDrawer->WireAspect(); @@ -171,7 +171,7 @@ void AIS_Relation::ComputeProjVertexPresentation(const Handle(Prs3d_Presentation const Aspect_TypeOfMarker aProjTOM, const Aspect_TypeOfLine aCallTOL) const { - if (!myDrawer->HasPointAspect()){ + if (!myDrawer->HasOwnPointAspect()){ myDrawer->SetPointAspect(new Prs3d_PointAspect(aProjTOM, aColor,1));} else { const Handle(Prs3d_PointAspect)& pa = myDrawer->PointAspect(); @@ -182,7 +182,7 @@ void AIS_Relation::ComputeProjVertexPresentation(const Handle(Prs3d_Presentation // calcul du projete StdPrs_Point::Add(aPrs, new Geom_CartesianPoint(ProjPoint), myDrawer); - if (!myDrawer->HasWireAspect()){ + if (!myDrawer->HasOwnWireAspect()){ myDrawer->SetWireAspect(new Prs3d_LineAspect(aColor,aCallTOL,2.));} else { const Handle(Prs3d_LineAspect)& li = myDrawer->WireAspect(); @@ -213,16 +213,17 @@ void AIS_Relation::SetColor(const Quantity_Color &aCol) { if(hasOwnColor && myOwnColor==aCol) return; - if (!myDrawer->HasTextAspect()) myDrawer->SetTextAspect(new Prs3d_TextAspect()); + if (!myDrawer->HasOwnTextAspect()) myDrawer->SetTextAspect(new Prs3d_TextAspect()); hasOwnColor=Standard_True; myOwnColor=aCol; myDrawer->TextAspect()->SetColor(aCol); - Standard_Real WW = HasWidth()? Width():AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line); - if (!myDrawer->HasLineAspect()) { + Standard_Real WW = HasWidth()? Width(): myDrawer->HasLink() ? + AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line) : 1.; + if (!myDrawer->HasOwnLineAspect()) { myDrawer->SetLineAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW)); } - if (!myDrawer->HasDimensionAspect()) { + if (!myDrawer->HasOwnDimensionAspect()) { myDrawer->SetDimensionAspect(new Prs3d_DimensionAspect); } @@ -244,11 +245,14 @@ void AIS_Relation::UnsetColor() if (!hasOwnColor) return; hasOwnColor = Standard_False; const Handle(Prs3d_LineAspect)& LA = myDrawer->LineAspect(); - Quantity_Color CC; - AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC); + Quantity_Color CC = Quantity_NOC_YELLOW; + if (myDrawer->HasLink()) + { + AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC); + myDrawer->SetTextAspect(myDrawer->Link()->TextAspect()); + } LA->SetColor(CC); myDrawer->DimensionAspect()->SetLineAspect(LA); - myDrawer->SetTextAspect(myDrawer->Link()->TextAspect()); } //======================================================================= diff --git a/src/AIS/AIS_Shape.cdl b/src/AIS/AIS_Shape.cdl index 81212e772c..030d1bd228 100644 --- a/src/AIS/AIS_Shape.cdl +++ b/src/AIS/AIS_Shape.cdl @@ -34,7 +34,7 @@ class Shape from AIS inherits InteractiveObject from AIS -- an inheriting shape class. These services allow you to -- select one type of shape interactive object for higher -- precision drawing. When you do this, the - -- AIS_Drawer::IsOwn... functions corresponding to the + -- Prs3d_Drawer::IsOwn... functions corresponding to the -- above deviation angle and coefficient functions return -- true indicating that there is a local setting available -- for the specific object. @@ -52,7 +52,6 @@ uses Projector from Prs3d, PresentationManager3d from PrsMgr, Selection from SelectMgr, - Drawer from AIS, KindOfInteractive from AIS, Transformation from Geom, Drawer from Prs3d, @@ -99,7 +98,7 @@ uses ---Purpose: Sets a local value for deviation coefficient for this specific shape. SetOwnHLRDeviationCoefficient(me: mutable; aCoefficient : Real from Standard) ; - ---Purpose: sets myOwnHLRDeviationCoefficient field in AIS_Drawer & + ---Purpose: sets myOwnHLRDeviationCoefficient field in Prs3d_Drawer & -- recomputes presentation SetAngleAndDeviation(me: mutable; anAngle: Real from Standard) ; @@ -110,7 +109,7 @@ uses ---Purpose: gives back the angle initial value put by the User. SetOwnDeviationAngle(me: mutable; anAngle: Real from Standard) ; - ---Purpose: sets myOwnDeviationAngle field in AIS_Drawer & recomputes presentation + ---Purpose: sets myOwnDeviationAngle field in Prs3d_Drawer & recomputes presentation SetHLRAngleAndDeviation(me: mutable; anAngle: Real from Standard) ; @@ -118,7 +117,7 @@ uses -- and set the values stored in myDrawer for with these that become local to the shape SetOwnHLRDeviationAngle(me: mutable; anAngle: Real from Standard) ; - ---Purpose: sets myOwnHLRDeviationAngle field in AIS_Drawer & recomputes presentation + ---Purpose: sets myOwnHLRDeviationAngle field in Prs3d_Drawer & recomputes presentation OwnDeviationCoefficient(me; aCoefficient : out Real from Standard ; @@ -194,16 +193,16 @@ uses ---Purpose: Sets the color aColor in the reconstructed -- compound shape. Acts via the Drawer methods below on the appearance of: -- - free boundaries: - -- AIS_Drawer_FreeBoundaryAspect, - -- - isos: AIS_Drawer_UIsoAspect, - -- AIS_Drawer_VIsoAspect, + -- Prs3d_Drawer_FreeBoundaryAspect, + -- - isos: Prs3d_Drawer_UIsoAspect, + -- Prs3dDrawer_VIsoAspect, -- - shared boundaries: - -- AIS_Drawer_UnFreeBoundaryAspect, - -- - shading: AIS_Drawer_ShadingAspect, + -- Prs3d_Drawer_UnFreeBoundaryAspect, + -- - shading: Prs3d_Drawer_ShadingAspect, -- - visible line color in hidden line mode: - -- AIS_Drawer_SeenLineAspect + -- Prs3d_Drawer_SeenLineAspect -- - hidden line color in hidden line mode: - -- AIS_Drawer_HiddenLineAspect. + -- Prs3d_Drawer_HiddenLineAspect. SetColor(me:mutable;aColor:Color from Quantity) is redefined virtual; @@ -283,22 +282,22 @@ uses ashape : Shape from TopoDS) is static private; setColor (me; - theDrawer : Drawer from AIS; + theDrawer : Drawer from Prs3d; theColor : Color from Quantity) is protected; setWidth (me; - theDrawer : Drawer from AIS; + theDrawer : Drawer from Prs3d; theWidth : Real from Standard) is protected; setTransparency (me; - theDrawer : Drawer from AIS; + theDrawer : Drawer from Prs3d; theValue : Real from Standard) is protected; setMaterial (me; - theDrawer : Drawer from AIS; + theDrawer : Drawer from Prs3d; theMaterial : MaterialAspect from Graphic3d; theToKeepColor : Boolean from Standard; theToKeepTransp : Boolean from Standard) diff --git a/src/AIS/AIS_Shape.cxx b/src/AIS/AIS_Shape.cxx index 34e819793b..668dfe3af4 100644 --- a/src/AIS/AIS_Shape.cxx +++ b/src/AIS/AIS_Shape.cxx @@ -66,7 +66,6 @@ #include #include -#include #include #include @@ -94,10 +93,9 @@ static Standard_Boolean IsInList(const TColStd_ListOfInteger& LL, const Standard AIS_Shape:: AIS_Shape(const TopoDS_Shape& shap): AIS_InteractiveObject(PrsMgr_TOP_ProjectorDependant), -myshape(shap), -myCompBB(Standard_True), myInitAng(0.) { + Set (shap); myFirstCompute = Standard_True; SetHilightMode(0); myDrawer->SetShadingAspectGlobal(Standard_False); @@ -254,7 +252,7 @@ void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector, } Handle (Prs3d_Drawer) defdrawer = GetContext()->DefaultDrawer(); - if (defdrawer->DrawHiddenLine()) + if (defdrawer->DrawHiddenLine()) {myDrawer->EnableDrawHiddenLine();} else {myDrawer->DisableDrawHiddenLine();} @@ -440,28 +438,40 @@ void AIS_Shape::SetColor(const Quantity_NameOfColor aCol) //purpose : //======================================================================= -void AIS_Shape::setColor (const Handle(AIS_Drawer)& theDrawer, - const Quantity_Color& theColor) const +void AIS_Shape::setColor (const Handle(Prs3d_Drawer)& theDrawer, + const Quantity_Color& theColor) const { - if (!theDrawer->HasShadingAspect()) + if (!theDrawer->HasOwnShadingAspect()) { theDrawer->SetShadingAspect (new Prs3d_ShadingAspect()); - *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect(); + } } - if (!theDrawer->HasLineAspect()) + if (!theDrawer->HasOwnLineAspect()) { theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); - *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect(); + } } - if (!theDrawer->HasWireAspect()) + if (!theDrawer->HasOwnWireAspect()) { theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); - *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect(); + } } - if (!theDrawer->HasPointAspect()) + if (!theDrawer->HasOwnPointAspect()) { theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_BLACK, 1.0)); - *theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect(); + } } // disable dedicated line aspects theDrawer->SetFreeBoundaryAspect (theDrawer->LineAspect()); @@ -559,26 +569,53 @@ void AIS_Shape::UnsetColor() } else { - Quantity_Color aColor; - AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, aColor); + Quantity_Color aColor = Quantity_NOC_YELLOW; + if (myDrawer->HasLink()) + { + AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, aColor); + } myDrawer->LineAspect()->SetColor (aColor); - AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Wire, aColor); + aColor = Quantity_NOC_RED; + if (myDrawer->HasLink()) + { + AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Wire, aColor); + } myDrawer->WireAspect()->SetColor (aColor); - AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Free, aColor); + aColor = Quantity_NOC_GREEN; + if (myDrawer->HasLink()) + { + AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Free, aColor); + } myDrawer->FreeBoundaryAspect()->SetColor (aColor); - AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_UnFree, aColor); + aColor = Quantity_NOC_YELLOW; + if (myDrawer->HasLink()) + { + AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_UnFree, aColor); + } myDrawer->UnFreeBoundaryAspect()->SetColor (aColor); - AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen, aColor); + if (myDrawer->HasLink()) + { + AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen, aColor); + } myDrawer->SeenLineAspect()->SetColor (aColor); } if (HasMaterial() || IsTransparent()) { - Graphic3d_MaterialAspect mat = AIS_GraphicTool::GetMaterial(HasMaterial()? myDrawer : myDrawer->Link()); + Graphic3d_MaterialAspect aDefaultMat (Graphic3d_NOM_BRASS); + Graphic3d_MaterialAspect mat = aDefaultMat; + if (HasMaterial() || myDrawer->HasLink()) + { + mat = AIS_GraphicTool::GetMaterial(HasMaterial()? myDrawer : myDrawer->Link()); + } if (HasMaterial()) { - Quantity_Color aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel); + Quantity_Color aColor = aDefaultMat.AmbientColor(); + if (myDrawer->HasLink()) + { + Quantity_Color aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel); + } mat.SetColor (aColor); } if (IsTransparent()) @@ -638,18 +675,24 @@ void AIS_Shape::UnsetColor() //purpose : //======================================================================= -void AIS_Shape::setWidth (const Handle(AIS_Drawer)& theDrawer, - const Standard_Real theLineWidth) const +void AIS_Shape::setWidth (const Handle(Prs3d_Drawer)& theDrawer, + const Standard_Real theLineWidth) const { - if (!theDrawer->HasLineAspect()) + if (!theDrawer->HasOwnLineAspect()) { theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); - *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect(); + } } - if (!theDrawer->HasWireAspect()) + if (!theDrawer->HasOwnWireAspect()) { theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); - *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect(); + } } // disable dedicated line aspects theDrawer->SetFreeBoundaryAspect (theDrawer->LineAspect()); @@ -701,11 +744,16 @@ void AIS_Shape::UnsetWidth() } else { - myDrawer->LineAspect() ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line)); - myDrawer->WireAspect() ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Wire)); - myDrawer->FreeBoundaryAspect() ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Free)); - myDrawer->UnFreeBoundaryAspect()->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_UnFree)); - myDrawer->SeenLineAspect() ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Seen)); + myDrawer->LineAspect() ->SetWidth (myDrawer->HasLink() ? + AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.); + myDrawer->WireAspect() ->SetWidth (myDrawer->HasLink() ? + AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Wire) : 1.); + myDrawer->FreeBoundaryAspect() ->SetWidth (myDrawer->HasLink() ? + AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Free) : 1.); + myDrawer->UnFreeBoundaryAspect()->SetWidth (myDrawer->HasLink() ? + AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_UnFree) : 1.); + myDrawer->SeenLineAspect() ->SetWidth (myDrawer->HasLink() ? + AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Seen) : 1.); } LoadRecomputable (AIS_WireFrame); } @@ -715,17 +763,20 @@ void AIS_Shape::UnsetWidth() //purpose : //======================================================================= -void AIS_Shape::setMaterial (const Handle(AIS_Drawer)& theDrawer, +void AIS_Shape::setMaterial (const Handle(Prs3d_Drawer)& theDrawer, const Graphic3d_MaterialAspect& theMaterial, const Standard_Boolean theToKeepColor, const Standard_Boolean theToKeepTransp) const { const Quantity_Color aColor = theDrawer->ShadingAspect()->Material (myCurrentFacingModel).Color(); const Standard_Real aTransp = theDrawer->ShadingAspect()->Transparency (myCurrentFacingModel); - if (!theDrawer->HasShadingAspect()) + if (!theDrawer->HasOwnShadingAspect()) { theDrawer->SetShadingAspect (new Prs3d_ShadingAspect()); - *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect(); + } } theDrawer->ShadingAspect()->SetMaterial (theMaterial, myCurrentFacingModel); @@ -805,8 +856,11 @@ void AIS_Shape::UnsetMaterial() if (HasColor() || IsTransparent()) { - myDrawer->ShadingAspect()->SetMaterial (myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel), - myCurrentFacingModel); + if(myDrawer->HasLink()) + { + myDrawer->ShadingAspect()->SetMaterial (myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel), + myCurrentFacingModel); + } if (HasColor()) { myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel); @@ -851,13 +905,16 @@ void AIS_Shape::UnsetMaterial() //purpose : //======================================================================= -void AIS_Shape::setTransparency (const Handle(AIS_Drawer)& theDrawer, - const Standard_Real theValue) const +void AIS_Shape::setTransparency (const Handle(Prs3d_Drawer)& theDrawer, + const Standard_Real theValue) const { - if (!theDrawer->HasShadingAspect()) + if (!theDrawer->HasOwnShadingAspect()) { theDrawer->SetShadingAspect (new Prs3d_ShadingAspect()); - *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect(); + } } // override transparency @@ -910,7 +967,7 @@ void AIS_Shape::SetTransparency (const Standard_Real theValue) void AIS_Shape::UnsetTransparency() { myTransparency = 0.0; - if (!myDrawer->HasShadingAspect()) + if (!myDrawer->HasOwnShadingAspect()) { return; } @@ -996,7 +1053,7 @@ const Bnd_Box& AIS_Shape::BoundingBox() Standard_Boolean AIS_Shape::SetOwnDeviationCoefficient () { - Standard_Boolean itSet = myDrawer->IsOwnDeviationCoefficient(); + Standard_Boolean itSet = myDrawer->HasOwnDeviationCoefficient(); if(itSet) myDrawer->SetDeviationCoefficient(); return itSet; } @@ -1009,7 +1066,7 @@ Standard_Boolean AIS_Shape::SetOwnDeviationCoefficient () Standard_Boolean AIS_Shape::SetOwnHLRDeviationCoefficient () { - Standard_Boolean itSet = myDrawer->IsOwnHLRDeviationCoefficient(); + Standard_Boolean itSet = myDrawer->HasOwnHLRDeviationCoefficient(); if(itSet) myDrawer->SetHLRDeviationCoefficient(); return itSet; @@ -1023,7 +1080,7 @@ Standard_Boolean AIS_Shape::SetOwnHLRDeviationCoefficient () Standard_Boolean AIS_Shape::SetOwnDeviationAngle () { - Standard_Boolean itSet = myDrawer->IsOwnDeviationAngle(); + Standard_Boolean itSet = myDrawer->HasOwnDeviationAngle(); if(itSet) myDrawer->SetDeviationAngle(); return itSet; @@ -1037,7 +1094,7 @@ Standard_Boolean AIS_Shape::SetOwnDeviationAngle () Standard_Boolean AIS_Shape::SetOwnHLRDeviationAngle () { - Standard_Boolean itSet = myDrawer->IsOwnHLRDeviationAngle(); + Standard_Boolean itSet = myDrawer->HasOwnHLRDeviationAngle(); if(itSet) myDrawer->SetHLRAngle(); return itSet; @@ -1138,7 +1195,7 @@ Standard_Boolean AIS_Shape::OwnDeviationCoefficient ( Standard_Real & aCoeffici { aCoefficient = myDrawer->DeviationCoefficient(); aPreviousCoefficient = myDrawer->PreviousDeviationCoefficient (); - return myDrawer->IsOwnDeviationCoefficient() ; + return myDrawer->HasOwnDeviationCoefficient() ; } //======================================================================= @@ -1151,7 +1208,7 @@ Standard_Boolean AIS_Shape::OwnHLRDeviationCoefficient ( Standard_Real & aCoeffi { aCoefficient = myDrawer->HLRDeviationCoefficient(); aPreviousCoefficient = myDrawer->PreviousHLRDeviationCoefficient (); - return myDrawer->IsOwnHLRDeviationCoefficient(); + return myDrawer->HasOwnHLRDeviationCoefficient(); } @@ -1165,7 +1222,7 @@ Standard_Boolean AIS_Shape::OwnDeviationAngle ( Standard_Real & anAngle, { anAngle = myDrawer->DeviationAngle(); aPreviousAngle = myDrawer->PreviousDeviationAngle (); - return myDrawer->IsOwnDeviationAngle(); + return myDrawer->HasOwnDeviationAngle(); } //======================================================================= @@ -1178,5 +1235,5 @@ Standard_Boolean AIS_Shape::OwnHLRDeviationAngle ( Standard_Real & anAngle, { anAngle = myDrawer->HLRAngle(); aPreviousAngle = myDrawer->PreviousHLRDeviationAngle (); - return myDrawer->IsOwnHLRDeviationAngle(); + return myDrawer->HasOwnHLRDeviationAngle(); } diff --git a/src/AIS/AIS_Shape.lxx b/src/AIS/AIS_Shape.lxx index ffe99e8bba..2837f1a966 100644 --- a/src/AIS/AIS_Shape.lxx +++ b/src/AIS/AIS_Shape.lxx @@ -14,7 +14,7 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include inline void AIS_Shape::Set(const TopoDS_Shape& ashap) { diff --git a/src/AIS/AIS_SymmetricRelation.cxx b/src/AIS/AIS_SymmetricRelation.cxx index 4d8b51fed9..dc822b5e52 100644 --- a/src/AIS/AIS_SymmetricRelation.cxx +++ b/src/AIS/AIS_SymmetricRelation.cxx @@ -18,7 +18,6 @@ #include #include -#include #include #include diff --git a/src/AIS/AIS_TexturedShape.cxx b/src/AIS/AIS_TexturedShape.cxx index 340df0eefd..ca9845c004 100644 --- a/src/AIS/AIS_TexturedShape.cxx +++ b/src/AIS/AIS_TexturedShape.cxx @@ -15,7 +15,6 @@ #include -#include #include #include #include @@ -25,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/src/AIS/AIS_Triangulation.cxx b/src/AIS/AIS_Triangulation.cxx index aa3c4d5431..f1abe2fd10 100644 --- a/src/AIS/AIS_Triangulation.cxx +++ b/src/AIS/AIS_Triangulation.cxx @@ -11,12 +11,12 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/AIS/AIS_Trihedron.cdl b/src/AIS/AIS_Trihedron.cdl index 3b3b1e14b1..149c659f34 100644 --- a/src/AIS/AIS_Trihedron.cdl +++ b/src/AIS/AIS_Trihedron.cdl @@ -32,7 +32,7 @@ class Trihedron from AIS inherits InteractiveObject from AIS -- dimensions, you must temporarily recover the Drawer. -- From inside it, you take the aspect in which the values -- for length are stocked. For trihedra, this is - -- AIS_Drawer_FirstAxisAspect. You change the + -- Prs3d_Drawer_FirstAxisAspect. You change the -- values inside this Aspect and recalculate the presentation. -- If you want to use extended selection modes, different than 0, -- you should take care of removing of the shapes from the interactive diff --git a/src/AIS/AIS_Trihedron.cxx b/src/AIS/AIS_Trihedron.cxx index 3fe1180f68..52f5630b3c 100644 --- a/src/AIS/AIS_Trihedron.cxx +++ b/src/AIS/AIS_Trihedron.cxx @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -118,7 +117,7 @@ void AIS_Trihedron::SetLocalTransformation (const gp_Trsf& theTransformation) void AIS_Trihedron::SetSize(const Standard_Real aValue) { myHasOwnSize = Standard_True; - if(!myDrawer->HasDatumAspect()){ + if(!myDrawer->HasOwnDatumAspect()){ Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect(); myDrawer->SetDatumAspect(DA); } @@ -146,13 +145,16 @@ void AIS_Trihedron::UnsetSize() myHasOwnSize = Standard_False; if(hasOwnColor){ - const Handle(Prs3d_DatumAspect)& DA = myDrawer->Link()->DatumAspect(); + const Handle(Prs3d_DatumAspect) DA = + myDrawer->HasLink() ? myDrawer->Link()->DatumAspect() : new Prs3d_DatumAspect(); myDrawer->DatumAspect()->SetAxisLength(DA->FirstAxisLength(), DA->SecondAxisLength(), DA->ThirdAxisLength()); } else - myDrawer->DatumAspect().Nullify(); + { + myDrawer->SetDatumAspect (Handle(Prs3d_DatumAspect)()); + } Update(); UpdateSelection(); @@ -165,15 +167,7 @@ void AIS_Trihedron::UnsetSize() Standard_Real AIS_Trihedron::Size() const { - if(myDrawer->HasDatumAspect()){ - myDrawer->Link()->DatumAspect(); // ? to ensure that myDrawer->myLink is not null for next call ? - return myDrawer->DatumAspect()->FirstAxisLength(); - } - else - //return the Defaut value - return 100. ; - - + return myDrawer->DatumAspect()->FirstAxisLength(); } //======================================================================= @@ -363,7 +357,7 @@ void AIS_Trihedron::ComputeSelection(const Handle(SelectMgr_Selection)& aSelecti { // update AIS_Axis for selection Handle(AIS_Axis) anAxis = Handle(AIS_Axis)::DownCast(myShapes[anIdx]); - Handle(AIS_Drawer) aDrawer = anAxis->Attributes(); + Handle(Prs3d_Drawer) aDrawer = anAxis->Attributes(); Handle(Prs3d_DatumAspect) aDatum = myDrawer->DatumAspect(); aDrawer->DatumAspect()->SetAxisLength (aDatum->FirstAxisLength(), aDatum->SecondAxisLength(), @@ -427,7 +421,7 @@ void AIS_Trihedron::SetColor(const Quantity_Color &aCol) hasOwnColor=Standard_True; myOwnColor = aCol; - if(!myDrawer->HasDatumAspect()){ + if(!myDrawer->HasOwnDatumAspect()){ Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect(); DA->SetAxisLength(myDrawer->DatumAspect()->FirstAxisLength(), @@ -451,7 +445,7 @@ void AIS_Trihedron::SetTextColor(const Quantity_NameOfColor aCol) myHasOwnTextColor = Standard_True; myOwnTextColor = aCol; - if(!myDrawer->HasDatumAspect()){ + if(!myDrawer->HasOwnDatumAspect()){ Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect(); DA->SetAxisLength(myDrawer->DatumAspect()->FirstAxisLength(), @@ -469,7 +463,7 @@ void AIS_Trihedron::SetArrowColor(const Quantity_NameOfColor aCol) myHasOwnArrowColor = Standard_True; myOwnArrowColor = aCol; - if(!myDrawer->HasDatumAspect()){ + if(!myDrawer->HasOwnDatumAspect()){ Handle (Prs3d_DatumAspect) DA = new Prs3d_DatumAspect(); DA->SetAxisLength(myDrawer->DatumAspect()->FirstAxisLength(), diff --git a/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx b/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx index 4bb14f4048..b84ed4b9a1 100644 --- a/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx +++ b/src/DPrsStd/DPrsStd_AISPresentationCommands.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include diff --git a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx b/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx index 93df001f46..00312ad886 100644 --- a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx +++ b/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver.cxx @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx b/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx index e0148bcd70..606792fd13 100644 --- a/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx +++ b/src/MPrsStd/MPrsStd_AISPresentationRetrievalDriver_1.cxx @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx b/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx index 6bba5f579e..9c04c74eb5 100644 --- a/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx +++ b/src/MPrsStd/MPrsStd_AISPresentationStorageDriver.cxx @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/src/MeshVS/MeshVS_NodalColorPrsBuilder.cxx b/src/MeshVS/MeshVS_NodalColorPrsBuilder.cxx index 4d9f6c4abe..32d4ea0551 100644 --- a/src/MeshVS/MeshVS_NodalColorPrsBuilder.cxx +++ b/src/MeshVS/MeshVS_NodalColorPrsBuilder.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -56,7 +57,6 @@ #include #include #include -#include #include #include @@ -438,12 +438,12 @@ void MeshVS_NodalColorPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs, if ( myUseTexture ) { - Handle(AIS_Drawer) anAISDrawer = myParentMesh->Attributes(); - if ( anAISDrawer.IsNull() ) + Handle(Prs3d_Drawer) aPrsDrawer = myParentMesh->Attributes(); + if ( aPrsDrawer.IsNull() ) return; - anAISDrawer->SetShadingAspect( new Prs3d_ShadingAspect() ); - anAsp = anAISDrawer->ShadingAspect()->Aspect(); + aPrsDrawer->SetShadingAspect( new Prs3d_ShadingAspect() ); + anAsp = aPrsDrawer->ShadingAspect()->Aspect(); if ( anAsp.IsNull() ) return; diff --git a/src/Prs3d/FILES b/src/Prs3d/FILES index c48cb5c169..6642590273 100755 --- a/src/Prs3d/FILES +++ b/src/Prs3d/FILES @@ -7,3 +7,5 @@ Prs3d_DimensionUnits.hxx Prs3d_DimensionUnits.cxx Prs3d_PresentationShadow.hxx Prs3d_PresentationShadow.cxx +Prs3d_Drawer.hxx +Prs3d_Drawer.cxx diff --git a/src/Prs3d/Prs3d.cdl b/src/Prs3d/Prs3d.cdl index 6a33d3ec4f..1563502a59 100644 --- a/src/Prs3d/Prs3d.cdl +++ b/src/Prs3d/Prs3d.cdl @@ -66,8 +66,8 @@ is ---Purpose: Declares types of hidden line removal algorithm. -- TOH_Algo enables using of exact HLR algorithm. -- TOH_PolyAlgo enables using of polygonal HLR algorithm. - -- TOH_NotSet is used by AIS_Drawer class, it means that the drawer should return the global value. - -- For more details see AIS_Drawer class, AIS_Shape::Compute() method and + -- TOH_NotSet is used by Prs3d_Drawer class, it means that the drawer should return the global value. + -- For more details see Prs3d_Drawer class, AIS_Shape::Compute() method and -- HLRAlgo package from TKHLR toolkit. enumeration DimensionTextHorizontalPosition is DTHP_Left, DTHP_Right, DTHP_Center, DTHP_Fit; @@ -114,7 +114,7 @@ is class DatumAspect; imported DimensionUnits; - class Drawer; + imported transient class Drawer; class Projector; diff --git a/src/Prs3d/Prs3d_Drawer.cdl b/src/Prs3d/Prs3d_Drawer.cdl deleted file mode 100644 index 1bdfaab7df..0000000000 --- a/src/Prs3d/Prs3d_Drawer.cdl +++ /dev/null @@ -1,601 +0,0 @@ --- Created on: 1992-09-18 --- Created by: Jean Louis FRENKEL --- Copyright (c) 1992-1999 Matra Datavision --- Copyright (c) 1999-2014 OPEN CASCADE SAS --- --- This file is part of Open CASCADE Technology software library. --- --- This library is free software; you can redistribute it and/or modify it under --- the terms of the GNU Lesser General Public License version 2.1 as published --- by the Free Software Foundation, with special exception defined in the file --- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT --- distribution for complete text of the license and disclaimer of any warranty. --- --- Alternatively, this file may be used under the terms of Open CASCADE --- commercial license or contractual agreement. - -class Drawer from Prs3d inherits TShared from MMgt - - ---Purpose: A graphic attribute manager which governs how - -- objects such as color, width, line thickness and - -- deflection are displayed. - -- Prs3d_Drawer is the mother class of AIS_Drawer. - -- As such, it is its set functions which are called to - -- modify display parameters. In the example below we - -- can see that the AIS_Drawer is modified to set the - -- value of the deviation coefficient using a method - -- inherited from Prs3d_Drawer. - -- A drawer includes an instance of the Aspect classes - -- with particular default values. - -uses - DatumAspect from Prs3d, - LineAspect from Prs3d, - TextAspect from Prs3d, - PointAspect from Prs3d, - ShadingAspect from Prs3d, - IsoAspect from Prs3d, - DimensionAspect from Prs3d, - PlaneAspect from Prs3d, - ArrowAspect from Prs3d, - TypeOfDeflection from Aspect, - NameOfColor from Quantity, - PlaneAngle from Quantity, - Length from Quantity, - TypeOfHLR from Prs3d, - DimensionUnits from Prs3d, - VertexDrawMode from Prs3d, - AsciiString from TCollection, - Ax2 from gp - -is - Create returns Drawer from Prs3d; - ----Category: deviation definition. --- --- All drawings of curves or patches are made with respect to a maximal --- chordial deviation. This deviation is absolute and given through --- the method: SetMaximalChordialDeviation. --- --- In the case of drawing shapes, it is allowed to ask for a relative --- deviation. --- This deviation will be: SizeOfObject * DeviationCoefficient where --- DeviationCoefficient can be set through the method: SetDeviationCoefficient. --- --- --- For drawing algorithms using discretisation, a default number of --- points has been set to 17. It is possible to use the method SetDiscret --- to change this number. --- - - - SetTypeOfDeflection (me:mutable; - aTypeOfDeflection: TypeOfDeflection from Aspect) - ---Purpose: Sets the type of chordal deflection. - -- This indicates whether the deflection value is absolute - -- or relative to the size of the object. - is virtual; - - TypeOfDeflection(me) returns TypeOfDeflection from Aspect - is virtual; - --- Purpose: Returns the type of chordal deflection. - -- This indicates whether the deflection value is absolute - -- or relative to the size of the object. - - SetMaximalChordialDeviation (me: mutable; - aChordialDeviation: Length from Quantity) - ---Purpose: Defines the maximal chordial deviation when drawing any curve; - -- Even if the type of deviation is set to TOD_Relative, - -- this value is used by: - -- - -- Prs3d_DeflectionCurve - -- Prs3d_WFDeflectionSurface - -- Prs3d_WFDeflectionRestrictedFace - is virtual; - - MaximalChordialDeviation (me) returns Length from Quantity - ---Purpose: returns the maximal chordial deviation. Default value is 0.1 - is virtual; - - SetDeviationCoefficient(me: mutable; aCoefficient: Real from Standard) - ---Purpose: Sets the deviation coefficient aCoefficient. - is virtual; - - DeviationCoefficient(me) returns Real from Standard - is virtual; - ---Purpose: Returns the deviation coefficient. - SetHLRDeviationCoefficient(me: mutable; aCoefficient: Real from Standard) - ---Purpose: Sets the deviation coefficient aCoefficient for removal - -- of hidden lines created by different viewpoints in - -- different presentations. The Default value is 0.02. - is virtual; - - HLRDeviationCoefficient(me) returns Real from Standard - is virtual; - ---Purpose: Returns the real number value of the hidden line - -- removal deviation coefficient. - SetHLRAngle(me: mutable; anAngle: Real from Standard) - ---Purpose: Sets anAngle, the angle of maximum chordal - -- deviation for removal of hidden lines created by - -- different viewpoints in different presentations. The - -- default value is 20*PI/180. - is virtual; - - HLRAngle(me) returns Real from Standard - is virtual; - ---Purpose: Returns the real number value of the deviation angle - -- in hidden line removal views. The default value is 20*PI/180. - - SetDeviationAngle(me: mutable; anAngle: Real from Standard) - ---Purpose: Sets deviation angle - is virtual; - - DeviationAngle(me) returns Real from Standard - ---Purpose: Returns the value for deviation angle. - is virtual; - - SetDiscretisation(me: mutable; d: Integer from Standard) - ---Purpose: Sets the discretisation parameter d. - is virtual; - - Discretisation(me) returns Integer from Standard - is virtual; - ---Purpose: Returns the discretisation setting. - SetMaximalParameterValue(me: mutable; Value: Real from Standard) - ---Purpose: defines the maximum value allowed for the first and last - -- parameters of an infinite curve. Default value: 500. - is virtual; - - MaximalParameterValue(me) returns Real from Standard - is virtual; - --- Purpose: Sets the maximum value allowed for the first and last - -- parameters of an infinite curve. By default, this value is 500000. - - SetIsoOnPlane (me: mutable; OnOff: Boolean from Standard) - ---Purpose: Sets IsoOnPlane on or off by setting the parameter - -- OnOff to true or false. - is virtual; - - IsoOnPlane(me) returns Boolean from Standard - ---Purpose: Returns True if the drawing of isos on planes is enabled. - is virtual; - - SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d) - is virtual; - ---Purpose: Sets the type of HLR algorithm - -- used by drawer's interactive objects - - TypeOfHLR(me) returns TypeOfHLR from Prs3d - is virtual; - ---Purpose: Gets the myTypeOfHLR value - - --- --- Attributes for the U Isoparametric lines of patches. --- - UIsoAspect (me:mutable) returns IsoAspect from Prs3d - ---Purpose: Defines the attributes which are used when drawing an - -- U isoparametric curve of a face. Defines the number - -- of U isoparametric curves to be drawn for a single face. - -- The LineAspect for U isoparametric lines can be edited - -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber) - -- The default values are: - -- COLOR : Quantity_NOC_GRAY75 - -- TYPE OF LINE: Aspect_TOL_SOLID - -- WIDTH : 0.5 - -- - -- - -- These attributes are used by the following algorithms: - -- Prs3d_WFDeflectionSurface - -- Prs3d_WFDeflectionRestrictedFace - - - is virtual; - - SetUIsoAspect (me:mutable; anAspect: IsoAspect from Prs3d) - is virtual; - --- Attributes for the V Isoparametric line of patches. - - - VIsoAspect (me:mutable) returns IsoAspect from Prs3d - ---Purpose: Defines the attributes which are used when drawing an - -- V isoparametric curve of a face. Defines the number - -- of V isoparametric curves to be drawn for a single face. - -- The LineAspect for V isoparametric lines can be edited - -- (methods SetColor, SetTypeOfLine, SetWidth, SetNumber) - -- The default values are: - -- COLOR : Quantity_NOC_GRAY82 - -- TYPE OF LINE: Aspect_TOL_SOLID - -- WIDTH : 0.5 - -- - -- - -- These attributes are used by the following algorithms: - -- Prs3d_WFDeflectionSurface - -- Prs3d_WFDeflectionRestrictedFace - is virtual; - - SetVIsoAspect (me:mutable;anAspect: IsoAspect from Prs3d) - is virtual; - ---Purpose: Sets the appearance of V isoparameters - anAspect. - - FreeBoundaryAspect (me:mutable) returns LineAspect from Prs3d - ---Purpose: Stores the values for presentation of free boundaries, - -- in other words, boundaries which are not shared. - -- The LineAspect for the free boundaries can be edited. - -- The default values are: - -- Color: Quantity_NOC_GREEN - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - -- These attributes are used by the algorithm Prs3d_WFShape - is virtual; - - SetFreeBoundaryAspect(me:mutable;anAspect: LineAspect from Prs3d) - is virtual; - --- Purpose: Sets the parameter anAspect for the display of free boundaries. - - SetFreeBoundaryDraw (me: mutable; OnOff: Boolean from Standard) - ---Purpose: Sets free boundary drawing on or off by setting the - -- parameter OnOff to true or false. - - is virtual; - - FreeBoundaryDraw(me) returns Boolean from Standard - ---Purpose: Returns True if the drawing of the shared boundaries - -- is disabled. True is the default setting. - is virtual; - - --- Attributes for the wires - - WireAspect (me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns wire aspect settings. - -- The LineAspect for the wire can be edited. - -- The default values are: - -- Color: Quantity_NOC_RED - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - -- These attributes are used by the algorithm Prs3d_WFShape - is virtual; - - SetWireAspect(me:mutable;anAspect: LineAspect from Prs3d) - is virtual; - - --- Purpose: Sets the parameter anAspect for display of wires. - - SetWireDraw (me: mutable; OnOff: Boolean from Standard) - ---Purpose: Sets WireDraw on or off by setting the parameter - -- OnOff to true or false. - - is virtual; - - WireDraw(me) returns Boolean from Standard - ---Purpose: returns True if the drawing of the wire is enabled. - is virtual; - - --- Attributes for the unfree boundaries - - UnFreeBoundaryAspect (me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns settings for shared boundary line aspects. - -- The LineAspect for the unfree boundaries can be edited. - -- The default values are: - -- Color: Quantity_NOC_YELLOW - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - -- These attributes are used by the algorithm Prs3d_WFShape - is virtual; - - SetUnFreeBoundaryAspect(me:mutable; anAspect: LineAspect from Prs3d) - is virtual; - --- Purpose: Sets the parameter anAspect for the display of shared boundaries. - SetUnFreeBoundaryDraw (me: mutable; OnOff: Boolean from Standard) - ---Purpose: Sets FreeBoundaryDraw on or off by setting the - -- parameter OnOff to true or false. - -- By default the unfree boundaries are drawn. - - is virtual; - - UnFreeBoundaryDraw(me) returns Boolean from Standard - ---Purpose: Returns True if the drawing of the shared boundaries is enabled. - -- True is the default setting. - is virtual; - - --- --- Attributes for the lines. --- - - LineAspect(me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns settings for line aspects. - -- These settings can be edited. The default values are: - -- Color: Quantity_NOC_YELLOW - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - -- These attributes are used by the following algorithms: - -- Prs3d_Curve - -- Prs3d_Line - -- Prs3d_HLRShape - - is virtual; - - SetLineAspect(me:mutable; anAspect: LineAspect from Prs3d) - is virtual; - --- Purpose: Sets the parameter anAspect for display attributes of lines. - - TextAspect(me:mutable) returns TextAspect from Prs3d - --- Purpose: Returns settings for text aspect. - -- These settings can be edited. The default value is: - -- - Color: Quantity_NOC_YELLOW - - is virtual; - - SetTextAspect(me:mutable; anAspect: TextAspect from Prs3d) - is virtual; - --- Purpose: Sets the parameter anAspect for display attributes of text. - - SetLineArrowDraw (me: mutable; OnOff: Boolean from Standard) - ---Purpose: enables the drawing of an arrow at the end of each line. - -- By default the arrows are not drawn. - - is virtual; - - LineArrowDraw(me) returns Boolean from Standard - ---Purpose: Returns True if drawing an arrow at the end of each edge is enabled - -- and False otherwise (the default). - is virtual; - - ArrowAspect(me:mutable) returns ArrowAspect from Prs3d - is virtual; - ---Purpose: Returns the attributes for display of arrows. - - SetArrowAspect(me:mutable; anAspect: ArrowAspect from Prs3d) - is virtual ; - ---Purpose: Sets the parameter anAspect for display attributes of arrows. - - PointAspect(me:mutable) returns PointAspect from Prs3d - ---Purpose: Returns the point aspect setting. The default values are - -- Color: Quantity_NOC_YELLOW - -- Type of marker: Aspect_TOM_PLUS - -- Scale: 1. - -- These attributes are used by the algorithms Prs3d_Point. - is virtual; - - SetPointAspect(me:mutable; anAspect: PointAspect from Prs3d) - is virtual; - --- Purpose: Sets the parameter anAspect for display attributes of points - - SetVertexDrawMode(me: mutable; theMode: VertexDrawMode from Prs3d) - ---Purpose: Sets the mode of visualization of vertices of a TopoDS_Shape instance. - -- By default, only stand-alone vertices (not belonging topologically to an edge) are drawn, - -- that corresponds to Prs3d_VDM_Standalone mode. - -- Switching to Prs3d_VDM_Standalone mode makes all shape's vertices visible. - -- To inherit this parameter from the global drawer instance ("the link") when it is present, - -- Prs3d_VDM_Inherited value should be used. - is virtual; - - VertexDrawMode(me) returns VertexDrawMode from Prs3d - ---Purpose: Returns the current mode of visualization of vertices of a TopoDS_Shape instance. - is virtual; - - ShadingAspect (me:mutable) returns ShadingAspect from Prs3d - is virtual; - ---Purpose: Returns settings for shading aspects. - -- These settings can be edited. The default values are: - -- - Color: Quantity_NOC_YELLOW - -- - Material: Graphic3d_NOM_BRASS - -- Shading aspect is obtained through decomposition of - -- 3d faces into triangles, each side of each triangle - -- being a chord of the corresponding curved edge in - -- the face. Reflection of light in each projector - -- perspective is then calculated for each of the - -- resultant triangular planes. - - - SetShadingAspect(me:mutable; anAspect: ShadingAspect from Prs3d) - is virtual; - ---Purpose: Sets the parameter anAspect for display attributes of shading. - - SetShadingAspectGlobal(me: mutable; aValue: Boolean from Standard) - ---Purpose: indicates that the ShadingAspect will be apply - -- to the whole presentation. This allows to modify - -- the aspect without recomputing the content of the presentation. - is virtual; - - ShadingAspectGlobal(me) returns Boolean from Standard - is virtual; --- --- Attributes for hidden lines removal. These attributes are used when --- using an algorithm such Prs3d_HLRShape for example. --- - - DrawHiddenLine(me) returns Boolean from Standard - ---Purpose: returns Standard_True if the hidden lines are to be drawn. - -- By default the hidden lines are not drawn. - is virtual; - - EnableDrawHiddenLine(me: mutable) - ---Purpose: Enables the DrawHiddenLine function. - is virtual; - - DisableDrawHiddenLine(me: mutable) - ---Purpose: Disables the DrawHiddenLine function. - is virtual; - - HiddenLineAspect(me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns settings for hidden line aspects. - -- These settings can be edited. The default values are: - -- Color: Quantity_NOC_YELLOW - -- Type of line: Aspect_TOL_DASH - -- Width: 1. - is virtual; - - SetHiddenLineAspect(me:mutable; anAspect: LineAspect from Prs3d) - is virtual; - ---Purpose: Sets the parameter anAspect for the display of - -- hidden lines in hidden line removal mode. - - SeenLineAspect(me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns settings for seen line aspects. - -- These settings can be edited. The default values are: - -- Color: Quantity_NOC_YELLOW - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - is virtual; - - SetSeenLineAspect(me:mutable; anAspect: LineAspect from Prs3d) - is virtual; - --- Purpose: Sets the parameter anAspect for the display of seen - -- lines in hidden line removal mode. - - PlaneAspect(me:mutable) returns PlaneAspect from Prs3d - is virtual; - ---Purpose: Returns settings for the appearance of planes. - - SetPlaneAspect(me:mutable; anAspect: PlaneAspect from Prs3d) - is virtual; - ---Purpose: Sets the parameter anAspect for the display of planes. - - VectorAspect(me:mutable) returns LineAspect from Prs3d - ---Purpose: Returns settings for the appearance of vectors. - -- These settings can be edited. The default values are: - -- Color: Quantity_NOC_SKYBLUE - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - is virtual; - - SetVectorAspect(me:mutable; anAspect: LineAspect from Prs3d) - is virtual; - ---Purpose: Sets the modality anAspect for the display of vectors. - --- --- Attributes for the presentation of a Datum. --- - - DatumAspect(me:mutable) returns DatumAspect from Prs3d - ---Purpose: Returns settings for the appearance of datums. - -- These settings can be edited. The default values for - -- the three axes are: - -- Color: Quantity_NOC_PEACHPUFF - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - is virtual; - - SetDatumAspect(me:mutable; anAspect: DatumAspect from Prs3d) - is virtual; - ---Purpose: Sets the modality anAspect for the display of datums. - - DimensionAspect(me:mutable) returns DimensionAspect from Prs3d is virtual; - ---Purpose: Returns settings for the appearance of dimensions. - - SetDimensionAspect(me:mutable; theAspect: DimensionAspect from Prs3d) is virtual; - ---Purpose: Sets the settings for the appearance of dimensions. - - SetDimLengthModelUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual; - ---Purpose: Sets dimension length model units for computing of dimension presentation. - - SetDimAngleModelUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual; - ---Purpose: Sets dimension angle model units for computing of dimension presentation. - - DimLengthModelUnits (me) returns AsciiString from TCollection is virtual; - ---Purpose: Returns length model units for the dimension presentation. - ---C++: return const & - - DimAngleModelUnits (me) returns AsciiString from TCollection is virtual; - ---Purpose: Returns angle model units for the dimension presentation. - ---C++: return const & - - SetDimLengthDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual; - ---Purpose: Sets length units in which value for dimension presentation is displayed. - - SetDimAngleDisplayUnits (me: mutable; theUnits : AsciiString from TCollection) is virtual; - ---Purpose: Sets angle units in which value for dimension presentation is displayed. - - DimLengthDisplayUnits (me) returns AsciiString from TCollection is virtual; - ---Purpose: Returns length units in which dimension presentation is displayed. - ---C++: return const & - - DimAngleDisplayUnits (me) returns AsciiString from TCollection is virtual; - ---Purpose: Returns angle units in which dimension presentation is displayed. - ---C++: return const & - - SectionAspect (me : mutable) returns LineAspect from Prs3d is virtual; - ---Purpose: The LineAspect for the wire can be edited. - -- The default values are: - -- Color: Quantity_NOC_ORANGE - -- Type of line: Aspect_TOL_SOLID - -- Width: 1. - -- These attributes are used by the algorithm Prs3d_WFShape. - - SetSectionAspect (me : mutable; theAspect: LineAspect from Prs3d) is virtual; - ---Purpose: Sets the parameter theAspect for display attributes of sections. - - SetFaceBoundaryDraw (me : mutable; - theIsEnabled : Boolean from Standard) - is virtual; - ---Purpose: Enables or disables face boundary drawing for shading presentations. - -- theIsEnabled is a boolean flag indicating whether the face boundaries should be - -- drawn or not. - - IsFaceBoundaryDraw (me) returns Boolean from Standard - is virtual; - ---Purpose: Checks whether the face boundary drawing is enabled or not. - - SetFaceBoundaryAspect (me : mutable; - theAspect : LineAspect from Prs3d) - is virtual; - ---Purpose: Sets line aspect for face boundaries. - -- theAspect is the line aspect that determines the look of the face boundaries. - - FaceBoundaryAspect (me : mutable) returns LineAspect from Prs3d - is virtual; - ---Purpose: Returns line aspect of face boundaries. - -fields - - myUIsoAspect: IsoAspect from Prs3d is protected; - myVIsoAspect: IsoAspect from Prs3d is protected; - myNbPoints : Integer from Standard is protected; - myIsoOnPlane: Boolean from Standard is protected; - myFreeBoundaryAspect: LineAspect from Prs3d is protected; - myFreeBoundaryDraw: Boolean from Standard is protected; - myUnFreeBoundaryAspect: LineAspect from Prs3d is protected; - myUnFreeBoundaryDraw: Boolean from Standard is protected; - myWireAspect: LineAspect from Prs3d is protected; - myWireDraw: Boolean from Standard is protected; - myLineAspect: LineAspect from Prs3d is protected; - myTextAspect: TextAspect from Prs3d is protected; - myShadingAspect: ShadingAspect from Prs3d is protected; - myShadingAspectGlobal: Boolean from Standard is protected; - myChordialDeviation: Length from Quantity is protected; - myTypeOfDeflection: TypeOfDeflection from Aspect is protected; - myMaximalParameterValue: Real from Standard is protected; - - myDeviationCoefficient: Real from Standard is protected; - myHLRDeviationCoefficient: Real from Standard is protected; - - myDeviationAngle: Real from Standard is protected; - myHLRAngle: Real from Standard is protected; - - myPointAspect: PointAspect from Prs3d is protected; - myVertexDrawMode: VertexDrawMode from Prs3d is protected; - myPlaneAspect: PlaneAspect from Prs3d is protected; - myArrowAspect: ArrowAspect from Prs3d is protected; - myLineDrawArrow: Boolean from Standard is protected; - myDrawHiddenLine: Boolean from Standard is protected; - myHiddenLineAspect: LineAspect from Prs3d is protected; - mySeenLineAspect: LineAspect from Prs3d is protected; - myVectorAspect: LineAspect from Prs3d is protected; - myDatumAspect: DatumAspect from Prs3d is protected; - myDatumScale: Real from Standard is protected; - - myDimensionAspect : DimensionAspect from Prs3d is protected; - myDimensionModelUnits : DimensionUnits from Prs3d is protected; - myDimensionDisplayUnits : DimensionUnits from Prs3d is protected; - - mySectionAspect : LineAspect from Prs3d is protected; - myFaceBoundaryDraw : Boolean from Standard is protected; - myFaceBoundaryAspect : LineAspect from Prs3d is protected; - myTypeOfHLR : TypeOfHLR from Prs3d is protected; - -end Drawer; diff --git a/src/Prs3d/Prs3d_Drawer.cxx b/src/Prs3d/Prs3d_Drawer.cxx index f4c63f9dbc..71b2a6e055 100644 --- a/src/Prs3d/Prs3d_Drawer.cxx +++ b/src/Prs3d/Prs3d_Drawer.cxx @@ -12,32 +12,84 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +IMPLEMENT_STANDARD_HANDLE (Prs3d_Drawer, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Drawer, MMgt_TShared) // ======================================================================= // function : Prs3d_Drawer // purpose : // ======================================================================= Prs3d_Drawer::Prs3d_Drawer() -: myNbPoints (30), - myIsoOnPlane (Standard_False), - myFreeBoundaryDraw (Standard_True), - myUnFreeBoundaryDraw (Standard_True), - myWireDraw (Standard_True), - myShadingAspect (new Prs3d_ShadingAspect()), - myShadingAspectGlobal (Standard_True), - myChordialDeviation (0.0001), - myTypeOfDeflection (Aspect_TOD_RELATIVE), - myMaximalParameterValue (500000.), - myDeviationCoefficient (0.001), - myHLRDeviationCoefficient (0.02), - myDeviationAngle (12.0 * M_PI / 180.0), - myHLRAngle (20.0 * M_PI / 180.0), - myVertexDrawMode (Prs3d_VDM_Isolated), - myLineDrawArrow (Standard_False), - myDrawHiddenLine (Standard_False), - myFaceBoundaryDraw (Standard_False), - myTypeOfHLR (Prs3d_TOH_PolyAlgo) +: myNbPoints (30), + myHasOwnNbPoints (Standard_False), + myMaximalParameterValue (500000.), + myHasOwnMaximalParameterValue (Standard_False), + myChordialDeviation (0.0001), + myHasOwnChordialDeviation (Standard_False), + myTypeOfDeflection (Aspect_TOD_RELATIVE), + myHasOwnTypeOfDeflection (Standard_False), + myTypeOfHLR (Prs3d_TOH_NotSet), + myDeviationCoefficient (0.001), + myHasOwnDeviationCoefficient (Standard_False), + myHLRDeviationCoefficient (0.02), + myHasOwnHLRDeviationCoefficient (Standard_False), + myDeviationAngle (12.0 * M_PI / 180.0), + myHasOwnDeviationAngle (Standard_False), + myHLRAngle (20.0 * M_PI / 180.0), + myHasOwnHLRDeviationAngle (Standard_False), + myIsoOnPlane (Standard_False), + myHasOwnIsoOnPlane (Standard_False), + + myHasOwnUIsoAspect (Standard_False), + myHasOwnVIsoAspect (Standard_False), + myHasOwnWireAspect (Standard_False), + myWireDraw (Standard_True), + myHasOwnWireDraw (Standard_False), + myHasOwnPointAspect (Standard_False), + myHasOwnLineAspect (Standard_False), + myHasOwnTextAspect (Standard_False), + myHasOwnShadingAspect (Standard_False), + myShadingAspectGlobal (Standard_True), + myHasOwnShadingAspectGlobal (Standard_False), + myHasOwnPlaneAspect (Standard_False), + myHasOwnSeenLineAspect (Standard_False), + myHasOwnArrowAspect (Standard_False), + myLineArrowDraw (Standard_False), + myHasOwnLineArrowDraw (Standard_False), + myHasOwnHiddenLineAspect (Standard_False), + myDrawHiddenLine (Standard_False), + myHasOwnDrawHiddenLine (Standard_False), + myHasOwnVectorAspect (Standard_False), + myVertexDrawMode (Prs3d_VDM_Inherited), + myHasOwnDatumAspect (Standard_False), + myHasOwnSectionAspect (Standard_False), + + myHasOwnFreeBoundaryAspect (Standard_False), + myFreeBoundaryDraw (Standard_True), + myHasOwnFreeBoundaryDraw (Standard_False), + myHasOwnUnFreeBoundaryAspect (Standard_False), + myUnFreeBoundaryDraw (Standard_True), + myHasOwnUnFreeBoundaryDraw (Standard_False), + myHasOwnFaceBoundaryAspect (Standard_False), + myFaceBoundaryDraw (Standard_False), + myHasOwnFaceBoundaryDraw (Standard_False), + + myHasOwnDimensionAspect (Standard_False), + myHasOwnDimLengthModelUnits (Standard_False), + myHasOwnDimAngleModelUnits (Standard_False), + myHasOwnDimLengthDisplayUnits (Standard_False), + myHasOwnDimAngleDisplayUnits (Standard_False) { myDimensionModelUnits.SetLengthUnits ("m"); myDimensionModelUnits.SetAngleUnits ("rad"); @@ -45,69 +97,100 @@ Prs3d_Drawer::Prs3d_Drawer() myDimensionDisplayUnits.SetAngleUnits ("deg"); } -void Prs3d_Drawer::SetTypeOfDeflection(const Aspect_TypeOfDeflection aTypeOfDeflection){ - - myTypeOfDeflection = aTypeOfDeflection;} - -Aspect_TypeOfDeflection Prs3d_Drawer::TypeOfDeflection() const { - - return myTypeOfDeflection; - -} +// ======================================================================= +// function : SetTypeOfDeflection +// purpose : +// ======================================================================= - -void Prs3d_Drawer::SetIsoOnPlane(const Standard_Boolean OnOff) +void Prs3d_Drawer::SetTypeOfDeflection (const Aspect_TypeOfDeflection theTypeOfDeflection) { - myIsoOnPlane = OnOff; + myHasOwnTypeOfDeflection = Standard_True; + myTypeOfDeflection = theTypeOfDeflection; } - -Standard_Boolean Prs3d_Drawer::IsoOnPlane()const +// ======================================================================= +// function : SetMaximalChordialDeviation +// purpose : +// ======================================================================= + +void Prs3d_Drawer::SetMaximalChordialDeviation (const Quantity_Length theChordialDeviation) { - return myIsoOnPlane; + myHasOwnChordialDeviation = Standard_True; + myChordialDeviation = theChordialDeviation; } +// ======================================================================= +// function : SetTypeOfHLR +// purpose : set type of HLR algorithm +// ======================================================================= -Standard_Integer Prs3d_Drawer::Discretisation() const +void Prs3d_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR) { - return myNbPoints; + myTypeOfHLR = theTypeOfHLR; } +// ======================================================================= +// function : TypeOfHLR +// purpose : gets type of HLR algorithm +// ======================================================================= -void Prs3d_Drawer::SetDiscretisation(const Standard_Integer d) +Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR() { - myNbPoints = d; + if (!HasOwnTypeOfHLR()) + { + if (!myLink.IsNull()) + { + return myLink->TypeOfHLR(); + } + // Prs3d_TOH_PolyAlgo is default value for this setting. + myTypeOfHLR = Prs3d_TOH_PolyAlgo; + } + return myTypeOfHLR; } +// ======================================================================= +// function : SetMaximalParameterValue +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetMaximalChordialDeviation( - const Quantity_Length aChordialDeviation) { - myChordialDeviation = aChordialDeviation; +void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real theValue) +{ + myHasOwnMaximalParameterValue = Standard_True; + myMaximalParameterValue = theValue; } -Quantity_Length Prs3d_Drawer::MaximalChordialDeviation() const { - return myChordialDeviation; -} +// ======================================================================= +// function : SetIsoOnPlane +// purpose : +// ======================================================================= -// -//======================================================================= -//function : SetDeviationCoefficient -//purpose : -//======================================================================= +void Prs3d_Drawer::SetIsoOnPlane (const Standard_Boolean theIsEnabled) +{ + myHasOwnIsoOnPlane = Standard_True; + myIsoOnPlane = theIsEnabled; +} -void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real aCoefficient) { +// ======================================================================= +// function : SetDiscretisation +// purpose : +// ======================================================================= - myDeviationCoefficient = aCoefficient; +void Prs3d_Drawer::SetDiscretisation (const Standard_Integer theValue) +{ + myHasOwnNbPoints = Standard_True; + myNbPoints = theValue; } //======================================================================= -//function : DeviationCoefficient +//function : SetDeviationCoefficient //purpose : //======================================================================= -Standard_Real Prs3d_Drawer::DeviationCoefficient () const { - - return myDeviationCoefficient; +void Prs3d_Drawer::SetDeviationCoefficient (const Standard_Real theCoefficient) +{ + myPreviousDeviationCoefficient = DeviationCoefficient(); + myDeviationCoefficient = theCoefficient; + myHasOwnDeviationCoefficient = Standard_True; } //======================================================================= @@ -115,19 +198,23 @@ Standard_Real Prs3d_Drawer::DeviationCoefficient () const { //purpose : //======================================================================= -void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real aCoefficient) { - - myHLRDeviationCoefficient = aCoefficient; +void Prs3d_Drawer::SetHLRDeviationCoefficient (const Standard_Real theCoefficient) +{ + myPreviousHLRDeviationCoefficient = HLRDeviationCoefficient(); + myHLRDeviationCoefficient = theCoefficient; + myHasOwnHLRDeviationCoefficient = Standard_True; } //======================================================================= -//function : HLRDeviationCoefficient +//function : SetDeviationAngle //purpose : //======================================================================= -Standard_Real Prs3d_Drawer::HLRDeviationCoefficient () const { - - return myHLRDeviationCoefficient; +void Prs3d_Drawer::SetDeviationAngle (const Standard_Real theAngle) +{ + myPreviousDeviationAngle = DeviationAngle(); + myDeviationAngle = theAngle; + myHasOwnDeviationAngle = Standard_True; } //======================================================================= @@ -135,457 +222,823 @@ Standard_Real Prs3d_Drawer::HLRDeviationCoefficient () const { //purpose : //======================================================================= -void Prs3d_Drawer::SetHLRAngle (const Standard_Real anAngle) { - - myHLRAngle = anAngle; +void Prs3d_Drawer::SetHLRAngle (const Standard_Real theAngle) +{ + myPreviousHLRDeviationAngle = HLRAngle(); + myHLRAngle = theAngle; + myHasOwnHLRDeviationAngle = Standard_True; } -//======================================================================= -//function : HLRAngle -//purpose : -//======================================================================= - -Standard_Real Prs3d_Drawer::HLRAngle () const { +// ======================================================================= +// function : FreeBoundaryAspect +// purpose : +// ======================================================================= - return myHLRAngle; +const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FreeBoundaryAspect() +{ + if (!HasOwnFreeBoundaryAspect()) + { + if (!myLink.IsNull()) + { + return myLink->FreeBoundaryAspect(); + } + if (myFreeBoundaryAspect.IsNull()) + { + myFreeBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1.0); + } + } + return myFreeBoundaryAspect; } -//======================================================================= -//function : SetDeviationAngle -//purpose : -//======================================================================= +// ======================================================================= +// function : FreeBoundaryAspect +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetDeviationAngle (const Standard_Real anAngle) +void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) { - myDeviationAngle = anAngle; + myFreeBoundaryAspect = theAspect; + myHasOwnFreeBoundaryAspect = !myFreeBoundaryAspect.IsNull(); } -//======================================================================= -//function : DeviationAngle -//purpose : -//======================================================================= +// ======================================================================= +// function : SetFreeBoundaryDraw +// purpose : +// ======================================================================= -Standard_Real Prs3d_Drawer::DeviationAngle () const +void Prs3d_Drawer::SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled) { - return myDeviationAngle; + myHasOwnFreeBoundaryDraw = Standard_True; + myFreeBoundaryDraw = theIsEnabled; } +// ======================================================================= +// function : UnFreeBoundaryAspect +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetMaximalParameterValue (const Standard_Real Value) { - myMaximalParameterValue = Value; -} - -Standard_Real Prs3d_Drawer::MaximalParameterValue () const { - return myMaximalParameterValue; +const Handle(Prs3d_LineAspect)& Prs3d_Drawer::UnFreeBoundaryAspect() +{ + if (!HasOwnUnFreeBoundaryAspect()) + { + if (!myLink.IsNull()) + { + return myLink->UnFreeBoundaryAspect(); + } + if (myUnFreeBoundaryAspect.IsNull()) + { + myUnFreeBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0); + } + } + return myUnFreeBoundaryAspect; } -Handle (Prs3d_IsoAspect) Prs3d_Drawer::UIsoAspect (){ - - if (myUIsoAspect.IsNull()) - myUIsoAspect = new Prs3d_IsoAspect - (Quantity_NOC_GRAY75,Aspect_TOL_SOLID,0.5,1); - - return myUIsoAspect; -} +// ======================================================================= +// function : SetUnFreeBoundaryAspect +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetUIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) { - myUIsoAspect = anAspect; +void Prs3d_Drawer::SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) +{ + myUnFreeBoundaryAspect = theAspect; + myHasOwnUnFreeBoundaryAspect = !myUnFreeBoundaryAspect.IsNull(); } -Handle (Prs3d_IsoAspect) Prs3d_Drawer::VIsoAspect () { - if (myVIsoAspect.IsNull()) - myVIsoAspect = new Prs3d_IsoAspect - (Quantity_NOC_GRAY75,Aspect_TOL_SOLID,0.5,1); - - return myVIsoAspect; -} +// ======================================================================= +// function : SetUnFreeBoundaryDraw +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetVIsoAspect ( const Handle(Prs3d_IsoAspect)& anAspect) { - myVIsoAspect = anAspect; +void Prs3d_Drawer::SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled) +{ + myHasOwnUnFreeBoundaryDraw = Standard_True; + myUnFreeBoundaryDraw = theIsEnabled; } -Handle (Prs3d_LineAspect) Prs3d_Drawer::FreeBoundaryAspect () { - if (myFreeBoundaryAspect.IsNull()) - myFreeBoundaryAspect = new Prs3d_LineAspect - (Quantity_NOC_GREEN,Aspect_TOL_SOLID,1.); - - return myFreeBoundaryAspect; -} +// ======================================================================= +// function : FaceBoundaryAspect +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& anAspect) { - myFreeBoundaryAspect = anAspect; +const Handle(Prs3d_LineAspect)& Prs3d_Drawer::FaceBoundaryAspect() +{ + if (!HasOwnFaceBoundaryAspect()) + { + if (!myLink.IsNull()) + { + return myLink->FaceBoundaryAspect(); + } + if (myFaceBoundaryAspect.IsNull()) + { + myFaceBoundaryAspect = new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0); + } + } + return myFaceBoundaryAspect; } -void Prs3d_Drawer::SetFreeBoundaryDraw ( const Standard_Boolean OnOff ) { - myFreeBoundaryDraw = OnOff; -} +// ======================================================================= +// function : SetFaceBoundaryAspect +// purpose : +// ======================================================================= -Standard_Boolean Prs3d_Drawer::FreeBoundaryDraw () const { -return myFreeBoundaryDraw; +void Prs3d_Drawer::SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) +{ + myFaceBoundaryAspect = theAspect; + myHasOwnFaceBoundaryAspect = !myFaceBoundaryAspect.IsNull(); } -Handle (Prs3d_LineAspect) Prs3d_Drawer::UnFreeBoundaryAspect (){ - if (myUnFreeBoundaryAspect.IsNull()) - myUnFreeBoundaryAspect = new Prs3d_LineAspect - (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.); - return myUnFreeBoundaryAspect; -} +// ======================================================================= +// function : SetFaceBoundaryDraw +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetUnFreeBoundaryAspect ( const Handle(Prs3d_LineAspect)& anAspect) { - myUnFreeBoundaryAspect = anAspect; +void Prs3d_Drawer::SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled) +{ + myHasOwnFaceBoundaryDraw = Standard_True; + myFaceBoundaryDraw = theIsEnabled; } -void Prs3d_Drawer::SetUnFreeBoundaryDraw ( const Standard_Boolean OnOff ) { - myUnFreeBoundaryDraw = OnOff; -} +// ======================================================================= +// function : DimensionAspect +// purpose : +// ======================================================================= -Standard_Boolean Prs3d_Drawer::UnFreeBoundaryDraw () const { - return myUnFreeBoundaryDraw; +const Handle(Prs3d_DimensionAspect)& Prs3d_Drawer::DimensionAspect() +{ + if (!HasOwnDimensionAspect()) + { + if (!myLink.IsNull()) + { + return myLink->DimensionAspect(); + } + if (myDimensionAspect.IsNull()) + { + myDimensionAspect = new Prs3d_DimensionAspect; + } + } + return myDimensionAspect; } -Handle (Prs3d_LineAspect) Prs3d_Drawer::WireAspect () { - if (myWireAspect.IsNull()) - myWireAspect = new Prs3d_LineAspect(Quantity_NOC_RED,Aspect_TOL_SOLID,1.); +// ======================================================================= +// function : SetDimensionAspect +// purpose : +// ======================================================================= - return myWireAspect; +void Prs3d_Drawer::SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect) +{ + myDimensionAspect = theAspect; + myHasOwnDimensionAspect = !myDimensionAspect.IsNull(); } -void Prs3d_Drawer::SetWireAspect ( const Handle(Prs3d_LineAspect)& anAspect) { - myWireAspect = anAspect; -} -void Prs3d_Drawer::SetWireDraw ( const Standard_Boolean OnOff ) { - myWireDraw = OnOff; -} +// ======================================================================= +// function : SetDimLengthModelUnits +// purpose : +// ======================================================================= -Standard_Boolean Prs3d_Drawer::WireDraw () const { -return myWireDraw; +void Prs3d_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits) +{ + myHasOwnDimLengthModelUnits = Standard_True; + myDimensionModelUnits.SetLengthUnits (theUnits); } +// ======================================================================= +// function : SetDimAngleModelUnits +// purpose : +// ======================================================================= -Handle (Prs3d_LineAspect) Prs3d_Drawer::LineAspect () { - if (myLineAspect.IsNull()) - myLineAspect = new Prs3d_LineAspect - (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.); - return myLineAspect; +void Prs3d_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits) +{ + myHasOwnDimAngleModelUnits = Standard_True; + myDimensionModelUnits.SetAngleUnits (theUnits); } -void Prs3d_Drawer::SetLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) { - myLineAspect = anAspect; +// ======================================================================= +// function : SetDimLengthDisplayUnits +// purpose : +// ======================================================================= + +void Prs3d_Drawer::SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits) +{ + myHasOwnDimLengthDisplayUnits = Standard_True; + myDimensionDisplayUnits.SetLengthUnits (theUnits); } -Handle (Prs3d_TextAspect) Prs3d_Drawer::TextAspect () { - if (myTextAspect.IsNull()) - myTextAspect = new Prs3d_TextAspect(); +// ======================================================================= +// function : SetDimAngleDisplayUnits +// purpose : +// ======================================================================= - return myTextAspect; +void Prs3d_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits) +{ + myHasOwnDimAngleDisplayUnits = Standard_True; + myDimensionDisplayUnits.SetAngleUnits (theUnits); } -void Prs3d_Drawer::SetTextAspect ( const Handle(Prs3d_TextAspect)& anAspect) { - myTextAspect = anAspect; +// ======================================================================= +// function : UIsoAspect +// purpose : +// ======================================================================= + +const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::UIsoAspect() +{ + if (!HasOwnUIsoAspect()) + { + if (!myLink.IsNull()) + { + return myLink->UIsoAspect(); + } + if (myUIsoAspect.IsNull()) + { + myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1); + } + } + return myUIsoAspect; } -Handle (Prs3d_ShadingAspect) Prs3d_Drawer::ShadingAspect () { - if (myShadingAspect.IsNull()) - myShadingAspect = new Prs3d_ShadingAspect(); +// ======================================================================= +// function : SetUIsoAspect +// purpose : +// ======================================================================= - return myShadingAspect; +void Prs3d_Drawer::SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect) +{ + myUIsoAspect = theAspect; + myHasOwnUIsoAspect = !myUIsoAspect.IsNull(); } -void Prs3d_Drawer::SetShadingAspect ( const Handle(Prs3d_ShadingAspect)& anAspect) { - myShadingAspect = anAspect; -} +// ======================================================================= +// function : VIsoAspect +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetShadingAspectGlobal(const Standard_Boolean aValue) { - myShadingAspectGlobal = aValue; +const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::VIsoAspect() +{ + if (!HasOwnVIsoAspect()) + { + if (!myLink.IsNull()) + { + return myLink->VIsoAspect(); + } + if (myVIsoAspect.IsNull()) + { + myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1); + } + } + return myVIsoAspect; } -Standard_Boolean Prs3d_Drawer::ShadingAspectGlobal() const { - - return myShadingAspectGlobal; +// ======================================================================= +// function : SetVIsoAspect +// purpose : +// ======================================================================= +void Prs3d_Drawer::SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect) +{ + myVIsoAspect = theAspect; + myHasOwnVIsoAspect= !myVIsoAspect.IsNull(); } - -void Prs3d_Drawer::SetLineArrowDraw ( const Standard_Boolean OnOff ) { - myLineDrawArrow = OnOff; -} -Standard_Boolean Prs3d_Drawer::LineArrowDraw () const { -return myLineDrawArrow; +// ======================================================================= +// function : WireAspect +// purpose : +// ======================================================================= + +const Handle(Prs3d_LineAspect)& Prs3d_Drawer::WireAspect() +{ + if (!HasOwnWireAspect()) + { + if (!myLink.IsNull()) + { + return myLink->WireAspect(); + } + if (myWireAspect.IsNull()) + { + myWireAspect = new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0); + } + } + return myWireAspect; } -Handle (Prs3d_ArrowAspect) Prs3d_Drawer::ArrowAspect() { - if (myArrowAspect.IsNull()) - myArrowAspect = new Prs3d_ArrowAspect; +// ======================================================================= +// function : SetWireAspect +// purpose : +// ======================================================================= - return myArrowAspect; +void Prs3d_Drawer::SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect) +{ + myWireAspect = theAspect; + myHasOwnWireAspect = !myWireAspect.IsNull(); } -void Prs3d_Drawer::SetArrowAspect ( const Handle(Prs3d_ArrowAspect)& anAspect) { - myArrowAspect = anAspect; +// ======================================================================= +// function : SetWireDraw +// purpose : +// ======================================================================= + +void Prs3d_Drawer::SetWireDraw (const Standard_Boolean theIsEnabled) +{ + myHasOwnWireDraw = Standard_True; + myWireDraw = theIsEnabled; } -Handle (Prs3d_PointAspect) Prs3d_Drawer::PointAspect() { - if (myPointAspect.IsNull()) - myPointAspect = new Prs3d_PointAspect - (Aspect_TOM_PLUS,Quantity_NOC_YELLOW,1.); +// ======================================================================= +// function : PointAspect +// purpose : +// ======================================================================= +const Handle(Prs3d_PointAspect)& Prs3d_Drawer::PointAspect() +{ + if (!HasOwnPointAspect()) + { + if (!myLink.IsNull()) + { + return myLink->PointAspect(); + } + if (myPointAspect.IsNull()) + { + myPointAspect = new Prs3d_PointAspect (Aspect_TOM_PLUS, Quantity_NOC_YELLOW, 1.0); + } + } return myPointAspect; } -void Prs3d_Drawer::SetPointAspect ( const Handle(Prs3d_PointAspect)& anAspect) { - myPointAspect = anAspect; -} +// ======================================================================= +// function : SetPointAspect +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetVertexDrawMode (const Prs3d_VertexDrawMode theMode) +void Prs3d_Drawer::SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect) { - // Prs3d_VDM_Inherited value is allowed at AIS_Drawer level. - // Replacing it by Prs3d_VDM_Isolated to avoid unpredictable behavior. - myVertexDrawMode = (theMode == Prs3d_VDM_Inherited ? Prs3d_VDM_Isolated : theMode); + myPointAspect = theAspect; + myHasOwnPointAspect = !myPointAspect.IsNull(); } -Prs3d_VertexDrawMode Prs3d_Drawer::VertexDrawMode () const +// ======================================================================= +// function : LineAspect +// purpose : +// ======================================================================= + +const Handle(Prs3d_LineAspect)& Prs3d_Drawer::LineAspect() { - return myVertexDrawMode; + if (!HasOwnLineAspect()) + { + if (!myLink.IsNull()) + { + return myLink->LineAspect(); + } + if (myLineAspect.IsNull()) + { + myLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0); + } + } + return myLineAspect; } -Standard_Boolean Prs3d_Drawer::DrawHiddenLine () const {return myDrawHiddenLine;} - -void Prs3d_Drawer::EnableDrawHiddenLine () {myDrawHiddenLine=Standard_True;} - -void Prs3d_Drawer::DisableDrawHiddenLine () {myDrawHiddenLine=Standard_False;} - -Handle (Prs3d_LineAspect) Prs3d_Drawer::HiddenLineAspect () { - if (myHiddenLineAspect.IsNull()) - myHiddenLineAspect = new Prs3d_LineAspect - (Quantity_NOC_YELLOW,Aspect_TOL_DASH,0.5); - - return myHiddenLineAspect; -} +// ======================================================================= +// function : SetLineAspect +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetHiddenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) { - myHiddenLineAspect = anAspect; +void Prs3d_Drawer::SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect) +{ + myLineAspect = theAspect; + myHasOwnLineAspect = !myLineAspect.IsNull(); } -Handle (Prs3d_LineAspect) Prs3d_Drawer::SeenLineAspect () { - if (mySeenLineAspect.IsNull()) - mySeenLineAspect = new Prs3d_LineAspect - (Quantity_NOC_YELLOW,Aspect_TOL_SOLID,1.); - - return mySeenLineAspect; -} +// ======================================================================= +// function : TextAspect +// purpose : +// ======================================================================= -void Prs3d_Drawer::SetSeenLineAspect ( const Handle(Prs3d_LineAspect)& anAspect) { - mySeenLineAspect = anAspect; +const Handle(Prs3d_TextAspect)& Prs3d_Drawer::TextAspect() +{ + if (!HasOwnTextAspect()) + { + if (!myLink.IsNull()) + { + return myLink->TextAspect(); + } + if (myTextAspect.IsNull()) + { + myTextAspect = new Prs3d_TextAspect(); + } + } + return myTextAspect; } -Handle (Prs3d_LineAspect) Prs3d_Drawer::VectorAspect () { - if (myVectorAspect.IsNull()) - myVectorAspect = new Prs3d_LineAspect - (Quantity_NOC_SKYBLUE,Aspect_TOL_SOLID,1.); +// ======================================================================= +// function : SetTextAspect +// purpose : +// ======================================================================= - return myVectorAspect; +void Prs3d_Drawer::SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect) +{ + myTextAspect = theAspect; + myHasOwnTextAspect = !myTextAspect.IsNull(); } -void Prs3d_Drawer::SetVectorAspect ( const Handle(Prs3d_LineAspect)& anAspect) { - myVectorAspect = anAspect; +// ======================================================================= +// function : ShadingAspect +// purpose : +// ======================================================================= + +const Handle(Prs3d_ShadingAspect)& Prs3d_Drawer::ShadingAspect() +{ + if (!HasOwnShadingAspect()) + { + if (!myLink.IsNull()) + { + return myLink->ShadingAspect(); + } + if (myShadingAspect.IsNull()) + { + myShadingAspect = new Prs3d_ShadingAspect(); + } + } + return myShadingAspect; } -Handle (Prs3d_DatumAspect) Prs3d_Drawer::DatumAspect () { - if (myDatumAspect.IsNull()) - myDatumAspect = new Prs3d_DatumAspect; +// ======================================================================= +// function : SetShadingAspect +// purpose : +// ======================================================================= - return myDatumAspect; +void Prs3d_Drawer::SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect) +{ + myShadingAspect = theAspect; + myHasOwnShadingAspect = !myShadingAspect.IsNull(); } -void Prs3d_Drawer::SetDatumAspect ( const Handle(Prs3d_DatumAspect)& anAspect) { - myDatumAspect = anAspect; +// ======================================================================= +// function : SetShadingAspectGlobal +// purpose : +// ======================================================================= + +void Prs3d_Drawer::SetShadingAspectGlobal (const Standard_Boolean theValue) +{ + myHasOwnShadingAspectGlobal = Standard_True; + myShadingAspectGlobal = theValue; } -Handle (Prs3d_PlaneAspect) Prs3d_Drawer::PlaneAspect () { - if (myPlaneAspect.IsNull()) - myPlaneAspect = new Prs3d_PlaneAspect; +// ======================================================================= +// function : PlaneAspect +// purpose : +// ======================================================================= +const Handle(Prs3d_PlaneAspect)& Prs3d_Drawer::PlaneAspect() +{ + if (!HasOwnPlaneAspect()) + { + if (!myLink.IsNull()) + { + return myLink->PlaneAspect(); + } + if (myPlaneAspect.IsNull()) + { + myPlaneAspect = new Prs3d_PlaneAspect(); + } + } return myPlaneAspect; } -void Prs3d_Drawer::SetPlaneAspect ( const Handle(Prs3d_PlaneAspect)& anAspect) { - myPlaneAspect = anAspect; +// ======================================================================= +// function : SetPlaneAspect +// purpose : +// ======================================================================= + +void Prs3d_Drawer::SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect) +{ + myPlaneAspect = theAspect; + myHasOwnPlaneAspect = !myPlaneAspect.IsNull(); } // ======================================================================= -// function : DimensionAspect +// function : SeenLineAspect // purpose : // ======================================================================= -Handle(Prs3d_DimensionAspect) Prs3d_Drawer::DimensionAspect() + +const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SeenLineAspect() { - if (myDimensionAspect.IsNull()) + if (!HasOwnSeenLineAspect()) { - myDimensionAspect = new Prs3d_DimensionAspect; + if (!myLink.IsNull()) + { + return myLink->SeenLineAspect(); + } + if (mySeenLineAspect.IsNull()) + { + mySeenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_SOLID, 1.0); + } } - - return myDimensionAspect; + return mySeenLineAspect; } // ======================================================================= -// function : SetDimensionAspect +// function : SetSeenLineAspect // purpose : // ======================================================================= -void Prs3d_Drawer::SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect) + +void Prs3d_Drawer::SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect) { - myDimensionAspect = theAspect; + mySeenLineAspect = theAspect; + myHasOwnSeenLineAspect = !mySeenLineAspect.IsNull(); } // ======================================================================= -// function : SetDimLengthModelUnits +// function : ArrowAspect // purpose : // ======================================================================= -void Prs3d_Drawer::SetDimLengthModelUnits (const TCollection_AsciiString& theUnits) + +const Handle(Prs3d_ArrowAspect)& Prs3d_Drawer::ArrowAspect() { - myDimensionModelUnits.SetLengthUnits (theUnits); + if (!HasOwnArrowAspect()) + { + if (!myLink.IsNull()) + { + return myLink->ArrowAspect(); + } + if (myArrowAspect.IsNull()) + { + myArrowAspect = new Prs3d_ArrowAspect(); + } + } + return myArrowAspect; } // ======================================================================= -// function : SetDimAngleModelUnits +// function : SetArrowAspect // purpose : // ======================================================================= -void Prs3d_Drawer::SetDimAngleModelUnits (const TCollection_AsciiString& theUnits) + +void Prs3d_Drawer::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) { - myDimensionModelUnits.SetAngleUnits (theUnits); + myArrowAspect = theAspect; + myHasOwnArrowAspect = !myArrowAspect.IsNull(); } // ======================================================================= -// function : DimLengthModelUnits +// function : SetLineArrowDraw // purpose : // ======================================================================= -const TCollection_AsciiString& Prs3d_Drawer::DimLengthModelUnits() const + +void Prs3d_Drawer::SetLineArrowDraw (const Standard_Boolean theIsEnabled) { - return myDimensionModelUnits.GetLengthUnits(); + myHasOwnLineArrowDraw = Standard_True; + myLineArrowDraw = theIsEnabled; } // ======================================================================= -// function : DimAngleModelUnits +// function : HiddenLineAspect // purpose : // ======================================================================= -const TCollection_AsciiString& Prs3d_Drawer::DimAngleModelUnits() const + +const Handle(Prs3d_LineAspect)& Prs3d_Drawer::HiddenLineAspect() { - return myDimensionModelUnits.GetAngleUnits(); + if (!HasOwnHiddenLineAspect()) + { + if (!myLink.IsNull()) + { + return myLink->HiddenLineAspect(); + } + if (myHiddenLineAspect.IsNull()) + { + myHiddenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_DASH, 0.5); + } + } + return myHiddenLineAspect; } // ======================================================================= -// function : SetDimLengthDisplayUnits +// function : SetHiddenLineAspect // purpose : // ======================================================================= -void Prs3d_Drawer::SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits) + +void Prs3d_Drawer::SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect) { - myDimensionDisplayUnits.SetLengthUnits (theUnits); + myHiddenLineAspect = theAspect; + myHasOwnHiddenLineAspect = !myHiddenLineAspect.IsNull(); } // ======================================================================= -// function : SetDimAngleDisplayUnits +// function : EnableDrawHiddenLineDraw // purpose : // ======================================================================= -void Prs3d_Drawer::SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits) + +void Prs3d_Drawer::EnableDrawHiddenLine() { - myDimensionDisplayUnits.SetAngleUnits (theUnits); + myHasOwnDrawHiddenLine = Standard_True; + myDrawHiddenLine = Standard_True; } // ======================================================================= -// function : DimLengthDisplayUnits +// function : DisableDrawHiddenLine // purpose : // ======================================================================= -const TCollection_AsciiString& Prs3d_Drawer::DimLengthDisplayUnits() const + +void Prs3d_Drawer::DisableDrawHiddenLine() { - return myDimensionDisplayUnits.GetLengthUnits(); + myHasOwnDrawHiddenLine = Standard_True; + myDrawHiddenLine = Standard_False; } // ======================================================================= -// function : DimAngleDisplayUnits +// function : VectorAspect // purpose : // ======================================================================= -const TCollection_AsciiString& Prs3d_Drawer::DimAngleDisplayUnits() const + +const Handle(Prs3d_LineAspect)& Prs3d_Drawer::VectorAspect() { - return myDimensionDisplayUnits.GetAngleUnits(); + if (!HasOwnVectorAspect()) + { + if (!myLink.IsNull()) + { + return myLink->VectorAspect(); + } + if (myVectorAspect.IsNull()) + { + myVectorAspect = new Prs3d_LineAspect (Quantity_NOC_SKYBLUE, Aspect_TOL_SOLID, 1.0); + } + } + return myVectorAspect; } // ======================================================================= -// function : SectionAspect +// function : SetVectorAspect // purpose : // ======================================================================= -Handle (Prs3d_LineAspect) Prs3d_Drawer::SectionAspect() -{ - if (mySectionAspect.IsNull()) - { - mySectionAspect = new Prs3d_LineAspect (Quantity_NOC_ORANGE, Aspect_TOL_SOLID, 1.0); - } - return mySectionAspect; +void Prs3d_Drawer::SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect) +{ + myVectorAspect = theAspect; + myHasOwnVectorAspect = !myVectorAspect.IsNull(); } // ======================================================================= -// function : SetSectionAspect +// function : SetVertexDrawMode // purpose : // ======================================================================= -void Prs3d_Drawer::SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect) + +void Prs3d_Drawer::SetVertexDrawMode (const Prs3d_VertexDrawMode theMode) { - mySectionAspect = theAspect; + // Prs3d_VDM_Inherited is default value and means + // that correct value should be taken from the Link if it exists. + myVertexDrawMode = theMode; } // ======================================================================= -// function : SetFaceBoundaryDraw +// function : VertexDrawMode // purpose : // ======================================================================= -void Prs3d_Drawer::SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled) + +Prs3d_VertexDrawMode Prs3d_Drawer::VertexDrawMode() { - myFaceBoundaryDraw = theIsEnabled; + if (!HasOwnVertexDrawMode()) + { + if (!myLink.IsNull()) + { + return myLink->VertexDrawMode(); + } + // Prs3d_VDM_Isolated is default value for this setting. + myVertexDrawMode = Prs3d_VDM_Isolated; + } + return myVertexDrawMode; } // ======================================================================= -// function : IsFaceBoundaryDraw +// function : DatumAspect // purpose : // ======================================================================= -Standard_Boolean Prs3d_Drawer::IsFaceBoundaryDraw () const + +const Handle(Prs3d_DatumAspect)& Prs3d_Drawer::DatumAspect() { - return myFaceBoundaryDraw; + if (!HasOwnDatumAspect()) + { + if (!myLink.IsNull()) + { + return myLink->DatumAspect(); + } + if (myDatumAspect.IsNull()) + { + myDatumAspect = new Prs3d_DatumAspect(); + } + } + return myDatumAspect; } // ======================================================================= -// function : SetFaceBoundaryAspect +// function : SetDatumAspect // purpose : // ======================================================================= -void Prs3d_Drawer::SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect) + +void Prs3d_Drawer::SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect) { - myFaceBoundaryAspect = theAspect; + myDatumAspect = theAspect; + myHasOwnDatumAspect = !myDatumAspect.IsNull(); } // ======================================================================= -// function : FaceBoundaryAspect +// function : SectionAspect // purpose : // ======================================================================= -Handle(Prs3d_LineAspect) Prs3d_Drawer::FaceBoundaryAspect () + +const Handle(Prs3d_LineAspect)& Prs3d_Drawer::SectionAspect() { - if (myFaceBoundaryAspect.IsNull ()) + if (!HasOwnSectionAspect()) { - myFaceBoundaryAspect = - new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0); + if (!myLink.IsNull()) + { + return myLink->SectionAspect(); + } + if (mySectionAspect.IsNull()) + { + mySectionAspect = new Prs3d_LineAspect (Quantity_NOC_ORANGE, Aspect_TOL_SOLID, 1.0); + } } - - return myFaceBoundaryAspect; + return mySectionAspect; } // ======================================================================= -// function : SetTypeOfHLR -// purpose : set type of HLR algorithm +// function : SetSectionAspect +// purpose : // ======================================================================= -void Prs3d_Drawer::SetTypeOfHLR ( const Prs3d_TypeOfHLR theTypeOfHLR) + +void Prs3d_Drawer::SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect) { - myTypeOfHLR = theTypeOfHLR; + mySectionAspect = theAspect; + myHasOwnSectionAspect = !mySectionAspect.IsNull(); } // ======================================================================= -// function : TypeOfHLR -// purpose : gets type of HLR algorithm +// function : SetSectionAspect +// purpose : // ======================================================================= -Prs3d_TypeOfHLR Prs3d_Drawer::TypeOfHLR ( ) const + +void Prs3d_Drawer::ClearLocalAttributes() { - return myTypeOfHLR; + if (myLink.IsNull()) + { + return; + } + + myUIsoAspect.Nullify(); + myVIsoAspect.Nullify(); + myFreeBoundaryAspect.Nullify(); + myUnFreeBoundaryAspect.Nullify(); + myFaceBoundaryAspect.Nullify(); + myWireAspect.Nullify(); + myLineAspect.Nullify(); + myTextAspect.Nullify(); + myShadingAspect.Nullify(); + myPointAspect.Nullify(); + myPlaneAspect.Nullify(); + myArrowAspect.Nullify(); + myHiddenLineAspect.Nullify(); + mySeenLineAspect.Nullify(); + myVectorAspect .Nullify(); + myDatumAspect.Nullify(); + myDimensionAspect.Nullify(); + mySectionAspect.Nullify(); + + myHasOwnUIsoAspect = Standard_False; + myHasOwnVIsoAspect = Standard_False; + myHasOwnWireAspect = Standard_False; + myHasOwnPointAspect = Standard_False; + myHasOwnLineAspect = Standard_False; + myHasOwnTextAspect = Standard_False; + myHasOwnShadingAspect = Standard_False; + myHasOwnPlaneAspect = Standard_False; + myHasOwnSeenLineAspect = Standard_False; + myHasOwnArrowAspect = Standard_False; + myHasOwnHiddenLineAspect = Standard_False; + myHasOwnVectorAspect = Standard_False; + myHasOwnDatumAspect = Standard_False; + myHasOwnSectionAspect = Standard_False; + myHasOwnFreeBoundaryAspect = Standard_False; + myHasOwnUnFreeBoundaryAspect = Standard_False; + myHasOwnFaceBoundaryAspect = Standard_False; + myHasOwnDimensionAspect = Standard_False; + + myHasOwnNbPoints = Standard_False; + myHasOwnMaximalParameterValue = Standard_False; + myHasOwnTypeOfDeflection = Standard_False; + myHasOwnChordialDeviation = Standard_False; + myHasOwnDeviationCoefficient = Standard_False; + myHasOwnHLRDeviationCoefficient = Standard_False; + myHasOwnDeviationAngle = Standard_False; + myHasOwnHLRDeviationAngle = Standard_False; + myHasOwnIsoOnPlane = Standard_False; + myHasOwnWireDraw = Standard_False; + myHasOwnShadingAspectGlobal = Standard_False; + myHasOwnLineArrowDraw = Standard_False; + myHasOwnDrawHiddenLine = Standard_False; + myHasOwnFreeBoundaryDraw = Standard_False; + myHasOwnUnFreeBoundaryDraw = Standard_False; + myHasOwnFaceBoundaryDraw = Standard_False; + myHasOwnDimLengthModelUnits = Standard_False; + myHasOwnDimLengthDisplayUnits = Standard_False; + myHasOwnDimAngleModelUnits = Standard_False; + myHasOwnDimAngleDisplayUnits = Standard_False; + + myVertexDrawMode = Prs3d_VDM_Inherited; + myTypeOfHLR = Prs3d_TOH_NotSet; } diff --git a/src/Prs3d/Prs3d_Drawer.hxx b/src/Prs3d/Prs3d_Drawer.hxx new file mode 100644 index 0000000000..58232df8d7 --- /dev/null +++ b/src/Prs3d/Prs3d_Drawer.hxx @@ -0,0 +1,910 @@ +// Copyright (c) 1995-1999 Matra Datavision +// Copyright (c) 1999-2014 OPEN CASCADE SAS +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _Prs3d_Drawer_HeaderFile +#define _Prs3d_Drawer_HeaderFile + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Prs3d_IsoAspect; +class Prs3d_LineAspect; +class Prs3d_TextAspect; +class Prs3d_ShadingAspect; +class Prs3d_PointAspect; +class Prs3d_PlaneAspect; +class Prs3d_ArrowAspect; +class Prs3d_DatumAspect; +class Prs3d_DimensionAspect; +class TCollection_AsciiString; + +DEFINE_STANDARD_HANDLE(Prs3d_Drawer, MMgt_TShared) + +//! A graphic attribute manager which governs how +//! objects such as color, width, line thickness and deflection are displayed. +//! A drawer includes an instance of the Aspect classes with particular default values. +class Prs3d_Drawer : public MMgt_TShared +{ + +public: + + //! Default constructor. + Standard_EXPORT Prs3d_Drawer(); + + //! Sets the type of chordal deflection. + //! This indicates whether the deflection value is absolute or relative to the size of the object. + Standard_EXPORT void SetTypeOfDeflection (const Aspect_TypeOfDeflection theTypeOfDeflection); + + //! Returns the type of chordal deflection. + //! This indicates whether the deflection value is absolute or relative to the size of the object. + Aspect_TypeOfDeflection TypeOfDeflection() const + { + return HasOwnTypeOfDeflection() || myLink.IsNull() + ? myTypeOfDeflection + : myLink->TypeOfDeflection(); + } + + //! Returns true if the drawer has a type of deflection setting active. + Standard_Boolean HasOwnTypeOfDeflection() const { return myHasOwnTypeOfDeflection; } + + //! Defines the maximal chordial deviation when drawing any curve. + //! Even if the type of deviation is set to TOD_Relative, this value is used by: + //! Prs3d_DeflectionCurve + //! Prs3d_WFDeflectionSurface + //! Prs3d_WFDeflectionRestrictedFace + Standard_EXPORT void SetMaximalChordialDeviation (const Quantity_Length theChordialDeviation); + + //! Returns the maximal chordal deviation. The default value is 0.1. + //! Drawings of curves or patches are made with respect to an absolute maximal chordal deviation. + Quantity_Length MaximalChordialDeviation() const + { + return HasOwnMaximalChordialDeviation() || myLink.IsNull() + ? myChordialDeviation + : myLink->MaximalChordialDeviation(); + } + + //! Returns true if the drawer has a maximal chordial deviation setting active. + Standard_Boolean HasOwnMaximalChordialDeviation() const { return myHasOwnChordialDeviation; } + + //! Sets the type of HLR algorithm used by drawer's interactive objects + Standard_EXPORT void SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR); + + //! Returns the type of HLR algorithm currently in use. + Standard_EXPORT Prs3d_TypeOfHLR TypeOfHLR(); + + //! Returns true if the type of HLR is not equal to Prs3d_TOH_NotSet. + Standard_Boolean HasOwnTypeOfHLR() const { return (myTypeOfHLR != Prs3d_TOH_NotSet); } + + //! Defines the maximum value allowed for the first and last + //! parameters of an infinite curve. + Standard_EXPORT void SetMaximalParameterValue (const Standard_Real theValue); + + //! Sets the maximum value allowed for the first and last + //! parameters of an infinite curve. By default, this value is 500000. + Standard_Real MaximalParameterValue() const + { + return HasOwnMaximalParameterValue() || myLink.IsNull() + ? myMaximalParameterValue + : myLink->MaximalParameterValue(); + } + + //! Returns true if the drawer has a maximum value allowed for the first and last + //! parameters of an infinite curve setting active. + Standard_Boolean HasOwnMaximalParameterValue() const { return myHasOwnMaximalParameterValue; } + + //! Sets IsoOnPlane on or off by setting the parameter theIsEnabled to true or false. + Standard_EXPORT void SetIsoOnPlane (const Standard_Boolean theIsEnabled); + + //! Returns True if the drawing of isos on planes is enabled. + Standard_Boolean IsoOnPlane() const + { + return HasOwnIsoOnPlane() || myLink.IsNull() + ? myIsoOnPlane + : myLink->IsoOnPlane(); + } + + //! Returns true if the drawer has IsoOnPlane setting active. + Standard_Boolean HasOwnIsoOnPlane() const { return myHasOwnIsoOnPlane; } + + //! Sets the discretisation parameter theValue. + Standard_EXPORT void SetDiscretisation (const Standard_Integer theValue); + + //! Returns the discretisation setting. + Standard_Integer Discretisation() const + { + return HasOwnDiscretisation() || myLink.IsNull() + ? myNbPoints + : myLink->Discretisation(); + } + + //! Returns true if the drawer has discretisation setting active. + Standard_Boolean HasOwnDiscretisation() const { return myHasOwnNbPoints; } + + //! Sets the deviation coefficient theCoefficient. + //! Also sets the hasOwnDeviationCoefficient flag to Standard_True and myPreviousDeviationCoefficient + Standard_EXPORT void SetDeviationCoefficient (const Standard_Real theCoefficient); + + //! Returns the deviation coefficient. + //! Drawings of curves or patches are made with respect + //! to a maximal chordal deviation. A Deviation coefficient + //! is used in the shading display mode. The shape is + //! seen decomposed into triangles. These are used to + //! calculate reflection of light from the surface of the + //! object. The triangles are formed from chords of the + //! curves in the shape. The deviation coefficient gives + //! the highest value of the angle with which a chord can + //! deviate from a tangent to a curve. If this limit is + //! reached, a new triangle is begun. + //! This deviation is absolute and is set through the + //! method: SetMaximalChordialDeviation. The default value is 0.001. + //! In drawing shapes, however, you are allowed to ask + //! for a relative deviation. This deviation will be: + //! SizeOfObject * DeviationCoefficient. + Standard_Real DeviationCoefficient() const + { + return HasOwnDeviationCoefficient() || myLink.IsNull() + ? myDeviationCoefficient + : myLink->DeviationCoefficient(); + } + + //! Sets the hasOwnDeviationCoefficient flag to Standard_False + void SetDeviationCoefficient() + { + myHasOwnDeviationCoefficient = Standard_False; + } + + //! Returns true if there is a local setting for deviation + //! coefficient in this framework for a specific interactive object. + Standard_Boolean HasOwnDeviationCoefficient() const { return myHasOwnDeviationCoefficient; } + + //! Saves the previous value used for the chordal + //! deviation coefficient. + Standard_Real PreviousDeviationCoefficient() const + { + return myHasOwnDeviationCoefficient + ? myPreviousDeviationCoefficient + : 0.0; + } + + //! Sets the deviation coefficient aCoefficient for removal + //! of hidden lines created by different viewpoints in + //! different presentations. The Default value is 0.02. + //! Also sets the hasOwnHLRDeviationCoefficient flag to Standard_True and myPreviousHLRDeviationCoefficient + Standard_EXPORT void SetHLRDeviationCoefficient (const Standard_Real theCoefficient); + + //! Returns the real number value of the hidden line + //! removal deviation coefficient in this framework, if the flag + //! hasOwnHLRDeviationCoefficient is true or there is no Link. + //! Else the shape's HLR deviation coefficient is used. + //! A Deviation coefficient is used in the shading display + //! mode. The shape is seen decomposed into triangles. + //! These are used to calculate reflection of light from the + //! surface of the object. + //! The triangles are formed from chords of the curves in + //! the shape. The deviation coefficient give the highest + //! value of the angle with which a chord can deviate + //! from a tangent to a curve. If this limit is reached, a new triangle is begun. + //! To find the hidden lines, hidden line display mode + //! entails recalculation of the view at each different projector perspective. + //! Since hidden lines entail calculations of more than + //! usual complexity to decompose them into these + //! triangles, a deviation coefficient allowing greater + //! tolerance is used. This increases efficiency in calculation. + //! The Default value is 0.02. + Standard_Real HLRDeviationCoefficient() const + { + return HasOwnHLRDeviationCoefficient() || myLink.IsNull() + ? myHLRDeviationCoefficient + : myLink->HLRDeviationCoefficient(); + } + + //! Sets the hasOwnHLRDeviationCoefficient flag to Standard_False + void SetHLRDeviationCoefficient() + { + myHasOwnHLRDeviationCoefficient = Standard_False; + } + + //! Returns true if the there is a setting for HLR deviation + //! coefficient in this framework for a specific interactive object. + Standard_Boolean HasOwnHLRDeviationCoefficient() const { return myHasOwnHLRDeviationCoefficient; } + + //! Returns the previous value of the hidden line removal deviation coefficient. + Standard_Real PreviousHLRDeviationCoefficient() const + { + return myHasOwnHLRDeviationCoefficient + ? myPreviousHLRDeviationCoefficient + : 0.0; + } + + //! Sets the deviation angle theAngle. + //! Also sets the hasOwnDeviationAngle flag to Standard_True, and myPreviousDeviationAngle. + Standard_EXPORT void SetDeviationAngle (const Standard_Real theAngle); + + //! Returns the value for deviation angle. + Standard_Real DeviationAngle() const + { + return HasOwnDeviationAngle() || myLink.IsNull() + ? myDeviationAngle + : myLink->DeviationAngle(); + } + + //! Sets the hasOwnDeviationAngle flag to Standard_False + void SetDeviationAngle() + { + myHasOwnDeviationAngle = Standard_False; + } + + //! Returns true if the there is a local setting for deviation + //! angle in this framework for a specific interactive object. + Standard_Boolean HasOwnDeviationAngle() const { return myHasOwnDeviationAngle; } + + //! Returns the previous deviation angle + Standard_Real PreviousDeviationAngle() const + { + return myHasOwnDeviationAngle + ? myPreviousDeviationAngle + : 0.0; + } + + //! Sets anAngle, the angle of maximum chordal deviation for removal of hidden lines created by + //! different viewpoints in different presentations. + //! The default value is 20 * M_PI / 180. + //! Also sets the hasOwnHLRDeviationAngle flag to Standard_True and myPreviousHLRDeviationAngle. + Standard_EXPORT void SetHLRAngle (const Standard_Real theAngle); + + //! Returns the real number value of the deviation angle + //! in hidden line removal views. The default value is 20 * M_PI / 180. + Standard_Real HLRAngle() const + { + return HasOwnHLRDeviationAngle() || myLink.IsNull() + ? myHLRAngle + : myLink->HLRAngle(); + } + + //! Sets the hasOwnHLRDeviationAngle flag to Standard_False + void SetHLRAngle() + { + myHasOwnHLRDeviationAngle = Standard_False; + } + + //! Returns true if the there is a setting for HLR deviation + //! angle in this framework for a specific interactive object. + Standard_Boolean HasOwnHLRDeviationAngle() const { return myHasOwnHLRDeviationAngle; } + + //! Returns the previous value of the HLR deviation angle. + Standard_Real PreviousHLRDeviationAngle() const + { + return myHasOwnHLRDeviationAngle + ? myPreviousHLRDeviationAngle + : 0.0; + } + + //! Defines the attributes which are used when drawing an + //! U isoparametric curve of a face. Defines the number + //! of U isoparametric curves to be drawn for a single face. + //! The LineAspect for U isoparametric lines can be edited + //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber) + //! The default values are: + //! COLOR : Quantity_NOC_GRAY75 + //! TYPE OF LINE: Aspect_TOL_SOLID + //! WIDTH : 0.5 + //! + //! These attributes are used by the following algorithms: + //! Prs3d_WFDeflectionSurface + //! Prs3d_WFDeflectionRestrictedFace + Standard_EXPORT const Handle(Prs3d_IsoAspect)& UIsoAspect(); + + Standard_EXPORT void SetUIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! UIso aspect that overrides the one in the link. + Standard_Boolean HasOwnUIsoAspect() const { return myHasOwnUIsoAspect; } + + //! Defines the attributes which are used when drawing an + //! V isoparametric curve of a face. Defines the number + //! of V isoparametric curves to be drawn for a single face. + //! The LineAspect for V isoparametric lines can be edited + //! (methods SetColor, SetTypeOfLine, SetWidth, SetNumber) + //! The default values are: + //! COLOR : Quantity_NOC_GRAY82 + //! TYPE OF LINE: Aspect_TOL_SOLID + //! WIDTH : 0.5 + //! + //! These attributes are used by the following algorithms: + //! Prs3d_WFDeflectionSurface + //! Prs3d_WFDeflectionRestrictedFace + Standard_EXPORT const Handle(Prs3d_IsoAspect)& VIsoAspect(); + + //! Sets the appearance of V isoparameters - theAspect. + Standard_EXPORT void SetVIsoAspect (const Handle(Prs3d_IsoAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! VIso aspect that overrides the one in the link. + Standard_Boolean HasOwnVIsoAspect() const { return myHasOwnVIsoAspect; } + + //! Returns wire aspect settings. + //! The LineAspect for the free boundaries can be edited. + //! The default values are: + //! Color: Quantity_NOC_GREEN + //! Type of line: Aspect_TOL_SOLID + //! Width: 1.0 + //! These attributes are used by the algorithm Prs3d_WFShape. + Standard_EXPORT const Handle(Prs3d_LineAspect)& WireAspect(); + + //! Sets the parameter theAspect for display of wires. + Standard_EXPORT void SetWireAspect (const Handle(Prs3d_LineAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! wire aspect that overrides the one in the link. + Standard_Boolean HasOwnWireAspect() const { return myHasOwnWireAspect; } + + //! Sets WireDraw on or off by setting the parameter theIsEnabled to true or false. + Standard_EXPORT void SetWireDraw(const Standard_Boolean theIsEnabled); + + //! Returns True if the drawing of the wire is enabled. + Standard_Boolean WireDraw() const + { + return HasOwnWireDraw() || myLink.IsNull() + ? myWireDraw + : myLink->WireDraw(); + } + + //! Returns true if the drawer has its own attribute for + //! "draw wires" flag that overrides the one in the link. + Standard_Boolean HasOwnWireDraw() const { return myHasOwnWireDraw; } + + //! Returns the point aspect setting. The default values are + //! Color: Quantity_NOC_YELLOW + //! Type of marker: Aspect_TOM_PLUS + //! Scale: 1.0 + //! These attributes are used by the algorithms Prs3d_Point. + Standard_EXPORT const Handle(Prs3d_PointAspect)& PointAspect(); + + //! Sets the parameter theAspect for display attributes of points + Standard_EXPORT void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! point aspect that overrides the one in the link. + Standard_Boolean HasOwnPointAspect() const { return myHasOwnPointAspect; } + + //! Returns settings for line aspects. + //! These settings can be edited. The default values are: + //! Color: Quantity_NOC_YELLOW + //! Type of line: Aspect_TOL_SOLID + //! Width: 1.0 + //! These attributes are used by the following algorithms: + //! Prs3d_Curve + //! Prs3d_Line + //! Prs3d_HLRShape + Standard_EXPORT const Handle(Prs3d_LineAspect)& LineAspect(); + + //! Sets the parameter theAspect for display attributes of lines. + Standard_EXPORT void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! line aspect that overrides the one in the link. + Standard_Boolean HasOwnLineAspect() const { return myHasOwnLineAspect; } + + //! Returns settings for text aspect. + //! These settings can be edited. The default value is: + //! - Color: Quantity_NOC_YELLOW + Standard_EXPORT const Handle(Prs3d_TextAspect)& TextAspect(); + + //! Sets the parameter theAspect for display attributes of text. + Standard_EXPORT void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! text aspect that overrides the one in the link. + Standard_Boolean HasOwnTextAspect() const { return myHasOwnTextAspect; } + + //! Returns settings for shading aspects. + //! These settings can be edited. The default values are: + //! - Color: Quantity_NOC_YELLOW + //! - Material: Graphic3d_NOM_BRASS + //! Shading aspect is obtained through decomposition of + //! 3d faces into triangles, each side of each triangle + //! being a chord of the corresponding curved edge in the face. + //! Reflection of light in each projector perspective is then calculated for each of the + //! resultant triangular planes. + Standard_EXPORT const Handle(Prs3d_ShadingAspect)& ShadingAspect(); + + //! Sets the parameter theAspect for display attributes of shading. + Standard_EXPORT void SetShadingAspect (const Handle(Prs3d_ShadingAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! shading aspect that overrides the one in the link. + Standard_Boolean HasOwnShadingAspect() const { return myHasOwnShadingAspect; } + + //! Returns True if the ShadingAspect is applied + //! to the whole presentation. + Standard_Boolean ShadingAspectGlobal() const + { + return HasOwnShadingAspectGlobal() || myLink.IsNull() + ? myShadingAspectGlobal + : myLink->ShadingAspectGlobal(); + } + + //! Indicates that the ShadingAspect will be apply + //! to the whole presentation. This allows to modify + //! the aspect without recomputing the content of the presentation. + Standard_EXPORT void SetShadingAspectGlobal (const Standard_Boolean theValue); + + //! Returns true if the drawer has its own attribute for + //! ShadingAspectGlobal flag that overrides the one in the link. + Standard_Boolean HasOwnShadingAspectGlobal() const { return myHasOwnShadingAspectGlobal; } + + //! Returns settings for seen line aspects. + //! These settings can be edited. The default values are: + //! Color: Quantity_NOC_YELLOW + //! Type of line: Aspect_TOL_SOLID + //! Width: 1.0 + Standard_EXPORT const Handle(Prs3d_LineAspect)& SeenLineAspect(); + + //! Sets the parameter theAspect for the display of seen lines in hidden line removal mode. + Standard_EXPORT void SetSeenLineAspect (const Handle(Prs3d_LineAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! seen line aspect that overrides the one in the link. + Standard_Boolean HasOwnSeenLineAspect() const { return myHasOwnSeenLineAspect; } + + //! Returns settings for the appearance of planes. + Standard_EXPORT const Handle(Prs3d_PlaneAspect)& PlaneAspect(); + + //! Sets the parameter theAspect for the display of planes. + Standard_EXPORT void SetPlaneAspect (const Handle(Prs3d_PlaneAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! plane aspect that overrides the one in the link. + Standard_Boolean HasOwnPlaneAspect() const { return myHasOwnPlaneAspect; } + + //! Returns the attributes for display of arrows. + Standard_EXPORT const Handle(Prs3d_ArrowAspect)& ArrowAspect(); + + //! Sets the parameter theAspect for display attributes of arrows. + Standard_EXPORT void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! arrow aspect that overrides the one in the link. + Standard_Boolean HasOwnArrowAspect() const { return myHasOwnArrowAspect; } + + //! Enables the drawing of an arrow at the end of each line. + //! By default the arrows are not drawn. + Standard_EXPORT void SetLineArrowDraw (const Standard_Boolean theIsEnabled); + + //! Returns True if drawing an arrow at the end of each edge is enabled + //! and False otherwise (the default). + Standard_Boolean LineArrowDraw() const + { + return HasOwnLineArrowDraw() || myLink.IsNull() + ? myLineArrowDraw + : myLink->LineArrowDraw(); + } + + //! Returns true if the drawer has its own attribute for + //! "draw arrow" flag that overrides the one in the link. + Standard_Boolean HasOwnLineArrowDraw() const + { + return myHasOwnLineArrowDraw; + } + + //! Returns settings for hidden line aspects. + //! These settings can be edited. The default values are: + //! Color: Quantity_NOC_YELLOW + //! Type of line: Aspect_TOL_DASH + //! Width: 1.0 + Standard_EXPORT const Handle(Prs3d_LineAspect)& HiddenLineAspect(); + + //! Sets the parameter theAspect for the display of hidden lines in hidden line removal mode. + Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! hidden lines aspect that overrides the one in the link. + Standard_Boolean HasOwnHiddenLineAspect() const { return myHasOwnHiddenLineAspect; } + + //! Returns Standard_True if the hidden lines are to be drawn. + //! By default the hidden lines are not drawn. + Standard_Boolean DrawHiddenLine() const + { + return HasOwnDrawHiddenLine() || myLink.IsNull() + ? myDrawHiddenLine + : myLink->DrawHiddenLine(); + } + + //! Enables the DrawHiddenLine function. + Standard_EXPORT void EnableDrawHiddenLine(); + + //! Disables the DrawHiddenLine function. + Standard_EXPORT void DisableDrawHiddenLine(); + + //! Returns true if the drawer has its own attribute for + //! "draw hidden lines" flag that overrides the one in the link. + Standard_Boolean HasOwnDrawHiddenLine() const { return myHasOwnDrawHiddenLine; } + + //! Returns settings for the appearance of vectors. + //! These settings can be edited. The default values are: + //! Color: Quantity_NOC_SKYBLUE + //! Type of line: Aspect_TOL_SOLID + //! Width: 1.0 + Standard_EXPORT const Handle(Prs3d_LineAspect)& VectorAspect(); + + //! Sets the modality theAspect for the display of vectors. + Standard_EXPORT void SetVectorAspect (const Handle(Prs3d_LineAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! vector aspect that overrides the one in the link. + Standard_Boolean HasOwnVectorAspect() const { return myHasOwnVectorAspect; } + + //! Sets the mode of visualization of vertices of a TopoDS_Shape instance. + //! By default, only stand-alone vertices (not belonging topologically to an edge) are drawn, + //! that corresponds to Prs3d_VDM_Standalone mode. + //! Switching to Prs3d_VDM_Standalone mode makes all shape's vertices visible. + //! To inherit this parameter from the global drawer instance ("the link") when it is present, + //! Prs3d_VDM_Inherited value should be used. + Standard_EXPORT void SetVertexDrawMode (const Prs3d_VertexDrawMode theMode); + + //! Returns the current mode of visualization of vertices of a TopoDS_Shape instance. + Standard_EXPORT Prs3d_VertexDrawMode VertexDrawMode(); + + //! Returns true if the vertex draw mode is not equal to Prs3d_VDM_Inherited. + //! This means that individual vertex draw mode value (i.e. not inherited from the global + //! drawer) is used for a specific interactive object. + Standard_Boolean HasOwnVertexDrawMode() const { return (myVertexDrawMode != Prs3d_VDM_Inherited); } + + //! Returns settings for the appearance of datums. + //! These settings can be edited. The default values for the three axes are: + //! Color: Quantity_NOC_PEACHPUFF + //! Type of line: Aspect_TOL_SOLID + //! Width: 1.0 + Standard_EXPORT const Handle(Prs3d_DatumAspect)& DatumAspect(); + + //! Sets the modality theAspect for the display of datums. + Standard_EXPORT void SetDatumAspect (const Handle(Prs3d_DatumAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! datum aspect that overrides the one in the link. + Standard_Boolean HasOwnDatumAspect() const { return myHasOwnDatumAspect; } + + //! The LineAspect for the wire can be edited. + //! The default values are: + //! Color: Quantity_NOC_ORANGE + //! Type of line: Aspect_TOL_SOLID + //! Width: 1.0 + //! These attributes are used by the algorithm Prs3d_WFShape. + Standard_EXPORT const Handle(Prs3d_LineAspect)& SectionAspect(); + + //! Sets the parameter theAspect for display attributes of sections. + Standard_EXPORT void SetSectionAspect (const Handle(Prs3d_LineAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! section aspect that overrides the one in the link. + Standard_Boolean HasOwnSectionAspect() const { return myHasOwnSectionAspect; } + + //! Sets the parameter theAspect for the display of free boundaries. + //! The method sets aspect owned by the drawer that will be used during + //! visualization instead of the one set in link. + Standard_EXPORT void SetFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect); + + //! Returns the values for presentation of free boundaries, + //! in other words, boundaries which are not shared. + //! The LineAspect for the free boundaries can be edited. + //! The default values are: + //! Color: Quantity_NOC_GREEN + //! Type of line: Aspect_TOL_SOLID + //! Width: 1.0 + //! These attributes are used by the algorithm Prs3d_WFShape + Standard_EXPORT const Handle(Prs3d_LineAspect)& FreeBoundaryAspect(); + + //! Returns true if the drawer has its own attribute for + //! free boundaries aspect that overrides the one in the link. + Standard_Boolean HasOwnFreeBoundaryAspect() const { return myHasOwnFreeBoundaryAspect; } + + //! Enables or disables drawing of free boundaries for shading presentations. + //! The method sets drawing flag owned by the drawer that will be used during + //! visualization instead of the one set in link. + //! theIsEnabled is a boolean flag indicating whether the free boundaries should be + //! drawn or not. + Standard_EXPORT void SetFreeBoundaryDraw (const Standard_Boolean theIsEnabled); + + //! Returns True if the drawing of the free boundaries is enabled + //! True is the default setting. + Standard_Boolean FreeBoundaryDraw() const + { + return HasOwnFreeBoundaryDraw() || myLink.IsNull() + ? myFreeBoundaryDraw + : myLink->FreeBoundaryDraw(); + } + + //! Returns true if the drawer has its own attribute for + //! "draw free boundaries" flag that overrides the one in the link. + Standard_Boolean HasOwnFreeBoundaryDraw() const { return myHasOwnFreeBoundaryDraw; } + + //! Sets the parameter theAspect for the display of shared boundaries. + //! The method sets aspect owned by the drawer that will be used during + //! visualization instead of the one set in link. + Standard_EXPORT void SetUnFreeBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect); + + //! Returns settings for shared boundary line aspects. + //! The LineAspect for the unfree boundaries can be edited. + //! The default values are: + //! Color: Quantity_NOC_YELLOW + //! Type of line: Aspect_TOL_SOLID + //! Width: 1. + //! These attributes are used by the algorithm Prs3d_WFShape + Standard_EXPORT const Handle(Prs3d_LineAspect)& UnFreeBoundaryAspect(); + + //! Returns true if the drawer has its own attribute for + //! unfree boundaries aspect that overrides the one in the link. + Standard_Boolean HasOwnUnFreeBoundaryAspect() const { return myHasOwnUnFreeBoundaryAspect; } + + //! Enables or disables drawing of shared boundaries for shading presentations. + //! The method sets drawing flag owned by the drawer that will be used during + //! visualization instead of the one set in link. + //! theIsEnabled is a boolean flag indicating whether the shared boundaries should be drawn or not. + Standard_EXPORT void SetUnFreeBoundaryDraw (const Standard_Boolean theIsEnabled); + + //! Returns True if the drawing of the shared boundaries is enabled. + //! True is the default setting. + Standard_Boolean UnFreeBoundaryDraw() const + { + return HasOwnUnFreeBoundaryDraw() || myLink.IsNull() + ? myUnFreeBoundaryDraw + : myLink->UnFreeBoundaryDraw(); + } + + //! Returns true if the drawer has its own attribute for + //! "draw shared boundaries" flag that overrides the one in the link. + Standard_Boolean HasOwnUnFreeBoundaryDraw() const { return myHasOwnUnFreeBoundaryDraw; } + + //! Sets line aspect for face boundaries. + //! The method sets line aspect owned by the drawer that will be used during + //! visualization instead of the one set in link. + //! theAspect is the line aspect that determines the look of the face boundaries. + Standard_EXPORT void SetFaceBoundaryAspect (const Handle(Prs3d_LineAspect)& theAspect); + + //! Returns line aspect of face boundaries. + Standard_EXPORT const Handle(Prs3d_LineAspect)& FaceBoundaryAspect(); + + //! Returns true if the drawer has its own attribute for + //! face boundaries aspect that overrides the one in the link. + Standard_Boolean HasOwnFaceBoundaryAspect() const { return myHasOwnFaceBoundaryAspect; } + + //! Enables or disables face boundary drawing for shading presentations. + //! The method sets drawing flag owned by the drawer that will be used during + //! visualization instead of the one set in link. + //! theIsEnabled is a boolean flag indicating whether the face boundaries should be drawn or not. + Standard_EXPORT void SetFaceBoundaryDraw (const Standard_Boolean theIsEnabled); + + //! Checks whether the face boundary drawing is enabled or not. + Standard_Boolean FaceBoundaryDraw() const + { + return HasOwnFaceBoundaryDraw() || myLink.IsNull() + ? myFaceBoundaryDraw + : myLink->FaceBoundaryDraw(); + } + + //! Returns true if the drawer has its own attribute for + //! "draw face boundaries" flag that overrides the one in the link. + Standard_Boolean HasOwnFaceBoundaryDraw() const { return myHasOwnFaceBoundaryDraw; } + + //! Returns settings for the appearance of dimensions. + Standard_EXPORT const Handle(Prs3d_DimensionAspect)& DimensionAspect(); + + //! Sets the settings for the appearance of dimensions. + //! The method sets aspect owned by the drawer that will be used during + //! visualization instead of the one set in link. + Standard_EXPORT void SetDimensionAspect (const Handle(Prs3d_DimensionAspect)& theAspect); + + //! Returns true if the drawer has its own attribute for + //! the appearance of dimensions that overrides the one in the link. + Standard_Boolean HasOwnDimensionAspect() const { return myHasOwnDimensionAspect; } + + //! Sets dimension length model units for computing of dimension presentation. + //! The method sets value owned by the drawer that will be used during + //! visualization instead of the one set in link. + Standard_EXPORT void SetDimLengthModelUnits (const TCollection_AsciiString& theUnits); + + //! Sets dimension angle model units for computing of dimension presentation. + //! The method sets value owned by the drawer that will be used during + //! visualization instead of the one set in link. + Standard_EXPORT void SetDimAngleModelUnits (const TCollection_AsciiString& theUnits); + + //! Returns length model units for the dimension presentation. + const TCollection_AsciiString& DimLengthModelUnits() const + { + return HasOwnDimLengthModelUnits() || myLink.IsNull() + ? myDimensionModelUnits.GetLengthUnits() + : myLink->DimLengthModelUnits(); + } + + //! Returns angle model units for the dimension presentation. + const TCollection_AsciiString& DimAngleModelUnits() const + { + return HasOwnDimAngleModelUnits() || myLink.IsNull() + ? myDimensionModelUnits.GetAngleUnits() + : myLink->DimAngleModelUnits(); + } + + //! Returns true if the drawer has its own attribute for + //! dimension length model units that overrides the one in the link. + Standard_Boolean HasOwnDimLengthModelUnits() const { return myHasOwnDimLengthModelUnits; } + + //! Returns true if the drawer has its own attribute for + //! dimension angle model units that overrides the one in the link. + Standard_Boolean HasOwnDimAngleModelUnits() const { return myHasOwnDimAngleModelUnits; } + + //! Sets length units in which value for dimension presentation is displayed. + //! The method sets value owned by the drawer that will be used during + //! visualization instead of the one set in link. + Standard_EXPORT void SetDimLengthDisplayUnits (const TCollection_AsciiString& theUnits); + + //! Sets angle units in which value for dimension presentation is displayed. + //! The method sets value owned by the drawer that will be used during + //! visualization instead of the one set in link. + Standard_EXPORT void SetDimAngleDisplayUnits (const TCollection_AsciiString& theUnits); + + //! Returns length units in which dimension presentation is displayed. + const TCollection_AsciiString& DimLengthDisplayUnits() const + { + return HasOwnDimLengthDisplayUnits() || myLink.IsNull() + ? myDimensionDisplayUnits.GetLengthUnits() + : myLink->DimLengthDisplayUnits(); + } + + //! Returns angle units in which dimension presentation is displayed. + const TCollection_AsciiString& DimAngleDisplayUnits() const + { + return HasOwnDimAngleDisplayUnits() || myLink.IsNull() + ? myDimensionDisplayUnits.GetAngleUnits() + : myLink->DimAngleDisplayUnits(); + } + + //! Returns true if the drawer has its own attribute for + //! length units in which dimension presentation is displayed + //! that overrides the one in the link. + Standard_Boolean HasOwnDimLengthDisplayUnits() const { return myHasOwnDimLengthDisplayUnits; } + + //! Returns true if the drawer has its own attribute for + //! angle units in which dimension presentation is displayed + //! that overrides the one in the link. + Standard_Boolean HasOwnDimAngleDisplayUnits() const { return myHasOwnDimAngleDisplayUnits; } + + //! Returns the drawer to which the current object references. + const Handle(Prs3d_Drawer)& Link() { return myLink; } + + //! Returns true if the current object has a link on the other drawer. + Standard_Boolean HasLink() const { return !myLink.IsNull(); } + + //! Sets theDrawer as a link to which the current object references. + void Link (const Handle(Prs3d_Drawer)& theDrawer) + { + myLink = theDrawer; + } + + //! Removes local attributes. + Standard_EXPORT void ClearLocalAttributes(); + +protected: + + Handle(Prs3d_Drawer) myLink; + + Standard_Integer myNbPoints; + Standard_Boolean myHasOwnNbPoints; + Standard_Real myMaximalParameterValue; + Standard_Boolean myHasOwnMaximalParameterValue; + Quantity_Length myChordialDeviation; + Standard_Boolean myHasOwnChordialDeviation; + Aspect_TypeOfDeflection myTypeOfDeflection; + Standard_Boolean myHasOwnTypeOfDeflection; + Prs3d_TypeOfHLR myTypeOfHLR; + Standard_Real myDeviationCoefficient; + Standard_Real myPreviousDeviationCoefficient; + Standard_Boolean myHasOwnDeviationCoefficient; + Standard_Real myHLRDeviationCoefficient; + Standard_Boolean myHasOwnHLRDeviationCoefficient; + Standard_Real myPreviousHLRDeviationCoefficient; + Standard_Real myDeviationAngle; + Standard_Boolean myHasOwnDeviationAngle; + Standard_Real myPreviousDeviationAngle; + Standard_Real myHLRAngle; + Standard_Boolean myHasOwnHLRDeviationAngle; + Standard_Real myPreviousHLRDeviationAngle; + Standard_Boolean myIsoOnPlane; + Standard_Boolean myHasOwnIsoOnPlane; + + Handle(Prs3d_IsoAspect) myUIsoAspect; + Standard_Boolean myHasOwnUIsoAspect; + Handle(Prs3d_IsoAspect) myVIsoAspect; + Standard_Boolean myHasOwnVIsoAspect; + Handle(Prs3d_LineAspect) myWireAspect; + Standard_Boolean myHasOwnWireAspect; + Standard_Boolean myWireDraw; + Standard_Boolean myHasOwnWireDraw; + Handle(Prs3d_PointAspect) myPointAspect; + Standard_Boolean myHasOwnPointAspect; + Handle(Prs3d_LineAspect) myLineAspect; + Standard_Boolean myHasOwnLineAspect; + Handle(Prs3d_TextAspect) myTextAspect; + Standard_Boolean myHasOwnTextAspect; + Handle(Prs3d_ShadingAspect) myShadingAspect; + Standard_Boolean myHasOwnShadingAspect; + Standard_Boolean myShadingAspectGlobal; + Standard_Boolean myHasOwnShadingAspectGlobal; + Handle(Prs3d_PlaneAspect) myPlaneAspect; + Standard_Boolean myHasOwnPlaneAspect; + Handle(Prs3d_LineAspect) mySeenLineAspect; + Standard_Boolean myHasOwnSeenLineAspect; + Handle(Prs3d_ArrowAspect) myArrowAspect; + Standard_Boolean myHasOwnArrowAspect; + Standard_Boolean myLineArrowDraw; + Standard_Boolean myHasOwnLineArrowDraw; + Handle(Prs3d_LineAspect) myHiddenLineAspect; + Standard_Boolean myHasOwnHiddenLineAspect; + Standard_Boolean myDrawHiddenLine; + Standard_Boolean myHasOwnDrawHiddenLine; + Handle(Prs3d_LineAspect) myVectorAspect; + Standard_Boolean myHasOwnVectorAspect; + Prs3d_VertexDrawMode myVertexDrawMode; + Handle(Prs3d_DatumAspect) myDatumAspect; + Standard_Boolean myHasOwnDatumAspect; + Handle(Prs3d_LineAspect) mySectionAspect; + Standard_Boolean myHasOwnSectionAspect; + + Handle(Prs3d_LineAspect) myFreeBoundaryAspect; + Standard_Boolean myHasOwnFreeBoundaryAspect; + Standard_Boolean myFreeBoundaryDraw; + Standard_Boolean myHasOwnFreeBoundaryDraw; + Handle(Prs3d_LineAspect) myUnFreeBoundaryAspect; + Standard_Boolean myHasOwnUnFreeBoundaryAspect; + Standard_Boolean myUnFreeBoundaryDraw; + Standard_Boolean myHasOwnUnFreeBoundaryDraw; + Handle(Prs3d_LineAspect) myFaceBoundaryAspect; + Standard_Boolean myHasOwnFaceBoundaryAspect; + Standard_Boolean myFaceBoundaryDraw; + Standard_Boolean myHasOwnFaceBoundaryDraw; + + Handle(Prs3d_DimensionAspect) myDimensionAspect; + Standard_Boolean myHasOwnDimensionAspect; + Prs3d_DimensionUnits myDimensionModelUnits; + Standard_Boolean myHasOwnDimLengthModelUnits; + Standard_Boolean myHasOwnDimAngleModelUnits; + Prs3d_DimensionUnits myDimensionDisplayUnits; + Standard_Boolean myHasOwnDimLengthDisplayUnits; + Standard_Boolean myHasOwnDimAngleDisplayUnits; + +public: + + DEFINE_STANDARD_RTTI(Prs3d_Drawer) + +}; + +#endif // _Prs3d_Drawer_HeaderFile diff --git a/src/Prs3d/Prs3d_IsoAspect.cdl b/src/Prs3d/Prs3d_IsoAspect.cdl index 58aeebd457..c659bdf4c5 100644 --- a/src/Prs3d/Prs3d_IsoAspect.cdl +++ b/src/Prs3d/Prs3d_IsoAspect.cdl @@ -17,7 +17,7 @@ class IsoAspect from Prs3d inherits LineAspect from Prs3d ---Purpose: A framework to define the display attributes of isoparameters. -- This framework can be used to modify the default - -- setting for isoparameters in AIS_Drawer. + -- setting for isoparameters in Prs3d_Drawer. uses diff --git a/src/QABugs/QABugs_17.cxx b/src/QABugs/QABugs_17.cxx index d0045cce41..7a3ea386af 100644 --- a/src/QABugs/QABugs_17.cxx +++ b/src/QABugs/QABugs_17.cxx @@ -1311,8 +1311,8 @@ static Standard_Integer OCC1188 (Draw_Interpretor& di, Standard_Integer argc, co return 0; } -#include #include +#include #include //======================================================================= //function : OCC1174_1 @@ -1326,44 +1326,47 @@ static Standard_Integer OCC1174_1 (Draw_Interpretor& di, Standard_Integer argc, return 1; } - Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext(); - if(AISContext.IsNull()) + Handle(AIS_InteractiveContext) anAISContext = ViewerTest::GetAISContext(); + if(anAISContext.IsNull()) { di << "use 'vinit' command before " << argv[0] << "\n"; return 1; } - TopoDS_Shape sh = DBRep::Get(argv[1]); + TopoDS_Shape aShape = DBRep::Get(argv[1]); + + Handle(AIS_Shape) anAisIO = new AIS_Shape(aShape); - Handle(AIS_Shape) ais = new AIS_Shape(sh); + Quantity_Color aColF(0.0, 0.4, 0.0, Quantity_TOC_RGB); + Quantity_Color aColB(0.0, 0.0, 0.6, Quantity_TOC_RGB); - Quantity_Color colf(0.0, 0.4, 0.0, Quantity_TOC_RGB); - Quantity_Color colb(0.0, 0.0, 0.6, Quantity_TOC_RGB); + Handle(Prs3d_Drawer) aDrawer = anAisIO->Attributes(); + Handle(Prs3d_ShadingAspect) aShadingAspect = aDrawer->ShadingAspect(); - Handle(Prs3d_ShadingAspect) sa = ais->Attributes()->ShadingAspect(); + Graphic3d_MaterialAspect aFront = aShadingAspect->Material(Aspect_TOFM_FRONT_SIDE); + aFront.SetAmbientColor(aColF); + aFront.SetDiffuseColor(aColF); + aFront.SetSpecularColor(aColF); + aFront.SetEmissiveColor(aColF); + aFront.SetTransparency(0.0); + aShadingAspect->SetMaterial(aFront,Aspect_TOFM_FRONT_SIDE); - Graphic3d_MaterialAspect front = sa->Material(Aspect_TOFM_FRONT_SIDE); - front.SetAmbientColor(colf); - front.SetDiffuseColor(colf); - front.SetSpecularColor(colf); - front.SetEmissiveColor(colf); - front.SetTransparency(0.0); - sa->SetMaterial(front,Aspect_TOFM_FRONT_SIDE); + Graphic3d_MaterialAspect aBack = aShadingAspect->Material(Aspect_TOFM_BACK_SIDE); + aBack.SetAmbientColor(aColB); + aBack.SetDiffuseColor(aColB); + aBack.SetSpecularColor(aColB); + aBack.SetEmissiveColor(aColB); + aBack.SetTransparency(0.0); + aShadingAspect->SetMaterial(aBack,Aspect_TOFM_BACK_SIDE); - Graphic3d_MaterialAspect back = sa->Material(Aspect_TOFM_BACK_SIDE); - back.SetAmbientColor(colb); - back.SetDiffuseColor(colb); - back.SetSpecularColor(colb); - back.SetEmissiveColor(colb); - back.SetTransparency(0.0); - sa->SetMaterial(back,Aspect_TOFM_BACK_SIDE); + aDrawer->SetShadingAspect (aShadingAspect); - AISContext->Display(ais,1,0); + anAISContext->Display(anAisIO, 1, 0); Standard_Real r, g, b; - sa->Color(Aspect_TOFM_FRONT_SIDE).Values(r,g,b, Quantity_TOC_RGB); + aShadingAspect->Color(Aspect_TOFM_FRONT_SIDE).Values(r,g,b, Quantity_TOC_RGB); di << "Info: color on front side (" << r << "," << g << "," << b << ")\n"; - sa->Color(Aspect_TOFM_BACK_SIDE).Values(r,g,b, Quantity_TOC_RGB); + aShadingAspect->Color(Aspect_TOFM_BACK_SIDE).Values(r,g,b, Quantity_TOC_RGB); di << "Info: color on back side (" << r << "," << g << "," << b << ")\n"; return 0; diff --git a/src/QABugs/QABugs_4.cxx b/src/QABugs/QABugs_4.cxx index 71a8099cb2..770b52a2c4 100644 --- a/src/QABugs/QABugs_4.cxx +++ b/src/QABugs/QABugs_4.cxx @@ -25,7 +25,7 @@ #include #include -#include +#include #include //#include @@ -47,7 +47,7 @@ static Standard_Integer BUC60738 (Draw_Interpretor& di, Standard_Integer /*argc* theAISShape->SetDisplayMode(1); //get the drawer - Handle(AIS_Drawer) theDrawer = theAISShape->Attributes(); + Handle(Prs3d_Drawer) theDrawer = theAISShape->Attributes(); Handle(Prs3d_ShadingAspect) theShadingAspect = theDrawer->ShadingAspect(); Handle(Graphic3d_AspectFillArea3d) theAspectFillArea3d = theShadingAspect->Aspect(); diff --git a/src/QABugs/QABugs_MyText.cxx b/src/QABugs/QABugs_MyText.cxx index 5fca3dced5..c1f5bf8de5 100644 --- a/src/QABugs/QABugs_MyText.cxx +++ b/src/QABugs/QABugs_MyText.cxx @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/QABugs/QABugs_PresentableObject.cxx b/src/QABugs/QABugs_PresentableObject.cxx index 6f2e305902..f4f2083886 100644 --- a/src/QABugs/QABugs_PresentableObject.cxx +++ b/src/QABugs/QABugs_PresentableObject.cxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include QABugs_PresentableObject::QABugs_PresentableObject(const PrsMgr_TypeOfPresentation3d theTypeOfPresentation3d) :AIS_InteractiveObject(theTypeOfPresentation3d) diff --git a/src/SelectMgr/SelectMgr_SelectableObject.cdl b/src/SelectMgr/SelectMgr_SelectableObject.cdl index 624e4019ad..e011f9805d 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.cdl +++ b/src/SelectMgr/SelectMgr_SelectableObject.cdl @@ -33,6 +33,7 @@ uses Selection from SelectMgr, SequenceOfSelection from SelectMgr, TypeOfPresentation3d from PrsMgr, + Drawer from Prs3d, Presentation from Prs3d, PresentationManager from PrsMgr, PresentationManager3d from PrsMgr, @@ -186,9 +187,21 @@ is ---Purpose: Set Z layer ID and update all presentations of the selectable object. -- The layers mechanism allows drawing objects in higher layers in overlay of objects in lower layers. + SetAttributes(me:mutable; theDrawer: Drawer from Prs3d) is virtual; + ---Purpose: Initializes the drawing tool theDrawer. + + Attributes(me) returns any Drawer from Prs3d; + ---C++: return const& + ---C++: inline + ---Purpose: Returns the attributes settings. + + UnsetAttributes(me:mutable) is virtual; + ---Purpose: Clears settings provided by the drawing tool theDrawer. + fields myselections : SequenceOfSelection is protected; + myDrawer : Drawer from Prs3d is protected; mycurrent : Integer; myAutoHilight : Boolean from Standard; diff --git a/src/SelectMgr/SelectMgr_SelectableObject.cxx b/src/SelectMgr/SelectMgr_SelectableObject.cxx index 070b52aa97..c65ba20d4b 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.cxx +++ b/src/SelectMgr/SelectMgr_SelectableObject.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -43,10 +44,11 @@ static Standard_Integer Search (const SelectMgr_SequenceOfSelection& seq, // Purpose : //================================================== -SelectMgr_SelectableObject::SelectMgr_SelectableObject( const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d):PrsMgr_PresentableObject(aTypeOfPresentation3d) -{ - myAutoHilight = Standard_True; -} +SelectMgr_SelectableObject::SelectMgr_SelectableObject( const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d): + PrsMgr_PresentableObject (aTypeOfPresentation3d), + myDrawer (new Prs3d_Drawer()), + myAutoHilight (Standard_True) +{} //================================================== @@ -352,3 +354,27 @@ void SelectMgr_SelectableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId) } } } + +//======================================================================= +//function : SetAttributes +//purpose : +//======================================================================= +void SelectMgr_SelectableObject::SetAttributes (const Handle(Prs3d_Drawer)& theDrawer) +{ + myDrawer = theDrawer; +} + +//======================================================================= +//function : UnsetAttributes +//purpose : +//======================================================================= +void SelectMgr_SelectableObject::UnsetAttributes() +{ + Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer(); + if (myDrawer->HasLink()) + { + aDrawer->Link (myDrawer->Link()); + } + myDrawer = aDrawer; +} + diff --git a/src/SelectMgr/SelectMgr_SelectableObject.lxx b/src/SelectMgr/SelectMgr_SelectableObject.lxx index 622fc478db..f140d68910 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.lxx +++ b/src/SelectMgr/SelectMgr_SelectableObject.lxx @@ -25,4 +25,7 @@ inline const Handle(SelectMgr_Selection)& SelectMgr_SelectableObject:: CurrentSelection() const {return myselections(mycurrent);} +inline const Handle(Prs3d_Drawer)& SelectMgr_SelectableObject:: +Attributes() const +{return myDrawer;} diff --git a/src/StdPrs/StdPrs_ShadedShape.cxx b/src/StdPrs/StdPrs_ShadedShape.cxx index d6e8403257..444d4d411a 100644 --- a/src/StdPrs/StdPrs_ShadedShape.cxx +++ b/src/StdPrs/StdPrs_ShadedShape.cxx @@ -544,7 +544,7 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs, (theVolume == StdPrs_Volume_Closed ? Standard_True : Standard_False)); } - if (theDrawer->IsFaceBoundaryDraw()) + if (theDrawer->FaceBoundaryDraw()) { computeFaceBoundaries (theShape, thePrs, theDrawer); } diff --git a/src/TPrsStd/TPrsStd.cdl b/src/TPrsStd/TPrsStd.cdl index f9cb3ebd17..af05292801 100644 --- a/src/TPrsStd/TPrsStd.cdl +++ b/src/TPrsStd/TPrsStd.cdl @@ -38,7 +38,8 @@ uses TDataXtd, Geom, TopoDS, - gp + gp, + Prs3d is diff --git a/src/TPrsStd/TPrsStd_AISPresentation.cdl b/src/TPrsStd/TPrsStd_AISPresentation.cdl index 84b2402e8b..3e474f3f5f 100644 --- a/src/TPrsStd/TPrsStd_AISPresentation.cdl +++ b/src/TPrsStd/TPrsStd_AISPresentation.cdl @@ -43,7 +43,7 @@ uses GUID from Standard, NameOfColor from Quantity, PlaneAngle from Quantity, NameOfMaterial from Graphic3d, - Drawer from AIS + Drawer from Prs3d is GetID (myclass) returns GUID from Standard; diff --git a/src/TPrsStd/TPrsStd_AxisDriver.cxx b/src/TPrsStd/TPrsStd_AxisDriver.cxx index 03fdd3b1ec..4af5c6929d 100644 --- a/src/TPrsStd/TPrsStd_AxisDriver.cxx +++ b/src/TPrsStd/TPrsStd_AxisDriver.cxx @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/src/TPrsStd/TPrsStd_ConstraintDriver.cxx b/src/TPrsStd/TPrsStd_ConstraintDriver.cxx index 1898ad049a..0d86b88eb9 100644 --- a/src/TPrsStd/TPrsStd_ConstraintDriver.cxx +++ b/src/TPrsStd/TPrsStd_ConstraintDriver.cxx @@ -20,7 +20,6 @@ #include #include #include -#include #include #include diff --git a/src/TPrsStd/TPrsStd_ConstraintTools.cxx b/src/TPrsStd/TPrsStd_ConstraintTools.cxx index 57cc9d33dd..b6e162bb7b 100644 --- a/src/TPrsStd/TPrsStd_ConstraintTools.cxx +++ b/src/TPrsStd/TPrsStd_ConstraintTools.cxx @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include @@ -90,6 +89,7 @@ #include #include +#include static Standard_Boolean CheckShapesPair(const TopoDS_Shape& , const TopoDS_Shape& ); //ota @@ -312,7 +312,7 @@ void TPrsStd_ConstraintTools::ComputeDistance (const Handle(TDataXtd_Constraint) Standard_Boolean isEdge = Standard_False; Standard_Boolean SaveDrw = Standard_False; - Handle(AIS_Drawer) aDrawer; + Handle(Prs3d_Drawer) aDrawer; Handle(AIS_LengthDimension) aDim; if (!theAIS.IsNull()) @@ -1810,7 +1810,7 @@ void TPrsStd_ConstraintTools::ComputeOffset (const Handle(TDataXtd_Constraint)& Standard_Real val1; TCollection_ExtendedString txt; Handle(AIS_LengthDimension) ais; - //Handle(AIS_Drawer) aDrawer; + //Handle(Prs3d_Drawer) aDrawer; if (nbgeom == 1) { diff --git a/src/TPrsStd/TPrsStd_GeometryDriver.cxx b/src/TPrsStd/TPrsStd_GeometryDriver.cxx index 369361f4f5..99ee3e9fad 100644 --- a/src/TPrsStd/TPrsStd_GeometryDriver.cxx +++ b/src/TPrsStd/TPrsStd_GeometryDriver.cxx @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/src/TPrsStd/TPrsStd_PlaneDriver.cxx b/src/TPrsStd/TPrsStd_PlaneDriver.cxx index 6c30f3dc42..a7207bc246 100644 --- a/src/TPrsStd/TPrsStd_PlaneDriver.cxx +++ b/src/TPrsStd/TPrsStd_PlaneDriver.cxx @@ -18,7 +18,6 @@ //#include #include #include -#include #include #include #include diff --git a/src/TPrsStd/TPrsStd_PointDriver.cxx b/src/TPrsStd/TPrsStd_PointDriver.cxx index 2b2115ea87..bd678bc932 100644 --- a/src/TPrsStd/TPrsStd_PointDriver.cxx +++ b/src/TPrsStd/TPrsStd_PointDriver.cxx @@ -18,7 +18,6 @@ #include //#include #include -#include #include #include #include diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index 7790ba10e0..60505dc2c8 100644 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -58,8 +57,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -90,8 +91,9 @@ extern int ViewerMainLoop(Standard_Integer argc, const char** argv); #include -#define DEFAULT_COLOR Quantity_NOC_GOLDENROD -#define DEFAULT_MATERIAL Graphic3d_NOM_BRASS +#define DEFAULT_COLOR Quantity_NOC_GOLDENROD +#define DEFAULT_FREEBOUNDARY_COLOR Quantity_NOC_GREEN +#define DEFAULT_MATERIAL Graphic3d_NOM_BRASS //======================================================================= //function : GetColorFromName @@ -594,7 +596,7 @@ static int visos (Draw_Interpretor& di, Standard_Integer argc, const char** argv if (anObj->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) { const Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (anObj); - Handle(AIS_Drawer) CurDrawer = aShape->Attributes(); + Handle(Prs3d_Drawer) CurDrawer = aShape->Attributes(); Handle(Prs3d_IsoAspect) aUIso = CurDrawer->UIsoAspect(); Handle(Prs3d_IsoAspect) aVIso = CurDrawer->VIsoAspect(); @@ -1395,6 +1397,12 @@ struct ViewerTest_AspectsChangeSet NCollection_Sequence SubShapes; + Standard_Integer ToSetShowFreeBoundary; + Standard_Integer ToSetFreeBoundaryWidth; + Standard_Real FreeBoundaryWidth; + Standard_Integer ToSetFreeBoundaryColor; + Quantity_Color FreeBoundaryColor; + //! Empty constructor ViewerTest_AspectsChangeSet() : ToSetVisibility (0), @@ -1406,16 +1414,24 @@ struct ViewerTest_AspectsChangeSet ToSetTransparency (0), Transparency (0.0), ToSetMaterial (0), - Material (Graphic3d_NOM_DEFAULT) {} + Material (Graphic3d_NOM_DEFAULT), + ToSetShowFreeBoundary (0), + ToSetFreeBoundaryWidth (0), + FreeBoundaryWidth (1.0), + ToSetFreeBoundaryColor (0), + FreeBoundaryColor (DEFAULT_FREEBOUNDARY_COLOR) {} //! @return true if no changes have been requested Standard_Boolean IsEmpty() const { - return ToSetVisibility == 0 - && ToSetLineWidth == 0 - && ToSetTransparency == 0 - && ToSetColor == 0 - && ToSetMaterial == 0; + return ToSetVisibility == 0 + && ToSetLineWidth == 0 + && ToSetTransparency == 0 + && ToSetColor == 0 + && ToSetMaterial == 0 + && ToSetShowFreeBoundary == 0 + && ToSetFreeBoundaryColor == 0 + && ToSetFreeBoundaryWidth == 0; } //! @return true if properties are valid @@ -1451,6 +1467,12 @@ struct ViewerTest_AspectsChangeSet std::cout << "Error: unknown material " << MatName << ".\n"; isOk = Standard_False; } + if (FreeBoundaryWidth <= 0.0 + || FreeBoundaryWidth > 10.0) + { + std::cout << "Error: the free boundary width should be within [1; 10] range (specified " << FreeBoundaryWidth << ")\n"; + isOk = Standard_False; + } return isOk; } @@ -1474,6 +1496,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, } Standard_Integer anArgIter = 1; + Standard_Boolean isDefaults = Standard_False; NCollection_Sequence aNames; for (; anArgIter < theArgNb; ++anArgIter) { @@ -1489,10 +1512,21 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, } else { + if (anArg == "-defaults") + { + isDefaults = Standard_True; + ++anArgIter; + } break; } } + if (!aNames.IsEmpty() && isDefaults) + { + std::cout << "Error: wrong syntax. If -defaults is used there should not be any objects' names!\n"; + return 1; + } + NCollection_Sequence aChanges; aChanges.Append (ViewerTest_AspectsChangeSet()); ViewerTest_AspectsChangeSet* aChangeSet = &aChanges.ChangeLast(); @@ -1770,6 +1804,12 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, else if (anArg == "-subshape" || anArg == "-subshapes") { + if (isDefaults) + { + std::cout << "Error: wrong syntax. -subshapes can not be used together with -defaults call!\n"; + return 1; + } + if (aNames.IsEmpty()) { std::cout << "Error: main objects should specified explicitly when -subshapes is used!\n"; @@ -1803,6 +1843,106 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, return 1; } } + else if (anArg == "-freeboundary" + || anArg == "-fb") + { + if (++anArgIter >= theArgNb) + { + std::cout << "Error: wrong syntax at " << anArg << "\n"; + return 1; + } + TCollection_AsciiString aValue (theArgVec[anArgIter]); + aValue.LowerCase(); + if (aValue == "on" + || aValue == "1") + { + aChangeSet->ToSetShowFreeBoundary = 1; + } + else if (aValue == "off" + || aValue == "0") + { + aChangeSet->ToSetShowFreeBoundary = -1; + } + else + { + std::cout << "Error: wrong syntax at " << anArg << "\n"; + return 1; + } + } + else if (anArg == "-setfreeboundarywidth" + || anArg == "-setfbwidth") + { + if (++anArgIter >= theArgNb) + { + std::cout << "Error: wrong syntax at " << anArg << "\n"; + return 1; + } + aChangeSet->ToSetFreeBoundaryWidth = 1; + aChangeSet->FreeBoundaryWidth = Draw::Atof (theArgVec[anArgIter]); + } + else if (anArg == "-unsetfreeboundarywidth" + || anArg == "-unsetfbwidth") + { + aChangeSet->ToSetFreeBoundaryWidth = -1; + aChangeSet->FreeBoundaryWidth = 1.0; + } + else if (anArg == "-setfreeboundarycolor" + || anArg == "-setfbcolor") + { + Standard_Integer aNbComps = 0; + Standard_Integer aCompIter = anArgIter + 1; + for (; aCompIter < theArgNb; ++aCompIter, ++aNbComps) + { + if (theArgVec[aCompIter][0] == '-') + { + break; + } + } + switch (aNbComps) + { + case 1: + { + Quantity_NameOfColor aColor = Quantity_NOC_BLACK; + Standard_CString aName = theArgVec[anArgIter + 1]; + if (!Quantity_Color::ColorFromName (aName, aColor)) + { + std::cout << "Error: unknown free boundary color name '" << aName << "'\n"; + return 1; + } + aChangeSet->FreeBoundaryColor = aColor; + break; + } + case 3: + { + Graphic3d_Vec3d anRgb; + anRgb.x() = Draw::Atof (theArgVec[anArgIter + 1]); + anRgb.y() = Draw::Atof (theArgVec[anArgIter + 2]); + anRgb.z() = Draw::Atof (theArgVec[anArgIter + 3]); + if (anRgb.x() < 0.0 || anRgb.x() > 1.0 + || anRgb.y() < 0.0 || anRgb.y() > 1.0 + || anRgb.z() < 0.0 || anRgb.z() > 1.0) + { + std::cout << "Error: free boundary RGB color values should be within range 0..1!\n"; + return 1; + } + aChangeSet->FreeBoundaryColor.SetValues (anRgb.x(), anRgb.y(), anRgb.z(), Quantity_TOC_RGB); + break; + } + default: + { + std::cout << "Error: wrong syntax at " << anArg << "\n"; + return 1; + } + } + aChangeSet->ToSetFreeBoundaryColor = 1; + anArgIter += aNbComps; + } + else if (anArg == "-unsetfreeboundarycolor" + || anArg == "-unsetfbcolor") + { + aChangeSet->ToSetFreeBoundaryColor = -1; + aChangeSet->FreeBoundaryColor = DEFAULT_FREEBOUNDARY_COLOR; + } else if (anArg == "-unset") { aChangeSet->ToSetVisibility = 1; @@ -1815,6 +1955,11 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, aChangeSet->Color = DEFAULT_COLOR; aChangeSet->ToSetMaterial = -1; aChangeSet->Material = Graphic3d_NOM_DEFAULT; + aChangeSet->ToSetShowFreeBoundary = -1; + aChangeSet->ToSetFreeBoundaryColor = -1; + aChangeSet->FreeBoundaryColor = DEFAULT_FREEBOUNDARY_COLOR; + aChangeSet->ToSetFreeBoundaryWidth = -1; + aChangeSet->FreeBoundaryWidth = 1.0; } else { @@ -1838,12 +1983,74 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, { aCtx->CloseLocalContext(); } + + // special case for -defaults parameter. + // all changed values will be set to DefaultDrawer. + if (isDefaults) + { + const Handle(Prs3d_Drawer)& aDrawer = aCtx->DefaultDrawer(); + + if (aChangeSet->ToSetLineWidth != 0) + { + aDrawer->LineAspect()->SetWidth (aChangeSet->LineWidth); + aDrawer->WireAspect()->SetWidth (aChangeSet->LineWidth); + aDrawer->UnFreeBoundaryAspect()->SetWidth (aChangeSet->LineWidth); + aDrawer->SeenLineAspect()->SetWidth (aChangeSet->LineWidth); + } + if (aChangeSet->ToSetColor != 0) + { + aDrawer->ShadingAspect()->SetColor (aChangeSet->Color); + aDrawer->LineAspect()->SetColor (aChangeSet->Color); + aDrawer->UnFreeBoundaryAspect()->SetColor (aChangeSet->Color); + aDrawer->SeenLineAspect()->SetColor (aChangeSet->Color); + aDrawer->WireAspect()->SetColor (aChangeSet->Color); + aDrawer->PointAspect()->SetColor (aChangeSet->Color); + } + if (aChangeSet->ToSetTransparency != 0) + { + aDrawer->ShadingAspect()->SetTransparency (aChangeSet->Transparency); + } + if (aChangeSet->ToSetMaterial != 0) + { + aDrawer->ShadingAspect()->SetMaterial (aChangeSet->Material); + } + if (aChangeSet->ToSetShowFreeBoundary == 1) + { + aDrawer->SetFreeBoundaryDraw (Standard_True); + } + else if (aChangeSet->ToSetShowFreeBoundary == -1) + { + aDrawer->SetFreeBoundaryDraw (Standard_False); + } + if (aChangeSet->ToSetFreeBoundaryWidth != 0) + { + aDrawer->FreeBoundaryAspect()->SetWidth (aChangeSet->FreeBoundaryWidth); + } + if (aChangeSet->ToSetFreeBoundaryColor != 0) + { + aDrawer->FreeBoundaryAspect()->SetColor (aChangeSet->FreeBoundaryColor); + } + + // redisplay all objects in context + for (ViewTest_PrsIter aPrsIter (aNames); aPrsIter.More(); aPrsIter.Next()) + { + Handle(AIS_InteractiveObject) aPrs = aPrsIter.Current(); + if (!aPrs.IsNull()) + { + aCtx->Redisplay (aPrs, Standard_False); + } + } + return 0; + } + for (ViewTest_PrsIter aPrsIter (aNames); aPrsIter.More(); aPrsIter.Next()) { - const TCollection_AsciiString& aName = aPrsIter.CurrentName(); - Handle(AIS_InteractiveObject) aPrs = aPrsIter.Current(); + const TCollection_AsciiString& aName = aPrsIter.CurrentName(); + Handle(AIS_InteractiveObject) aPrs = aPrsIter.Current(); + Handle(Prs3d_Drawer) aDrawer = aPrs->Attributes(); Handle(AIS_ColoredShape) aColoredPrs; Standard_Boolean toDisplay = Standard_False; + Standard_Boolean toRedisplay = Standard_False; if (aChanges.Length() > 1 || aChangeSet->ToSetVisibility == 1) { Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast (aPrs); @@ -1906,6 +2113,37 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, { aCtx->UnsetWidth (aPrs, Standard_False); } + if (!aDrawer.IsNull()) + { + if (aChangeSet->ToSetShowFreeBoundary == 1) + { + aDrawer->SetFreeBoundaryDraw (Standard_True); + toRedisplay = Standard_True; + } + else if (aChangeSet->ToSetShowFreeBoundary == -1) + { + aDrawer->SetFreeBoundaryDraw (Standard_False); + toRedisplay = Standard_True; + } + if (aChangeSet->ToSetFreeBoundaryWidth != 0) + { + Handle(Prs3d_LineAspect) aBoundaryAspect = + new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0); + *aBoundaryAspect->Aspect() = *aDrawer->FreeBoundaryAspect()->Aspect(); + aBoundaryAspect->SetWidth (aChangeSet->FreeBoundaryWidth); + aDrawer->SetFreeBoundaryAspect (aBoundaryAspect); + toRedisplay = Standard_True; + } + if (aChangeSet->ToSetFreeBoundaryColor != 0) + { + Handle(Prs3d_LineAspect) aBoundaryAspect = + new Prs3d_LineAspect (Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0); + *aBoundaryAspect->Aspect() = *aDrawer->FreeBoundaryAspect()->Aspect(); + aBoundaryAspect->SetColor (aChangeSet->FreeBoundaryColor); + aDrawer->SetFreeBoundaryAspect (aBoundaryAspect); + toRedisplay = Standard_True; + } + } for (aChangesIter.Next(); aChangesIter.More(); aChangesIter.Next()) { @@ -1938,6 +2176,10 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/, { aCtx->Display (aPrs, Standard_False); } + if (toRedisplay) + { + aCtx->Redisplay (aPrs, Standard_False); + } else if (!aColoredPrs.IsNull()) { aColoredPrs->Redisplay(); @@ -4659,16 +4901,23 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands) __FILE__,VSubInt,group); theCommands.Add("vaspects", - "vaspects [-noupdate|-update] [name1 [name2 [...]]]" + "vaspects [-noupdate|-update] [name1 [name2 [...]] | -defaults]" "\n\t\t: [-setvisibility 0|1]" "\n\t\t: [-setcolor ColorName] [-setcolor R G B] [-unsetcolor]" "\n\t\t: [-setmaterial MatName] [-unsetmaterial]" "\n\t\t: [-settransparency Transp] [-unsettransparency]" "\n\t\t: [-setwidth LineWidth] [-unsetwidth]" + "\n\t\t: [-freeBoundary {off/on | 0/1}]" + "\n\t\t: [-setFreeBoundaryWidth Width] [-unsetFreeBoundaryWidth]" + "\n\t\t: [-setFreeBoundaryColor {ColorName | R G B}] [-unsetFreeBoundaryColor]" "\n\t\t: [-subshapes subname1 [subname2 [...]]]" "\n\t\t: Manage presentation properties of all, selected or named objects." "\n\t\t: When -subshapes is specified than following properties will be" - "\n\t\t: assigned to specified sub-shapes.", + "\n\t\t: assigned to specified sub-shapes." + "\n\t\t: When -defaults is specified than presentation properties will be" + "\n\t\t: assigned to all objects that have not their own specified properties" + "\n\t\t: and to all objects to be displayed in the future." + "\n\t\t: If -defaults is used there should not be any objects' names and -subshapes specifier.", __FILE__,VAspects,group); theCommands.Add("vsetcolor", diff --git a/src/ViewerTest/ViewerTest_ObjectCommands.cxx b/src/ViewerTest/ViewerTest_ObjectCommands.cxx index 9a3c184a11..e422a01f6e 100644 --- a/src/ViewerTest/ViewerTest_ObjectCommands.cxx +++ b/src/ViewerTest/ViewerTest_ObjectCommands.cxx @@ -99,7 +99,6 @@ #include #include -#include #include #include #include @@ -128,6 +127,7 @@ #include #include +#include #include #include #include @@ -2514,10 +2514,13 @@ void MyTextClass::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresent aPresentation->Clear(); - if (!myDrawer->HasTextAspect()) + if (!myDrawer->HasOwnTextAspect()) { myDrawer->SetTextAspect (new Prs3d_TextAspect()); - *myDrawer->TextAspect()->Aspect() = *myDrawer->Link()->TextAspect()->Aspect(); + if(myDrawer->HasLink()) + { + *myDrawer->TextAspect()->Aspect() = *myDrawer->Link()->TextAspect()->Aspect(); + } } Handle(Prs3d_TextAspect) asp = myDrawer->TextAspect(); @@ -3771,6 +3774,7 @@ static Standard_Integer VConnect (Draw_Interpretor& /*di*/, continue; } anObject = new AIS_Shape (aTDShape); + aContext->Load (anObject); anObject->SetColor (ViewerTest::GetColorFromName (aColorName)); } diff --git a/src/ViewerTest/ViewerTest_OpenGlCommands.cxx b/src/ViewerTest/ViewerTest_OpenGlCommands.cxx index add97289d7..0ae4df393d 100644 --- a/src/ViewerTest/ViewerTest_OpenGlCommands.cxx +++ b/src/ViewerTest/ViewerTest_OpenGlCommands.cxx @@ -15,7 +15,6 @@ #include -#include #include #include #include @@ -34,6 +33,7 @@ #include #include #include +#include #include #include #include diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 03608ea625..cd0a073498 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -16,7 +16,6 @@ #include #include -#include #include #include #include @@ -73,6 +72,7 @@ #include #include #include +#include #ifdef WNT #undef DrawText diff --git a/src/XCAFPrs/XCAFPrs_AISObject.cxx b/src/XCAFPrs/XCAFPrs_AISObject.cxx index 0f94f57bec..ad7f157230 100644 --- a/src/XCAFPrs/XCAFPrs_AISObject.cxx +++ b/src/XCAFPrs/XCAFPrs_AISObject.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -209,46 +209,67 @@ void XCAFPrs_AISObject::Compute (const Handle(PrsMgr_PresentationManager3d)& the //function : SetColors //purpose : //======================================================================= -void XCAFPrs_AISObject::SetColors (const Handle(AIS_Drawer)& theDrawer, - const Quantity_Color& theColorCurv, - const Quantity_Color& theColorSurf) +void XCAFPrs_AISObject::SetColors (const Handle(Prs3d_Drawer)& theDrawer, + const Quantity_Color& theColorCurv, + const Quantity_Color& theColorSurf) { - if (!theDrawer->HasShadingAspect()) + if (!theDrawer->HasOwnShadingAspect()) { theDrawer->SetShadingAspect (new Prs3d_ShadingAspect()); - *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect(); + } } - if (!theDrawer->HasLineAspect()) + if (!theDrawer->HasOwnLineAspect()) { theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); - *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect(); + } } - if (!theDrawer->HasWireAspect()) + if (!theDrawer->HasOwnWireAspect()) { theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); - *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect(); + } } - if (!theDrawer->HasUIsoAspect()) + if (!theDrawer->HasOwnUIsoAspect()) { theDrawer->SetUIsoAspect (new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1)); - *theDrawer->UIsoAspect()->Aspect() = *theDrawer->Link()->UIsoAspect()->Aspect(); - theDrawer->UIsoAspect()->SetNumber (theDrawer->Link()->UIsoAspect()->Number()); + if (theDrawer->HasLink()) + { + *theDrawer->UIsoAspect()->Aspect() = *theDrawer->Link()->UIsoAspect()->Aspect(); + theDrawer->UIsoAspect()->SetNumber (theDrawer->Link()->UIsoAspect()->Number()); + } } - if (!theDrawer->HasVIsoAspect()) + if (!theDrawer->HasOwnVIsoAspect()) { theDrawer->SetVIsoAspect (new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1)); - *theDrawer->VIsoAspect()->Aspect() = *theDrawer->Link()->VIsoAspect()->Aspect(); - theDrawer->VIsoAspect()->SetNumber (theDrawer->Link()->VIsoAspect()->Number()); + if (theDrawer->HasLink()) + { + *theDrawer->VIsoAspect()->Aspect() = *theDrawer->Link()->VIsoAspect()->Aspect(); + theDrawer->VIsoAspect()->SetNumber (theDrawer->Link()->VIsoAspect()->Number()); + } } - if (!theDrawer->HasFreeBoundaryAspect()) + if (!theDrawer->HasOwnFreeBoundaryAspect()) { theDrawer->SetFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); - *theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->FreeBoundaryAspect()->Aspect() = *theDrawer->Link()->FreeBoundaryAspect()->Aspect(); + } } - if (!theDrawer->HasUnFreeBoundaryAspect()) + if (!theDrawer->HasOwnUnFreeBoundaryAspect()) { theDrawer->SetUnFreeBoundaryAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0)); - *theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect(); + if (theDrawer->HasLink()) + { + *theDrawer->UnFreeBoundaryAspect()->Aspect() = *theDrawer->Link()->UnFreeBoundaryAspect()->Aspect(); + } } theDrawer->UnFreeBoundaryAspect()->SetColor (theColorCurv); diff --git a/src/XCAFPrs/XCAFPrs_AISObject.hxx b/src/XCAFPrs/XCAFPrs_AISObject.hxx index de5e5e09a5..c213385c47 100644 --- a/src/XCAFPrs/XCAFPrs_AISObject.hxx +++ b/src/XCAFPrs/XCAFPrs_AISObject.hxx @@ -36,9 +36,9 @@ protected: const Standard_Integer theMode); //! Set colors to drawer - Standard_EXPORT void SetColors (const Handle(AIS_Drawer)& theDrawer, - const Quantity_Color& theColorCurv, - const Quantity_Color& theColorSurf); + Standard_EXPORT void SetColors (const Handle(Prs3d_Drawer)& theDrawer, + const Quantity_Color& theColorCurv, + const Quantity_Color& theColorSurf); //! Fills out a default style object which is used when styles are //! not explicitly defined in the document. diff --git a/src/XDEDRAW/XDEDRAW.cxx b/src/XDEDRAW/XDEDRAW.cxx index 0a688eda72..eef41eee5d 100644 --- a/src/XDEDRAW/XDEDRAW.cxx +++ b/src/XDEDRAW/XDEDRAW.cxx @@ -89,8 +89,8 @@ #include #include -#include #include +#include #include #include #include @@ -953,7 +953,7 @@ static Standard_Integer XShowFaceBoundary (Draw_Interpretor& di, } // get drawer - const Handle(AIS_Drawer)& aDrawer = anInteractive->Attributes (); + const Handle(Prs3d_Drawer)& aDrawer = anInteractive->Attributes (); // default attributes Quantity_Parameter aRed = 0.0; diff --git a/tests/bugs/vis/bug25773 b/tests/bugs/vis/bug25773 new file mode 100644 index 0000000000..e5ea2c481a --- /dev/null +++ b/tests/bugs/vis/bug25773 @@ -0,0 +1,26 @@ +puts "============" +puts "CR25773" +puts "Check that properties of object can be applied to it (set to its drawer)" +puts "============" +puts "" + +vinit View1 +vclear + +vaspects -defaults -setfreeboundarycolor 0 0 1 + +pcone c 0 5 10 +explode c F +vdisplay c_1; vfit + +set x 80 +set y 103 +checkcolor $x $y 0 0 1 + +vaspects c_1 -freeboundary off +checkcolor $x $y 0 0 0 + +vaspects c_1 -freeboundary on -setfreeboundarycolor 1 0 0 -setfreeboundarywidth 2 +checkcolor $x $y 1 0 0 + +set only_screen 1 -- 2.20.1