diff --git a/dox/dev_guides/upgrade/upgrade.md b/dox/dev_guides/upgrade/upgrade.md index 1846d04bc9..a01664d375 100644 --- a/dox/dev_guides/upgrade/upgrade.md +++ b/dox/dev_guides/upgrade/upgrade.md @@ -1738,6 +1738,12 @@ or updating presentation without recomputation (see *AIS_InteractiveObject::Sync * *Aspect_IS_HIDDENLINE* does not implicitly enables drawing mesh edges anymore. Specify Graphic3d_AspectFillArea3d::SetDrawEdges(true) with Graphic3d_AspectFillArea3d::SetInteriorStyle(Aspect_IS_HIDDENLINE) to get previous behavior of Aspect_IS_HIDDENLINE style. +@subsection upgrade_740_modedprs PrsMgr_ModedPresentation removal + +Proxy classes *Prs3d_Presentation*, *PrsMgr_ModedPresentation* and *PrsMgr_Prs* have been removed. +Code iterating through the list of low-level structures AIS_InteractiveObject::Presentations() should be updated to access PrsMgr_Presentation directly. +Forward declarations of *Prs3d_Presentation* should be corrected, since it is now a typedef to *Graphic3d_Structure*. + @subsection upgrade_740_geproj Custom defines within env.bat *env.bat* produced by Visual Studio project generator *genproj.bat* has been modified so that *%CSF_DEFINES%* variable is reset to initial state. diff --git a/src/AIS/AIS.cxx b/src/AIS/AIS.cxx index 60b6067de3..fa84613c2f 100644 --- a/src/AIS/AIS.cxx +++ b/src/AIS/AIS.cxx @@ -14,10 +14,10 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include #include #include -#include #include #include #include diff --git a/src/AIS/AIS.hxx b/src/AIS/AIS.hxx index 27559d4ec0..70cc8ce6a3 100644 --- a/src/AIS/AIS.hxx +++ b/src/AIS/AIS.hxx @@ -17,73 +17,26 @@ #ifndef _AIS_HeaderFile #define _AIS_HeaderFile +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -class gp_Pnt; -class TopoDS_Shape; -class gp_Lin; -class Geom_Curve; -class TopoDS_Edge; -class Geom_Plane; -class TopoDS_Vertex; -class TopoDS_Face; -class gp_Pln; -class Geom_Surface; -class gp_Dir; class Bnd_Box; -class gp_Elips; -class Prs3d_Presentation; -class AIS_Triangulation; -class AIS_InteractiveContext; -class AIS_GraphicTool; -class AIS_GlobalStatus; -class AIS_InteractiveObject; -class AIS_Point; -class AIS_Axis; -class AIS_Trihedron; -class AIS_PlaneTrihedron; -class AIS_Line; -class AIS_Circle; -class AIS_Plane; -class AIS_Shape; -class AIS_ConnectedInteractive; -class AIS_MultipleConnectedInteractive; -class AIS_DimensionOwner; -class AIS_Relation; -class AIS_EllipseRadiusDimension; -class AIS_MaxRadiusDimension; -class AIS_MinRadiusDimension; -class AIS_Chamf2dDimension; -class AIS_Chamf3dDimension; -class AIS_OffsetDimension; -class AIS_FixRelation; -class AIS_PerpendicularRelation; -class AIS_ParallelRelation; -class AIS_TangentRelation; -class AIS_ConcentricRelation; -class AIS_IdenticRelation; -class AIS_SymmetricRelation; -class AIS_MidPointRelation; -class AIS_EqualRadiusRelation; -class AIS_EqualDistanceRelation; -class AIS_TypeFilter; -class AIS_SignatureFilter; -class AIS_ExclusionFilter; -class AIS_AttributeFilter; -class AIS_C0RegularityFilter; -class AIS_BadEdgeFilter; -class AIS_Selection; - +class Geom_Curve; +class Geom_Plane; +class Geom_Surface; +class TopoDS_Edge; +class TopoDS_Face; +class TopoDS_Shape; +class TopoDS_Vertex; //! Application Interactive Services provide the means to create links between an application GUI viewer and //! the packages which are used to manage selection and presentation. diff --git a/src/AIS/AIS_Chamf2dDimension.hxx b/src/AIS/AIS_Chamf2dDimension.hxx index d7adc215db..278e80c4a4 100644 --- a/src/AIS/AIS_Chamf2dDimension.hxx +++ b/src/AIS/AIS_Chamf2dDimension.hxx @@ -17,29 +17,13 @@ #ifndef _AIS_Chamf2dDimension_HeaderFile #define _AIS_Chamf2dDimension_HeaderFile -#include -#include - -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -class TopoDS_Shape; +#include +#include +#include + class Geom_Plane; -class TCollection_ExtendedString; -class gp_Pnt; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; - -class AIS_Chamf2dDimension; DEFINE_STANDARD_HANDLE(AIS_Chamf2dDimension, AIS_Relation) //! A framework to define display of 2D chamfers. @@ -48,10 +32,9 @@ DEFINE_STANDARD_HANDLE(AIS_Chamf2dDimension, AIS_Relation) //! chamfer, or the angle if it is not. class AIS_Chamf2dDimension : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_Chamf2dDimension, AIS_Relation) public: - //! Constructs the display object for 2D chamfers. //! This object is defined by the face aFShape, the //! dimension aVal, the plane aPlane and the text aText. @@ -79,18 +62,7 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_Chamf2dDimension,AIS_Relation) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; @@ -101,14 +73,8 @@ private: gp_Pnt myPntAttach; gp_Dir myDir; - }; - #include - - - - #endif // _AIS_Chamf2dDimension_HeaderFile diff --git a/src/AIS/AIS_Chamf3dDimension.hxx b/src/AIS/AIS_Chamf3dDimension.hxx index 50d4ebf70e..1e8c6db2fe 100644 --- a/src/AIS/AIS_Chamf3dDimension.hxx +++ b/src/AIS/AIS_Chamf3dDimension.hxx @@ -17,28 +17,11 @@ #ifndef _AIS_Chamf3dDimension_HeaderFile #define _AIS_Chamf3dDimension_HeaderFile -#include -#include - -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -class TopoDS_Shape; -class TCollection_ExtendedString; -class gp_Pnt; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; +#include +#include +#include - -class AIS_Chamf3dDimension; DEFINE_STANDARD_HANDLE(AIS_Chamf3dDimension, AIS_Relation) //! A framework to define display of 3D chamfers. @@ -47,10 +30,9 @@ DEFINE_STANDARD_HANDLE(AIS_Chamf3dDimension, AIS_Relation) //! chamfer, or the angle if it is not. class AIS_Chamf3dDimension : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_Chamf3dDimension, AIS_Relation) public: - //! Constructs a display object for 3D chamfers. //! This object is defined by the shape aFShape, the //! dimension aVal and the text aText. @@ -78,19 +60,8 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_Chamf3dDimension,AIS_Relation) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -100,14 +71,8 @@ private: gp_Pnt myPntAttach; gp_Dir myDir; - }; - #include - - - - #endif // _AIS_Chamf3dDimension_HeaderFile diff --git a/src/AIS/AIS_ConcentricRelation.hxx b/src/AIS/AIS_ConcentricRelation.hxx index 620381a40f..af88f42ae8 100644 --- a/src/AIS/AIS_ConcentricRelation.hxx +++ b/src/AIS/AIS_ConcentricRelation.hxx @@ -17,24 +17,11 @@ #ifndef _AIS_ConcentricRelation_HeaderFile #define _AIS_ConcentricRelation_HeaderFile -#include -#include - -#include -#include -#include #include -#include -#include -#include -class TopoDS_Shape; +#include + class Geom_Plane; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; - -class AIS_ConcentricRelation; DEFINE_STANDARD_HANDLE(AIS_ConcentricRelation, AIS_Relation) //! A framework to define a constraint by a relation of @@ -44,10 +31,9 @@ DEFINE_STANDARD_HANDLE(AIS_ConcentricRelation, AIS_Relation) //! relation of concentricity can be extended. class AIS_ConcentricRelation : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_ConcentricRelation, AIS_Relation) public: - //! Constructs the display object for concentric relations //! between shapes. //! This object is defined by the two shapes, aFShape @@ -65,19 +51,8 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_ConcentricRelation,AIS_Relation) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -95,13 +70,6 @@ private: gp_Dir myDir; gp_Pnt myPnt; - }; - - - - - - #endif // _AIS_ConcentricRelation_HeaderFile diff --git a/src/AIS/AIS_ConnectedInteractive.cxx b/src/AIS/AIS_ConnectedInteractive.cxx index 6a655f6def..cd58808f14 100644 --- a/src/AIS/AIS_ConnectedInteractive.cxx +++ b/src/AIS/AIS_ConnectedInteractive.cxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -92,12 +91,12 @@ void AIS_ConnectedInteractive::connect (const Handle(AIS_InteractiveObject)& the void AIS_ConnectedInteractive::Disconnect() { - for(Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) + for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const Handle(PrsMgr_Presentation)& aPrs = myPresentations (aPrsIter).Presentation(); + const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value(); if (!aPrs.IsNull()) { - aPrs->Presentation()->DisconnectAll (Graphic3d_TOC_DESCENDANT); + aPrs->DisconnectAll (Graphic3d_TOC_DESCENDANT); } } } @@ -112,7 +111,7 @@ void AIS_ConnectedInteractive::Compute (const Handle(PrsMgr_PresentationManager3 if (HasConnection()) { thePrs->Clear (Standard_False); - thePrs->RemoveAll(); + thePrs->DisconnectAll (Graphic3d_TOC_DESCENDANT); if (!myReference->HasInteractiveContext()) { diff --git a/src/AIS/AIS_EqualDistanceRelation.hxx b/src/AIS/AIS_EqualDistanceRelation.hxx index ab21457501..b119072c56 100644 --- a/src/AIS/AIS_EqualDistanceRelation.hxx +++ b/src/AIS/AIS_EqualDistanceRelation.hxx @@ -17,32 +17,12 @@ #ifndef _AIS_EqualDistanceRelation_HeaderFile #define _AIS_EqualDistanceRelation_HeaderFile -#include -#include - -#include -#include #include -#include -#include -#include -#include -#include -#include -#include #include -class TopoDS_Shape; +#include + class Geom_Plane; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class TopoDS_Edge; -class Bnd_Box; -class gp_Pnt; -class TopoDS_Vertex; - -class AIS_EqualDistanceRelation; DEFINE_STANDARD_HANDLE(AIS_EqualDistanceRelation, AIS_Relation) //! A framework to display equivalent distances between @@ -52,10 +32,9 @@ DEFINE_STANDARD_HANDLE(AIS_EqualDistanceRelation, AIS_Relation) //! These distances are used to compare shapes by this vector alone. class AIS_EqualDistanceRelation : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_EqualDistanceRelation,AIS_Relation) public: - //! Constructs a framework to display equivalent //! distances between the shapes aShape1, aShape2, //! aShape3, aShape4 and the plane aPlane. @@ -105,19 +84,8 @@ public: //! a line or a circle. Standard_EXPORT static void ComputeOneEdgeOneVertexLength (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Real ArrowSize, const TopoDS_Shape& FirstShape, const TopoDS_Shape& SecondShape, const Handle(Geom_Plane)& Plane, const Standard_Boolean AutomaticPos, const Standard_Boolean IsSetBndBox, const Bnd_Box& BndBox, gp_Pnt& Position, gp_Pnt& FirstAttach, gp_Pnt& SecondAttach, gp_Pnt& FirstExtreme, gp_Pnt& SecondExtreme, DsgPrs_ArrowSide& SymbolPrs); - - - - DEFINE_STANDARD_RTTIEXT(AIS_EqualDistanceRelation,AIS_Relation) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -135,14 +103,8 @@ private: gp_Pnt myPoint3; gp_Pnt myPoint4; - }; - #include - - - - #endif // _AIS_EqualDistanceRelation_HeaderFile diff --git a/src/AIS/AIS_EqualRadiusRelation.hxx b/src/AIS/AIS_EqualRadiusRelation.hxx index ae22ff8482..0680585ba2 100644 --- a/src/AIS/AIS_EqualRadiusRelation.hxx +++ b/src/AIS/AIS_EqualRadiusRelation.hxx @@ -17,31 +17,17 @@ #ifndef _AIS_EqualRadiusRelation_HeaderFile #define _AIS_EqualRadiusRelation_HeaderFile -#include -#include - -#include #include -#include -#include -#include -class TopoDS_Edge; + class Geom_Plane; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; - -class AIS_EqualRadiusRelation; DEFINE_STANDARD_HANDLE(AIS_EqualRadiusRelation, AIS_Relation) - class AIS_EqualRadiusRelation : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_EqualRadiusRelation, AIS_Relation) public: - //! Creates equal relation of two arc's radiuses. //! If one of edges is not in the given plane, //! the presentation method projects it onto the plane. @@ -56,19 +42,8 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_EqualRadiusRelation,AIS_Relation) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -82,13 +57,6 @@ private: gp_Pnt myFirstPoint; gp_Pnt mySecondPoint; - }; - - - - - - #endif // _AIS_EqualRadiusRelation_HeaderFile diff --git a/src/AIS/AIS_FixRelation.hxx b/src/AIS/AIS_FixRelation.hxx index 39e118381e..4ee25eb67b 100644 --- a/src/AIS/AIS_FixRelation.hxx +++ b/src/AIS/AIS_FixRelation.hxx @@ -17,32 +17,11 @@ #ifndef _AIS_FixRelation_HeaderFile #define _AIS_FixRelation_HeaderFile -#include -#include - #include -#include #include -#include -#include -#include -#include -#include -class TopoDS_Shape; + class Geom_Plane; -class TopoDS_Wire; -class gp_Pnt; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class TopoDS_Vertex; -class Geom_Curve; -class TopoDS_Edge; -class gp_Lin; -class gp_Circ; - -class AIS_FixRelation; DEFINE_STANDARD_HANDLE(AIS_FixRelation, AIS_Relation) //! Constructs and manages a constraint by a fixed @@ -55,9 +34,8 @@ DEFINE_STANDARD_HANDLE(AIS_FixRelation, AIS_Relation) //! object. class AIS_FixRelation : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_FixRelation, AIS_Relation) public: - //! initializes the vertex aShape, the //! plane aPlane and the wire aWire, which connects @@ -98,16 +76,6 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_FixRelation,AIS_Relation) - -protected: - - - - private: @@ -141,11 +109,6 @@ private: }; - #include - - - - #endif // _AIS_FixRelation_HeaderFile diff --git a/src/AIS/AIS_InteractiveContext.cxx b/src/AIS/AIS_InteractiveContext.cxx index 737d03ba96..5e658480e2 100644 --- a/src/AIS/AIS_InteractiveContext.cxx +++ b/src/AIS/AIS_InteractiveContext.cxx @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -2447,6 +2446,13 @@ void AIS_InteractiveContext::Disconnect (const Handle(AIS_InteractiveObject)& th { Handle(AIS_MultipleConnectedInteractive) theObj (Handle(AIS_MultipleConnectedInteractive)::DownCast (theAssembly)); theObj->Disconnect (theObjToDisconnect); + if (!myObjects.IsBound (theObjToDisconnect)) + { + // connected presentation might contain displayed presentations + myMainPM->Erase (theObjToDisconnect, -1); + theObjToDisconnect->ErasePresentations (true); + } + const Handle(SelectMgr_SelectableObject)& anObj = theObjToDisconnect; // to avoid ambiguity mgrSelector->Remove (anObj); } diff --git a/src/AIS/AIS_InteractiveContext_2.cxx b/src/AIS/AIS_InteractiveContext_2.cxx index 1d2f2da9c3..9ce6fa886f 100644 --- a/src/AIS/AIS_InteractiveContext_2.cxx +++ b/src/AIS/AIS_InteractiveContext_2.cxx @@ -419,7 +419,7 @@ Standard_Boolean AIS_InteractiveContext::ImmediateAdd (const Handle(AIS_Interact return Standard_False; } - myMainPM->AddToImmediateList (myMainPM->Presentation (theObj, theMode)->Presentation()); + myMainPM->AddToImmediateList (myMainPM->Presentation (theObj, theMode)); return Standard_True; } diff --git a/src/AIS/AIS_InteractiveObject.cxx b/src/AIS/AIS_InteractiveObject.cxx index cb01b222cc..ccca7490ea 100644 --- a/src/AIS/AIS_InteractiveObject.cxx +++ b/src/AIS/AIS_InteractiveObject.cxx @@ -29,7 +29,6 @@ #include #include #include -#include #include IMPLEMENT_STANDARD_RTTIEXT(AIS_InteractiveObject,SelectMgr_SelectableObject) @@ -106,9 +105,7 @@ Handle(Prs3d_Presentation) AIS_InteractiveObject::Presentation() const } Handle(PrsMgr_Presentation) aPrs = myCTXPtr->MainPrsMgr()->Presentation (this, myDrawer->DisplayMode(), false); - return !aPrs.IsNull() - ? aPrs->Presentation() - : Handle(Prs3d_Presentation)(); + return aPrs; } //======================================================================= diff --git a/src/AIS/AIS_InteractiveObject.hxx b/src/AIS/AIS_InteractiveObject.hxx index 5330fd6704..4ca80616ed 100644 --- a/src/AIS/AIS_InteractiveObject.hxx +++ b/src/AIS/AIS_InteractiveObject.hxx @@ -22,7 +22,6 @@ class AIS_InteractiveContext; class Graphic3d_MaterialAspect; -class Prs3d_Presentation; class Prs3d_BasicAspect; class Bnd_Box; diff --git a/src/AIS/AIS_LengthDimension.hxx b/src/AIS/AIS_LengthDimension.hxx index 867fe7257e..90a87201c0 100755 --- a/src/AIS/AIS_LengthDimension.hxx +++ b/src/AIS/AIS_LengthDimension.hxx @@ -18,37 +18,13 @@ #include #include #include -#include #include #include #include #include -#include #include -#include -#include -#include -#include -#include #include #include -#include - -class TopoDS_Face; -class TCollection_ExtendedString; -class gp_Pnt; -class TopoDS_Edge; -class TopoDS_Shape; -class Geom_Plane; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class SelectMgr_Selection; -class Bnd_Box; -class gp_Dir; -class TopoDS_Vertex; -class Standard_Transient; -class AIS_LengthDimension; DEFINE_STANDARD_HANDLE (AIS_LengthDimension, AIS_Dimension) diff --git a/src/AIS/AIS_MaxRadiusDimension.hxx b/src/AIS/AIS_MaxRadiusDimension.hxx index 435e58b424..cdb5976cb9 100644 --- a/src/AIS/AIS_MaxRadiusDimension.hxx +++ b/src/AIS/AIS_MaxRadiusDimension.hxx @@ -17,38 +17,19 @@ #ifndef _AIS_MaxRadiusDimension_HeaderFile #define _AIS_MaxRadiusDimension_HeaderFile -#include -#include - -#include #include -#include #include -#include -#include -#include -class Standard_ConstructionError; -class TopoDS_Shape; -class TCollection_ExtendedString; -class gp_Pnt; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; - -class AIS_MaxRadiusDimension; DEFINE_STANDARD_HANDLE(AIS_MaxRadiusDimension, AIS_EllipseRadiusDimension) - //! Ellipse Max radius dimension of a Shape which can be Edge //! or Face (planar or cylindrical(surface of extrusion or //! surface of offset)) class AIS_MaxRadiusDimension : public AIS_EllipseRadiusDimension { - + DEFINE_STANDARD_RTTIEXT(AIS_MaxRadiusDimension, AIS_EllipseRadiusDimension) public: - //! Max Ellipse radius dimension //! Shape can be edge , planar face or cylindrical face Standard_EXPORT AIS_MaxRadiusDimension(const TopoDS_Shape& aShape, const Standard_Real aVal, const TCollection_ExtendedString& aText); @@ -66,19 +47,8 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_MaxRadiusDimension,AIS_EllipseRadiusDimension) - -protected: - - - - private: - Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -93,13 +63,6 @@ private: gp_Pnt myApexN; gp_Pnt myEndOfArrow; - }; - - - - - - #endif // _AIS_MaxRadiusDimension_HeaderFile diff --git a/src/AIS/AIS_MidPointRelation.hxx b/src/AIS/AIS_MidPointRelation.hxx index e2f814f287..cbe4b9901c 100644 --- a/src/AIS/AIS_MidPointRelation.hxx +++ b/src/AIS/AIS_MidPointRelation.hxx @@ -16,37 +16,22 @@ #ifndef _AIS_MidPointRelation_HeaderFile #define _AIS_MidPointRelation_HeaderFile -#include -#include - -#include -#include #include -#include -#include -#include -#include -class TopoDS_Shape; + class Geom_Plane; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; class gp_Lin; class gp_Pnt; class gp_Circ; class gp_Elips; - -class AIS_MidPointRelation; DEFINE_STANDARD_HANDLE(AIS_MidPointRelation, AIS_Relation) //! presentation of equal distance to point myMidPoint class AIS_MidPointRelation : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_MidPointRelation, AIS_Relation) public: - Standard_EXPORT AIS_MidPointRelation(const TopoDS_Shape& aSymmTool, const TopoDS_Shape& FirstShape, const TopoDS_Shape& SecondShape, const Handle(Geom_Plane)& aPlane); virtual Standard_Boolean IsMovable() const Standard_OVERRIDE; @@ -64,19 +49,8 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_MidPointRelation,AIS_Relation) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -118,14 +92,8 @@ private: gp_Pnt mySecondPnt1; gp_Pnt mySecondPnt2; - }; - #include - - - - #endif // _AIS_MidPointRelation_HeaderFile diff --git a/src/AIS/AIS_MinRadiusDimension.hxx b/src/AIS/AIS_MinRadiusDimension.hxx index dafc902942..edfb4bf5fe 100644 --- a/src/AIS/AIS_MinRadiusDimension.hxx +++ b/src/AIS/AIS_MinRadiusDimension.hxx @@ -17,26 +17,9 @@ #ifndef _AIS_MinRadiusDimension_HeaderFile #define _AIS_MinRadiusDimension_HeaderFile -#include -#include - -#include #include -#include #include -#include -#include -#include -class Standard_ConstructionError; -class TopoDS_Shape; -class TCollection_ExtendedString; -class gp_Pnt; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; - -class AIS_MinRadiusDimension; DEFINE_STANDARD_HANDLE(AIS_MinRadiusDimension, AIS_EllipseRadiusDimension) //! -- Ellipse Min radius dimension of a Shape which @@ -44,10 +27,9 @@ DEFINE_STANDARD_HANDLE(AIS_MinRadiusDimension, AIS_EllipseRadiusDimension) //! extrusion or surface of offset)) class AIS_MinRadiusDimension : public AIS_EllipseRadiusDimension { - + DEFINE_STANDARD_RTTIEXT(AIS_MinRadiusDimension, AIS_EllipseRadiusDimension) public: - //! Max Ellipse radius dimension //! Shape can be edge , planar face or cylindrical face Standard_EXPORT AIS_MinRadiusDimension(const TopoDS_Shape& aShape, const Standard_Real aVal, const TCollection_ExtendedString& aText); @@ -65,18 +47,7 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_MinRadiusDimension,AIS_EllipseRadiusDimension) - -protected: - - - - private: - Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; @@ -92,13 +63,6 @@ private: gp_Pnt myApexN; gp_Pnt myEndOfArrow; - }; - - - - - - #endif // _AIS_MinRadiusDimension_HeaderFile diff --git a/src/AIS/AIS_MultipleConnectedInteractive.cxx b/src/AIS/AIS_MultipleConnectedInteractive.cxx index bd749ce522..0776e7d3f7 100644 --- a/src/AIS/AIS_MultipleConnectedInteractive.cxx +++ b/src/AIS/AIS_MultipleConnectedInteractive.cxx @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/src/AIS/AIS_OffsetDimension.hxx b/src/AIS/AIS_OffsetDimension.hxx index 5230255a2f..5c769ec477 100644 --- a/src/AIS/AIS_OffsetDimension.hxx +++ b/src/AIS/AIS_OffsetDimension.hxx @@ -17,28 +17,9 @@ #ifndef _AIS_OffsetDimension_HeaderFile #define _AIS_OffsetDimension_HeaderFile -#include -#include - -#include -#include -#include #include -#include -#include -#include -#include #include -#include -class TopoDS_Shape; -class TCollection_ExtendedString; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; -class gp_Trsf; - -class AIS_OffsetDimension; DEFINE_STANDARD_HANDLE(AIS_OffsetDimension, AIS_Relation) //! A framework to display dimensions of offsets. @@ -48,10 +29,9 @@ DEFINE_STANDARD_HANDLE(AIS_OffsetDimension, AIS_Relation) //! and the basis shape. class AIS_OffsetDimension : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_OffsetDimension, AIS_Relation) public: - //! Constructs the offset display object defined by the //! first shape aFShape, the second shape aSShape, the //! dimension aVal, and the text aText. @@ -77,19 +57,8 @@ public: //! selection to a relative position. void SetRelativePos (const gp_Trsf& aTrsf); - - - - DEFINE_STANDARD_RTTIEXT(AIS_OffsetDimension,AIS_Relation) - -protected: - - - - private: - Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -108,14 +77,8 @@ private: gp_Dir myDirAttach2; gp_Trsf myRelativePos; - }; - #include - - - - #endif // _AIS_OffsetDimension_HeaderFile diff --git a/src/AIS/AIS_ParallelRelation.hxx b/src/AIS/AIS_ParallelRelation.hxx index 0f821bbf7d..2dcc2d1aa2 100644 --- a/src/AIS/AIS_ParallelRelation.hxx +++ b/src/AIS/AIS_ParallelRelation.hxx @@ -17,27 +17,9 @@ #ifndef _AIS_ParallelRelation_HeaderFile #define _AIS_ParallelRelation_HeaderFile -#include -#include - -#include -#include #include #include -#include -#include -#include -#include -#include -class TopoDS_Shape; -class Geom_Plane; -class gp_Pnt; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; - -class AIS_ParallelRelation; DEFINE_STANDARD_HANDLE(AIS_ParallelRelation, AIS_Relation) //! A framework to display constraints of parallelism @@ -45,7 +27,7 @@ DEFINE_STANDARD_HANDLE(AIS_ParallelRelation, AIS_Relation) //! entities can be faces or edges. class AIS_ParallelRelation : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_ParallelRelation, AIS_Relation) public: @@ -73,19 +55,8 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_ParallelRelation,AIS_Relation) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -100,14 +71,8 @@ private: gp_Pnt mySAttach; gp_Dir myDirAttach; - }; - #include - - - - #endif // _AIS_ParallelRelation_HeaderFile diff --git a/src/AIS/AIS_PerpendicularRelation.hxx b/src/AIS/AIS_PerpendicularRelation.hxx index 83de38c925..574091886a 100644 --- a/src/AIS/AIS_PerpendicularRelation.hxx +++ b/src/AIS/AIS_PerpendicularRelation.hxx @@ -17,22 +17,8 @@ #ifndef _AIS_PerpendicularRelation_HeaderFile #define _AIS_PerpendicularRelation_HeaderFile -#include -#include - -#include #include -#include -#include -#include -class TopoDS_Shape; -class Geom_Plane; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; - -class AIS_PerpendicularRelation; DEFINE_STANDARD_HANDLE(AIS_PerpendicularRelation, AIS_Relation) //! A framework to display constraints of perpendicularity @@ -40,10 +26,9 @@ DEFINE_STANDARD_HANDLE(AIS_PerpendicularRelation, AIS_Relation) //! datums can be edges or faces. class AIS_PerpendicularRelation : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_PerpendicularRelation, AIS_Relation) public: - //! Constructs an object to display constraints of //! perpendicularity on shapes. //! This object is defined by a first shape aFShape, a @@ -68,16 +53,6 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_PerpendicularRelation,AIS_Relation) - -protected: - - - - private: @@ -94,13 +69,6 @@ private: gp_Pnt myFAttach; gp_Pnt mySAttach; - }; - - - - - - #endif // _AIS_PerpendicularRelation_HeaderFile diff --git a/src/AIS/AIS_PointCloud.cxx b/src/AIS/AIS_PointCloud.cxx index ffce06c13b..a395b0de4e 100644 --- a/src/AIS/AIS_PointCloud.cxx +++ b/src/AIS/AIS_PointCloud.cxx @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/src/AIS/AIS_Relation.hxx b/src/AIS/AIS_Relation.hxx index 2ccd6db16e..4246abf454 100644 --- a/src/AIS/AIS_Relation.hxx +++ b/src/AIS/AIS_Relation.hxx @@ -27,7 +27,6 @@ #include #include #include -#include #include #include diff --git a/src/AIS/AIS_Shape.cxx b/src/AIS/AIS_Shape.cxx index e6f75cb1ed..35202da2d9 100644 --- a/src/AIS/AIS_Shape.cxx +++ b/src/AIS/AIS_Shape.cxx @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include diff --git a/src/AIS/AIS_SymmetricRelation.hxx b/src/AIS/AIS_SymmetricRelation.hxx index e0487ba28a..dcbc2cdd9f 100644 --- a/src/AIS/AIS_SymmetricRelation.hxx +++ b/src/AIS/AIS_SymmetricRelation.hxx @@ -17,25 +17,11 @@ #ifndef _AIS_SymmetricRelation_HeaderFile #define _AIS_SymmetricRelation_HeaderFile -#include -#include - #include #include #include #include -#include -#include -#include -#include -class TopoDS_Shape; -class Geom_Plane; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; - -class AIS_SymmetricRelation; DEFINE_STANDARD_HANDLE(AIS_SymmetricRelation, AIS_Relation) //! A framework to display constraints of symmetricity @@ -44,10 +30,9 @@ DEFINE_STANDARD_HANDLE(AIS_SymmetricRelation, AIS_Relation) //! shapes of which the datums are parts. class AIS_SymmetricRelation : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_SymmetricRelation, AIS_Relation) public: - //! Constructs an object to display constraints of symmetricity. //! This object is defined by a tool aSymmTool, a first //! shape FirstShape, a second shape SecondShape, and a plane aPlane. @@ -79,19 +64,8 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_SymmetricRelation,AIS_Relation) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -110,14 +84,8 @@ private: gp_Dir myFDirAttach; gp_Dir myAxisDirAttach; - }; - #include - - - - #endif // _AIS_SymmetricRelation_HeaderFile diff --git a/src/AIS/AIS_TangentRelation.hxx b/src/AIS/AIS_TangentRelation.hxx index 032d5ede81..e19703551e 100644 --- a/src/AIS/AIS_TangentRelation.hxx +++ b/src/AIS/AIS_TangentRelation.hxx @@ -17,24 +17,8 @@ #ifndef _AIS_TangentRelation_HeaderFile #define _AIS_TangentRelation_HeaderFile -#include -#include - -#include -#include -#include -#include #include -#include -#include -class TopoDS_Shape; -class Geom_Plane; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; - -class AIS_TangentRelation; DEFINE_STANDARD_HANDLE(AIS_TangentRelation, AIS_Relation) //! A framework to display tangency constraints between @@ -42,10 +26,9 @@ DEFINE_STANDARD_HANDLE(AIS_TangentRelation, AIS_Relation) //! The datums are normally faces or edges. class AIS_TangentRelation : public AIS_Relation { - + DEFINE_STANDARD_RTTIEXT(AIS_TangentRelation, AIS_Relation) public: - //! TwoFacesTangent or TwoEdgesTangent relation //! Constructs an object to display tangency constraints. //! This object is defined by the first shape aFShape, the @@ -79,19 +62,8 @@ public: //! to the object to display before computation !!! Standard_EXPORT virtual void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTrsf, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; - - - - DEFINE_STANDARD_RTTIEXT(AIS_TangentRelation,AIS_Relation) - -protected: - - - - private: - Standard_EXPORT void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; Standard_EXPORT void Compute (const Handle(Prs3d_Projector)& aProjector, const Handle(Prs3d_Presentation)& aPresentation) Standard_OVERRIDE; @@ -107,13 +79,6 @@ private: Standard_Real myLength; Standard_Integer myExternRef; - }; - - - - - - #endif // _AIS_TangentRelation_HeaderFile diff --git a/src/AIS/AIS_TexturedShape.cxx b/src/AIS/AIS_TexturedShape.cxx index 1baa8418c0..00b1c22695 100644 --- a/src/AIS/AIS_TexturedShape.cxx +++ b/src/AIS/AIS_TexturedShape.cxx @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -199,14 +198,12 @@ void AIS_TexturedShape::SetColor (const Quantity_Color& theColor) { AIS_Shape::SetColor (theColor); - for (Standard_Integer aPrsIt = 1; aPrsIt <= Presentations().Length(); ++aPrsIt) + for (PrsMgr_Presentations::Iterator aPrsIter (Presentations()); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aPrsModed = Presentations().Value (aPrsIt); - - if (aPrsModed.Mode() != 3) - continue; - - updateAttributes (aPrsModed.Presentation()->Presentation()); + if (aPrsIter.Value()->Mode() == 3) + { + updateAttributes (aPrsIter.Value()); + } } } @@ -228,15 +225,12 @@ void AIS_TexturedShape::UnsetColor() void AIS_TexturedShape::SetMaterial (const Graphic3d_MaterialAspect& theMat) { AIS_Shape::SetMaterial (theMat); - - for (Standard_Integer aPrsIt = 1; aPrsIt <= Presentations().Length(); ++aPrsIt) + for (PrsMgr_Presentations::Iterator aPrsIter (Presentations()); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aPrsModed = Presentations().Value (aPrsIt); - - if (aPrsModed.Mode() != 3) - continue; - - updateAttributes (aPrsModed.Presentation()->Presentation()); + if (aPrsIter.Value()->Mode() == 3) + { + updateAttributes (aPrsIter.Value()); + } } } @@ -247,15 +241,12 @@ void AIS_TexturedShape::SetMaterial (const Graphic3d_MaterialAspect& theMat) void AIS_TexturedShape::UnsetMaterial() { AIS_Shape::UnsetMaterial(); - - for (Standard_Integer aPrsIt = 1; aPrsIt <= Presentations().Length(); ++aPrsIt) + for (PrsMgr_Presentations::Iterator aPrsIter (Presentations()); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aPrsModed = Presentations().Value (aPrsIt); - - if (aPrsModed.Mode() != 3) - continue; - - updateAttributes (aPrsModed.Presentation()->Presentation()); + if (aPrsIter.Value()->Mode() == 3) + { + updateAttributes (aPrsIter.Value()); + } } } diff --git a/src/AIS/AIS_Triangulation.cxx b/src/AIS/AIS_Triangulation.cxx index 0ff986f3b6..20e39471e6 100644 --- a/src/AIS/AIS_Triangulation.cxx +++ b/src/AIS/AIS_Triangulation.cxx @@ -95,16 +95,14 @@ void AIS_Triangulation::updatePresentation() // modify shading presentation without re-computation const PrsMgr_Presentations& aPrsList = Presentations(); Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect(); - for (Standard_Integer aPrsIt = 1; aPrsIt <= aPrsList.Length(); ++aPrsIt) + for (PrsMgr_Presentations::Iterator aPrsIter (aPrsList); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aPrsModed = aPrsList.Value (aPrsIt); - if (aPrsModed.Mode() != AIS_WireFrame) + if (aPrsIter.Value()->Mode() != AIS_WireFrame) { continue; } - const Handle(Prs3d_Presentation)& aPrs = aPrsModed.Presentation()->Presentation(); - + const Handle(Prs3d_Presentation)& aPrs = aPrsIter.Value(); for (Graphic3d_SequenceOfGroup::Iterator aGroupIt (aPrs->Groups()); aGroupIt.More(); aGroupIt.Next()) { const Handle(Graphic3d_Group)& aGroup = aGroupIt.Value(); diff --git a/src/AIS/AIS_Triangulation.hxx b/src/AIS/AIS_Triangulation.hxx index d602e92480..9961a21582 100644 --- a/src/AIS/AIS_Triangulation.hxx +++ b/src/AIS/AIS_Triangulation.hxx @@ -16,20 +16,11 @@ #ifndef _AIS_Triangulation_HeaderFile #define _AIS_Triangulation_HeaderFile -#include -#include - #include -#include #include -#include -#include -#include + class Poly_Triangulation; -class Prs3d_Presentation; - -class AIS_Triangulation; DEFINE_STANDARD_HANDLE(AIS_Triangulation, AIS_InteractiveObject) //! Interactive object that draws data from Poly_Triangulation, optionally with colors associated @@ -38,10 +29,9 @@ DEFINE_STANDARD_HANDLE(AIS_Triangulation, AIS_InteractiveObject) //! Interactive selection of triangles and vertices is not yet implemented. class AIS_Triangulation : public AIS_InteractiveObject { - + DEFINE_STANDARD_RTTIEXT(AIS_Triangulation, AIS_InteractiveObject) public: - //! Constructs the Triangulation display object Standard_EXPORT AIS_Triangulation(const Handle(Poly_Triangulation)& aTriangulation); @@ -73,8 +63,6 @@ public: //! Removes the setting for transparency in the reconstructed compound shape. Standard_EXPORT virtual void UnsetTransparency() Standard_OVERRIDE; - DEFINE_STANDARD_RTTIEXT(AIS_Triangulation,AIS_InteractiveObject) - protected: Standard_EXPORT void updatePresentation(); @@ -101,13 +89,6 @@ private: Standard_Integer myNbNodes; Standard_Integer myNbTriangles; - }; - - - - - - #endif // _AIS_Triangulation_HeaderFile diff --git a/src/DsgPrs/DsgPrs.cxx b/src/DsgPrs/DsgPrs.cxx index 5fd2844f83..38aece8c43 100644 --- a/src/DsgPrs/DsgPrs.cxx +++ b/src/DsgPrs/DsgPrs.cxx @@ -12,9 +12,10 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include + #include #include -#include #include #include #include diff --git a/src/DsgPrs/DsgPrs.hxx b/src/DsgPrs/DsgPrs.hxx index 94cd890db3..06cc1f2034 100644 --- a/src/DsgPrs/DsgPrs.hxx +++ b/src/DsgPrs/DsgPrs.hxx @@ -17,47 +17,14 @@ #ifndef _DsgPrs_HeaderFile #define _DsgPrs_HeaderFile -#include -#include -#include - #include -#include -#include -class Prs3d_Presentation; -class Prs3d_DimensionAspect; -class gp_Pnt; -class gp_Dir; -class gp_Pln; -class Geom_Surface; -class Geom_Curve; -class gp_Ax1; -class gp_Circ; -class gp_Elips; -class DsgPrs_EllipseRadiusPresentation; -class DsgPrs_LengthPresentation; -class DsgPrs_RadiusPresentation; -class DsgPrs_DiameterPresentation; -class DsgPrs_FilletRadiusPresentation; -class DsgPrs_AnglePresentation; -class DsgPrs_Chamf2dPresentation; -class DsgPrs_ParalPresentation; -class DsgPrs_PerpenPresentation; -class DsgPrs_SymmetricPresentation; -class DsgPrs_MidPointPresentation; -class DsgPrs_TangentPresentation; -class DsgPrs_ConcentricPresentation; -class DsgPrs_FixPresentation; -class DsgPrs_IdenticPresentation; -class DsgPrs_EqualRadiusPresentation; -class DsgPrs_EqualDistancePresentation; -class DsgPrs_SymbPresentation; -class DsgPrs_ShapeDirPresentation; -class DsgPrs_OffsetPresentation; -class DsgPrs_XYZAxisPresentation; -class DsgPrs_XYZPlanePresentation; -class DsgPrs_ShadedPlanePresentation; +#include +#include +#include +class Geom_Curve; +class Geom_Surface; +class Prs3d_DimensionAspect; //! Describes Standard Presentations for DsgIHM objects class DsgPrs @@ -66,7 +33,6 @@ public: DEFINE_STANDARD_ALLOC - //! draws symbols ((one or two) arrows,(one or two)points //! at thebeginning and at the end of the dimension Standard_EXPORT static void ComputeSymbol (const Handle(Prs3d_Presentation)& aPresentation, const Handle(Prs3d_DimensionAspect)& anAspect, const gp_Pnt& pt1, const gp_Pnt& pt2, const gp_Dir& dir1, const gp_Dir& dir2, const DsgPrs_ArrowSide ArrowSide, const Standard_Boolean drawFromCenter = Standard_True); @@ -88,50 +54,6 @@ public: //! computes length of ellipse arc in parametric units Standard_EXPORT static Standard_Real DistanceFromApex (const gp_Elips& elips, const gp_Pnt& Apex, const Standard_Real par); - - - -protected: - - - - - -private: - - - - -friend class DsgPrs_EllipseRadiusPresentation; -friend class DsgPrs_LengthPresentation; -friend class DsgPrs_RadiusPresentation; -friend class DsgPrs_DiameterPresentation; -friend class DsgPrs_FilletRadiusPresentation; -friend class DsgPrs_AnglePresentation; -friend class DsgPrs_Chamf2dPresentation; -friend class DsgPrs_ParalPresentation; -friend class DsgPrs_PerpenPresentation; -friend class DsgPrs_SymmetricPresentation; -friend class DsgPrs_MidPointPresentation; -friend class DsgPrs_TangentPresentation; -friend class DsgPrs_ConcentricPresentation; -friend class DsgPrs_FixPresentation; -friend class DsgPrs_IdenticPresentation; -friend class DsgPrs_EqualRadiusPresentation; -friend class DsgPrs_EqualDistancePresentation; -friend class DsgPrs_SymbPresentation; -friend class DsgPrs_ShapeDirPresentation; -friend class DsgPrs_OffsetPresentation; -friend class DsgPrs_XYZAxisPresentation; -friend class DsgPrs_XYZPlanePresentation; -friend class DsgPrs_ShadedPlanePresentation; - }; - - - - - - #endif // _DsgPrs_HeaderFile diff --git a/src/DsgPrs/DsgPrs_AnglePresentation.hxx b/src/DsgPrs/DsgPrs_AnglePresentation.hxx index 4f4f6b7d87..aeb4d2c5d1 100644 --- a/src/DsgPrs/DsgPrs_AnglePresentation.hxx +++ b/src/DsgPrs/DsgPrs_AnglePresentation.hxx @@ -25,7 +25,8 @@ #include #include #include -class Prs3d_Presentation; +#include + class TCollection_ExtendedString; class gp_Circ; class gp_Pnt; diff --git a/src/DsgPrs/DsgPrs_Chamf2dPresentation.hxx b/src/DsgPrs/DsgPrs_Chamf2dPresentation.hxx index 0b8e3efd66..2f43829391 100644 --- a/src/DsgPrs/DsgPrs_Chamf2dPresentation.hxx +++ b/src/DsgPrs/DsgPrs_Chamf2dPresentation.hxx @@ -23,11 +23,11 @@ #include #include -class Prs3d_Presentation; +#include + class gp_Pnt; class TCollection_ExtendedString; - //! Framework for display of 2D chamfers. class DsgPrs_Chamf2dPresentation { diff --git a/src/DsgPrs/DsgPrs_ConcentricPresentation.hxx b/src/DsgPrs/DsgPrs_ConcentricPresentation.hxx index 99b411a6f9..893a56852f 100644 --- a/src/DsgPrs/DsgPrs_ConcentricPresentation.hxx +++ b/src/DsgPrs/DsgPrs_ConcentricPresentation.hxx @@ -22,12 +22,11 @@ #include #include -#include -class Prs3d_Presentation; +#include + class gp_Pnt; class gp_Dir; - //! A framework to define display of relations of concentricity. class DsgPrs_ConcentricPresentation { diff --git a/src/DsgPrs/DsgPrs_DiameterPresentation.hxx b/src/DsgPrs/DsgPrs_DiameterPresentation.hxx index f957b6b2ad..5cd24f3400 100644 --- a/src/DsgPrs/DsgPrs_DiameterPresentation.hxx +++ b/src/DsgPrs/DsgPrs_DiameterPresentation.hxx @@ -23,9 +23,8 @@ #include #include -#include -#include -class Prs3d_Presentation; +#include + class TCollection_ExtendedString; class gp_Pnt; class gp_Circ; diff --git a/src/DsgPrs/DsgPrs_EllipseRadiusPresentation.hxx b/src/DsgPrs/DsgPrs_EllipseRadiusPresentation.hxx index 29682dc32f..bcd3cb15ce 100644 --- a/src/DsgPrs/DsgPrs_EllipseRadiusPresentation.hxx +++ b/src/DsgPrs/DsgPrs_EllipseRadiusPresentation.hxx @@ -22,17 +22,14 @@ #include #include -#include -#include #include -class Prs3d_Presentation; +#include + class TCollection_ExtendedString; class gp_Pnt; class gp_Elips; class Geom_OffsetCurve; - - class DsgPrs_EllipseRadiusPresentation { public: diff --git a/src/DsgPrs/DsgPrs_EqualDistancePresentation.hxx b/src/DsgPrs/DsgPrs_EqualDistancePresentation.hxx index 01956302ae..42108c8985 100644 --- a/src/DsgPrs/DsgPrs_EqualDistancePresentation.hxx +++ b/src/DsgPrs/DsgPrs_EqualDistancePresentation.hxx @@ -23,13 +23,13 @@ #include #include -class Prs3d_Presentation; +#include + class gp_Pnt; class Geom_Plane; class gp_Dir; class gp_Circ; - //! A framework to display equal distances between shapes and a given plane. //! The distance is the length of a projection from the shape to the plane. //! These distances are used to compare two shapes by this vector alone. diff --git a/src/DsgPrs/DsgPrs_EqualRadiusPresentation.hxx b/src/DsgPrs/DsgPrs_EqualRadiusPresentation.hxx index dfcc6463f5..802409b797 100644 --- a/src/DsgPrs/DsgPrs_EqualRadiusPresentation.hxx +++ b/src/DsgPrs/DsgPrs_EqualRadiusPresentation.hxx @@ -22,11 +22,11 @@ #include #include -class Prs3d_Presentation; +#include + class gp_Pnt; class Geom_Plane; - //! A framework to define display of equality in radii. class DsgPrs_EqualRadiusPresentation { diff --git a/src/DsgPrs/DsgPrs_FilletRadiusPresentation.hxx b/src/DsgPrs/DsgPrs_FilletRadiusPresentation.hxx index 674e6ad197..e7ed0b6456 100644 --- a/src/DsgPrs/DsgPrs_FilletRadiusPresentation.hxx +++ b/src/DsgPrs/DsgPrs_FilletRadiusPresentation.hxx @@ -22,16 +22,14 @@ #include #include -#include #include -#include -class Prs3d_Presentation; +#include + class TCollection_ExtendedString; class gp_Pnt; class gp_Dir; class Geom_TrimmedCurve; - //! A framework for displaying radii of fillets. class DsgPrs_FilletRadiusPresentation { diff --git a/src/DsgPrs/DsgPrs_FixPresentation.hxx b/src/DsgPrs/DsgPrs_FixPresentation.hxx index e9feff8530..840a9664a6 100644 --- a/src/DsgPrs/DsgPrs_FixPresentation.hxx +++ b/src/DsgPrs/DsgPrs_FixPresentation.hxx @@ -22,12 +22,11 @@ #include #include -#include -class Prs3d_Presentation; +#include + class gp_Pnt; class gp_Dir; - //! class which draws the presentation of Fixed objects class DsgPrs_FixPresentation { diff --git a/src/DsgPrs/DsgPrs_IdenticPresentation.hxx b/src/DsgPrs/DsgPrs_IdenticPresentation.hxx index 436353bc0f..b407744960 100644 --- a/src/DsgPrs/DsgPrs_IdenticPresentation.hxx +++ b/src/DsgPrs/DsgPrs_IdenticPresentation.hxx @@ -22,14 +22,13 @@ #include #include -class Prs3d_Presentation; +#include + class TCollection_ExtendedString; class gp_Pnt; class gp_Ax2; class gp_Elips; - - class DsgPrs_IdenticPresentation { public: diff --git a/src/DsgPrs/DsgPrs_LengthPresentation.hxx b/src/DsgPrs/DsgPrs_LengthPresentation.hxx index e7f797d49d..0af13a36e8 100644 --- a/src/DsgPrs/DsgPrs_LengthPresentation.hxx +++ b/src/DsgPrs/DsgPrs_LengthPresentation.hxx @@ -23,14 +23,14 @@ #include #include -class Prs3d_Presentation; +#include + class TCollection_ExtendedString; class gp_Pnt; class gp_Dir; class gp_Pln; class Geom_Surface; - //! Framework for displaying lengths. //! The length displayed is indicated by line segments //! and text alone or by a combination of line segment, diff --git a/src/DsgPrs/DsgPrs_MidPointPresentation.hxx b/src/DsgPrs/DsgPrs_MidPointPresentation.hxx index bd16c1a449..c12af42d88 100644 --- a/src/DsgPrs/DsgPrs_MidPointPresentation.hxx +++ b/src/DsgPrs/DsgPrs_MidPointPresentation.hxx @@ -21,15 +21,13 @@ #include #include -#include -class Prs3d_Presentation; +#include + class gp_Ax2; class gp_Pnt; class gp_Circ; class gp_Elips; - - class DsgPrs_MidPointPresentation { public: diff --git a/src/DsgPrs/DsgPrs_OffsetPresentation.hxx b/src/DsgPrs/DsgPrs_OffsetPresentation.hxx index 364cba37e1..e141da9294 100644 --- a/src/DsgPrs/DsgPrs_OffsetPresentation.hxx +++ b/src/DsgPrs/DsgPrs_OffsetPresentation.hxx @@ -22,12 +22,12 @@ #include #include -class Prs3d_Presentation; +#include + class TCollection_ExtendedString; class gp_Pnt; class gp_Dir; - //! A framework to define display of offsets. class DsgPrs_OffsetPresentation { diff --git a/src/DsgPrs/DsgPrs_ParalPresentation.hxx b/src/DsgPrs/DsgPrs_ParalPresentation.hxx index d781f225b2..bfbf9efc77 100644 --- a/src/DsgPrs/DsgPrs_ParalPresentation.hxx +++ b/src/DsgPrs/DsgPrs_ParalPresentation.hxx @@ -17,18 +17,14 @@ #ifndef _DsgPrs_ParalPresentation_HeaderFile #define _DsgPrs_ParalPresentation_HeaderFile -#include -#include -#include - #include #include -class Prs3d_Presentation; +#include + class TCollection_ExtendedString; class gp_Pnt; class gp_Dir; - //! A framework to define display of relations of parallelism between shapes. class DsgPrs_ParalPresentation { diff --git a/src/DsgPrs/DsgPrs_PerpenPresentation.hxx b/src/DsgPrs/DsgPrs_PerpenPresentation.hxx index 5f94a74b87..799363c437 100644 --- a/src/DsgPrs/DsgPrs_PerpenPresentation.hxx +++ b/src/DsgPrs/DsgPrs_PerpenPresentation.hxx @@ -22,10 +22,9 @@ #include #include -#include -class Prs3d_Presentation; -class gp_Pnt; +#include +class gp_Pnt; //! A framework to define display of perpendicular //! constraints between shapes. diff --git a/src/DsgPrs/DsgPrs_RadiusPresentation.hxx b/src/DsgPrs/DsgPrs_RadiusPresentation.hxx index 9117089434..15afa61f59 100644 --- a/src/DsgPrs/DsgPrs_RadiusPresentation.hxx +++ b/src/DsgPrs/DsgPrs_RadiusPresentation.hxx @@ -22,10 +22,9 @@ #include #include -#include -#include #include -class Prs3d_Presentation; +#include + class TCollection_ExtendedString; class gp_Pnt; class gp_Circ; diff --git a/src/DsgPrs/DsgPrs_ShadedPlanePresentation.hxx b/src/DsgPrs/DsgPrs_ShadedPlanePresentation.hxx index b335a4c39c..1e94db7a55 100644 --- a/src/DsgPrs/DsgPrs_ShadedPlanePresentation.hxx +++ b/src/DsgPrs/DsgPrs_ShadedPlanePresentation.hxx @@ -22,9 +22,9 @@ #include #include -class Prs3d_Presentation; -class gp_Pnt; +#include +class gp_Pnt; //! A framework to define display of shaded planes. class DsgPrs_ShadedPlanePresentation diff --git a/src/DsgPrs/DsgPrs_ShapeDirPresentation.hxx b/src/DsgPrs/DsgPrs_ShapeDirPresentation.hxx index 83bb3fbc47..5b781683c4 100644 --- a/src/DsgPrs/DsgPrs_ShapeDirPresentation.hxx +++ b/src/DsgPrs/DsgPrs_ShapeDirPresentation.hxx @@ -22,10 +22,9 @@ #include #include -#include -class Prs3d_Presentation; -class TopoDS_Shape; +#include +class TopoDS_Shape; //! A framework to define display of the normal to the //! surface of a shape. diff --git a/src/DsgPrs/DsgPrs_SymbPresentation.hxx b/src/DsgPrs/DsgPrs_SymbPresentation.hxx index 2e4988b50c..34a3d2475a 100644 --- a/src/DsgPrs/DsgPrs_SymbPresentation.hxx +++ b/src/DsgPrs/DsgPrs_SymbPresentation.hxx @@ -22,11 +22,11 @@ #include #include -class Prs3d_Presentation; +#include + class TCollection_ExtendedString; class gp_Pnt; - //! A framework to define display of symbols. class DsgPrs_SymbPresentation { diff --git a/src/DsgPrs/DsgPrs_SymmetricPresentation.hxx b/src/DsgPrs/DsgPrs_SymmetricPresentation.hxx index 67cb6d9bcc..854ec89372 100644 --- a/src/DsgPrs/DsgPrs_SymmetricPresentation.hxx +++ b/src/DsgPrs/DsgPrs_SymmetricPresentation.hxx @@ -22,13 +22,13 @@ #include #include -class Prs3d_Presentation; +#include + class gp_Pnt; class gp_Dir; class gp_Lin; class gp_Circ; - //! A framework to define display of symmetry between shapes. class DsgPrs_SymmetricPresentation { diff --git a/src/DsgPrs/DsgPrs_TangentPresentation.hxx b/src/DsgPrs/DsgPrs_TangentPresentation.hxx index 4e8ad84881..99067d3361 100644 --- a/src/DsgPrs/DsgPrs_TangentPresentation.hxx +++ b/src/DsgPrs/DsgPrs_TangentPresentation.hxx @@ -22,12 +22,11 @@ #include #include -#include -class Prs3d_Presentation; +#include + class gp_Pnt; class gp_Dir; - //! A framework to define display of tangents. class DsgPrs_TangentPresentation { diff --git a/src/DsgPrs/DsgPrs_XYZAxisPresentation.hxx b/src/DsgPrs/DsgPrs_XYZAxisPresentation.hxx index 441161d4a7..b1f3b580c6 100644 --- a/src/DsgPrs/DsgPrs_XYZAxisPresentation.hxx +++ b/src/DsgPrs/DsgPrs_XYZAxisPresentation.hxx @@ -21,16 +21,15 @@ #include #include -#include #include -class Prs3d_Presentation; +#include + class Prs3d_LineAspect; class gp_Dir; class gp_Pnt; class Prs3d_ArrowAspect; class Prs3d_TextAspect; - //! A framework for displaying the axes of an XYZ trihedron. class DsgPrs_XYZAxisPresentation { diff --git a/src/DsgPrs/DsgPrs_XYZPlanePresentation.hxx b/src/DsgPrs/DsgPrs_XYZPlanePresentation.hxx index 645082d529..8becdd159c 100644 --- a/src/DsgPrs/DsgPrs_XYZPlanePresentation.hxx +++ b/src/DsgPrs/DsgPrs_XYZPlanePresentation.hxx @@ -22,9 +22,9 @@ #include #include -class Prs3d_Presentation; -class gp_Pnt; +#include +class gp_Pnt; //! A framework for displaying the planes of an XYZ trihedron. class DsgPrs_XYZPlanePresentation diff --git a/src/Graphic3d/FILES b/src/Graphic3d/FILES index 711dbe8a0f..f3e0acb83f 100755 --- a/src/Graphic3d/FILES +++ b/src/Graphic3d/FILES @@ -76,7 +76,6 @@ Graphic3d_PresentationAttributes.cxx Graphic3d_HorizontalTextAlignment.hxx Graphic3d_IndexBuffer.hxx Graphic3d_MutableIndexBuffer.hxx -Graphic3d_IndexedMapOfAddress.hxx Graphic3d_LevelOfTextureAnisotropy.hxx Graphic3d_LightSet.cxx Graphic3d_LightSet.hxx diff --git a/src/Graphic3d/Graphic3d_CView.cxx b/src/Graphic3d/Graphic3d_CView.cxx index d5dac3a0e0..7b7f9e3f6d 100644 --- a/src/Graphic3d/Graphic3d_CView.cxx +++ b/src/Graphic3d/Graphic3d_CView.cxx @@ -620,7 +620,7 @@ void Graphic3d_CView::Compute() // function : Clear // purpose : // ======================================================================= -void Graphic3d_CView::Clear (const Handle(Graphic3d_Structure)& theStructure, +void Graphic3d_CView::Clear (Graphic3d_Structure* theStructure, const Standard_Boolean theWithDestruction) { const Standard_Integer anIndex = IsComputed (theStructure); @@ -636,8 +636,8 @@ void Graphic3d_CView::Clear (const Handle(Graphic3d_Structure)& theStructure, // function : Connect // purpose : // ======================================================================= -void Graphic3d_CView::Connect (const Handle(Graphic3d_Structure)& theMother, - const Handle(Graphic3d_Structure)& theDaughter) +void Graphic3d_CView::Connect (const Graphic3d_Structure* theMother, + const Graphic3d_Structure* theDaughter) { Standard_Integer anIndexM = IsComputed (theMother); Standard_Integer anIndexD = IsComputed (theDaughter); @@ -654,8 +654,8 @@ void Graphic3d_CView::Connect (const Handle(Graphic3d_Structure)& theMother, // function : Disconnect // purpose : // ======================================================================= -void Graphic3d_CView::Disconnect (const Handle(Graphic3d_Structure)& theMother, - const Handle(Graphic3d_Structure)& theDaughter) +void Graphic3d_CView::Disconnect (const Graphic3d_Structure* theMother, + const Graphic3d_Structure* theDaughter) { Standard_Integer anIndexM = IsComputed (theMother); Standard_Integer anIndexD = IsComputed (theDaughter); @@ -850,25 +850,25 @@ void Graphic3d_CView::Erase (const Handle(Graphic3d_Structure)& theStructure) return; } - Graphic3d_TypeOfAnswer anAnswer = acceptDisplay (theStructure->Visual()); - if (!ComputedMode()) - { - anAnswer = Graphic3d_TOA_YES; - } - + const Graphic3d_TypeOfAnswer anAnswer = myIsInComputedMode ? acceptDisplay (theStructure->Visual()) : Graphic3d_TOA_YES; if (anAnswer != Graphic3d_TOA_COMPUTE) { eraseStructure (theStructure->CStructure()); } - else if (anAnswer == Graphic3d_TOA_COMPUTE && myIsInComputedMode) + + const Standard_Integer anIndex = !myStructsToCompute.IsEmpty() ? IsComputed (theStructure) : 0; + if (anIndex != 0) { - const Standard_Integer anIndex = IsComputed (theStructure); - if (anIndex != 0) + if (anAnswer == Graphic3d_TOA_COMPUTE + && myIsInComputedMode) { const Handle(Graphic3d_Structure)& aCompStruct = myStructsComputed.ChangeValue (anIndex); eraseStructure (aCompStruct->CStructure()); } + myStructsComputed .Remove (anIndex); + myStructsToCompute.Remove (anIndex); } + myStructsDisplayed.Remove (theStructure); Update (theStructure->GetZLayer()); } @@ -966,16 +966,16 @@ Standard_Boolean Graphic3d_CView::IsComputed (const Standard_Integer theStructId // function : IsComputed // purpose : // ======================================================================= -Standard_Integer Graphic3d_CView::IsComputed (const Handle(Graphic3d_Structure)& theStructure) const +Standard_Integer Graphic3d_CView::IsComputed (const Graphic3d_Structure* theStructure) const { const Standard_Integer aStructId = theStructure->Identification(); - const Standard_Integer aNbStructs = myStructsToCompute.Length(); - for (Standard_Integer aStructIter = 1; aStructIter <= aNbStructs; ++aStructIter) + Standard_Integer aStructIndex = 1; + for (Graphic3d_SequenceOfStructure::Iterator aStructIter (myStructsToCompute); aStructIter.More(); aStructIter.Next(), ++aStructIndex) { - const Handle(Graphic3d_Structure)& aStruct = myStructsToCompute.Value (aStructIter); + const Handle(Graphic3d_Structure)& aStruct = aStructIter.Value(); if (aStruct->Identification() == aStructId) { - return aStructIter; + return aStructIndex; } } return 0; diff --git a/src/Graphic3d/Graphic3d_CView.hxx b/src/Graphic3d/Graphic3d_CView.hxx index e409c5e5bf..5691912879 100644 --- a/src/Graphic3d/Graphic3d_CView.hxx +++ b/src/Graphic3d/Graphic3d_CView.hxx @@ -169,15 +169,16 @@ private: Standard_EXPORT Graphic3d_TypeOfAnswer acceptDisplay (const Graphic3d_TypeOfStructure theStructType) const; //! Clears the structure in this view. - Standard_EXPORT void Clear (const Handle(Graphic3d_Structure)& theStructure, const Standard_Boolean theWithDestruction); + Standard_EXPORT void Clear (Graphic3d_Structure* theStructure, + const Standard_Boolean theWithDestruction); //! Connects the structures. - Standard_EXPORT void Connect (const Handle(Graphic3d_Structure)& theMother, - const Handle(Graphic3d_Structure)& theDaughter); + Standard_EXPORT void Connect (const Graphic3d_Structure* theMother, + const Graphic3d_Structure* theDaughter); //! Disconnects the structures. - Standard_EXPORT void Disconnect (const Handle(Graphic3d_Structure)& theMother, - const Handle(Graphic3d_Structure)& theDaughter); + Standard_EXPORT void Disconnect (const Graphic3d_Structure* theMother, + const Graphic3d_Structure* theDaughter); //! Displays the structure in the view. Standard_EXPORT void Display (const Handle(Graphic3d_Structure)& theStructure); @@ -197,7 +198,9 @@ private: Standard_EXPORT void UnHighlight (const Handle(Graphic3d_Structure)& theStructure); //! Returns an index != 0 if the structure have another structure computed for the view . - Standard_EXPORT Standard_Integer IsComputed (const Handle(Graphic3d_Structure)& theStructure) const; + Standard_EXPORT Standard_Integer IsComputed (const Graphic3d_Structure* theStructure) const; + + Standard_Integer IsComputed (const Handle(Graphic3d_Structure)& theStructure) const { return IsComputed (theStructure.get()); } //! Returns true if the structure is displayed in the view. Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(Graphic3d_Structure)& theStructure) const; diff --git a/src/Graphic3d/Graphic3d_IndexedMapOfAddress.hxx b/src/Graphic3d/Graphic3d_IndexedMapOfAddress.hxx deleted file mode 100644 index 80be9de5fc..0000000000 --- a/src/Graphic3d/Graphic3d_IndexedMapOfAddress.hxx +++ /dev/null @@ -1,23 +0,0 @@ -// Created on: 2015-04-2015 -// Created by: Denis BOGOLEPOV -// Copyright (c) 2015 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 _Graphic3d_IndexedMapOfAddress -#define _Graphic3d_IndexedMapOfAddress - -#include - -typedef NCollection_IndexedMap Graphic3d_IndexedMapOfAddress; - -#endif // _Graphic3d_IndexedMapOfAddress diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index 1384a676de..e8a48295f3 100644 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -34,31 +34,28 @@ IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Structure,Standard_Transient) -//============================================================================= -//function : Graphic3d_Structure -//purpose : -//============================================================================= -Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManager)& theManager) -: myStructureManager(theManager.operator->()), - myComputeVisual (Graphic3d_TOS_ALL), - myOwner (NULL), - myVisual (Graphic3d_TOS_ALL) -{ - myCStructure = theManager->GraphicDriver()->CreateStructure (theManager); -} - //============================================================================= //function : Graphic3d_Structure //purpose : //============================================================================= Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManager)& theManager, - const Handle(Graphic3d_Structure)& thePrs) -: myStructureManager(theManager.operator->()), - myComputeVisual (thePrs->myComputeVisual), - myOwner (thePrs->myOwner), - myVisual (thePrs->myVisual) + const Handle(Graphic3d_Structure)& theLinkPrs) +: myStructureManager(theManager.get()), + myOwner (NULL), + myVisual (Graphic3d_TOS_ALL), + myComputeVisual (Graphic3d_TOS_ALL) { - myCStructure = thePrs->myCStructure->ShadowLink (theManager); + if (!theLinkPrs.IsNull()) + { + myOwner = theLinkPrs->myOwner; + myVisual = theLinkPrs->myVisual; + myComputeVisual = theLinkPrs->myComputeVisual; + myCStructure = theLinkPrs->myCStructure->ShadowLink (theManager); + } + else + { + myCStructure = theManager->GraphicDriver()->CreateStructure (theManager); + } } //============================================================================= @@ -119,20 +116,16 @@ void Graphic3d_Structure::Remove() aGroupIter.ChangeValue()->Clear (Standard_False); } - Standard_Address APtr = (void *) this; - // It is necessary to remove the eventual pointer on the structure - // that can be destroyed, in the list of descendants - // of ancestors of this structure and in the list of ancestors - // of descendants of the same structure. - + // It is necessary to remove the eventual pointer on the structure that can be destroyed, in the list of descendants + // of ancestors of this structure and in the list of ancestors of descendants of the same structure. for (Standard_Integer aStructIdx = 1, aNbDesc = myDescendants.Size(); aStructIdx <= aNbDesc; ++aStructIdx) { - ((Graphic3d_Structure *)myDescendants.FindKey (aStructIdx))->Remove (APtr, Graphic3d_TOC_ANCESTOR); + myDescendants.FindKey (aStructIdx)->Remove (this, Graphic3d_TOC_ANCESTOR); } for (Standard_Integer aStructIdx = 1, aNbAnces = myAncestors.Size(); aStructIdx <= aNbAnces; ++aStructIdx) { - ((Graphic3d_Structure *)myAncestors.FindKey (aStructIdx))->Remove (APtr, Graphic3d_TOC_DESCENDANT); + myAncestors.FindKey (aStructIdx)->Remove (this, Graphic3d_TOC_DESCENDANT); } // Destruction of me in the graphic library @@ -163,15 +156,6 @@ void Graphic3d_Structure::Display() } } -//============================================================================= -//function : SetIsForHighlight -//purpose : -//============================================================================= -void Graphic3d_Structure::SetIsForHighlight (const Standard_Boolean isForHighlight) -{ - myCStructure->IsForHighlight = isForHighlight; -} - //============================================================================= //function : SetDisplayPriority //purpose : @@ -219,15 +203,6 @@ void Graphic3d_Structure::ResetDisplayPriority() } } -//============================================================================= -//function : DisplayPriority -//purpose : -//============================================================================= -Standard_Integer Graphic3d_Structure::DisplayPriority() const -{ - return myCStructure->Priority; -} - //============================================================================= //function : Erase //purpose : @@ -314,61 +289,6 @@ void Graphic3d_Structure::UnHighlight() } } -//============================================================================= -//function : HighlightStyle -//purpose : -//============================================================================= -const Handle(Graphic3d_PresentationAttributes)& Graphic3d_Structure::HighlightStyle() const -{ - return myCStructure->HighlightStyle(); -} - -//============================================================================= -//function : IsDisplayed -//purpose : -//============================================================================= -Standard_Boolean Graphic3d_Structure::IsDisplayed() const -{ - return myCStructure->stick ? Standard_True : Standard_False; -} - -//============================================================================= -//function : IsDeleted -//purpose : -//============================================================================= -Standard_Boolean Graphic3d_Structure::IsDeleted() const -{ - return myCStructure.IsNull(); -} - -//============================================================================= -//function : IsHighlighted -//purpose : -//============================================================================= -Standard_Boolean Graphic3d_Structure::IsHighlighted() const -{ - return myCStructure->highlight ? Standard_True : Standard_False; -} - -//============================================================================= -//function : IsVisible -//purpose : -//============================================================================= -Standard_Boolean Graphic3d_Structure::IsVisible() const -{ - return myCStructure->visible ? Standard_True : Standard_False; -} - -//============================================================================= -//function : IsTransformed -//purpose : -//============================================================================= -Standard_Boolean Graphic3d_Structure::IsTransformed() const -{ - return !myCStructure->Transformation().IsNull() - && myCStructure->Transformation()->Form() != gp_Identity; -} - //============================================================================= //function : ContainsFacet //purpose : @@ -386,9 +306,9 @@ Standard_Boolean Graphic3d_Structure::ContainsFacet() const } // stop at the first descendant containing at least one facet - for (Graphic3d_IndexedMapOfAddress::Iterator anIter (myDescendants); anIter.More(); anIter.Next()) + for (NCollection_IndexedMap::Iterator anIter (myDescendants); anIter.More(); anIter.Next()) { - if (((const Graphic3d_Structure *)anIter.Value())->ContainsFacet()) + if (anIter.Value()->ContainsFacet()) { return Standard_True; } @@ -420,9 +340,9 @@ Standard_Boolean Graphic3d_Structure::IsEmpty() const } // stop at the first non-empty descendant - for (Graphic3d_IndexedMapOfAddress::Iterator anIter (myDescendants); anIter.More(); anIter.Next()) + for (NCollection_IndexedMap::Iterator anIter (myDescendants); anIter.More(); anIter.Next()) { - if (!((const Graphic3d_Structure* )anIter.Value())->IsEmpty()) + if (!anIter.Value()->IsEmpty()) { return Standard_False; } @@ -443,57 +363,6 @@ void Graphic3d_Structure::GroupsWithFacet (const Standard_Integer theDelta) } } -//============================================================================= -//function : Compute -//purpose : -//============================================================================= -void Graphic3d_Structure::Compute() -{ - // Implemented by Presentation -} - -//============================================================================= -//function : Compute -//purpose : -//============================================================================= -Handle(Graphic3d_Structure) Graphic3d_Structure::Compute (const Handle(Graphic3d_DataStructureManager)& ) -{ - // Implemented by Presentation - return this; -} - -//============================================================================= -//function : Compute -//purpose : -//============================================================================= -Handle(Graphic3d_Structure) Graphic3d_Structure::Compute (const Handle(Graphic3d_DataStructureManager)& , - const Handle(Geom_Transformation)& ) -{ - // Implemented by Presentation - return this; -} - -//============================================================================= -//function : Compute -//purpose : -//============================================================================= -void Graphic3d_Structure::Compute (const Handle(Graphic3d_DataStructureManager)& , - Handle(Graphic3d_Structure)& ) -{ - // Implemented by Presentation -} - -//============================================================================= -//function : Compute -//purpose : -//============================================================================= -void Graphic3d_Structure::Compute (const Handle(Graphic3d_DataStructureManager)& , - const Handle(Geom_Transformation)& , - Handle(Graphic3d_Structure)& ) -{ - // Implemented by Presentation -} - //============================================================================= //function : ReCompute //purpose : @@ -512,25 +381,6 @@ void Graphic3d_Structure::ReCompute (const Handle(Graphic3d_DataStructureManager myStructureManager->ReCompute (this, theProjector); } -//============================================================================= -//function : SetInfiniteState -//purpose : -//============================================================================= -void Graphic3d_Structure::SetInfiniteState (const Standard_Boolean theToSet) -{ - myCStructure->IsInfinite = theToSet ? 1 : 0; -} - -//============================================================================= -//function : IsInfinite -//purpose : -//============================================================================= -Standard_Boolean Graphic3d_Structure::IsInfinite() const -{ - return IsDeleted() - || myCStructure->IsInfinite; -} - //============================================================================= //function : GraphicClear //purpose : @@ -560,42 +410,6 @@ void Graphic3d_Structure::GraphicClear (const Standard_Boolean theWithDestructio myCStructure->Clear(); } -//============================================================================= -//function : GraphicConnect -//purpose : -//============================================================================= -void Graphic3d_Structure::GraphicConnect (const Handle(Graphic3d_Structure)& theDaughter) -{ - myCStructure->Connect (*theDaughter->myCStructure); -} - -//============================================================================= -//function : GraphicDisconnect -//purpose : -//============================================================================= -void Graphic3d_Structure::GraphicDisconnect (const Handle(Graphic3d_Structure)& theDaughter) -{ - myCStructure->Disconnect (*theDaughter->myCStructure); -} - -//============================================================================= -//function : Groups -//purpose : -//============================================================================= -const Graphic3d_SequenceOfGroup& Graphic3d_Structure::Groups() const -{ - return myCStructure->Groups(); -} - -//============================================================================= -//function : NumberOfGroups -//purpose : -//============================================================================= -Standard_Integer Graphic3d_Structure::NumberOfGroups() const -{ - return myCStructure->Groups().Length(); -} - //============================================================================= //function : SetVisual //purpose : @@ -639,25 +453,16 @@ void Graphic3d_Structure::SetZoomLimit (const Standard_Real theLimitInf, "ZoomLimit sup < ZoomLimit inf"); } -//============================================================================= -//function : Visual -//purpose : -//============================================================================= -Graphic3d_TypeOfStructure Graphic3d_Structure::Visual() const -{ - return myVisual; -} - //============================================================================= //function : AcceptConnection //purpose : //============================================================================= -Standard_Boolean Graphic3d_Structure::AcceptConnection (const Handle(Graphic3d_Structure)& theStructure1, - const Handle(Graphic3d_Structure)& theStructure2, - const Graphic3d_TypeOfConnection theType) +Standard_Boolean Graphic3d_Structure::AcceptConnection (Graphic3d_Structure* theStructure1, + Graphic3d_Structure* theStructure2, + Graphic3d_TypeOfConnection theType) { // cycle detection - Graphic3d_MapOfStructure aSet; + NCollection_Map aSet; Graphic3d_Structure::Network (theStructure2, theType, aSet); return !aSet.Contains (theStructure1); } @@ -668,39 +473,21 @@ Standard_Boolean Graphic3d_Structure::AcceptConnection (const Handle(Graphic3d_S //============================================================================= void Graphic3d_Structure::Ancestors (Graphic3d_MapOfStructure& theSet) const { - for (Graphic3d_IndexedMapOfAddress::Iterator anIter (myAncestors); anIter.More(); anIter.Next()) + for (NCollection_IndexedMap::Iterator anIter (myAncestors); anIter.More(); anIter.Next()) { - theSet.Add ((Graphic3d_Structure* )anIter.Value()); + theSet.Add (anIter.Value()); } } -//============================================================================= -//function : SetOwner -//purpose : -//============================================================================= -void Graphic3d_Structure::SetOwner (const Standard_Address theOwner) -{ - myOwner = theOwner; -} - -//============================================================================= -//function : Owner -//purpose : -//============================================================================= -Standard_Address Graphic3d_Structure::Owner() const -{ - return myOwner; -} - //============================================================================= //function : Descendants //purpose : //============================================================================= void Graphic3d_Structure::Descendants (Graphic3d_MapOfStructure& theSet) const { - for (Graphic3d_IndexedMapOfAddress::Iterator anIter (myDescendants); anIter.More(); anIter.Next()) + for (NCollection_IndexedMap::Iterator anIter (myDescendants); anIter.More(); anIter.Next()) { - theSet.Add ((Graphic3d_Structure* )anIter.Value()); + theSet.Add (anIter.Value()); } } @@ -708,7 +495,7 @@ void Graphic3d_Structure::Descendants (Graphic3d_MapOfStructure& theSet) const //function : AppendAncestor //purpose : //============================================================================= -Standard_Boolean Graphic3d_Structure::AppendAncestor (const Standard_Address theAncestor) +Standard_Boolean Graphic3d_Structure::AppendAncestor (Graphic3d_Structure* theAncestor) { const Standard_Integer aSize = myAncestors.Size(); @@ -719,7 +506,7 @@ Standard_Boolean Graphic3d_Structure::AppendAncestor (const Standard_Address the //function : AppendDescendant //purpose : //============================================================================= -Standard_Boolean Graphic3d_Structure::AppendDescendant (const Standard_Address theDescendant) +Standard_Boolean Graphic3d_Structure::AppendDescendant (Graphic3d_Structure* theDescendant) { const Standard_Integer aSize = myDescendants.Size(); @@ -730,7 +517,7 @@ Standard_Boolean Graphic3d_Structure::AppendDescendant (const Standard_Address t //function : RemoveAncestor //purpose : //============================================================================= -Standard_Boolean Graphic3d_Structure::RemoveAncestor (const Standard_Address theAncestor) +Standard_Boolean Graphic3d_Structure::RemoveAncestor (Graphic3d_Structure* theAncestor) { const Standard_Integer anIndex = myAncestors.FindIndex (theAncestor); @@ -747,7 +534,7 @@ Standard_Boolean Graphic3d_Structure::RemoveAncestor (const Standard_Address the //function : RemoveDescendant //purpose : //============================================================================= -Standard_Boolean Graphic3d_Structure::RemoveDescendant (const Standard_Address theDescendant) +Standard_Boolean Graphic3d_Structure::RemoveDescendant (Graphic3d_Structure* theDescendant) { const Standard_Integer anIndex = myDescendants.FindIndex (theDescendant); @@ -764,9 +551,9 @@ Standard_Boolean Graphic3d_Structure::RemoveDescendant (const Standard_Address t //function : Connect //purpose : //============================================================================= -void Graphic3d_Structure::Connect (const Handle(Graphic3d_Structure)& theStructure, - const Graphic3d_TypeOfConnection theType, - const Standard_Boolean theWithCheck) +void Graphic3d_Structure::Connect (Graphic3d_Structure* theStructure, + Graphic3d_TypeOfConnection theType, + Standard_Boolean theWithCheck) { if (IsDeleted()) { @@ -780,11 +567,9 @@ void Graphic3d_Structure::Connect (const Handle(Graphic3d_Structure)& theStructu return; } - const Standard_Address aStructure = theStructure.operator->(); - if (theType == Graphic3d_TOC_DESCENDANT) { - if (!AppendDescendant (aStructure)) + if (!AppendDescendant (theStructure)) { return; } @@ -799,7 +584,7 @@ void Graphic3d_Structure::Connect (const Handle(Graphic3d_Structure)& theStructu } else // Graphic3d_TOC_ANCESTOR { - if (!AppendAncestor (aStructure)) + if (!AppendAncestor (theStructure)) { return; } @@ -815,16 +600,14 @@ void Graphic3d_Structure::Connect (const Handle(Graphic3d_Structure)& theStructu //function : Disconnect //purpose : //============================================================================= -void Graphic3d_Structure::Disconnect (const Handle(Graphic3d_Structure)& theStructure) +void Graphic3d_Structure::Disconnect (Graphic3d_Structure* theStructure) { if (IsDeleted()) { return; } - const Standard_Address aStructure = theStructure.operator->(); - - if (RemoveDescendant (aStructure)) + if (RemoveDescendant (theStructure)) { theStructure->Disconnect (this); @@ -834,7 +617,7 @@ void Graphic3d_Structure::Disconnect (const Handle(Graphic3d_Structure)& theStru CalculateBoundBox(); Update (true); } - else if (RemoveAncestor (aStructure)) + else if (RemoveAncestor (theStructure)) { theStructure->Disconnect (this); CalculateBoundBox(); @@ -861,7 +644,7 @@ void Graphic3d_Structure::DisconnectAll (const Graphic3d_TypeOfConnection theTyp // is modified by : // Graphic3d_Structure::Disconnect (AStructure) // that takes AStructure from myDescendants - ((Graphic3d_Structure* )(myDescendants.FindKey (1)))->Disconnect (this); + myDescendants.FindKey (1)->Disconnect (this); } break; } @@ -873,7 +656,7 @@ void Graphic3d_Structure::DisconnectAll (const Graphic3d_TypeOfConnection theTyp // is modified by : // Graphic3d_Structure::Disconnect (AStructure) // that takes AStructure from myAncestors - ((Graphic3d_Structure* )(myAncestors.FindKey (1)))->Disconnect (this); + myAncestors.FindKey (1)->Disconnect (this); } break; } @@ -941,15 +724,6 @@ Bnd_Box Graphic3d_Structure::MinMaxValues (const Standard_Boolean theToIgnoreInf return aResult; } -//============================================================================= -//function : Identification -//purpose : -//============================================================================= -Standard_Integer Graphic3d_Structure::Identification() const -{ - return myCStructure->Id; -} - //============================================================================= //function : SetTransformPersistence //purpose : @@ -968,7 +742,7 @@ void Graphic3d_Structure::SetTransformPersistence (const Handle(Graphic3d_Transf //function : Remove //purpose : //============================================================================= -void Graphic3d_Structure::Remove (const Standard_Address thePtr, +void Graphic3d_Structure::Remove (Graphic3d_Structure* thePtr, const Graphic3d_TypeOfConnection theType) { if (theType == Graphic3d_TOC_DESCENDANT) @@ -1074,9 +848,9 @@ void Graphic3d_Structure::addTransformed (Graphic3d_BndBox3d& theBox, Graphic3d_BndBox3d aCombinedBox, aBox; getBox (aCombinedBox, theToIgnoreInfiniteFlag); - for (Graphic3d_IndexedMapOfAddress::Iterator anIter (myDescendants); anIter.More(); anIter.Next()) + for (NCollection_IndexedMap::Iterator anIter (myDescendants); anIter.More(); anIter.Next()) { - const Graphic3d_Structure* aStruct = (const Graphic3d_Structure* )anIter.Value(); + const Graphic3d_Structure* aStruct = anIter.Value(); aStruct->getBox (aBox, theToIgnoreInfiniteFlag); aCombinedBox.Combine (aBox); } @@ -1184,28 +958,29 @@ void Graphic3d_Structure::TransformBoundaries (const gp_Trsf& theTrsf, //function : Network //purpose : //============================================================================= -void Graphic3d_Structure::Network (const Handle(Graphic3d_Structure)& theStructure, - const Graphic3d_TypeOfConnection theType, - Graphic3d_MapOfStructure& theSet) +void Graphic3d_Structure::Network (Graphic3d_Structure* theStructure, + const Graphic3d_TypeOfConnection theType, + NCollection_Map& theSet) { - Graphic3d_MapOfStructure aSetD, aSetA; - theStructure->Descendants (aSetD); - theStructure->Ancestors (aSetA); theSet.Add (theStructure); switch (theType) { case Graphic3d_TOC_DESCENDANT: - for (Graphic3d_MapIteratorOfMapOfStructure anIter (aSetD); anIter.More(); anIter.Next()) + { + for (NCollection_IndexedMap::Iterator anIter (theStructure->myDescendants); anIter.More(); anIter.Next()) { - Graphic3d_Structure::Network (anIter.Key(), theType, theSet); + Graphic3d_Structure::Network (anIter.Value(), theType, theSet); } break; + } case Graphic3d_TOC_ANCESTOR: - for (Graphic3d_MapIteratorOfMapOfStructure anIter (aSetA); anIter.More(); anIter.Next()) + { + for (NCollection_IndexedMap::Iterator anIter (theStructure->myAncestors); anIter.More(); anIter.Next()) { - Graphic3d_Structure::Network (anIter.Key (), theType, theSet); + Graphic3d_Structure::Network (anIter.Value(), theType, theSet); } break; + } } } @@ -1216,9 +991,9 @@ void Graphic3d_Structure::Network (const Handle(Graphic3d_Structure)& theStructu void Graphic3d_Structure::PrintNetwork (const Handle(Graphic3d_Structure)& theStructure, const Graphic3d_TypeOfConnection theType) { - Graphic3d_MapOfStructure aSet; - Graphic3d_Structure::Network (theStructure, theType, aSet); - for (Graphic3d_MapIteratorOfMapOfStructure anIter (aSet); anIter.More(); anIter.Next()) + NCollection_Map aSet; + Graphic3d_Structure::Network (theStructure.get(), theType, aSet); + for (NCollection_Map::Iterator anIter (aSet); anIter.More(); anIter.Next()) { std::cout << "\tIdent " << (anIter.Key())->Identification () << "\n"; } @@ -1239,60 +1014,6 @@ void Graphic3d_Structure::Update (const bool theUpdateLayer) const myStructureManager->Update (theUpdateLayer ? myCStructure->ZLayer() : Graphic3d_ZLayerId_UNKNOWN); } -//============================================================================= -//function : GraphicTransform -//purpose : -//============================================================================= -void Graphic3d_Structure::GraphicTransform (const Handle(Geom_Transformation)& theTrsf) -{ - myCStructure->SetTransformation (theTrsf); -} - -//============================================================================= -//function : ComputeVisual -//purpose : -//============================================================================= -Graphic3d_TypeOfStructure Graphic3d_Structure::ComputeVisual() const -{ - return myComputeVisual; -} - -//============================================================================= -//function : SetComputeVisual -//purpose : -//============================================================================= -void Graphic3d_Structure::SetComputeVisual (const Graphic3d_TypeOfStructure theVisual) -{ - // The ComputeVisual is saved only if the structure is declared TOS_ALL, TOS_WIREFRAME or TOS_SHADING. - // This declaration permits to calculate proper representation of the structure calculated by Compute instead of passage to TOS_COMPUTED. - if (theVisual != Graphic3d_TOS_COMPUTED) - { - myComputeVisual = theVisual; - } -} - -//============================================================================= -//function : SetHLRValidation -//purpose : -//============================================================================= -void Graphic3d_Structure::SetHLRValidation (const Standard_Boolean theFlag) -{ - myCStructure->HLRValidation = theFlag ? 1 : 0; -} - -//============================================================================= -//function : HLRValidation -//purpose : -//============================================================================= -Standard_Boolean Graphic3d_Structure::HLRValidation() const -{ - // Hidden parts stored in are valid if : - // 1/ the owner is defined. - // 2/ they are not invalid. - return myOwner != NULL - && myCStructure->HLRValidation != 0; -} - //======================================================================= //function : SetZLayer //purpose : @@ -1306,48 +1027,3 @@ void Graphic3d_Structure::SetZLayer (const Graphic3d_ZLayerId theLayerId) myStructureManager->ChangeZLayer (this, theLayerId); myCStructure->SetZLayer (theLayerId); } - -//======================================================================= -//function : GetZLayer -//purpose : -//======================================================================= -Graphic3d_ZLayerId Graphic3d_Structure::GetZLayer() const -{ - return myCStructure->ZLayer(); -} - -//======================================================================= -//function : SetClipPlanes -//purpose : -//======================================================================= -void Graphic3d_Structure::SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) -{ - myCStructure->SetClipPlanes (thePlanes); -} - -//======================================================================= -//function : GetClipPlanes -//purpose : -//======================================================================= -const Handle(Graphic3d_SequenceOfHClipPlane)& Graphic3d_Structure::ClipPlanes() const -{ - return myCStructure->ClipPlanes(); -} - -//======================================================================= -//function : SetMutable -//purpose : -//======================================================================= -void Graphic3d_Structure::SetMutable (const Standard_Boolean theIsMutable) -{ - myCStructure->IsMutable = theIsMutable; -} - -//======================================================================= -//function : IsMutable -//purpose : -//======================================================================= -Standard_Boolean Graphic3d_Structure::IsMutable() const -{ - return myCStructure->IsMutable; -} diff --git a/src/Graphic3d/Graphic3d_Structure.hxx b/src/Graphic3d/Graphic3d_Structure.hxx index d366406615..3854a4389a 100644 --- a/src/Graphic3d/Graphic3d_Structure.hxx +++ b/src/Graphic3d/Graphic3d_Structure.hxx @@ -17,62 +17,44 @@ #ifndef _Graphic3d_Structure_HeaderFile #define _Graphic3d_Structure_HeaderFile -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -class Graphic3d_PriorityDefinitionError; -class Graphic3d_StructureDefinitionError; -class Graphic3d_TransformError; -class Graphic3d_Group; +#include +#include + class Graphic3d_StructureManager; class Graphic3d_DataStructureManager; class Bnd_Box; class gp_Pnt; - -class Graphic3d_Structure; DEFINE_STANDARD_HANDLE(Graphic3d_Structure, Standard_Transient) //! This class allows the definition a graphic object. -//! This graphic structure can be displayed, -//! erased, or highlighted. -//! This graphic structure can be connected with -//! another graphic structure. -//! Keywords: Structure, StructureManager, Display, Erase, Highlight, -//! UnHighlight, Visible, Priority, Selectable, Visible, -//! Visual, Connection, Ancestors, Descendants, Transformation +//! This graphic structure can be displayed, erased, or highlighted. +//! This graphic structure can be connected with another graphic structure. class Graphic3d_Structure : public Standard_Transient { - + DEFINE_STANDARD_RTTIEXT(Graphic3d_Structure, Standard_Transient) + friend class Graphic3d_Group; public: - //! Creates a graphic object in the manager theManager. //! It will appear in all the views of the visualiser. //! The structure is not displayed when it is created. - Standard_EXPORT Graphic3d_Structure(const Handle(Graphic3d_StructureManager)& theManager); - - //! Creates a shadow link to existing graphic object. - Standard_EXPORT Graphic3d_Structure(const Handle(Graphic3d_StructureManager)& theManager, const Handle(Graphic3d_Structure)& thePrs); + //! @param theManager structure manager holding this structure + //! @param theLinkPrs another structure for creating a shadow (linked) structure + Standard_EXPORT Graphic3d_Structure (const Handle(Graphic3d_StructureManager)& theManager, + const Handle(Graphic3d_Structure)& theLinkPrs = Handle(Graphic3d_Structure)()); //! if WithDestruction == Standard_True then //! suppress all the groups of primitives in the structure. @@ -88,14 +70,13 @@ public: //! Suppresses the structure . //! It will be erased at the next screen update. - Standard_EXPORT ~Graphic3d_Structure(); + Standard_EXPORT virtual ~Graphic3d_Structure(); //! Displays the structure in all the views of the visualiser. Standard_EXPORT virtual void Display(); - - //! Returns the current display priority for the - //! structure . - Standard_EXPORT Standard_Integer DisplayPriority() const; + + //! Returns the current display priority for this structure. + Standard_Integer DisplayPriority() const { return myCStructure->Priority; } //! Erases the structure in all the views //! of the visualiser. @@ -116,13 +97,13 @@ public: //! Computes axis-aligned bounding box of a structure. Standard_EXPORT virtual void CalculateBoundBox(); - //! If is Standard_True then is infinite and - //! the MinMaxValues method method return : + //! Sets infinite flag. + //! When TRUE, the MinMaxValues method returns: //! theXMin = theYMin = theZMin = RealFirst(). //! theXMax = theYMax = theZMax = RealLast(). - //! By default, is not infinite but empty. - Standard_EXPORT void SetInfiniteState (const Standard_Boolean theToSet); - + //! By default, structure is created not infinite but empty. + void SetInfiniteState (const Standard_Boolean theToSet) { myCStructure->IsInfinite = theToSet ? 1 : 0; } + //! Modifies the order of displaying the structure. //! Values are between 0 and 10. //! Structures are drawn according to their display priorities @@ -151,17 +132,17 @@ public: //! test between layers Standard_EXPORT void SetZLayer (const Graphic3d_ZLayerId theLayerId); - //! Get Z layer ID of displayed structure. The method - //! returns -1 if the structure has no ID (deleted from graphic driver). - Standard_EXPORT Graphic3d_ZLayerId GetZLayer() const; + //! Get Z layer ID of displayed structure. + //! The method returns -1 if the structure has no ID (deleted from graphic driver). + Graphic3d_ZLayerId GetZLayer() const { return myCStructure->ZLayer(); } //! Changes a sequence of clip planes slicing the structure on rendering. //! @param thePlanes [in] the set of clip planes. - Standard_EXPORT void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes); + void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) { myCStructure->SetClipPlanes (thePlanes); } //! Get clip planes slicing the structure on rendering. //! @return set of clip planes. - Standard_EXPORT const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const; + const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const { return myCStructure->ClipPlanes(); } //! Modifies the visibility indicator to Standard_True or //! Standard_False for the structure . @@ -180,32 +161,52 @@ public: //! greater than or if or //! is a negative value. Standard_EXPORT void SetZoomLimit (const Standard_Real LimitInf, const Standard_Real LimitSup); - - //! marks the structure representing wired structure needed for - //! highlight only so it won't be added to BVH tree. - //! Category: Methods to modify the class definition - Standard_EXPORT void SetIsForHighlight (const Standard_Boolean isForHighlight); + + //! Marks the structure representing wired structure needed for highlight only so it won't be added to BVH tree. + void SetIsForHighlight (const Standard_Boolean isForHighlight) { myCStructure->IsForHighlight = isForHighlight; } //! Suppresses the highlight for the structure //! in all the views of the visualiser. Standard_EXPORT void UnHighlight(); - Standard_EXPORT virtual void Compute(); + virtual void Compute() + { + // + } //! Returns the new Structure defined for the new visualization - Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector); + virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector) + { + (void )theProjector; + return this; + } //! Returns the new Structure defined for the new visualization - Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, - const Handle(Geom_Transformation)& theTrsf); + virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, + const Handle(Geom_Transformation)& theTrsf) + { + (void )theProjector; + (void )theTrsf; + return this; + } + + //! Returns the new Structure defined for the new visualization + virtual void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, + Handle(Graphic3d_Structure)& theStructure) + { + (void )theProjector; + (void )theStructure; + } //! Returns the new Structure defined for the new visualization - Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, Handle(Graphic3d_Structure)& aStructure); - - //! Returns the new Structure defined for the new visualization - Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, - const Handle(Geom_Transformation)& theTrsf, - Handle(Graphic3d_Structure)& theStructure); + virtual void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, + const Handle(Geom_Transformation)& theTrsf, + Handle(Graphic3d_Structure)& theStructure) + { + (void )theProjector; + (void )theTrsf; + (void )theStructure; + } //! Forces a new construction of the structure //! if is displayed and TOS_COMPUTED. @@ -219,26 +220,33 @@ public: //! Polygons, Triangles or Quadrangles. Standard_EXPORT Standard_Boolean ContainsFacet() const; - //! Returns the groups sequence included in the structure (internal storage). - Standard_EXPORT const Graphic3d_SequenceOfGroup& Groups() const; - - //! Returns the current number of groups in the - //! structure . - Standard_EXPORT Standard_Integer NumberOfGroups() const; + //! Returns the groups sequence included in this structure. + const Graphic3d_SequenceOfGroup& Groups() const { return myCStructure->Groups(); } + + //! Returns the current number of groups in this structure. + Standard_Integer NumberOfGroups() const { return myCStructure->Groups().Length(); } //! Append new group to this structure. Standard_EXPORT Handle(Graphic3d_Group) NewGroup(); + + //! Returns the last created group or creates new one if list is empty. + Handle(Graphic3d_Group) CurrentGroup() + { + if (Groups().IsEmpty()) + { + return NewGroup(); + } + return Groups().Last(); + } + + //! Returns the highlight attributes. + const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const { return myCStructure->HighlightStyle(); } + + //! Returns TRUE if this structure is deleted (after Remove() call). + Standard_Boolean IsDeleted() const { return myCStructure.IsNull(); } - //! Returns the highlight color for the Highlight method - //! with the highlight method TOHM_COLOR or TOHM_BOUNDBOX. - Standard_EXPORT const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const; - - //! Returns Standard_True if the structure is deleted. - //! is deleted after the call Remove (me). - Standard_EXPORT Standard_Boolean IsDeleted() const; - - //! Returns the display indicator for the structure . - Standard_EXPORT virtual Standard_Boolean IsDisplayed() const; + //! Returns the display indicator for this structure. + virtual Standard_Boolean IsDisplayed() const { return myCStructure->stick != 0; } //! Returns Standard_True if the structure is empty. //! Warning: A structure is empty if : @@ -248,17 +256,24 @@ public: Standard_EXPORT Standard_Boolean IsEmpty() const; //! Returns Standard_True if the structure is infinite. - Standard_EXPORT Standard_Boolean IsInfinite() const; + Standard_Boolean IsInfinite() const + { + return IsDeleted() + || myCStructure->IsInfinite; + } - //! Returns the highlight indicator for the structure . - Standard_EXPORT virtual Standard_Boolean IsHighlighted() const; + //! Returns the highlight indicator for this structure. + virtual Standard_Boolean IsHighlighted() const { return myCStructure->highlight != 0; } - //! Returns Standard_True if the structure is transformed. - //! <=> The transformation != Identity. - Standard_EXPORT Standard_Boolean IsTransformed() const; + //! Returns TRUE if the structure is transformed. + Standard_Boolean IsTransformed() const + { + return !myCStructure->Transformation().IsNull() + && myCStructure->Transformation()->Form() != gp_Identity; + } - //! Returns the visibility indicator for the structure . - Standard_EXPORT Standard_Boolean IsVisible() const; + //! Returns the visibility indicator for this structure. + Standard_Boolean IsVisible() const { return myCStructure->visible != 0; } //! Returns the coordinates of the boundary box of the structure . //! If is TRUE, the method returns actual graphical @@ -272,7 +287,7 @@ public: Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const; //! Returns the visualisation mode for the structure . - Standard_EXPORT Graphic3d_TypeOfStructure Visual() const; + Graphic3d_TypeOfStructure Visual() const { return myVisual; } //! Returns Standard_True if the connection is possible between //! and without a creation @@ -287,7 +302,9 @@ public: //! - the set of all descendants of contains //! and if the //! TypeOfConnection == TOC_ANCESTOR - Standard_EXPORT static Standard_Boolean AcceptConnection (const Handle(Graphic3d_Structure)& AStructure1, const Handle(Graphic3d_Structure)& AStructure2, const Graphic3d_TypeOfConnection AType); + Standard_EXPORT static Standard_Boolean AcceptConnection (Graphic3d_Structure* theStructure1, + Graphic3d_Structure* theStructure2, + Graphic3d_TypeOfConnection theType); //! Returns the group of structures to which is connected. Standard_EXPORT void Ancestors (Graphic3d_MapOfStructure& SG) const; @@ -300,34 +317,57 @@ public: //! Remove, and stacks the transformations. //! No connection if the graph of the structures //! contains a cycle and is Standard_True; - Standard_EXPORT void Connect (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType, const Standard_Boolean WithCheck = Standard_False); + Standard_EXPORT void Connect (Graphic3d_Structure* theStructure, + Graphic3d_TypeOfConnection theType, + Standard_Boolean theWithCheck = Standard_False); + + Standard_DEPRECATED("Deprecated short-cut") + void Connect (const Handle(Graphic3d_Structure)& thePrs) + { + Connect (thePrs.get(), Graphic3d_TOC_DESCENDANT); + } //! Returns the group of structures connected to . Standard_EXPORT void Descendants (Graphic3d_MapOfStructure& SG) const; //! Suppress the connection between and . - Standard_EXPORT void Disconnect (const Handle(Graphic3d_Structure)& AStructure); + Standard_EXPORT void Disconnect (Graphic3d_Structure* theStructure); + + Standard_DEPRECATED("Deprecated alias for Disconnect()") + void Remove (const Handle(Graphic3d_Structure)& thePrs) { Disconnect (thePrs.get()); } //! If Atype is TOC_DESCENDANT then suppress all //! the connections with the child structures of . //! If Atype is TOC_ANCESTOR then suppress all //! the connections with the parent structures of . Standard_EXPORT void DisconnectAll (const Graphic3d_TypeOfConnection AType); + + Standard_DEPRECATED("Deprecated alias for DisconnectAll()") + void RemoveAll() { DisconnectAll (Graphic3d_TOC_DESCENDANT); } //! Returns the group of structures : //! - directly or indirectly connected to if the //! TypeOfConnection == TOC_DESCENDANT //! - to which is directly or indirectly connected //! if the TypeOfConnection == TOC_ANCESTOR - Standard_EXPORT static void Network (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType, Graphic3d_MapOfStructure& ASet); + Standard_EXPORT static void Network (Graphic3d_Structure* theStructure, + const Graphic3d_TypeOfConnection theType, + NCollection_Map& theSet); - Standard_EXPORT void SetOwner (const Standard_Address Owner); + void SetOwner (const Standard_Address theOwner) { myOwner = theOwner; } - Standard_EXPORT Standard_Address Owner() const; + Standard_Address Owner() const { return myOwner; } - Standard_EXPORT void SetHLRValidation (const Standard_Boolean AFlag); - - Standard_EXPORT Standard_Boolean HLRValidation() const; + void SetHLRValidation (const Standard_Boolean theFlag) { myCStructure->HLRValidation = theFlag ? 1 : 0; } + + //! Hidden parts stored in this structure are valid if: + //! 1) the owner is defined. + //! 2) they are not invalid. + Standard_Boolean HLRValidation() const + { + return myOwner != NULL + && myCStructure->HLRValidation != 0; + } //! Return local transformation. const Handle(Geom_Transformation)& Transformation() const { return myCStructure->Transformation(); } @@ -345,36 +385,44 @@ public: const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myCStructure->TransformPersistence(); } //! Sets if the structure location has mutable nature (content or location will be changed regularly). - Standard_EXPORT void SetMutable (const Standard_Boolean theIsMutable); + void SetMutable (const Standard_Boolean theIsMutable) { myCStructure->IsMutable = theIsMutable; } //! Returns true if structure has mutable nature (content or location are be changed regularly). //! Mutable structure will be managed in different way than static onces. - Standard_EXPORT Standard_Boolean IsMutable() const; + Standard_Boolean IsMutable() const { return myCStructure->IsMutable; } - Standard_EXPORT Graphic3d_TypeOfStructure ComputeVisual() const; + Graphic3d_TypeOfStructure ComputeVisual() const { return myComputeVisual; } //! Clears the structure . Standard_EXPORT void GraphicClear (const Standard_Boolean WithDestruction); - Standard_EXPORT void GraphicConnect (const Handle(Graphic3d_Structure)& ADaughter); + void GraphicConnect (const Handle(Graphic3d_Structure)& theDaughter) { myCStructure->Connect (*theDaughter->myCStructure); } - Standard_EXPORT void GraphicDisconnect (const Handle(Graphic3d_Structure)& ADaughter); + void GraphicDisconnect (const Handle(Graphic3d_Structure)& theDaughter) { myCStructure->Disconnect (*theDaughter->myCStructure); } //! Internal method which sets new transformation without calling graphic manager callbacks. - Standard_EXPORT void GraphicTransform (const Handle(Geom_Transformation)& theTrsf); + void GraphicTransform (const Handle(Geom_Transformation)& theTrsf) { myCStructure->SetTransformation (theTrsf); } - //! Returns the identification number of the structure . - Standard_EXPORT Standard_Integer Identification() const; + //! Returns the identification number of this structure. + Standard_Integer Identification() const { return myCStructure->Id; } //! Prints informations about the network associated //! with the structure . Standard_EXPORT static void PrintNetwork (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType); - //! Suppress the adress in the list - //! of descendants or in the list of ancestors. - Standard_EXPORT void Remove (const Standard_Address APtr, const Graphic3d_TypeOfConnection AType); + //! Suppress the structure in the list of descendants or in the list of ancestors. + Standard_EXPORT void Remove (Graphic3d_Structure* thePtr, + const Graphic3d_TypeOfConnection theType); - Standard_EXPORT void SetComputeVisual (const Graphic3d_TypeOfStructure AVisual); + void SetComputeVisual (const Graphic3d_TypeOfStructure theVisual) + { + // The ComputeVisual is saved only if the structure is declared TOS_ALL, TOS_WIREFRAME or TOS_SHADING. + // This declaration permits to calculate proper representation of the structure calculated by Compute instead of passage to TOS_COMPUTED. + if (theVisual != Graphic3d_TOS_COMPUTED) + { + myComputeVisual = theVisual; + } + } //! Transforms theX, theY, theZ with the transformation theTrsf. Standard_EXPORT static void Transforms (const gp_Trsf& theTrsf, @@ -384,11 +432,6 @@ public: //! Returns the low-level structure const Handle(Graphic3d_CStructure)& CStructure() const { return myCStructure; } -friend class Graphic3d_Group; - - - DEFINE_STANDARD_RTTIEXT(Graphic3d_Structure,Standard_Transient) - protected: //! Transforms boundaries with transformation. @@ -397,16 +440,16 @@ protected: Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax); //! Appends new descendant structure. - Standard_EXPORT Standard_Boolean AppendDescendant (const Standard_Address theDescendant); + Standard_EXPORT Standard_Boolean AppendDescendant (Graphic3d_Structure* theDescendant); //! Removes the given descendant structure. - Standard_EXPORT Standard_Boolean RemoveDescendant (const Standard_Address theDescendant); + Standard_EXPORT Standard_Boolean RemoveDescendant (Graphic3d_Structure* theDescendant); //! Appends new ancestor structure. - Standard_EXPORT Standard_Boolean AppendAncestor (const Standard_Address theAncestor); + Standard_EXPORT Standard_Boolean AppendAncestor (Graphic3d_Structure* theAncestor); //! Removes the given ancestor structure. - Standard_EXPORT Standard_Boolean RemoveAncestor (const Standard_Address theAncestor); + Standard_EXPORT Standard_Boolean RemoveAncestor (Graphic3d_Structure* theAncestor); private: @@ -438,14 +481,13 @@ private: protected: - Graphic3d_StructureManager* myStructureManager; - Graphic3d_TypeOfStructure myComputeVisual; - - Handle(Graphic3d_CStructure) myCStructure; - Graphic3d_IndexedMapOfAddress myAncestors; - Graphic3d_IndexedMapOfAddress myDescendants; - Standard_Address myOwner; - Graphic3d_TypeOfStructure myVisual; + Graphic3d_StructureManager* myStructureManager; + Handle(Graphic3d_CStructure) myCStructure; + NCollection_IndexedMap myAncestors; + NCollection_IndexedMap myDescendants; + Standard_Address myOwner; + Graphic3d_TypeOfStructure myVisual; + Graphic3d_TypeOfStructure myComputeVisual; }; diff --git a/src/Graphic3d/Graphic3d_StructureManager.cxx b/src/Graphic3d/Graphic3d_StructureManager.cxx index 572c27e4e4..0c1728b717 100644 --- a/src/Graphic3d/Graphic3d_StructureManager.cxx +++ b/src/Graphic3d/Graphic3d_StructureManager.cxx @@ -162,21 +162,21 @@ void Graphic3d_StructureManager::RecomputeStructures() myDeviceLostFlag = Standard_False; // Go through all unique structures including child (connected) ones and ensure that they are computed. - Graphic3d_MapOfStructure aStructNetwork; + NCollection_Map aStructNetwork; for (Graphic3d_MapIteratorOfMapOfStructure anIter(myDisplayedStructure); anIter.More(); anIter.Next()) { Handle(Graphic3d_Structure) aStructure = anIter.Key(); - anIter.Key()->Network (anIter.Key(), Graphic3d_TOC_DESCENDANT, aStructNetwork); + anIter.Key()->Network (anIter.Key().get(), Graphic3d_TOC_DESCENDANT, aStructNetwork); } RecomputeStructures (aStructNetwork); } -void Graphic3d_StructureManager::RecomputeStructures (const Graphic3d_MapOfStructure& theStructures) +void Graphic3d_StructureManager::RecomputeStructures (const NCollection_Map& theStructures) { - for (Graphic3d_MapIteratorOfMapOfStructure anIter (theStructures); anIter.More(); anIter.Next()) + for (NCollection_Map::Iterator anIter (theStructures); anIter.More(); anIter.Next()) { - Handle(Graphic3d_Structure) aStruct = anIter.Key(); + Graphic3d_Structure* aStruct = anIter.Key(); aStruct->Clear(); aStruct->Compute(); } @@ -295,7 +295,7 @@ void Graphic3d_StructureManager::ReCompute (const Handle(Graphic3d_Structure)& t // function : Clear // purpose : // ======================================================================== -void Graphic3d_StructureManager::Clear (const Handle(Graphic3d_Structure)& theStructure, +void Graphic3d_StructureManager::Clear (Graphic3d_Structure* theStructure, const Standard_Boolean theWithDestruction) { for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next()) @@ -308,8 +308,8 @@ void Graphic3d_StructureManager::Clear (const Handle(Graphic3d_Structure)& theSt // function : Connect // purpose : // ======================================================================== -void Graphic3d_StructureManager::Connect (const Handle(Graphic3d_Structure)& theMother, - const Handle(Graphic3d_Structure)& theDaughter) +void Graphic3d_StructureManager::Connect (const Graphic3d_Structure* theMother, + const Graphic3d_Structure* theDaughter) { for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next()) { @@ -321,8 +321,8 @@ void Graphic3d_StructureManager::Connect (const Handle(Graphic3d_Structure)& the // function : Disconnect // purpose : // ======================================================================== -void Graphic3d_StructureManager::Disconnect (const Handle(Graphic3d_Structure)& theMother, - const Handle(Graphic3d_Structure)& theDaughter) +void Graphic3d_StructureManager::Disconnect (const Graphic3d_Structure* theMother, + const Graphic3d_Structure* theDaughter) { for (Graphic3d_IndexedMapOfView::Iterator aViewIt (myDefinedViews); aViewIt.More(); aViewIt.Next()) { diff --git a/src/Graphic3d/Graphic3d_StructureManager.hxx b/src/Graphic3d/Graphic3d_StructureManager.hxx index c5b7e87eca..0f36aa2b23 100644 --- a/src/Graphic3d/Graphic3d_StructureManager.hxx +++ b/src/Graphic3d/Graphic3d_StructureManager.hxx @@ -89,13 +89,15 @@ public: Standard_EXPORT virtual void ReCompute (const Handle(Graphic3d_Structure)& theStructure, const Handle(Graphic3d_DataStructureManager)& theProjector); //! Clears the structure. - Standard_EXPORT virtual void Clear (const Handle(Graphic3d_Structure)& theStructure, const Standard_Boolean theWithDestruction); + Standard_EXPORT virtual void Clear (Graphic3d_Structure* theStructure, const Standard_Boolean theWithDestruction); //! Connects the structures. - Standard_EXPORT virtual void Connect (const Handle(Graphic3d_Structure)& theMother, const Handle(Graphic3d_Structure)& theDaughter); + Standard_EXPORT virtual void Connect (const Graphic3d_Structure* theMother, + const Graphic3d_Structure* theDaughter); //! Disconnects the structures. - Standard_EXPORT virtual void Disconnect (const Handle(Graphic3d_Structure)& theMother, const Handle(Graphic3d_Structure)& theDaughter); + Standard_EXPORT virtual void Disconnect (const Graphic3d_Structure* theMother, + const Graphic3d_Structure* theDaughter); //! Display the structure. Standard_EXPORT virtual void Display (const Handle(Graphic3d_Structure)& theStructure); @@ -147,7 +149,7 @@ public: Standard_EXPORT void RecomputeStructures(); //! Recomputes all structures from theStructures. - Standard_EXPORT void RecomputeStructures (const Graphic3d_MapOfStructure& theStructures); + Standard_EXPORT void RecomputeStructures (const NCollection_Map& theStructures); Standard_EXPORT Handle(Graphic3d_ViewAffinity) RegisterObject (const Handle(Standard_Transient)& theObject); diff --git a/src/MeshVS/MeshVS_ElementalColorPrsBuilder.hxx b/src/MeshVS/MeshVS_ElementalColorPrsBuilder.hxx index c24f715ec6..c093048832 100644 --- a/src/MeshVS/MeshVS_ElementalColorPrsBuilder.hxx +++ b/src/MeshVS/MeshVS_ElementalColorPrsBuilder.hxx @@ -16,21 +16,15 @@ #ifndef _MeshVS_ElementalColorPrsBuilder_HeaderFile #define _MeshVS_ElementalColorPrsBuilder_HeaderFile -#include -#include - #include #include #include #include -#include #include -#include -#include #include + class MeshVS_Mesh; class MeshVS_DataSource; -class Prs3d_Presentation; class Quantity_Color; diff --git a/src/MeshVS/MeshVS_Mesh.cxx b/src/MeshVS/MeshVS_Mesh.cxx index 1df85334e4..108dc57e35 100644 --- a/src/MeshVS/MeshVS_Mesh.cxx +++ b/src/MeshVS/MeshVS_Mesh.cxx @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include diff --git a/src/MeshVS/MeshVS_Mesh.hxx b/src/MeshVS/MeshVS_Mesh.hxx index 817bed9864..06a0275046 100644 --- a/src/MeshVS/MeshVS_Mesh.hxx +++ b/src/MeshVS/MeshVS_Mesh.hxx @@ -16,29 +16,20 @@ #ifndef _MeshVS_Mesh_HeaderFile #define _MeshVS_Mesh_HeaderFile -#include -#include - #include #include #include #include -#include -#include -#include -#include #include #include #include + class MeshVS_PrsBuilder; class TColStd_HPackedMapOfInteger; class MeshVS_DataSource; class MeshVS_Drawer; class SelectMgr_EntityOwner; -class Prs3d_Presentation; - -class MeshVS_Mesh; DEFINE_STANDARD_HANDLE(MeshVS_Mesh, AIS_InteractiveObject) //! the main class provides interface to create mesh presentation as a whole diff --git a/src/MeshVS/MeshVS_MeshPrsBuilder.hxx b/src/MeshVS/MeshVS_MeshPrsBuilder.hxx index acdd26d717..818c90c931 100644 --- a/src/MeshVS/MeshVS_MeshPrsBuilder.hxx +++ b/src/MeshVS/MeshVS_MeshPrsBuilder.hxx @@ -16,29 +16,21 @@ #ifndef _MeshVS_MeshPrsBuilder_HeaderFile #define _MeshVS_MeshPrsBuilder_HeaderFile -#include -#include - #include #include -#include #include #include -#include #include -#include #include + class MeshVS_Mesh; class MeshVS_DataSource; -class Prs3d_Presentation; class Graphic3d_ArrayOfSegments; class Graphic3d_ArrayOfTriangles; class Graphic3d_ArrayOfPrimitives; class Graphic3d_AspectFillArea3d; class Graphic3d_AspectLine3d; - -class MeshVS_MeshPrsBuilder; DEFINE_STANDARD_HANDLE(MeshVS_MeshPrsBuilder, MeshVS_PrsBuilder) //! This class provides methods to compute base mesh presentation diff --git a/src/MeshVS/MeshVS_NodalColorPrsBuilder.hxx b/src/MeshVS/MeshVS_NodalColorPrsBuilder.hxx index c87f836d52..259f2ad85a 100644 --- a/src/MeshVS/MeshVS_NodalColorPrsBuilder.hxx +++ b/src/MeshVS/MeshVS_NodalColorPrsBuilder.hxx @@ -16,32 +16,24 @@ #ifndef _MeshVS_NodalColorPrsBuilder_HeaderFile #define _MeshVS_NodalColorPrsBuilder_HeaderFile -#include -#include - #include -#include #include #include #include #include #include -#include #include #include -#include #include #include #include + class MeshVS_Mesh; class MeshVS_DataSource; -class Prs3d_Presentation; class Quantity_Color; class Graphic3d_Texture2D; class Graphic3d_ArrayOfPrimitives; - -class MeshVS_NodalColorPrsBuilder; DEFINE_STANDARD_HANDLE(MeshVS_NodalColorPrsBuilder, MeshVS_PrsBuilder) //! This class provides methods to create presentation of nodes with assigned color. diff --git a/src/MeshVS/MeshVS_PrsBuilder.hxx b/src/MeshVS/MeshVS_PrsBuilder.hxx index 87b4189350..eb5007209e 100644 --- a/src/MeshVS/MeshVS_PrsBuilder.hxx +++ b/src/MeshVS/MeshVS_PrsBuilder.hxx @@ -16,21 +16,16 @@ #ifndef _MeshVS_PrsBuilder_HeaderFile #define _MeshVS_PrsBuilder_HeaderFile -#include -#include - -#include #include -#include #include -#include +#include #include #include #include + class MeshVS_DataSource; class MeshVS_Drawer; class MeshVS_Mesh; -class Prs3d_Presentation; class SelectBasics_SensitiveEntity; class SelectBasics_EntityOwner; diff --git a/src/MeshVS/MeshVS_TextPrsBuilder.hxx b/src/MeshVS/MeshVS_TextPrsBuilder.hxx index 6e3356d0d0..7dad18b4ef 100644 --- a/src/MeshVS/MeshVS_TextPrsBuilder.hxx +++ b/src/MeshVS/MeshVS_TextPrsBuilder.hxx @@ -16,25 +16,16 @@ #ifndef _MeshVS_TextPrsBuilder_HeaderFile #define _MeshVS_TextPrsBuilder_HeaderFile -#include -#include - #include #include -#include #include -#include #include -#include -#include + class MeshVS_Mesh; class Quantity_Color; class MeshVS_DataSource; -class Prs3d_Presentation; class TCollection_AsciiString; - -class MeshVS_TextPrsBuilder; DEFINE_STANDARD_HANDLE(MeshVS_TextPrsBuilder, MeshVS_PrsBuilder) //! This class provides methods to create text data presentation. diff --git a/src/MeshVS/MeshVS_VectorPrsBuilder.hxx b/src/MeshVS/MeshVS_VectorPrsBuilder.hxx index 4f2bed81b5..295cea0e45 100644 --- a/src/MeshVS/MeshVS_VectorPrsBuilder.hxx +++ b/src/MeshVS/MeshVS_VectorPrsBuilder.hxx @@ -16,28 +16,19 @@ #ifndef _MeshVS_VectorPrsBuilder_HeaderFile #define _MeshVS_VectorPrsBuilder_HeaderFile -#include -#include - -#include -#include #include #include #include -#include #include -#include #include + class MeshVS_Mesh; class Quantity_Color; class MeshVS_DataSource; -class Prs3d_Presentation; class gp_Trsf; class Graphic3d_ArrayOfPrimitives; class gp_Vec; - -class MeshVS_VectorPrsBuilder; DEFINE_STANDARD_HANDLE(MeshVS_VectorPrsBuilder, MeshVS_PrsBuilder) //! This class provides methods to create vector data presentation. diff --git a/src/Prs3d/FILES b/src/Prs3d/FILES index 52ee3aef56..31d2a551e6 100755 --- a/src/Prs3d/FILES +++ b/src/Prs3d/FILES @@ -32,7 +32,6 @@ Prs3d_PlaneAspect.hxx Prs3d_Point.hxx Prs3d_PointAspect.cxx Prs3d_PointAspect.hxx -Prs3d_Presentation.cxx Prs3d_Presentation.hxx Prs3d_PresentationShadow.cxx Prs3d_PresentationShadow.hxx diff --git a/src/Prs3d/Prs3d.hxx b/src/Prs3d/Prs3d.hxx index 0fc819df50..73e10d5300 100644 --- a/src/Prs3d/Prs3d.hxx +++ b/src/Prs3d/Prs3d.hxx @@ -21,13 +21,11 @@ #include #include #include -#include -#include #include #include +#include class TopoDS_Shape; -class Prs3d_Presentation; //! The Prs3d package provides the following services //! - a presentation object (the context for all diff --git a/src/Prs3d/Prs3d_Presentation.cxx b/src/Prs3d/Prs3d_Presentation.cxx deleted file mode 100644 index f3796a5387..0000000000 --- a/src/Prs3d/Prs3d_Presentation.cxx +++ /dev/null @@ -1,146 +0,0 @@ -// 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. - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(Prs3d_Presentation,Graphic3d_Structure) - -//======================================================================= -//function : Prs3d_Presentation -//purpose : -//======================================================================= -Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)& theViewer, - const Standard_Boolean theToInit) -: Graphic3d_Structure (theViewer) -{ - if (!theToInit) - { - return; - } -} - -//======================================================================= -//function : Prs3d_Presentation -//purpose : -//======================================================================= -Prs3d_Presentation::Prs3d_Presentation (const Handle(Graphic3d_StructureManager)& theViewer, - const Handle(Prs3d_Presentation)& thePrs) -: Graphic3d_Structure (theViewer, thePrs) -{ - // -} - - -//======================================================================= -//function : Connect -//purpose : -//======================================================================= -void Prs3d_Presentation::Connect - ( const Handle(Prs3d_Presentation)& aPresentation) -{ - Graphic3d_Structure::Connect(aPresentation, Graphic3d_TOC_DESCENDANT); -} - - -//======================================================================= -//function : Remove -//purpose : -//======================================================================= -void Prs3d_Presentation::Remove (const Handle(Prs3d_Presentation)& aPresentation) -{ - Disconnect(aPresentation); -} - -//======================================================================= -//function : RemoveAll -//purpose : -//======================================================================= -void Prs3d_Presentation::RemoveAll () -{ - DisconnectAll(Graphic3d_TOC_DESCENDANT); -} - - -//======================================================================= -//function : CurrentGroup -//purpose : -//======================================================================= -Handle(Graphic3d_Group) Prs3d_Presentation::CurrentGroup () const -{ - if (Groups().IsEmpty()) - { - return const_cast(this)->NewGroup(); - } - return Groups().Last(); -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -Handle(Graphic3d_Structure) Prs3d_Presentation:: - Compute(const Handle(Graphic3d_DataStructureManager)& /*aProjector*/) -{ - return this; -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void Prs3d_Presentation::Compute(const Handle(Graphic3d_DataStructureManager)& aDataStruct, - Handle(Graphic3d_Structure)& aStruct) -{ - Graphic3d_Structure::Compute(aDataStruct,aStruct ); -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -Handle(Graphic3d_Structure) Prs3d_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theDataStruc, - const Handle(Geom_Transformation)& theTrsf) -{ - return Graphic3d_Structure::Compute (theDataStruc, theTrsf); -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void Prs3d_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theDataStruc, - const Handle(Geom_Transformation)& theTrsf, - Handle(Graphic3d_Structure)& theStruc) -{ - Graphic3d_Structure::Compute (theDataStruc, theTrsf, theStruc); -} diff --git a/src/Prs3d/Prs3d_Presentation.hxx b/src/Prs3d/Prs3d_Presentation.hxx index 09c5386be1..aa6c0eaf5e 100644 --- a/src/Prs3d/Prs3d_Presentation.hxx +++ b/src/Prs3d/Prs3d_Presentation.hxx @@ -17,71 +17,9 @@ #ifndef _Prs3d_Presentation_HeaderFile #define _Prs3d_Presentation_HeaderFile -#include -#include - #include -#include -class Prs3d_Root; -class Graphic3d_StructureManager; -class Graphic3d_Structure; -class Graphic3d_DataStructureManager; -class Geom_Transformation; -class Graphic3d_Group; - -class Prs3d_Presentation; -DEFINE_STANDARD_HANDLE(Prs3d_Presentation, Graphic3d_Structure) - -//! Defines a presentation object which can be displayed, -//! highlighted or erased. -//! The presentation object stores the results of the -//! presentation algorithms as defined in the StdPrs -//! classes and the Prs3d classes inheriting Prs3d_Root. -//! This presentation object is used to give display -//! attributes defined at this level to -//! ApplicationInteractiveServices classes at the level above. -//! A presentation object is attached to a given Viewer. -class Prs3d_Presentation : public Graphic3d_Structure -{ - -public: - - //! Constructs a presentation object - //! if is false, no color initialization is done. - Standard_EXPORT Prs3d_Presentation(const Handle(Graphic3d_StructureManager)& theStructManager, const Standard_Boolean theToInit = Standard_True); - - //! Constructs a presentation object. - Standard_EXPORT Prs3d_Presentation(const Handle(Graphic3d_StructureManager)& theStructManager, const Handle(Prs3d_Presentation)& thePrs); - - Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector) Standard_OVERRIDE; - - //! Returns the new Structure defined for the new visualization - Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, - const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE; - - //! Returns the new Structure defined for the new visualization - Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, Handle(Graphic3d_Structure)& aStructure) Standard_OVERRIDE; - - //! Returns the new Structure defined for the new visualization - Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, - const Handle(Geom_Transformation)& theTrsf, - Handle(Graphic3d_Structure)& theStructure) Standard_OVERRIDE; - - Standard_EXPORT void Connect (const Handle(Prs3d_Presentation)& aPresentation); - - Standard_EXPORT void Remove (const Handle(Prs3d_Presentation)& aPresentation); - - Standard_EXPORT void RemoveAll(); - -friend class Prs3d_Root; - - DEFINE_STANDARD_RTTIEXT(Prs3d_Presentation,Graphic3d_Structure) - -private: - - Standard_EXPORT Handle(Graphic3d_Group) CurrentGroup() const; - -}; +//! Alias for porting code. +typedef Graphic3d_Structure Prs3d_Presentation; #endif // _Prs3d_Presentation_HeaderFile diff --git a/src/Prs3d/Prs3d_PresentationShadow.cxx b/src/Prs3d/Prs3d_PresentationShadow.cxx index 37e4fa24bf..ab7d417b22 100644 --- a/src/Prs3d/Prs3d_PresentationShadow.cxx +++ b/src/Prs3d/Prs3d_PresentationShadow.cxx @@ -15,18 +15,17 @@ #include - -IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PresentationShadow,Prs3d_Presentation) +IMPLEMENT_STANDARD_RTTIEXT(Prs3d_PresentationShadow, Graphic3d_Structure) //======================================================================= //function : Prs3d_PresentationShadow //purpose : //======================================================================= Prs3d_PresentationShadow::Prs3d_PresentationShadow (const Handle(Graphic3d_StructureManager)& theViewer, - const Handle(Prs3d_Presentation)& thePrs) -: Prs3d_Presentation (theViewer, thePrs), - myParentStructId (thePrs->Identification()), - myParentAffinity (thePrs->CStructure()->ViewAffinity) + const Handle(Graphic3d_Structure)& thePrs) +: Graphic3d_Structure (theViewer, thePrs), + myParentAffinity (thePrs->CStructure()->ViewAffinity), + myParentStructId (thePrs->Identification()) { // } diff --git a/src/Prs3d/Prs3d_PresentationShadow.hxx b/src/Prs3d/Prs3d_PresentationShadow.hxx index 9d680affdd..bf68cdcb0c 100644 --- a/src/Prs3d/Prs3d_PresentationShadow.hxx +++ b/src/Prs3d/Prs3d_PresentationShadow.hxx @@ -19,14 +19,14 @@ #include //! Defines a "shadow" of existing presentation object with custom aspects. -class Prs3d_PresentationShadow : public Prs3d_Presentation +class Prs3d_PresentationShadow : public Graphic3d_Structure { - + DEFINE_STANDARD_RTTIEXT(Prs3d_PresentationShadow, Graphic3d_Structure) public: //! Constructs a shadow of existing presentation object. Standard_EXPORT Prs3d_PresentationShadow (const Handle(Graphic3d_StructureManager)& theViewer, - const Handle(Prs3d_Presentation)& thePrs); + const Handle(Graphic3d_Structure)& thePrs); //! Returns the id of the parent presentation inline Standard_Integer ParentId() const { return myParentStructId; } @@ -37,16 +37,13 @@ public: //! Do nothing - axis-aligned bounding box should be initialized from parent structure. Standard_EXPORT virtual void CalculateBoundBox() Standard_OVERRIDE; -private: - - DEFINE_STANDARD_RTTIEXT(Prs3d_PresentationShadow,Prs3d_Presentation) - private: - Standard_Integer myParentStructId; + Handle(Graphic3d_ViewAffinity) myParentAffinity; + Standard_Integer myParentStructId; }; -DEFINE_STANDARD_HANDLE(Prs3d_PresentationShadow, Prs3d_Presentation) +DEFINE_STANDARD_HANDLE(Prs3d_PresentationShadow, Graphic3d_Structure) #endif // _Prs3d_PresentationShadow_HeaderFile diff --git a/src/PrsMgr/FILES b/src/PrsMgr/FILES index e540bbd95c..e09bd0bdbc 100644 --- a/src/PrsMgr/FILES +++ b/src/PrsMgr/FILES @@ -1,7 +1,5 @@ PrsMgr_ListOfPresentableObjects.hxx PrsMgr_ListOfPresentations.hxx -PrsMgr_ModedPresentation.cxx -PrsMgr_ModedPresentation.hxx PrsMgr_PresentableObject.cxx PrsMgr_PresentableObject.hxx PrsMgr_Presentation.cxx @@ -11,6 +9,4 @@ PrsMgr_PresentationManager.cxx PrsMgr_PresentationManager.hxx PrsMgr_PresentationManager3d.hxx PrsMgr_Presentations.hxx -PrsMgr_Prs.cxx -PrsMgr_Prs.hxx PrsMgr_TypeOfPresentation3d.hxx diff --git a/src/PrsMgr/PrsMgr_ModedPresentation.cxx b/src/PrsMgr/PrsMgr_ModedPresentation.cxx deleted file mode 100644 index 5b96dc8a06..0000000000 --- a/src/PrsMgr/PrsMgr_ModedPresentation.cxx +++ /dev/null @@ -1,38 +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 - -PrsMgr_ModedPresentation::PrsMgr_ModedPresentation() -: myMode (0) {} - -PrsMgr_ModedPresentation::PrsMgr_ModedPresentation (const Handle(PrsMgr_Presentation)& thePrs, - const Standard_Integer theMode) -: myPresentation (thePrs), - myMode (theMode) -{ - // -} - -const Handle(PrsMgr_Presentation)& PrsMgr_ModedPresentation::Presentation() const -{ - return myPresentation; -} - -Standard_Integer PrsMgr_ModedPresentation::Mode() const -{ - return myMode; -} diff --git a/src/PrsMgr/PrsMgr_ModedPresentation.hxx b/src/PrsMgr/PrsMgr_ModedPresentation.hxx deleted file mode 100644 index 2109183758..0000000000 --- a/src/PrsMgr/PrsMgr_ModedPresentation.hxx +++ /dev/null @@ -1,69 +0,0 @@ -// Created on: 1995-01-30 -// Created by: Mister rmi -// 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 _PrsMgr_ModedPresentation_HeaderFile -#define _PrsMgr_ModedPresentation_HeaderFile - -#include -#include -#include - -#include -class PrsMgr_Presentation; - - - -class PrsMgr_ModedPresentation -{ -public: - - DEFINE_STANDARD_ALLOC - - - Standard_EXPORT PrsMgr_ModedPresentation(); - - Standard_EXPORT PrsMgr_ModedPresentation(const Handle(PrsMgr_Presentation)& thePrs, const Standard_Integer theMode); - - Standard_EXPORT const Handle(PrsMgr_Presentation)& Presentation() const; - - Standard_EXPORT Standard_Integer Mode() const; - - - - -protected: - - - - - -private: - - - - Handle(PrsMgr_Presentation) myPresentation; - Standard_Integer myMode; - - -}; - - - - - - - -#endif // _PrsMgr_ModedPresentation_HeaderFile diff --git a/src/PrsMgr/PrsMgr_PresentableObject.cxx b/src/PrsMgr/PrsMgr_PresentableObject.cxx index 342ea99304..4d33a1b87c 100644 --- a/src/PrsMgr/PrsMgr_PresentableObject.cxx +++ b/src/PrsMgr/PrsMgr_PresentableObject.cxx @@ -23,7 +23,8 @@ #include #include #include -#include +#include +#include #include #include @@ -66,6 +67,14 @@ PrsMgr_PresentableObject::PrsMgr_PresentableObject (const PrsMgr_TypeOfPresentat //======================================================================= PrsMgr_PresentableObject::~PrsMgr_PresentableObject() { + for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) + { + // should never happen - assertion can be used + const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.Value(); + aPrs3d->Erase(); + aPrs3d->myPresentableObject = NULL; + } + for (PrsMgr_ListOfPresentableObjectsIter anIter (myChildren); anIter.More(); anIter.Next()) { anIter.Value()->SetCombinedParentTransform (Handle(Geom_Transformation)()); @@ -81,7 +90,7 @@ void PrsMgr_PresentableObject::Fill (const Handle(PrsMgr_PresentationManager)& t const Handle(PrsMgr_Presentation)& thePrs, const Standard_Integer theMode) { - Handle(Prs3d_Presentation) aStruct3d = thePrs->Presentation(); + const Handle(Prs3d_Presentation)& aStruct3d = thePrs; Compute (thePrsMgr, aStruct3d, theMode); aStruct3d->SetTransformation (myTransformation); aStruct3d->SetClipPlanes (myClipPlanes); @@ -117,17 +126,17 @@ Standard_Boolean PrsMgr_PresentableObject::ToBeUpdated (Standard_Boolean theToIn { for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value(); - if (aModedPrs.Presentation()->MustBeUpdated()) + const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value(); + if (aModedPrs->MustBeUpdated()) { if (theToIncludeHidden) { return Standard_True; } - Handle(PrsMgr_PresentationManager) aPrsMgr = aModedPrs.Presentation()->PresentationManager(); - if (aPrsMgr->IsDisplayed (this, aModedPrs.Mode()) - || aPrsMgr->IsHighlighted(this, aModedPrs.Mode())) + Handle(PrsMgr_PresentationManager) aPrsMgr = aModedPrs->PresentationManager(); + if (aPrsMgr->IsDisplayed (this, aModedPrs->Mode()) + || aPrsMgr->IsHighlighted(this, aModedPrs->Mode())) { return Standard_True; } @@ -145,16 +154,16 @@ Standard_Boolean PrsMgr_PresentableObject::UpdatePresentations (Standard_Boolean Standard_Boolean hasUpdates = Standard_False; for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value(); - if (aModedPrs.Presentation()->MustBeUpdated()) + const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value(); + if (aModedPrs->MustBeUpdated()) { - Handle(PrsMgr_PresentationManager) aPrsMgr = aModedPrs.Presentation()->PresentationManager(); + Handle(PrsMgr_PresentationManager) aPrsMgr = aModedPrs->PresentationManager(); if (theToIncludeHidden - || aPrsMgr->IsDisplayed (this, aModedPrs.Mode()) - || aPrsMgr->IsHighlighted(this, aModedPrs.Mode())) + || aPrsMgr->IsDisplayed (this, aModedPrs->Mode()) + || aPrsMgr->IsHighlighted(this, aModedPrs->Mode())) { hasUpdates = Standard_True; - aPrsMgr->Update (this, aModedPrs.Mode()); + aPrsMgr->Update (this, aModedPrs->Mode()); } } } @@ -169,18 +178,18 @@ void PrsMgr_PresentableObject::Update (Standard_Integer theMode, Standard_Boolea { for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More();) { - if (aPrsIter.Value().Mode() == theMode) + if (aPrsIter.Value()->Mode() == theMode) { - Handle(PrsMgr_PresentationManager) aPrsMgr = aPrsIter.Value().Presentation()->PresentationManager(); + Handle(PrsMgr_PresentationManager) aPrsMgr = aPrsIter.Value()->PresentationManager(); if (aPrsMgr->IsDisplayed (this, theMode) || aPrsMgr->IsHighlighted(this, theMode)) { aPrsMgr->Update (this, theMode); - aPrsIter.Value().Presentation()->SetUpdateStatus (Standard_False); + aPrsIter.Value()->SetUpdateStatus (Standard_False); } else { - SetToUpdate (aPrsIter.Value().Mode()); + SetToUpdate (aPrsIter.Value()->Mode()); } } else if (theToClearOther) @@ -201,9 +210,9 @@ void PrsMgr_PresentableObject::SetToUpdate (Standard_Integer theMode) for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { if (theMode == -1 - || aPrsIter.Value().Mode() == theMode) + || aPrsIter.Value()->Mode() == theMode) { - aPrsIter.ChangeValue().Presentation()->SetUpdateStatus(Standard_True); + aPrsIter.ChangeValue()->SetUpdateStatus (Standard_True); } } } @@ -218,11 +227,11 @@ void PrsMgr_PresentableObject::ToBeUpdated (TColStd_ListOfInteger& theOutList) c TColStd_MapOfInteger MI(myPresentations.Length()); for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value(); - if (aModedPrs.Presentation()->MustBeUpdated() - && MI.Add (aModedPrs.Mode())) + const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value(); + if (aModedPrs->MustBeUpdated() + && MI.Add (aModedPrs->Mode())) { - theOutList.Append (aModedPrs.Mode()); + theOutList.Append (aModedPrs->Mode()); } } } @@ -236,10 +245,10 @@ void PrsMgr_PresentableObject::SetTypeOfPresentation (const PrsMgr_TypeOfPresent myTypeOfPresentation3d = theType; for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value().Presentation(); - aPrs->Presentation()->SetVisual (myTypeOfPresentation3d == PrsMgr_TOP_ProjectorDependant - ? Graphic3d_TOS_COMPUTED - : Graphic3d_TOS_ALL); + const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value(); + aPrs->SetVisual (myTypeOfPresentation3d == PrsMgr_TOP_ProjectorDependant + ? Graphic3d_TOS_COMPUTED + : Graphic3d_TOS_ALL); } } @@ -302,7 +311,7 @@ void PrsMgr_PresentableObject::UpdateTransformation() for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - aPrsIter.ChangeValue().Presentation()->SetTransformation (myTransformation); + aPrsIter.ChangeValue()->SetTransformation (myTransformation); } for (PrsMgr_ListOfPresentableObjectsIter aChildIter (myChildren); aChildIter.More(); aChildIter.Next()) @@ -319,12 +328,8 @@ void PrsMgr_PresentableObject::recomputeComputed() const { for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.Value().Presentation(); - if (!aPrs3d.IsNull() - && !aPrs3d->Presentation().IsNull()) - { - aPrs3d->Presentation()->ReCompute(); - } + const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.Value(); + aPrs3d->ReCompute(); } } @@ -337,13 +342,9 @@ void PrsMgr_PresentableObject::SetTransformPersistence (const Handle(Graphic3d_T myTransformPersistence = theTrsfPers; for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.Value().Presentation(); - if (!aPrs3d.IsNull() - && !aPrs3d->Presentation().IsNull()) - { - aPrs3d->Presentation()->SetTransformPersistence (myTransformPersistence); - aPrs3d->Presentation()->ReCompute(); - } + const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.Value(); + aPrs3d->SetTransformPersistence (myTransformPersistence); + aPrs3d->ReCompute(); } } @@ -439,14 +440,8 @@ void PrsMgr_PresentableObject::SetZLayer (const Graphic3d_ZLayerId theLayerId) myDrawer->SetZLayer (theLayerId); for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value(); - if (aModedPrs.Presentation().IsNull() - || aModedPrs.Presentation()->Presentation().IsNull()) - { - continue; - } - - aModedPrs.Presentation()->Presentation()->SetZLayer (theLayerId); + const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value(); + aModedPrs->SetZLayer (theLayerId); } } @@ -509,12 +504,8 @@ void PrsMgr_PresentableObject::UpdateClipping() { for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value(); - if (!aModedPrs.Presentation().IsNull() - && !aModedPrs.Presentation()->Presentation().IsNull()) - { - aModedPrs.Presentation()->Presentation()->SetClipPlanes (myClipPlanes); - } + const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value(); + aModedPrs->SetClipPlanes (myClipPlanes); } } @@ -532,12 +523,8 @@ void PrsMgr_PresentableObject::SetInfiniteState (const Standard_Boolean theFlag) myInfiniteState = theFlag; for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value(); - if (!aModedPrs.Presentation().IsNull() - && !aModedPrs.Presentation()->Presentation().IsNull()) - { - aModedPrs.Presentation()->Presentation()->SetInfiniteState (theFlag); - } + const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value(); + aModedPrs->SetInfiniteState (theFlag); } } @@ -555,12 +542,8 @@ void PrsMgr_PresentableObject::SetMutable (const Standard_Boolean theIsMutable) myIsMutable = theIsMutable; for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsIter.Value(); - if (!aModedPrs.Presentation().IsNull() - && !aModedPrs.Presentation()->Presentation().IsNull()) - { - aModedPrs.Presentation()->Presentation()->SetMutable (theIsMutable); - } + const Handle(PrsMgr_Presentation)& aModedPrs = aPrsIter.Value(); + aModedPrs->SetMutable (theIsMutable); } } @@ -617,14 +600,8 @@ void PrsMgr_PresentableObject::SynchronizeAspects() { for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue().Presentation(); - if (aPrs3d.IsNull() - || aPrs3d->Presentation().IsNull()) - { - continue; - } - - for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Presentation()->Groups()); aGroupIter.More(); aGroupIter.Next()) + const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue(); + for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Groups()); aGroupIter.More(); aGroupIter.Next()) { if (!aGroupIter.Value().IsNull()) { @@ -647,14 +624,8 @@ void PrsMgr_PresentableObject::replaceAspects (const Graphic3d_MapOfAspectsToAsp for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue().Presentation(); - if (aPrs3d.IsNull() - || aPrs3d->Presentation().IsNull()) - { - continue; - } - - for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Presentation()->Groups()); aGroupIter.More(); aGroupIter.Next()) + const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue(); + for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (aPrs3d->Groups()); aGroupIter.More(); aGroupIter.Next()) { if (!aGroupIter.Value().IsNull()) { @@ -674,9 +645,8 @@ void PrsMgr_PresentableObject::BoundingBox (Bnd_Box& theBndBox) { if (!myPresentations.IsEmpty()) { - const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations.First().Presentation(); - const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation(); - const Graphic3d_BndBox3d& aBndBox = aStruct->CStructure()->BoundingBox(); + const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations.First(); + const Graphic3d_BndBox3d& aBndBox = aPrs3d->CStructure()->BoundingBox(); if (aBndBox.IsValid()) { theBndBox.Update (aBndBox.CornerMin().x(), aBndBox.CornerMin().y(), aBndBox.CornerMin().z(), @@ -701,13 +671,12 @@ void PrsMgr_PresentableObject::BoundingBox (Bnd_Box& theBndBox) return; } - for (Standard_Integer aPrsIter = 1; aPrsIter <= myPresentations.Length(); ++aPrsIter) + for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - if (myPresentations (aPrsIter).Mode() == myDrawer->DisplayMode()) + const Handle(PrsMgr_Presentation)& aPrs3d = aPrsIter.ChangeValue(); + if (aPrs3d->Mode() == myDrawer->DisplayMode()) { - const Handle(PrsMgr_Presentation)& aPrs3d = myPresentations (aPrsIter).Presentation(); - const Handle(Graphic3d_Structure)& aStruct = aPrs3d->Presentation(); - const Graphic3d_BndBox3d& aBndBox = aStruct->CStructure()->BoundingBox(); + const Graphic3d_BndBox3d& aBndBox = aPrs3d->CStructure()->BoundingBox(); if (aBndBox.IsValid()) { theBndBox.Update (aBndBox.CornerMin().x(), aBndBox.CornerMin().y(), aBndBox.CornerMin().z(), diff --git a/src/PrsMgr/PrsMgr_PresentableObject.hxx b/src/PrsMgr/PrsMgr_PresentableObject.hxx index 34fcae2c96..c79bc8deb6 100644 --- a/src/PrsMgr/PrsMgr_PresentableObject.hxx +++ b/src/PrsMgr/PrsMgr_PresentableObject.hxx @@ -28,10 +28,12 @@ #include #include #include -#include #include #include +class PrsMgr_PresentationManager; +typedef PrsMgr_PresentationManager PrsMgr_PresentationManager3d; + //! A framework to supply the Graphic3d structure of the object to be presented. //! On the first display request, this structure is created by calling the appropriate algorithm and retaining this framework for further display. //! This abstract framework is inherited in Application Interactive Services (AIS), notably by AIS_InteractiveObject. diff --git a/src/PrsMgr/PrsMgr_Presentation.cxx b/src/PrsMgr/PrsMgr_Presentation.cxx index ff8b5ee8dc..fa647c6bc2 100644 --- a/src/PrsMgr/PrsMgr_Presentation.cxx +++ b/src/PrsMgr/PrsMgr_Presentation.cxx @@ -16,20 +16,15 @@ #include #include -#include #include #include -#include #include -#include #include #include -#include #include -#include #include -IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_Presentation, Standard_Transient) +IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_Presentation, Graphic3d_Structure) namespace { @@ -40,7 +35,7 @@ namespace State_Visible }; - static BeforeHighlightState StructureState(const Handle(Prs3d_Presentation)& theStructure) + static BeforeHighlightState StructureState (const Graphic3d_Structure* theStructure) { return !theStructure->IsDisplayed() ? State_Empty : !theStructure->IsVisible() ? @@ -53,16 +48,21 @@ namespace //purpose : //======================================================================= PrsMgr_Presentation::PrsMgr_Presentation (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr, - const Handle(PrsMgr_PresentableObject)& thePrsObject) -: myPresentationManager (thePrsMgr), - myPresentableObject (thePrsObject.operator->()), - myMustBeUpdated (Standard_False), - myBeforeHighlightState (State_Empty) + const Handle(PrsMgr_PresentableObject)& thePrsObject, + const Standard_Integer theMode) +: Graphic3d_Structure (thePrsMgr->StructureManager()), + myPresentationManager (thePrsMgr), + myPresentableObject (thePrsObject.get()), + myBeforeHighlightState (State_Empty), + myMode (theMode), + myMustBeUpdated (Standard_False) { - myStructure = new PrsMgr_Prs (thePrsMgr->StructureManager(), - this, thePrsObject->TypeOfPresentation3d()); - myStructure->SetOwner (myPresentableObject); - myStructure->SetMutable (myPresentableObject->IsMutable()); + if (thePrsObject->TypeOfPresentation3d() == PrsMgr_TOP_ProjectorDependant) + { + SetVisual (Graphic3d_TOS_COMPUTED); + } + SetOwner (myPresentableObject); + SetMutable (myPresentableObject->IsMutable()); } //======================================================================= @@ -81,15 +81,15 @@ void PrsMgr_Presentation::Display() //======================================================================= void PrsMgr_Presentation::display (const Standard_Boolean theIsHighlight) { - if (!myStructure->IsDisplayed()) + if (!base_type::IsDisplayed()) { - myStructure->SetIsForHighlight (theIsHighlight); - myStructure->Display(); + base_type::SetIsForHighlight (theIsHighlight); + base_type::Display(); } - else if (!myStructure->IsVisible()) + else if (!base_type::IsVisible()) { - SetVisible (Standard_True); - myStructure->SetIsForHighlight (theIsHighlight); + base_type::SetVisible (Standard_True); + base_type::SetIsForHighlight (theIsHighlight); } } @@ -99,27 +99,18 @@ void PrsMgr_Presentation::display (const Standard_Boolean theIsHighlight) //======================================================================= void PrsMgr_Presentation::Erase() { - if (myStructure.IsNull()) + if (IsDeleted()) { return; } // Erase structure from structure manager - myStructure->Erase(); - myStructure->Clear(); + base_type::Erase(); + base_type::Clear(); // Disconnect other structures - myStructure->DisconnectAll (Graphic3d_TOC_DESCENDANT); + base_type::DisconnectAll (Graphic3d_TOC_DESCENDANT); // Clear groups and remove graphic structure - myStructure.Nullify(); -} - -//======================================================================= -//function : SetVisible -//purpose : -//======================================================================= -void PrsMgr_Presentation::SetVisible (const Standard_Boolean theValue) -{ - myStructure->SetVisible (theValue); + base_type::Remove(); } //======================================================================= @@ -130,30 +121,30 @@ void PrsMgr_Presentation::Highlight (const Handle(Prs3d_Drawer)& theStyle) { if (!IsHighlighted()) { - myBeforeHighlightState = StructureState (myStructure); + myBeforeHighlightState = StructureState (this); } display (Standard_True); - myStructure->Highlight (theStyle); + base_type::Highlight (theStyle); } //======================================================================= //function : Unhighlight //purpose : //======================================================================= -void PrsMgr_Presentation::Unhighlight() const +void PrsMgr_Presentation::Unhighlight() { - myStructure->UnHighlight(); + base_type::UnHighlight(); switch (myBeforeHighlightState) { - case State_Visible: - return; - case State_Hidden: - myStructure->SetVisible (Standard_False); - break; - case State_Empty: - myStructure->Erase(); - break; + case State_Visible: + return; + case State_Hidden: + base_type::SetVisible (Standard_False); + break; + case State_Empty: + base_type::Erase(); + break; } } @@ -161,7 +152,7 @@ void PrsMgr_Presentation::Unhighlight() const //function : Clear //purpose : //======================================================================= -void PrsMgr_Presentation::Clear() +void PrsMgr_Presentation::Clear (const Standard_Boolean theWithDestruction) { // This modification remove the contain of the structure: // Consequence: @@ -169,69 +160,33 @@ void PrsMgr_Presentation::Clear() // 2. The speed for animation is constant //myPresentableObject = NULL; SetUpdateStatus (Standard_True); - if (myStructure.IsNull()) + if (IsDeleted()) { return; } - myStructure->Clear (Standard_True); - // myStructure->Clear(Standard_False); - myStructure->RemoveAll(); + base_type::Clear (theWithDestruction); + base_type::DisconnectAll (Graphic3d_TOC_DESCENDANT); } //======================================================================= -//function : IsDisplayed +//function : Compute //purpose : //======================================================================= -Standard_Boolean PrsMgr_Presentation::IsDisplayed() const +void PrsMgr_Presentation::Compute() { - return myStructure->IsDisplayed() - && myStructure->IsVisible(); -} + Standard_Integer aDispMode = 0; + for (PrsMgr_Presentations::Iterator aPrsIter (myPresentableObject->myPresentations); aPrsIter.More(); aPrsIter.Next()) + { + const Handle(PrsMgr_Presentation)& aModedPresentation = aPrsIter.Value(); + if (aModedPresentation == this) + { + aDispMode = aModedPresentation->Mode(); + break; + } + } -//======================================================================= -//function : IsHighlighted -//purpose : -//======================================================================= -Standard_Boolean PrsMgr_Presentation::IsHighlighted() const -{ - return myStructure->IsHighlighted(); -} - -//======================================================================= -//function : DisplayPriority -//purpose : -//======================================================================= -Standard_Integer PrsMgr_Presentation::DisplayPriority() const -{ - return myStructure->DisplayPriority(); -} - -//======================================================================= -//function : SetDisplayPriority -//purpose : -//======================================================================= -void PrsMgr_Presentation::SetDisplayPriority (const Standard_Integer theNewPrior) -{ - myStructure->SetDisplayPriority (theNewPrior); -} - -//======================================================================= -//function : Connect -//purpose : -//======================================================================= -void PrsMgr_Presentation::Connect (const Handle(PrsMgr_Presentation)& theOther) const -{ - myStructure->Connect (theOther->Presentation()); -} - -//======================================================================= -//function : SetTransformation -//purpose : -//======================================================================= -void PrsMgr_Presentation::SetTransformation (const Handle(Geom_Transformation)& theTrsf) const -{ - myStructure->SetTransformation (theTrsf); + myPresentableObject->Compute (myPresentationManager, this, aDispMode); } //======================================================================= @@ -240,42 +195,20 @@ void PrsMgr_Presentation::SetTransformation (const Handle(Geom_Transformation)& //======================================================================= Handle(Graphic3d_Structure) PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector) { - Handle(Prs3d_Presentation) aPrs = new Prs3d_Presentation (myPresentationManager->StructureManager()); + Handle(Graphic3d_Structure) aPrs = new Graphic3d_Structure (myPresentationManager->StructureManager()); myPresentableObject->Compute (Projector (theProjector), aPrs); return aPrs; } -//======================================================================= -//function : Compute -//purpose : -//======================================================================= -void PrsMgr_Presentation::Compute (const Handle(Graphic3d_Structure)& theStructure) -{ - Standard_Integer aDispMode = 0; - Standard_Integer aPresentationsNumber = myPresentableObject->myPresentations.Length(); - for (Standard_Integer anIter = 1; anIter <= aPresentationsNumber; ++anIter) - { - const PrsMgr_ModedPresentation& aModedPresentation = myPresentableObject->myPresentations.Value (anIter); - if (aModedPresentation.Presentation().operator->() == this) - { - aDispMode = aModedPresentation.Mode(); - break; - } - } - - Handle(Prs3d_Presentation) aPrs3d = Handle(Prs3d_Presentation)::DownCast (theStructure); - myPresentableObject->Compute (myPresentationManager, aPrs3d, aDispMode); -} - //======================================================================= //function : Compute //purpose : //======================================================================= void PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, - const Handle(Graphic3d_Structure)& theStructToFill) + Handle(Graphic3d_Structure)& theStructToFill) { theStructToFill->Clear(); - Handle(Prs3d_Presentation) aPrs (Handle(Prs3d_Presentation)::DownCast (theStructToFill)); + Handle(Prs3d_Presentation) aPrs = theStructToFill; myPresentableObject->Compute (Projector (theProjector), aPrs); } @@ -296,11 +229,11 @@ Handle(Graphic3d_Structure) PrsMgr_Presentation::Compute (const Handle(Graphic3d //purpose : //======================================================================= void PrsMgr_Presentation::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, - const Handle(Geom_Transformation)& theTrsf, - const Handle(Graphic3d_Structure)& theStructToFill) + const Handle(Geom_Transformation)& theTrsf, + Handle(Graphic3d_Structure)& theStructToFill) { // recompute HLR after transformation in all the case - Handle(Prs3d_Presentation) aPrs = Handle(Prs3d_Presentation)::DownCast (theStructToFill); + Handle(Graphic3d_Structure) aPrs = theStructToFill; theStructToFill->Clear(); myPresentableObject->Compute (Projector (theProjector), theTrsf, aPrs); } @@ -331,21 +264,3 @@ PrsMgr_Presentation::~PrsMgr_Presentation() { Erase(); } - -//======================================================================= -//function : SetZLayer -//purpose : -//======================================================================= -void PrsMgr_Presentation::SetZLayer (Graphic3d_ZLayerId theLayerId) -{ - myStructure->SetZLayer (theLayerId); -} - -//======================================================================= -//function : GetZLayer -//purpose : -//======================================================================= -Graphic3d_ZLayerId PrsMgr_Presentation::GetZLayer() const -{ - return myStructure->GetZLayer(); -} diff --git a/src/PrsMgr/PrsMgr_Presentation.hxx b/src/PrsMgr/PrsMgr_Presentation.hxx index 9df9a7059f..b91c2802c5 100644 --- a/src/PrsMgr/PrsMgr_Presentation.hxx +++ b/src/PrsMgr/PrsMgr_Presentation.hxx @@ -17,39 +17,32 @@ #ifndef _PrsMgr_Presentation_HeaderFile #define _PrsMgr_Presentation_HeaderFile -#include -#include -#include -#include -#include -#include #include +#include class PrsMgr_PresentationManager; -class PrsMgr_Prs; class PrsMgr_PresentableObject; class Quantity_Color; class Geom_Transformation; -class Prs3d_Presentation; class Prs3d_Drawer; class Graphic3d_Structure; class Graphic3d_DataStructureManager; class Prs3d_Projector; -DEFINE_STANDARD_HANDLE(PrsMgr_Presentation, Standard_Transient) +DEFINE_STANDARD_HANDLE(PrsMgr_Presentation, Graphic3d_Structure) -class PrsMgr_Presentation : public Standard_Transient +class PrsMgr_Presentation : public Graphic3d_Structure { - DEFINE_STANDARD_RTTIEXT(PrsMgr_Presentation, Standard_Transient) + DEFINE_STANDARD_RTTIEXT(PrsMgr_Presentation, Graphic3d_Structure) friend class PrsMgr_PresentationManager; friend class PrsMgr_PresentableObject; - friend class PrsMgr_Prs; public: //! Destructor Standard_EXPORT ~PrsMgr_Presentation(); - const Handle(Prs3d_Presentation)& Presentation() const { return myStructure; } + Standard_DEPRECATED("Dummy to simplify porting - returns self") + Prs3d_Presentation* Presentation() { return this; } //! returns the PresentationManager in which the presentation has been created. const Handle(PrsMgr_PresentationManager)& PresentationManager() const { return myPresentationManager; } @@ -58,64 +51,66 @@ public: Standard_Boolean MustBeUpdated() const { return myMustBeUpdated; } -private: + //! Return display mode index. + Standard_Integer Mode() const { return myMode; } - Standard_EXPORT PrsMgr_Presentation(const Handle(PrsMgr_PresentationManager)& thePresentationManager, const Handle(PrsMgr_PresentableObject)& thePresentableObject); - - Standard_EXPORT void Display(); - - //! Displays myStructure. - Standard_EXPORT void display (const Standard_Boolean theIsHighlight); - - Standard_EXPORT void Erase(); - - Standard_EXPORT void SetVisible (const Standard_Boolean theValue); - + //! Display structure. + Standard_EXPORT virtual void Display() Standard_OVERRIDE; + + //! Remove structure. + Standard_EXPORT virtual void Erase() Standard_OVERRIDE; + + //! Highlight structure. Standard_EXPORT void Highlight (const Handle(Prs3d_Drawer)& theStyle); - - Standard_EXPORT void Unhighlight() const; - - Standard_EXPORT Standard_Boolean IsHighlighted() const; - - Standard_EXPORT Standard_Boolean IsDisplayed() const; - - Standard_EXPORT Standard_Integer DisplayPriority() const; - - Standard_EXPORT void SetDisplayPriority (const Standard_Integer aNewPrior); - - //! Set Z layer ID for the presentation - Standard_EXPORT void SetZLayer (const Graphic3d_ZLayerId theLayerId); - - //! Get Z layer ID for the presentation - Standard_EXPORT Graphic3d_ZLayerId GetZLayer() const; - + + //! Unhighlight structure. + Standard_EXPORT void Unhighlight(); + + //! Return TRUE if structure has been displayed and in no hidden state. + virtual Standard_Boolean IsDisplayed() const Standard_OVERRIDE + { + return base_type::IsDisplayed() + && base_type::IsVisible(); + } + //! removes the whole content of the presentation. //! Does not remove the other connected presentations. - Standard_EXPORT void Clear(); - - Standard_EXPORT void Connect (const Handle(PrsMgr_Presentation)& theOther) const; - - Standard_EXPORT void SetTransformation (const Handle(Geom_Transformation)& theTrsf) const; + Standard_EXPORT virtual void Clear (const Standard_Boolean theWithDestruction = Standard_True) Standard_OVERRIDE; + + //! Compute structure using presentation manager. + Standard_EXPORT virtual void Compute() Standard_OVERRIDE; + +protected: + + //! Main constructor. + Standard_EXPORT PrsMgr_Presentation (const Handle(PrsMgr_PresentationManager)& thePresentationManager, + const Handle(PrsMgr_PresentableObject)& thePresentableObject, + const Standard_Integer theMode); + + //! Displays myStructure. + Standard_EXPORT void display (const Standard_Boolean theIsHighlight); + + Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector) Standard_OVERRIDE; + + Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, + const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE; + + Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, + Handle(Graphic3d_Structure)& theGivenStruct) Standard_OVERRIDE; + + Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, + const Handle(Geom_Transformation)& theTrsf, + Handle(Graphic3d_Structure)& theGivenStruct) Standard_OVERRIDE; - Standard_EXPORT void Compute (const Handle(Graphic3d_Structure)& theStructure); - - Standard_EXPORT Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector); - - Standard_EXPORT Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, const Handle(Geom_Transformation)& theTrsf); - - Standard_EXPORT void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, const Handle(Graphic3d_Structure)& theGivenStruct); - - Standard_EXPORT void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, const Handle(Geom_Transformation)& theTrsf, const Handle(Graphic3d_Structure)& theGivenStruct); - Standard_EXPORT static Handle(Prs3d_Projector) Projector (const Handle(Graphic3d_DataStructureManager)& theProjector); protected: Handle(PrsMgr_PresentationManager) myPresentationManager; - Handle(Prs3d_Presentation) myStructure; PrsMgr_PresentableObject* myPresentableObject; - Standard_Boolean myMustBeUpdated; Standard_Integer myBeforeHighlightState; + Standard_Integer myMode; + Standard_Boolean myMustBeUpdated; }; diff --git a/src/PrsMgr/PrsMgr_PresentationManager.cxx b/src/PrsMgr/PrsMgr_PresentationManager.cxx index e237fe1601..4cb5544d31 100644 --- a/src/PrsMgr/PrsMgr_PresentationManager.cxx +++ b/src/PrsMgr/PrsMgr_PresentationManager.cxx @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -58,7 +57,7 @@ void PrsMgr_PresentationManager::Display (const Handle(PrsMgr_PresentableObject) if (myImmediateModeOn > 0) { - AddToImmediateList (aPrs->Presentation()); + AddToImmediateList (aPrs); } else { @@ -89,22 +88,22 @@ void PrsMgr_PresentationManager::Erase (const Handle(PrsMgr_PresentableObject)& } PrsMgr_Presentations& aPrsList = thePrsObj->Presentations(); - for (PrsMgr_Presentations::Iterator anIt (aPrsList); anIt.More();) + for (PrsMgr_Presentations::Iterator aPrsIter (aPrsList); aPrsIter.More();) { - const PrsMgr_ModedPresentation& aModedPrs = anIt.Value(); - if (aModedPrs.Presentation().IsNull()) + const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value(); + if (aPrs.IsNull()) { - anIt.Next(); + aPrsIter.Next(); continue; } - const Handle(PrsMgr_PresentationManager)& aPrsMgr = aModedPrs.Presentation()->PresentationManager(); - if ((theMode == aModedPrs.Mode() || theMode == -1) + const Handle(PrsMgr_PresentationManager)& aPrsMgr = aPrs->PresentationManager(); + if ((theMode == aPrs->Mode() || theMode == -1) && (this == aPrsMgr)) { - aModedPrs.Presentation()->Erase(); + aPrs->Erase(); - aPrsList.Remove (anIt); + aPrsList.Remove (aPrsIter); if (theMode != -1) { @@ -113,7 +112,7 @@ void PrsMgr_PresentationManager::Erase (const Handle(PrsMgr_PresentableObject)& } else { - anIt.Next(); + aPrsIter.Next(); } } } @@ -173,11 +172,10 @@ void PrsMgr_PresentationManager::Unhighlight (const Handle(PrsMgr_PresentableObj } const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations(); - for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter) + for (PrsMgr_Presentations::Iterator aPrsIter (aPrsList); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter); - const Handle(PrsMgr_Presentation)& aPrs = aModedPrs.Presentation(); - const Handle(PrsMgr_PresentationManager)& aPrsMgr = aPrs->PresentationManager(); + const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value(); + const Handle(PrsMgr_PresentationManager)& aPrsMgr = aPrs->PresentationManager(); if (this == aPrsMgr && aPrs->IsHighlighted()) { @@ -344,8 +342,7 @@ void PrsMgr_PresentationManager::displayImmediate (const Handle(V3d_Viewer)& the if (!aShadowPrs.IsNull() && aView->IsComputed (aShadowPrs->ParentId(), aViewDepPrs)) { aShadowPrs.Nullify(); - aShadowPrs = new Prs3d_PresentationShadow (myStructureManager, - Handle(Prs3d_Presentation)::DownCast (aViewDepPrs)); + aShadowPrs = new Prs3d_PresentationShadow (myStructureManager, aViewDepPrs); aShadowPrs->SetZLayer (aViewDepPrs->CStructure()->ZLayer()); aShadowPrs->SetClipPlanes (aViewDepPrs->ClipPlanes()); aShadowPrs->CStructure()->IsForHighlight = 1; @@ -447,11 +444,11 @@ Standard_Boolean PrsMgr_PresentationManager::HasPresentation (const Handle(PrsMg return Standard_False; const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations(); - for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter) + for (PrsMgr_Presentations::Iterator aPrsIter (aPrsList); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter); - const Handle(PrsMgr_PresentationManager)& aPrsMgr = aModedPrs.Presentation()->PresentationManager(); - if (theMode == aModedPrs.Mode() + const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value(); + const Handle(PrsMgr_PresentationManager)& aPrsMgr = aPrs->PresentationManager(); + if (theMode == aPrs->Mode() && this == aPrsMgr) { return Standard_True; @@ -470,14 +467,14 @@ Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Hand const Handle(PrsMgr_PresentableObject)& theSelObj) const { const PrsMgr_Presentations& aPrsList = thePrsObj->Presentations(); - for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter) + for (PrsMgr_Presentations::Iterator aPrsIter (aPrsList); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter); - const Handle(PrsMgr_PresentationManager)& aPrsMgr = aModedPrs.Presentation()->PresentationManager(); - if (theMode == aModedPrs.Mode() + const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value(); + const Handle(PrsMgr_PresentationManager)& aPrsMgr = aPrs->PresentationManager(); + if (theMode == aPrs->Mode() && this == aPrsMgr) { - return aModedPrs.Presentation(); + return aPrs; } } @@ -486,10 +483,10 @@ Handle(PrsMgr_Presentation) PrsMgr_PresentationManager::Presentation (const Hand return Handle(PrsMgr_Presentation)(); } - Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation (this, thePrsObj); + Handle(PrsMgr_Presentation) aPrs = new PrsMgr_Presentation (this, thePrsObj, theMode); aPrs->SetZLayer (thePrsObj->ZLayer()); - aPrs->Presentation()->CStructure()->ViewAffinity = myStructureManager->ObjectAffinity (!theSelObj.IsNull() ? theSelObj : thePrsObj); - thePrsObj->Presentations().Append (PrsMgr_ModedPresentation (aPrs, theMode)); + aPrs->CStructure()->ViewAffinity = myStructureManager->ObjectAffinity (!theSelObj.IsNull() ? theSelObj : thePrsObj); + thePrsObj->Presentations().Append (aPrs); thePrsObj->Fill (this, aPrs, theMode); // set layer index accordingly to object's presentations @@ -505,11 +502,11 @@ Standard_Boolean PrsMgr_PresentationManager::RemovePresentation (const Handle(Pr const Standard_Integer theMode) { PrsMgr_Presentations& aPrsList = thePrsObj->Presentations(); - for (Standard_Integer aPrsIter = 1; aPrsIter <= aPrsList.Length(); ++aPrsIter) + for (PrsMgr_Presentations::Iterator aPrsIter (aPrsList); aPrsIter.More(); aPrsIter.Next()) { - const PrsMgr_ModedPresentation& aModedPrs = aPrsList.Value (aPrsIter); - const Handle(PrsMgr_PresentationManager)& aPrsMgr = aModedPrs.Presentation()->PresentationManager(); - if (theMode == aPrsList (aPrsIter).Mode() + const Handle(PrsMgr_Presentation)& aPrs = aPrsIter.Value(); + const Handle(PrsMgr_PresentationManager)& aPrsMgr = aPrs->PresentationManager(); + if (theMode == aPrs->Mode() && this == aPrsMgr) { aPrsList.Remove (aPrsIter); @@ -558,7 +555,7 @@ void PrsMgr_PresentationManager::Connect (const Handle(PrsMgr_PresentableObject) { Handle(PrsMgr_Presentation) aPrs = Presentation (thePrsObject, theMode, Standard_True); Handle(PrsMgr_Presentation) aPrsOther = Presentation (theOtherObject, theOtherMode, Standard_True); - aPrs->Connect (aPrsOther); + aPrs->Connect (aPrsOther.get(), Graphic3d_TOC_DESCENDANT); } // ======================================================================= @@ -599,9 +596,9 @@ void PrsMgr_PresentationManager::Color (const Handle(PrsMgr_PresentableObject)& if (myImmediateModeOn > 0) { - Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs->Presentation()); + Handle(Prs3d_PresentationShadow) aShadow = new Prs3d_PresentationShadow (myStructureManager, aPrs); aShadow->SetZLayer (theImmediateStructLayerId); - aShadow->SetClipPlanes (aPrs->Presentation()->ClipPlanes()); + aShadow->SetClipPlanes (aPrs->ClipPlanes()); aShadow->CStructure()->IsForHighlight = 1; aShadow->Highlight (theStyle); AddToImmediateList (aShadow); @@ -658,7 +655,7 @@ void PrsMgr_PresentationManager::UpdateHighlightTrsf (const Handle(V3d_Viewer)& } Handle(Geom_Transformation) aTrsf = theObj->LocalTransformationGeom(); - const Standard_Integer aParentId = aPrs->Presentation()->CStructure()->Id; + const Standard_Integer aParentId = aPrs->CStructure()->Id; updatePrsTransformation (myImmediateList, aParentId, aTrsf); if (!myViewDependentImmediateList.IsEmpty()) diff --git a/src/PrsMgr/PrsMgr_PresentationManager.hxx b/src/PrsMgr/PrsMgr_PresentationManager.hxx index 70a8dd22c2..ae94609f6c 100644 --- a/src/PrsMgr/PrsMgr_PresentationManager.hxx +++ b/src/PrsMgr/PrsMgr_PresentationManager.hxx @@ -29,11 +29,13 @@ #include #include +class Graphic3d_Structure; +typedef Graphic3d_Structure Prs3d_Presentation; + class Geom_Transformation; class Prs3d_Drawer; -class Prs3d_Presentation; -class PrsMgr_PresentableObject; class PrsMgr_Presentation; +class PrsMgr_PresentableObject; class Standard_NoSuchObject; class V3d_Viewer; diff --git a/src/PrsMgr/PrsMgr_Presentations.hxx b/src/PrsMgr/PrsMgr_Presentations.hxx index 179becd97c..a77adb1a88 100644 --- a/src/PrsMgr/PrsMgr_Presentations.hxx +++ b/src/PrsMgr/PrsMgr_Presentations.hxx @@ -17,10 +17,10 @@ #ifndef PrsMgr_Presentations_HeaderFile #define PrsMgr_Presentations_HeaderFile -#include +#include #include -typedef NCollection_Sequence PrsMgr_Presentations; - +class PrsMgr_Presentation; +typedef NCollection_Sequence PrsMgr_Presentations; #endif diff --git a/src/PrsMgr/PrsMgr_Prs.cxx b/src/PrsMgr/PrsMgr_Prs.cxx deleted file mode 100644 index 1f02d67fa8..0000000000 --- a/src/PrsMgr/PrsMgr_Prs.cxx +++ /dev/null @@ -1,89 +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 -#include -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(PrsMgr_Prs,Prs3d_Presentation) - -PrsMgr_Prs::PrsMgr_Prs (const Handle(Graphic3d_StructureManager)& theStructManager, - PrsMgr_Presentation* thePrs, - PrsMgr_TypeOfPresentation3d theTypeOfPresentation) -: Prs3d_Presentation (theStructManager), - myPresentation3d (thePrs) -{ - if (theTypeOfPresentation == PrsMgr_TOP_ProjectorDependant) - SetVisual(Graphic3d_TOS_COMPUTED); -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void PrsMgr_Prs::Compute() -{ - myPresentation3d->Compute (this); -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -Handle(Graphic3d_Structure) PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector) { - return myPresentation3d->Compute(aProjector); -} -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -Handle(Graphic3d_Structure) PrsMgr_Prs::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, - const Handle(Geom_Transformation)& theTrsf) -{ - return myPresentation3d->Compute (theProjector, theTrsf); -} - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void PrsMgr_Prs::Compute(const Handle(Graphic3d_DataStructureManager)& aProjector, - Handle(Graphic3d_Structure)& aGivenStruct) -{ - myPresentation3d->Compute(aProjector,aGivenStruct); -} - - -//======================================================================= -//function : Compute -//purpose : -//======================================================================= - -void PrsMgr_Prs::Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, - const Handle(Geom_Transformation)& theTrsf, - Handle(Graphic3d_Structure)& theGivenStruct) -{ - myPresentation3d->Compute (theProjector, theTrsf, theGivenStruct); -} diff --git a/src/PrsMgr/PrsMgr_Prs.hxx b/src/PrsMgr/PrsMgr_Prs.hxx deleted file mode 100644 index 9b2b933495..0000000000 --- a/src/PrsMgr/PrsMgr_Prs.hxx +++ /dev/null @@ -1,70 +0,0 @@ -// Created on: 1995-01-31 -// Created by: Mister rmi -// 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 _PrsMgr_Prs_HeaderFile -#define _PrsMgr_Prs_HeaderFile - -#include -#include -#include - -class Graphic3d_StructureManager; -class Graphic3d_Structure; -class Graphic3d_DataStructureManager; -class PrsMgr_Presentation; - -DEFINE_STANDARD_HANDLE(PrsMgr_Prs, Prs3d_Presentation) - -class PrsMgr_Prs : public Prs3d_Presentation -{ - DEFINE_STANDARD_RTTIEXT(PrsMgr_Prs, Prs3d_Presentation) -public: - - Standard_EXPORT PrsMgr_Prs (const Handle(Graphic3d_StructureManager)& theStructManager, - PrsMgr_Presentation* thePresentation, - PrsMgr_TypeOfPresentation3d theTypeOfPresentation3d); - - Standard_EXPORT virtual void Compute() Standard_OVERRIDE; - - Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector) Standard_OVERRIDE; - - //! the "degenerated" Structure is displayed with - //! a transformation defined by - //! which is not a Pure Translation. - //! We have to take in account this Transformation - //! in the computation of hidden line removal... - //! returns a filled Graphic Structure. - Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, - const Handle(Geom_Transformation)& theTrsf) Standard_OVERRIDE; - - //! No need to return a structure, just to fill - //! .... - Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, Handle(Graphic3d_Structure)& ComputedStruct) Standard_OVERRIDE; - - //! No Need to return a Structure, just to - //! Fill . The Trsf has to be taken in account - //! in the computation (Rotation Part....) - Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& theProjector, - const Handle(Geom_Transformation)& theTrsf, - Handle(Graphic3d_Structure)& theStructure) Standard_OVERRIDE; - -private: - - PrsMgr_Presentation* myPresentation3d; - -}; - -#endif // _PrsMgr_Prs_HeaderFile diff --git a/src/QABugs/QABugs_PresentableObject.hxx b/src/QABugs/QABugs_PresentableObject.hxx index d5d7dca1a5..002a131cc6 100644 --- a/src/QABugs/QABugs_PresentableObject.hxx +++ b/src/QABugs/QABugs_PresentableObject.hxx @@ -16,54 +16,23 @@ #ifndef _QABugs_PresentableObject_HeaderFile #define _QABugs_PresentableObject_HeaderFile -#include -#include - #include -#include -#include -#include -#include -class Prs3d_Presentation; - -class QABugs_PresentableObject; DEFINE_STANDARD_HANDLE(QABugs_PresentableObject, AIS_InteractiveObject) - class QABugs_PresentableObject : public AIS_InteractiveObject { - + DEFINE_STANDARD_RTTIEXT(QABugs_PresentableObject, AIS_InteractiveObject) public: - Standard_EXPORT QABugs_PresentableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d = PrsMgr_TOP_AllView); - - - - DEFINE_STANDARD_RTTIEXT(QABugs_PresentableObject,AIS_InteractiveObject) - protected: - Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer aMode) Standard_OVERRIDE; Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPresentation, const Standard_Integer aMode = 0) Standard_OVERRIDE; - - -private: - - - - }; - - - - - - #endif // _QABugs_PresentableObject_HeaderFile diff --git a/src/SelectMgr/SelectMgr_SelectableObject.hxx b/src/SelectMgr/SelectMgr_SelectableObject.hxx index efb7604a46..2da46a4120 100644 --- a/src/SelectMgr/SelectMgr_SelectableObject.hxx +++ b/src/SelectMgr/SelectMgr_SelectableObject.hxx @@ -24,7 +24,6 @@ #include class SelectMgr_EntityOwner; -class Prs3d_Presentation; class Standard_NotImplemented; class SelectMgr_SelectionManager; diff --git a/src/StdPrs/StdPrs_Curve.hxx b/src/StdPrs/StdPrs_Curve.hxx index 2e69da3b8d..5fced62612 100644 --- a/src/StdPrs/StdPrs_Curve.hxx +++ b/src/StdPrs/StdPrs_Curve.hxx @@ -17,19 +17,11 @@ #ifndef _StdPrs_Curve_HeaderFile #define _StdPrs_Curve_HeaderFile -#include -#include -#include - #include #include -#include -#include #include -#include -class Prs3d_Presentation; -class Adaptor3d_Curve; +class Adaptor3d_Curve; //! A framework to define display of lines, arcs of circles //! and conic sections. diff --git a/src/StdPrs/StdPrs_DeflectionCurve.hxx b/src/StdPrs/StdPrs_DeflectionCurve.hxx index 8cd4bb3174..5f26d89b1a 100644 --- a/src/StdPrs/StdPrs_DeflectionCurve.hxx +++ b/src/StdPrs/StdPrs_DeflectionCurve.hxx @@ -17,20 +17,12 @@ #ifndef _StdPrs_DeflectionCurve_HeaderFile #define _StdPrs_DeflectionCurve_HeaderFile -#include -#include -#include - #include #include -#include -#include #include -class Prs3d_Presentation; class Adaptor3d_Curve; - //! A framework to provide display of any curve with //! respect to the maximal chordal deviation defined in //! the Prs3d_Drawer attributes manager. diff --git a/src/StdPrs/StdPrs_HLRPolyShape.hxx b/src/StdPrs/StdPrs_HLRPolyShape.hxx index 707ffa6c2d..5edfc044e2 100644 --- a/src/StdPrs/StdPrs_HLRPolyShape.hxx +++ b/src/StdPrs/StdPrs_HLRPolyShape.hxx @@ -17,17 +17,12 @@ #ifndef _StdPrs_HLRPolyShape_HeaderFile #define _StdPrs_HLRPolyShape_HeaderFile -#include -#include -#include - #include #include -class Prs3d_Presentation; + class TopoDS_Shape; class Prs3d_Projector; - //! Instantiates Prs3d_PolyHLRShape to define a //! display of a shape where hidden and visible lines are //! identified with respect to a given projection. diff --git a/src/StdPrs/StdPrs_Plane.hxx b/src/StdPrs/StdPrs_Plane.hxx index 0c91ebd7e8..4d29fa18c6 100644 --- a/src/StdPrs/StdPrs_Plane.hxx +++ b/src/StdPrs/StdPrs_Plane.hxx @@ -17,18 +17,11 @@ #ifndef _StdPrs_Plane_HeaderFile #define _StdPrs_Plane_HeaderFile -#include -#include -#include - #include #include -#include -class Prs3d_Presentation; class Adaptor3d_Surface; - //! A framework to display infinite planes. class StdPrs_Plane : public Prs3d_Root { diff --git a/src/StdPrs/StdPrs_PoleCurve.hxx b/src/StdPrs/StdPrs_PoleCurve.hxx index 9c78baad01..a42562aa77 100644 --- a/src/StdPrs/StdPrs_PoleCurve.hxx +++ b/src/StdPrs/StdPrs_PoleCurve.hxx @@ -17,19 +17,11 @@ #ifndef _StdPrs_PoleCurve_HeaderFile #define _StdPrs_PoleCurve_HeaderFile -#include -#include -#include - #include #include -#include -#include -class Prs3d_Presentation; class Adaptor3d_Curve; - //! A framework to provide display of Bezier or BSpline curves //! (by drawing a broken line linking the poles of the curve). class StdPrs_PoleCurve : public Prs3d_Root diff --git a/src/StdPrs/StdPrs_ShadedShape.hxx b/src/StdPrs/StdPrs_ShadedShape.hxx index 0bd9d8bd34..f65e762ce2 100644 --- a/src/StdPrs/StdPrs_ShadedShape.hxx +++ b/src/StdPrs/StdPrs_ShadedShape.hxx @@ -21,11 +21,9 @@ #include #include #include -#include class Graphic3d_ArrayOfSegments; class Graphic3d_ArrayOfTriangles; -class Prs3d_Presentation; class TopoDS_Shape; class gp_Pnt2d; class BRep_Builder; diff --git a/src/StdPrs/StdPrs_ShadedSurface.hxx b/src/StdPrs/StdPrs_ShadedSurface.hxx index 5a38ebedb9..3bb48cb5ff 100644 --- a/src/StdPrs/StdPrs_ShadedSurface.hxx +++ b/src/StdPrs/StdPrs_ShadedSurface.hxx @@ -17,15 +17,10 @@ #ifndef _StdPrs_ShadedSurface_HeaderFile #define _StdPrs_ShadedSurface_HeaderFile -#include -#include -#include - #include #include -class Prs3d_Presentation; -class Adaptor3d_Surface; +class Adaptor3d_Surface; //! Computes the shading presentation of surfaces. //! Draws a surface by drawing the isoparametric curves with respect to diff --git a/src/StdPrs/StdPrs_WFDeflectionRestrictedFace.hxx b/src/StdPrs/StdPrs_WFDeflectionRestrictedFace.hxx index 64fd2031f5..be7d35f9f7 100644 --- a/src/StdPrs/StdPrs_WFDeflectionRestrictedFace.hxx +++ b/src/StdPrs/StdPrs_WFDeflectionRestrictedFace.hxx @@ -17,21 +17,13 @@ #ifndef _StdPrs_WFDeflectionRestrictedFace_HeaderFile #define _StdPrs_WFDeflectionRestrictedFace_HeaderFile -#include -#include -#include - #include #include -#include -#include #include -class Prs3d_Presentation; class BRepAdaptor_HSurface; class Bnd_Box; - //! A framework to provide display of U and V //! isoparameters of faces, while allowing you to impose //! a deflection on them. diff --git a/src/StdPrs/StdPrs_WFDeflectionSurface.hxx b/src/StdPrs/StdPrs_WFDeflectionSurface.hxx index 1db12e2cef..87f832b27b 100644 --- a/src/StdPrs/StdPrs_WFDeflectionSurface.hxx +++ b/src/StdPrs/StdPrs_WFDeflectionSurface.hxx @@ -17,15 +17,10 @@ #ifndef _StdPrs_WFDeflectionSurface_HeaderFile #define _StdPrs_WFDeflectionSurface_HeaderFile -#include -#include -#include - #include #include -class Prs3d_Presentation; -class Adaptor3d_HSurface; +class Adaptor3d_HSurface; //! Draws a surface by drawing the isoparametric curves with respect to //! a maximal chordial deviation. diff --git a/src/StdPrs/StdPrs_WFPoleSurface.hxx b/src/StdPrs/StdPrs_WFPoleSurface.hxx index 3ed460482e..f0ffaeb550 100644 --- a/src/StdPrs/StdPrs_WFPoleSurface.hxx +++ b/src/StdPrs/StdPrs_WFPoleSurface.hxx @@ -17,15 +17,10 @@ #ifndef _StdPrs_WFPoleSurface_HeaderFile #define _StdPrs_WFPoleSurface_HeaderFile -#include -#include -#include - #include #include -class Prs3d_Presentation; -class Adaptor3d_Surface; +class Adaptor3d_Surface; //! Computes the presentation of surfaces by drawing a //! double network of lines linking the poles of the surface diff --git a/src/StdPrs/StdPrs_WFSurface.hxx b/src/StdPrs/StdPrs_WFSurface.hxx index f5e0faa36a..dacdba11c3 100644 --- a/src/StdPrs/StdPrs_WFSurface.hxx +++ b/src/StdPrs/StdPrs_WFSurface.hxx @@ -17,15 +17,10 @@ #ifndef _StdPrs_WFSurface_HeaderFile #define _StdPrs_WFSurface_HeaderFile -#include -#include -#include - #include #include -class Prs3d_Presentation; -class Adaptor3d_HSurface; +class Adaptor3d_HSurface; //! Computes the wireframe presentation of surfaces //! by displaying a given number of U and/or V isoparametric diff --git a/src/StdSelect/StdSelect_Shape.hxx b/src/StdSelect/StdSelect_Shape.hxx index 250f1992b9..f6ebdd44c4 100644 --- a/src/StdSelect/StdSelect_Shape.hxx +++ b/src/StdSelect/StdSelect_Shape.hxx @@ -17,19 +17,11 @@ #ifndef _StdSelect_Shape_HeaderFile #define _StdSelect_Shape_HeaderFile -#include -#include - #include #include #include -#include -#include class TopoDS_Shape; -class Prs3d_Presentation; -class Prs3d_Projector; -class Geom_Transformation; //! Presentable shape only for purpose of display for BRepOwner... class StdSelect_Shape : public PrsMgr_PresentableObject diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx index 47604eff68..321044872e 100644 --- a/src/ViewerTest/ViewerTest.cxx +++ b/src/ViewerTest/ViewerTest.cxx @@ -3870,10 +3870,10 @@ inline void bndPresentation (Draw_Interpretor& theDI, Bnd_Box aBox; for (PrsMgr_Presentations::Iterator aPrsIter (theObj->Presentations()); aPrsIter.More(); aPrsIter.Next()) { - if (aPrsIter.Value().Mode() != theDispMode) + if (aPrsIter.Value()->Mode() != theDispMode) continue; - aBox = aPrsIter.Value().Presentation()->Presentation()->MinMaxValues(); + aBox = aPrsIter.Value()->MinMaxValues(); } gp_Pnt aMin = aBox.CornerMin(); gp_Pnt aMax = aBox.CornerMax(); diff --git a/src/XCAFPrs/XCAFPrs_AISObject.cxx b/src/XCAFPrs/XCAFPrs_AISObject.cxx index 46c7bf4785..21ad5880d5 100644 --- a/src/XCAFPrs/XCAFPrs_AISObject.cxx +++ b/src/XCAFPrs/XCAFPrs_AISObject.cxx @@ -207,8 +207,8 @@ void XCAFPrs_AISObject::Compute (const Handle(PrsMgr_PresentationManager3d)& the Standard_Boolean toMapStyles = myToSyncStyles; for (PrsMgr_Presentations::Iterator aPrsIter (myPresentations); aPrsIter.More(); aPrsIter.Next()) { - if (aPrsIter.Value().Presentation()->Presentation() != thePrs - && !aPrsIter.Value().Presentation()->MustBeUpdated()) + if (aPrsIter.Value() != thePrs + && !aPrsIter.Value()->MustBeUpdated()) { toMapStyles = Standard_False; break;