From 51b10cd46682682f6b0f83ade5b32e43c1f89c8b Mon Sep 17 00:00:00 2001 From: apl Date: Mon, 18 Nov 2013 21:48:50 +0400 Subject: [PATCH] 0024321: Use List collection instead of NCollection_Set for collection of Handle(Graphic3d_ClipPlane) - The NCollection_Sequence (Graphic3d_SequenceOfHClipPlane) is used for handling ordered lists of clipping planes instead of NCollection_Set (Graphic3d_SetOfHClipPlane). --- src/Graphic3d/FILES | 4 +- src/Graphic3d/Graphic3d.cdl | 4 +- src/Graphic3d/Graphic3d_CStructure.hxx | 4 +- src/Graphic3d/Graphic3d_CView.hxx | 4 +- ...hxx => Graphic3d_SequenceOfHClipPlane.hxx} | 11 +++--- ...Graphic3d_SequenceOfHClipPlane_Handle.hxx} | 8 ++-- src/Graphic3d/Graphic3d_Structure.cdl | 8 ++-- src/Graphic3d/Graphic3d_Structure.cxx | 4 +- src/OpenGl/OpenGl_CappingAlgo.cxx | 6 +-- src/OpenGl/OpenGl_Clipping.cxx | 14 +++---- src/OpenGl/OpenGl_Clipping.hxx | 24 ++++++------ src/OpenGl/OpenGl_ShaderManager.cxx | 4 +- src/OpenGl/OpenGl_ShaderStates.hxx | 2 - src/OpenGl/OpenGl_Structure.cxx | 10 ++--- src/OpenGl/OpenGl_Structure.hxx | 10 ++--- src/OpenGl/OpenGl_View.hxx | 6 +-- src/OpenGl/OpenGl_View_2.cxx | 12 +++--- src/PrsMgr/PrsMgr_PresentableObject.cdl | 8 ++-- src/PrsMgr/PrsMgr_PresentableObject.cxx | 23 ++++++++---- src/PrsMgr/PrsMgr_PresentableObject.lxx | 2 +- src/StdSelect/StdSelect_ViewerSelector3d.cdl | 37 +++++++++---------- src/StdSelect/StdSelect_ViewerSelector3d.cxx | 8 ++-- src/V3d/V3d_View.cdl | 8 ++-- src/V3d/V3d_View_2.cxx | 34 +++++++++-------- src/Visual3d/Visual3d_ContextView.cdl | 32 ++++++++-------- src/Visual3d/Visual3d_ContextView.cxx | 20 +++++++--- src/Visual3d/Visual3d_View.cxx | 7 ++-- 27 files changed, 164 insertions(+), 150 deletions(-) rename src/Graphic3d/{Graphic3d_SetOfHClipPlane.hxx => Graphic3d_SequenceOfHClipPlane.hxx} (74%) rename src/Graphic3d/{Graphic3d_SetOfHClipPlane_Handle.hxx => Graphic3d_SequenceOfHClipPlane_Handle.hxx} (80%) diff --git a/src/Graphic3d/FILES b/src/Graphic3d/FILES index d4a0f1f69e..5341a18316 100755 --- a/src/Graphic3d/FILES +++ b/src/Graphic3d/FILES @@ -68,5 +68,5 @@ Graphic3d_MarkerImage_Handle.hxx Graphic3d_ClipPlane.hxx Graphic3d_ClipPlane.cxx Graphic3d_ClipPlane_Handle.hxx -Graphic3d_SetOfHClipPlane.hxx -Graphic3d_SetOfHClipPlane_Handle.hxx +Graphic3d_SequenceOfHClipPlane.hxx +Graphic3d_SequenceOfHClipPlane_Handle.hxx diff --git a/src/Graphic3d/Graphic3d.cdl b/src/Graphic3d/Graphic3d.cdl index e7cd6326c0..70f77199f2 100755 --- a/src/Graphic3d/Graphic3d.cdl +++ b/src/Graphic3d/Graphic3d.cdl @@ -587,9 +587,9 @@ is imported ShaderProgram_Handle; ---Category: Instantiated classes - imported SetOfHClipPlane; + imported SequenceOfHClipPlane; ---Category: Instantiated classes - -- Set of handles on clip planes + -- Sequence of handles on clip planes deferred class TextureRoot from Graphic3d; deferred class TextureMap from Graphic3d; diff --git a/src/Graphic3d/Graphic3d_CStructure.hxx b/src/Graphic3d/Graphic3d_CStructure.hxx index 5f96ef877f..e5bd040a20 100755 --- a/src/Graphic3d/Graphic3d_CStructure.hxx +++ b/src/Graphic3d/Graphic3d_CStructure.hxx @@ -20,7 +20,7 @@ #define _Graphic3d_CStructure_HeaderFile #include -#include +#include class Graphic3d_CStructure { @@ -56,7 +56,7 @@ public: CALL_DEF_TRANSFORM_PERSISTENCE TransformPersistence; - Graphic3d_SetOfHClipPlane ClipPlanes; + Graphic3d_SequenceOfHClipPlane ClipPlanes; }; ///typedef Graphic3d_CStructure CALL_DEF_STRUCTURE; diff --git a/src/Graphic3d/Graphic3d_CView.hxx b/src/Graphic3d/Graphic3d_CView.hxx index dbc739a196..6532fad8d8 100755 --- a/src/Graphic3d/Graphic3d_CView.hxx +++ b/src/Graphic3d/Graphic3d_CView.hxx @@ -22,7 +22,7 @@ #include #include #include -#include +#include class CALL_DEF_VIEWCONTEXT { @@ -74,7 +74,7 @@ public: Handle(Graphic3d_TextureEnv) TextureEnv; int SurfaceDetail; - Graphic3d_SetOfHClipPlane ClipPlanes; + Graphic3d_SequenceOfHClipPlane ClipPlanes; }; class Graphic3d_CView diff --git a/src/Graphic3d/Graphic3d_SetOfHClipPlane.hxx b/src/Graphic3d/Graphic3d_SequenceOfHClipPlane.hxx similarity index 74% rename from src/Graphic3d/Graphic3d_SetOfHClipPlane.hxx rename to src/Graphic3d/Graphic3d_SequenceOfHClipPlane.hxx index a16dd1cf3c..494926e59e 100644 --- a/src/Graphic3d/Graphic3d_SetOfHClipPlane.hxx +++ b/src/Graphic3d/Graphic3d_SequenceOfHClipPlane.hxx @@ -17,14 +17,13 @@ // purpose or non-infringement Please see the License for the specific terms // and conditions governing the rights and limitations under the License -#ifndef _Graphic3d_SetOfHClipPlane_HeaderFile -#define _Graphic3d_SetOfHClipPlane_HeaderFile +#ifndef _Graphic3d_SequenceOfHClipPlane_HeaderFile +#define _Graphic3d_SequenceOfHClipPlane_HeaderFile -#include +#include #include -// CDL-header shortcut for set of graphical clipping planes. This is a compact -// way (compared to list) to store clippings, with mandatory uniqueness check. -typedef NCollection_Set Graphic3d_SetOfHClipPlane; +// CDL-header shortcut for sequence of graphical clipping planes. +typedef NCollection_Sequence Graphic3d_SequenceOfHClipPlane; #endif diff --git a/src/Graphic3d/Graphic3d_SetOfHClipPlane_Handle.hxx b/src/Graphic3d/Graphic3d_SequenceOfHClipPlane_Handle.hxx similarity index 80% rename from src/Graphic3d/Graphic3d_SetOfHClipPlane_Handle.hxx rename to src/Graphic3d/Graphic3d_SequenceOfHClipPlane_Handle.hxx index 71d80b2974..09d4e4f5bb 100644 --- a/src/Graphic3d/Graphic3d_SetOfHClipPlane_Handle.hxx +++ b/src/Graphic3d/Graphic3d_SequenceOfHClipPlane_Handle.hxx @@ -17,12 +17,12 @@ // purpose or non-infringement Please see the License for the specific terms // and conditions governing the rights and limitations under the License -#ifndef _Graphic3d_SetOfHClipPlane_Handle_HeaderFile -#define _Graphic3d_SetOfHClipPlane_Handle_HeaderFile +#ifndef _Graphic3d_SequenceOfHClipPlane_Handle_HeaderFile +#define _Graphic3d_SequenceOfHClipPlane_Handle_HeaderFile #include -#include +#include -typedef NCollection_Handle Handle(Graphic3d_SetOfHClipPlane); +typedef NCollection_Handle Handle(Graphic3d_SequenceOfHClipPlane); #endif diff --git a/src/Graphic3d/Graphic3d_Structure.cdl b/src/Graphic3d/Graphic3d_Structure.cdl index 92c176dfe7..3fdd2468f8 100755 --- a/src/Graphic3d/Graphic3d_Structure.cdl +++ b/src/Graphic3d/Graphic3d_Structure.cdl @@ -75,7 +75,7 @@ uses Vertex from Graphic3d, TransModeFlags from Graphic3d, Pnt from gp, - SetOfHClipPlane from Graphic3d + SequenceOfHClipPlane from Graphic3d raises @@ -271,11 +271,11 @@ is ---Purpose: Get Z layer ID of displayed structure. The method -- returns -1 if the structure has no ID (deleted from graphic driver). - SetClipPlanes (me : mutable; thePlanes : SetOfHClipPlane from Graphic3d) is static; - ---Purpose: Changes a set of clip planes slicing the structure on rendering. + SetClipPlanes (me : mutable; thePlanes : SequenceOfHClipPlane from Graphic3d) is static; + ---Purpose: Changes a sequence of clip planes slicing the structure on rendering. -- @param thePlanes [in] the set of clip planes. - GetClipPlanes (me) returns SetOfHClipPlane from Graphic3d; + GetClipPlanes (me) returns SequenceOfHClipPlane from Graphic3d; ---C++: return const& ---Purpose: Get clip planes slicing the structure on rendering. -- @return set of clip planes. diff --git a/src/Graphic3d/Graphic3d_Structure.cxx b/src/Graphic3d/Graphic3d_Structure.cxx index fe14aaec68..9066edf35b 100755 --- a/src/Graphic3d/Graphic3d_Structure.cxx +++ b/src/Graphic3d/Graphic3d_Structure.cxx @@ -2497,7 +2497,7 @@ Standard_Integer Graphic3d_Structure::GetZLayer () const //function : SetClipPlanes //purpose : //======================================================================= -void Graphic3d_Structure::SetClipPlanes (const Graphic3d_SetOfHClipPlane& thePlanes) +void Graphic3d_Structure::SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { MyCStructure.ClipPlanes = thePlanes; MyGraphicDriver->SetClipPlanes (MyCStructure); @@ -2507,7 +2507,7 @@ void Graphic3d_Structure::SetClipPlanes (const Graphic3d_SetOfHClipPlane& thePla //function : GetClipPlanes //purpose : //======================================================================= -const Graphic3d_SetOfHClipPlane& Graphic3d_Structure::GetClipPlanes() const +const Graphic3d_SequenceOfHClipPlane& Graphic3d_Structure::GetClipPlanes() const { return MyCStructure.ClipPlanes; } diff --git a/src/OpenGl/OpenGl_CappingAlgo.cxx b/src/OpenGl/OpenGl_CappingAlgo.cxx index 24a994fe02..6dae35ad2b 100644 --- a/src/OpenGl/OpenGl_CappingAlgo.cxx +++ b/src/OpenGl/OpenGl_CappingAlgo.cxx @@ -74,8 +74,8 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks // check whether algorithm need to be performed Standard_Boolean isCapping = Standard_False; - const Graphic3d_SetOfHClipPlane& aContextPlanes = aContext->Clipping().Planes(); - Graphic3d_SetOfHClipPlane::Iterator aCappingIt (aContextPlanes); + const Graphic3d_SequenceOfHClipPlane& aContextPlanes = aContext->Clipping().Planes(); + Graphic3d_SequenceOfHClipPlane::Iterator aCappingIt (aContextPlanes); for (; aCappingIt.More(); aCappingIt.Next()) { const Handle(Graphic3d_ClipPlane)& aPlane = aCappingIt.Value(); @@ -117,7 +117,7 @@ void OpenGl_CappingAlgo::RenderCapping (const Handle(OpenGl_Workspace)& theWorks } // enable only the rendering plane to generate stencil mask - Graphic3d_SetOfHClipPlane::Iterator aPlaneIt (aContextPlanes); + Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (aContextPlanes); for (; aPlaneIt.More(); aPlaneIt.Next()) { const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value(); diff --git a/src/OpenGl/OpenGl_Clipping.cxx b/src/OpenGl/OpenGl_Clipping.cxx index c8e7e6b409..c5bae79048 100644 --- a/src/OpenGl/OpenGl_Clipping.cxx +++ b/src/OpenGl/OpenGl_Clipping.cxx @@ -53,7 +53,7 @@ void OpenGl_Clipping::Init (const Standard_Integer theMaxPlanes) // function : Add // purpose : // ======================================================================= -void OpenGl_Clipping::Add (Graphic3d_SetOfHClipPlane& thePlanes, +void OpenGl_Clipping::Add (Graphic3d_SequenceOfHClipPlane& thePlanes, const EquationCoords& theCoordSpace, const Handle(OpenGl_Workspace)& theWS) { @@ -90,9 +90,9 @@ void OpenGl_Clipping::Add (Graphic3d_SetOfHClipPlane& thePlanes, // function : Add // purpose : // ======================================================================= -void OpenGl_Clipping::Add (Graphic3d_SetOfHClipPlane& thePlanes, const EquationCoords& theCoordSpace) +void OpenGl_Clipping::Add (Graphic3d_SequenceOfHClipPlane& thePlanes, const EquationCoords& theCoordSpace) { - Graphic3d_SetOfHClipPlane::Iterator aPlaneIt (thePlanes); + Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (thePlanes); while (aPlaneIt.More() && myEmptyPlaneIds->Available() > 0) { const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value(); @@ -103,7 +103,7 @@ void OpenGl_Clipping::Add (Graphic3d_SetOfHClipPlane& thePlanes, const EquationC } Standard_Integer anID = myEmptyPlaneIds->Next(); - myPlanes.Add (aPlane); + myPlanes.Append (aPlane); myPlaneStates.Bind (aPlane, PlaneProps (theCoordSpace, anID, Standard_True)); glEnable ((GLenum)anID); @@ -121,9 +121,9 @@ void OpenGl_Clipping::Add (Graphic3d_SetOfHClipPlane& thePlanes, const EquationC // function : Remove // purpose : // ======================================================================= -void OpenGl_Clipping::Remove (const Graphic3d_SetOfHClipPlane& thePlanes) +void OpenGl_Clipping::Remove (const Graphic3d_SequenceOfHClipPlane& thePlanes) { - Graphic3d_SetOfHClipPlane::Iterator aPlaneIt (thePlanes); + Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (thePlanes); for (; aPlaneIt.More(); aPlaneIt.Next()) { const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value(); @@ -160,7 +160,7 @@ void OpenGl_Clipping::Remove (const Graphic3d_SetOfHClipPlane& thePlanes) // purpose : // ======================================================================= void OpenGl_Clipping::SetEnabled (const Handle(Graphic3d_ClipPlane)& thePlane, - const Standard_Boolean theIsEnabled) + const Standard_Boolean theIsEnabled) { if (!Contains (thePlane)) { diff --git a/src/OpenGl/OpenGl_Clipping.hxx b/src/OpenGl/OpenGl_Clipping.hxx index e84be9d6c0..1225ade48f 100644 --- a/src/OpenGl/OpenGl_Clipping.hxx +++ b/src/OpenGl/OpenGl_Clipping.hxx @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -66,7 +66,7 @@ public: //! @name non-modifying getters //! Get clip planes defined for context. //! @return sequence of set clipping planes. - inline const Graphic3d_SetOfHClipPlane& Planes() const + inline const Graphic3d_SequenceOfHClipPlane& Planes() const { return myPlanes; } @@ -97,7 +97,7 @@ public: //! @name clipping state modification commands //! This list then can be used to fall back to previous state. //! @param theCoordSpace [in] the equation definition space. //! @param theWS [in] the workspace to access the matrices. - Standard_EXPORT void Add (Graphic3d_SetOfHClipPlane& thePlanes, + Standard_EXPORT void Add (Graphic3d_SequenceOfHClipPlane& thePlanes, const EquationCoords& theCoordSpace, const Handle(OpenGl_Workspace)& theWS); @@ -109,12 +109,12 @@ public: //! @name clipping state modification commands //! The list then provides information on which planes were really added to clipping state. //! This list then can be used to fall back to previous state. //! @param theCoordSpace [in] the equation definition space. - Standard_EXPORT void Add (Graphic3d_SetOfHClipPlane& thePlanes, + Standard_EXPORT void Add (Graphic3d_SequenceOfHClipPlane& thePlanes, const EquationCoords& theCoordSpace); //! Remove the passed set of clipping planes from the context state. //! @param thePlanes [in] the planes to remove from list. - Standard_EXPORT void Remove (const Graphic3d_SetOfHClipPlane& thePlanes); + Standard_EXPORT void Remove (const Graphic3d_SequenceOfHClipPlane& thePlanes); //! Enable or disable clipping plane in the OpenGl context. //! @param thePlane [in] the plane to affect. @@ -131,7 +131,7 @@ public: //! @name Short-cuts //! The list then provides information on which planes were really added to clipping state. //! This list then can be used to fall back to previous state. //! @param theWS [in] the workspace to access the matrices. - inline void AddView (Graphic3d_SetOfHClipPlane& thePlanes, const Handle(OpenGl_Workspace)& theWS) + inline void AddView (Graphic3d_SequenceOfHClipPlane& thePlanes, const Handle(OpenGl_Workspace)& theWS) { Add (thePlanes, EquationCoords_View, theWS); } @@ -142,7 +142,7 @@ public: //! @name Short-cuts //! @param thePlanes [in/out] the list of planes to be added. //! The list then provides information on which planes were really added to clipping state. //! This list then can be used to fall back to previous state. - inline void AddView (Graphic3d_SetOfHClipPlane& thePlanes) + inline void AddView (Graphic3d_SequenceOfHClipPlane& thePlanes) { Add (thePlanes, EquationCoords_View); } @@ -154,7 +154,7 @@ public: //! @name Short-cuts //! The list then provides information on which planes were really added to clipping state. //! This list then can be used to fall back to previous state. //! @param theWS [in] the workspace to access the matrices. - inline void AddWorld (Graphic3d_SetOfHClipPlane& thePlanes, const Handle(OpenGl_Workspace)& theWS) + inline void AddWorld (Graphic3d_SequenceOfHClipPlane& thePlanes, const Handle(OpenGl_Workspace)& theWS) { Add (thePlanes, EquationCoords_World, theWS); } @@ -165,7 +165,7 @@ public: //! @name Short-cuts //! @param thePlanes [in/out] the list of planes to be added. //! The list then provides information on which planes were really added to clipping state. //! This list then can be used to fall back to previous state. - inline void AddWorld (Graphic3d_SetOfHClipPlane& thePlanes) + inline void AddWorld (Graphic3d_SequenceOfHClipPlane& thePlanes) { Add (thePlanes, EquationCoords_World); } @@ -202,9 +202,9 @@ private: typedef NCollection_DataMap OpenGl_MapOfPlaneStates; typedef NCollection_Handle OpenGl_EmptyPlaneIds; - Graphic3d_SetOfHClipPlane myPlanes; //!< defined clipping planes. - OpenGl_MapOfPlaneStates myPlaneStates; //!< map of clip planes bound for the props. - OpenGl_EmptyPlaneIds myEmptyPlaneIds; //!< generator of empty ids. + Graphic3d_SequenceOfHClipPlane myPlanes; //!< defined clipping planes. + OpenGl_MapOfPlaneStates myPlaneStates; //!< map of clip planes bound for the props. + OpenGl_EmptyPlaneIds myEmptyPlaneIds; //!< generator of empty ids. private: diff --git a/src/OpenGl/OpenGl_ShaderManager.cxx b/src/OpenGl/OpenGl_ShaderManager.cxx index 9837f4a907..72c72e0661 100644 --- a/src/OpenGl/OpenGl_ShaderManager.cxx +++ b/src/OpenGl/OpenGl_ShaderManager.cxx @@ -512,7 +512,7 @@ void OpenGl_ShaderManager::PushClippingState (const Handle(OpenGl_ShaderProgram) } GLuint aPlanesNb = 0; - for (Graphic3d_SetOfHClipPlane::Iterator anIter (myContext->Clipping().Planes()); + for (Graphic3d_SequenceOfHClipPlane::Iterator anIter (myContext->Clipping().Planes()); anIter.More(); anIter.Next()) { const Handle(Graphic3d_ClipPlane)& aPlane = anIter.Value(); @@ -531,7 +531,7 @@ void OpenGl_ShaderManager::PushClippingState (const Handle(OpenGl_ShaderProgram) OpenGl_Vec4* anEquations = new OpenGl_Vec4[aPlanesNb]; GLint* aSpaces = new GLint [aPlanesNb]; GLuint aPlaneId = 0; - for (Graphic3d_SetOfHClipPlane::Iterator anIter (myContext->Clipping().Planes()); + for (Graphic3d_SequenceOfHClipPlane::Iterator anIter (myContext->Clipping().Planes()); anIter.More(); anIter.Next()) { const Handle(Graphic3d_ClipPlane)& aPlane = anIter.Value(); diff --git a/src/OpenGl/OpenGl_ShaderStates.hxx b/src/OpenGl/OpenGl_ShaderStates.hxx index 60731ff4e9..ce71a3a16f 100644 --- a/src/OpenGl/OpenGl_ShaderStates.hxx +++ b/src/OpenGl/OpenGl_ShaderStates.hxx @@ -20,8 +20,6 @@ #ifndef _OpenGl_State_HeaderFile #define _OpenGl_State_HeaderFile -#include - #include #include diff --git a/src/OpenGl/OpenGl_Structure.cxx b/src/OpenGl/OpenGl_Structure.cxx index f7a89cc7f9..537bfed5b0 100644 --- a/src/OpenGl/OpenGl_Structure.cxx +++ b/src/OpenGl/OpenGl_Structure.cxx @@ -33,7 +33,7 @@ #include #include -#include +#include //! Auxiliary class for bounding box presentation class OpenGl_BndBoxPrs : public OpenGl_Element @@ -682,12 +682,12 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &AWorkspace) const const Handle(OpenGl_Context)& aContext = AWorkspace->GetGlContext(); // List of planes to be applied to context state - Handle(Graphic3d_SetOfHClipPlane) aUserPlanes; + Handle(Graphic3d_SequenceOfHClipPlane) aUserPlanes; // Collect clipping planes of structure scope if (!myClipPlanes.IsEmpty()) { - Graphic3d_SetOfHClipPlane::Iterator aClippingIt (myClipPlanes); + Graphic3d_SequenceOfHClipPlane::Iterator aClippingIt (myClipPlanes); for (; aClippingIt.More(); aClippingIt.Next()) { const Handle(Graphic3d_ClipPlane)& aClipPlane = aClippingIt.Value(); @@ -698,10 +698,10 @@ void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &AWorkspace) const if (aUserPlanes.IsNull()) { - aUserPlanes = new Graphic3d_SetOfHClipPlane(); + aUserPlanes = new Graphic3d_SequenceOfHClipPlane(); } - aUserPlanes->Add (aClipPlane); + aUserPlanes->Append (aClipPlane); } } diff --git a/src/OpenGl/OpenGl_Structure.hxx b/src/OpenGl/OpenGl_Structure.hxx index 4a4fe17480..04eb21feaf 100644 --- a/src/OpenGl/OpenGl_Structure.hxx +++ b/src/OpenGl/OpenGl_Structure.hxx @@ -32,7 +32,7 @@ #include #include -#include +#include class OpenGl_Structure; @@ -71,7 +71,7 @@ public: Standard_Boolean IsVisible() const { return !(myNamedStatus & OPENGL_NS_HIDE); } - void SetClipPlanes (const Graphic3d_SetOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; } + void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; } void Connect (const OpenGl_Structure *astructure); void Disconnect (const OpenGl_Structure *astructure); @@ -169,9 +169,9 @@ protected: int myNamedStatus; //Structure_LABNameSet int myZLayer; - OpenGl_ListOfStructure myConnected; - OpenGl_ListOfGroup myGroups; - Graphic3d_SetOfHClipPlane myClipPlanes; + OpenGl_ListOfStructure myConnected; + OpenGl_ListOfGroup myGroups; + Graphic3d_SequenceOfHClipPlane myClipPlanes; #ifdef HAVE_OPENCL mutable OpenGl_ListOfStructure myAncestorStructures; diff --git a/src/OpenGl/OpenGl_View.hxx b/src/OpenGl/OpenGl_View.hxx index d8f13ac5b5..c8467585b0 100644 --- a/src/OpenGl/OpenGl_View.hxx +++ b/src/OpenGl/OpenGl_View.hxx @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include @@ -115,7 +115,7 @@ class OpenGl_View : public MMgt_TShared void SetBackfacing (const Standard_Integer AMode); void SetLights (const CALL_DEF_VIEWCONTEXT &AContext); void SetAntiAliasing (const Standard_Boolean AMode) { myAntiAliasing = AMode; } - void SetClipPlanes (const Graphic3d_SetOfHClipPlane &thePlanes) { myClipPlanes = thePlanes; } + void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane &thePlanes) { myClipPlanes = thePlanes; } void SetVisualisation (const CALL_DEF_VIEWCONTEXT &AContext); void SetClipLimit (const Graphic3d_CView& theCView); @@ -243,7 +243,7 @@ public: OPENGL_EXTRA_REP myExtra; //} - Graphic3d_SetOfHClipPlane myClipPlanes; + Graphic3d_SequenceOfHClipPlane myClipPlanes; OPENGL_FOG myFog; OpenGl_Trihedron* myTrihedron; diff --git a/src/OpenGl/OpenGl_View_2.cxx b/src/OpenGl/OpenGl_View_2.cxx index 84e7494024..8349bafd20 100644 --- a/src/OpenGl/OpenGl_View_2.cxx +++ b/src/OpenGl/OpenGl_View_2.cxx @@ -989,15 +989,15 @@ D = -[Px,Py,Pz] dot |Nx| // do some "memory allocation"-wise optimization if (!aPlaneBack.IsNull() || !aPlaneFront.IsNull()) { - Graphic3d_SetOfHClipPlane aSlicingPlanes; + Graphic3d_SequenceOfHClipPlane aSlicingPlanes; if (!aPlaneBack.IsNull()) { - aSlicingPlanes.Add (aPlaneBack); + aSlicingPlanes.Append (aPlaneBack); } if (!aPlaneFront.IsNull()) { - aSlicingPlanes.Add (aPlaneFront); + aSlicingPlanes.Append (aPlaneFront); } // add planes at loaded view matrix state @@ -1008,14 +1008,14 @@ D = -[Px,Py,Pz] dot |Nx| // Apply user clipping planes if (!myClipPlanes.IsEmpty()) { - Graphic3d_SetOfHClipPlane aUserPlanes; - Graphic3d_SetOfHClipPlane::Iterator aClippingIt (myClipPlanes); + Graphic3d_SequenceOfHClipPlane aUserPlanes; + Graphic3d_SequenceOfHClipPlane::Iterator aClippingIt (myClipPlanes); for (; aClippingIt.More(); aClippingIt.Next()) { const Handle(Graphic3d_ClipPlane)& aClipPlane = aClippingIt.Value(); if (aClipPlane->IsOn()) { - aUserPlanes.Add (aClipPlane); + aUserPlanes.Append (aClipPlane); } } diff --git a/src/PrsMgr/PrsMgr_PresentableObject.cdl b/src/PrsMgr/PrsMgr_PresentableObject.cdl index fa0527336a..176220a2a1 100755 --- a/src/PrsMgr/PrsMgr_PresentableObject.cdl +++ b/src/PrsMgr/PrsMgr_PresentableObject.cdl @@ -64,7 +64,7 @@ uses ListOfInteger from TColStd, Location from TopLoc, ClipPlane_Handle from Graphic3d, - SetOfHClipPlane from Graphic3d, + SequenceOfHClipPlane from Graphic3d, -- ABD 29/10/04 Transform Persistence of Presentation( pan, zoom, rotate ) TransModeFlags from Graphic3d, Pnt from gp, @@ -266,7 +266,7 @@ is ---Purpose: Removes previously added clip plane. -- @param thePlane [in] the clip plane to be removed from map of clip planes. - SetClipPlanes (me : mutable; thePlanes : SetOfHClipPlane from Graphic3d) is virtual; + SetClipPlanes (me : mutable; thePlanes : SequenceOfHClipPlane from Graphic3d) is virtual; ---Purpose: Set clip planes for graphical clipping for all display mode presentations. -- The composition of clip planes truncates the rendering space to convex -- volume. Please be aware that number of supported clip plane is limited. @@ -275,7 +275,7 @@ is -- of these planes should be substracted from limit to predict the maximum -- possible number of object clipping planes. - GetClipPlanes (me) returns SetOfHClipPlane from Graphic3d; + GetClipPlanes (me) returns SequenceOfHClipPlane from Graphic3d; ---C++: inline ---C++: return const& ---Purpose: Get clip planes. @@ -290,7 +290,7 @@ fields myPresentations: Presentations from PrsMgr is protected; myTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr is protected; myLocation : Location from TopLoc is protected; - myClipPlanes : SetOfHClipPlane from Graphic3d is protected; + myClipPlanes : SequenceOfHClipPlane from Graphic3d is protected; --myTransformPersistence : TransModeFlags from Graphic3d; myTransformPersistence : CTransPersStruct from Graphic3d; diff --git a/src/PrsMgr/PrsMgr_PresentableObject.cxx b/src/PrsMgr/PrsMgr_PresentableObject.cxx index a6ad5cc17f..58eef407b9 100755 --- a/src/PrsMgr/PrsMgr_PresentableObject.cxx +++ b/src/PrsMgr/PrsMgr_PresentableObject.cxx @@ -378,9 +378,9 @@ Standard_Integer PrsMgr_PresentableObject::GetZLayer // ======================================================================= void PrsMgr_PresentableObject::AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane) { - myClipPlanes.Add (thePlane); - - UpdateClipping(); // process changes + // add to collection and process changes + myClipPlanes.Append (thePlane); + UpdateClipping(); } // ======================================================================= @@ -389,19 +389,28 @@ void PrsMgr_PresentableObject::AddClipPlane (const Handle(Graphic3d_ClipPlane)& // ======================================================================= void PrsMgr_PresentableObject::RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane) { - myClipPlanes.Remove (thePlane); + // remove from collection and process changes + Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (myClipPlanes); + for (; aPlaneIt.More(); aPlaneIt.Next()) + { + const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value(); + if (aPlane != thePlane) + continue; - UpdateClipping(); // process changes + myClipPlanes.Remove (aPlaneIt); + UpdateClipping(); + return; + } } // ======================================================================= // function : SetClipPlanes // purpose : // ======================================================================= -void PrsMgr_PresentableObject::SetClipPlanes (const Graphic3d_SetOfHClipPlane& thePlanes) +void PrsMgr_PresentableObject::SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { + // change collection and process changes myClipPlanes = thePlanes; - UpdateClipping(); } diff --git a/src/PrsMgr/PrsMgr_PresentableObject.lxx b/src/PrsMgr/PrsMgr_PresentableObject.lxx index 3edbbe7305..517ba6f7ab 100755 --- a/src/PrsMgr/PrsMgr_PresentableObject.lxx +++ b/src/PrsMgr/PrsMgr_PresentableObject.lxx @@ -26,7 +26,7 @@ inline PrsMgr_TypeOfPresentation3d PrsMgr_PresentableObject::TypeOfPresentation3 inline const TopLoc_Location& PrsMgr_PresentableObject::Location() const {return myLocation;} -inline const Graphic3d_SetOfHClipPlane& PrsMgr_PresentableObject::GetClipPlanes() const +inline const Graphic3d_SequenceOfHClipPlane& PrsMgr_PresentableObject::GetClipPlanes() const { return myClipPlanes; } diff --git a/src/StdSelect/StdSelect_ViewerSelector3d.cdl b/src/StdSelect/StdSelect_ViewerSelector3d.cdl index 55c93f169d..6f685f29e8 100755 --- a/src/StdSelect/StdSelect_ViewerSelector3d.cdl +++ b/src/StdSelect/StdSelect_ViewerSelector3d.cdl @@ -28,17 +28,17 @@ class ViewerSelector3d from StdSelect inherits ViewerSelector from SelectMgr -- uses - View from V3d, - Selection from SelectMgr, - EntityOwner from SelectMgr, - Projector from Select3D, - Group from Graphic3d, - Structure from Graphic3d, - SetOfHClipPlane from Graphic3d, - Array1OfReal from TColStd, - Array1OfPnt2d from TColgp, - SensitivityMode from StdSelect, - Lin from gp + View from V3d, + Selection from SelectMgr, + EntityOwner from SelectMgr, + Projector from Select3D, + Group from Graphic3d, + Structure from Graphic3d, + SequenceOfHClipPlane from Graphic3d, + Array1OfReal from TColStd, + Array1OfPnt2d from TColgp, + SensitivityMode from StdSelect, + Lin from gp is @@ -152,12 +152,12 @@ is is static private; ---Level: Internal - SetClipping (me : mutable; thePlanes : SetOfHClipPlane from Graphic3d) is protected; + SetClipping (me : mutable; thePlanes : SequenceOfHClipPlane from Graphic3d) is protected; ---Level: Internal ---Purpose: Set view clipping for the selector. -- @param thePlanes [in] the view planes. - ComputeClipRange (me; thePlanes : SetOfHClipPlane from Graphic3d; + ComputeClipRange (me; thePlanes : SequenceOfHClipPlane from Graphic3d; thePickLine : Lin from gp; theDepthMin, theDepthMax : out Real from Standard) is protected; @@ -207,12 +207,9 @@ fields --areas verification... - myareagroup : Group from Graphic3d; - mysensgroup : Group from Graphic3d; - mystruct: Structure from Graphic3d; - myClipPlanes : SetOfHClipPlane from Graphic3d; + myareagroup : Group from Graphic3d; + mysensgroup : Group from Graphic3d; + mystruct : Structure from Graphic3d; + myClipPlanes : SequenceOfHClipPlane from Graphic3d; end ViewerSelector3d; - - - diff --git a/src/StdSelect/StdSelect_ViewerSelector3d.cxx b/src/StdSelect/StdSelect_ViewerSelector3d.cxx index 1c88fce988..fd448c897a 100755 --- a/src/StdSelect/StdSelect_ViewerSelector3d.cxx +++ b/src/StdSelect/StdSelect_ViewerSelector3d.cxx @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include @@ -1048,7 +1048,7 @@ void StdSelect_ViewerSelector3d::ComputeAreasPrs (const Handle(SelectMgr_Selecti //function : SetClipping //purpose : //======================================================================= -void StdSelect_ViewerSelector3d::SetClipping (const Graphic3d_SetOfHClipPlane& thePlanes) +void StdSelect_ViewerSelector3d::SetClipping (const Graphic3d_SequenceOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; } @@ -1057,7 +1057,7 @@ void StdSelect_ViewerSelector3d::SetClipping (const Graphic3d_SetOfHClipPlane& t //function : ComputeClipRange //purpose : //======================================================================= -void StdSelect_ViewerSelector3d::ComputeClipRange (const Graphic3d_SetOfHClipPlane& thePlanes, +void StdSelect_ViewerSelector3d::ComputeClipRange (const Graphic3d_SequenceOfHClipPlane& thePlanes, const gp_Lin& thePickLine, Standard_Real& theDepthMin, Standard_Real& theDepthMax) const @@ -1066,7 +1066,7 @@ void StdSelect_ViewerSelector3d::ComputeClipRange (const Graphic3d_SetOfHClipPla theDepthMax = RealLast(); Standard_Real aPlaneA, aPlaneB, aPlaneC, aPlaneD; - Graphic3d_SetOfHClipPlane::Iterator aPlaneIt (thePlanes); + Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (thePlanes); for (; aPlaneIt.More(); aPlaneIt.Next()) { const Handle(Graphic3d_ClipPlane)& aClipPlane = aPlaneIt.Value(); diff --git a/src/V3d/V3d_View.cdl b/src/V3d/V3d_View.cdl index a21d80679a..dfea8ae103 100755 --- a/src/V3d/V3d_View.cdl +++ b/src/V3d/V3d_View.cdl @@ -137,7 +137,7 @@ uses ExtendedString from TCollection, PrintAlgo from Aspect, ClipPlane_Handle from Graphic3d, - SetOfHClipPlane from Graphic3d + SequenceOfHClipPlane from Graphic3d raises BadValue from V3d, TypeMismatch from Standard, @@ -1566,8 +1566,8 @@ is ---Purpose: Removes clip plane from the view. -- @param thePlane [in] the clip plane to be removed from view. - SetClipPlanes (me : mutable; thePlanes : SetOfHClipPlane from Graphic3d); - ---Purpose: Set clip planes to the view. The planes that have been set + SetClipPlanes (me : mutable; thePlanes : SequenceOfHClipPlane from Graphic3d); + ---Purpose: Sets sequence of clip planes to the view. The planes that have been set -- before are removed from the view. The composition of clip planes -- truncates the rendering space to convex volume. Number of supported -- clip planes can be consulted by PlaneLimit method of associated @@ -1575,7 +1575,7 @@ is -- are igonred during rendering. -- @param thePlanes [in] the clip planes to set. - GetClipPlanes (me) returns SetOfHClipPlane from Graphic3d; + GetClipPlanes (me) returns SequenceOfHClipPlane from Graphic3d; ---C++: return const& ---Purpose: Get clip planes. -- @return sequence clip planes that have been set for the view diff --git a/src/V3d/V3d_View_2.cxx b/src/V3d/V3d_View_2.cxx index 8af5b3d4ca..dfb389233a 100755 --- a/src/V3d/V3d_View_2.cxx +++ b/src/V3d/V3d_View_2.cxx @@ -146,12 +146,8 @@ Standard_Boolean V3d_View::IfMoreLights() const { //======================================================================= void V3d_View::AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane) { - Graphic3d_SetOfHClipPlane aCurrPlanes = MyViewContext.GetClipPlanes(); - if (!aCurrPlanes.Add (thePlane)) - return; - - MyViewContext.SetClipPlanes (aCurrPlanes); - MyView->SetContext (MyViewContext) ; + MyViewContext.ChangeClipPlanes().Append (thePlane); + MyView->SetContext (MyViewContext); } //======================================================================= @@ -160,29 +156,35 @@ void V3d_View::AddClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane) //======================================================================= void V3d_View::RemoveClipPlane (const Handle(Graphic3d_ClipPlane)& thePlane) { - Graphic3d_SetOfHClipPlane aCurrPlanes = MyViewContext.GetClipPlanes(); - if (!aCurrPlanes.Remove (thePlane)) - return; + Graphic3d_SequenceOfHClipPlane& aSeqOfPlanes = MyViewContext.ChangeClipPlanes(); + Graphic3d_SequenceOfHClipPlane::Iterator aPlaneIt (aSeqOfPlanes); + for (; aPlaneIt.More(); aPlaneIt.Next()) + { + const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIt.Value(); + if (aPlane != thePlane) + continue; - MyViewContext.SetClipPlanes (aCurrPlanes); - MyView->SetContext (MyViewContext) ; + aSeqOfPlanes.Remove (aPlaneIt); + MyView->SetContext (MyViewContext); + return; + } } //======================================================================= //function : SetClipPlanes //purpose : //======================================================================= -void V3d_View::SetClipPlanes (const Graphic3d_SetOfHClipPlane& thePlanes) +void V3d_View::SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { - MyViewContext.SetClipPlanes (thePlanes); - MyView->SetContext (MyViewContext) ; + MyViewContext.ChangeClipPlanes() = thePlanes; + MyView->SetContext (MyViewContext); } //======================================================================= //function : GetClipPlanes //purpose : //======================================================================= -const Graphic3d_SetOfHClipPlane& V3d_View::GetClipPlanes() const +const Graphic3d_SequenceOfHClipPlane& V3d_View::GetClipPlanes() const { - return MyViewContext.GetClipPlanes(); + return MyViewContext.ClipPlanes(); } diff --git a/src/Visual3d/Visual3d_ContextView.cdl b/src/Visual3d/Visual3d_ContextView.cdl index 3b0f33c6d8..42b565e004 100755 --- a/src/Visual3d/Visual3d_ContextView.cdl +++ b/src/Visual3d/Visual3d_ContextView.cdl @@ -38,15 +38,14 @@ class ContextView from Visual3d uses - SequenceOfAddress from TColStd, - Light from Visual3d, - HSetOfLight from Visual3d, - - TypeOfModel from Visual3d, - TypeOfVisualization from Visual3d, - TypeOfSurfaceDetail from Visual3d, - TextureEnv from Graphic3d, - SetOfHClipPlane from Graphic3d + SequenceOfAddress from TColStd, + Light from Visual3d, + HSetOfLight from Visual3d, + TypeOfModel from Visual3d, + TypeOfVisualization from Visual3d, + TypeOfSurfaceDetail from Visual3d, + TextureEnv from Graphic3d, + SequenceOfHClipPlane from Graphic3d raises @@ -147,13 +146,14 @@ is -- Clip Plane --------------------------------------------------- - SetClipPlanes (me : in out; thePlanes : SetOfHClipPlane from Graphic3d); - ---Purpose: Set list of clip planes to the view context. - -- @param thePlanes [in] the clip planes to set. - - GetClipPlanes (me) returns SetOfHClipPlane from Graphic3d; + ClipPlanes (me) returns SequenceOfHClipPlane from Graphic3d; ---C++: return const& - ---Purpose: Get clip planes. + ---Purpose: Returns sequence of clip planes. + -- @return sequence of clip planes. + + ChangeClipPlanes (me : in out) returns SequenceOfHClipPlane from Graphic3d; + ---C++: return& + ---Purpose: Change clip planes. -- @return sequence of clip planes. --------------------------------------------------- @@ -440,6 +440,6 @@ fields MyTextureEnv : TextureEnv from Graphic3d; MySurfaceDetail : TypeOfSurfaceDetail from Visual3d; - myClipPlanes : SetOfHClipPlane from Graphic3d; + myClipPlanes : SequenceOfHClipPlane from Graphic3d; end ContextView; diff --git a/src/Visual3d/Visual3d_ContextView.cxx b/src/Visual3d/Visual3d_ContextView.cxx index 370ec549ba..0b02ee2de2 100755 --- a/src/Visual3d/Visual3d_ContextView.cxx +++ b/src/Visual3d/Visual3d_ContextView.cxx @@ -334,12 +334,20 @@ Visual3d_TypeOfSurfaceDetail Visual3d_ContextView::SurfaceDetail() const return MySurfaceDetail; } -void Visual3d_ContextView::SetClipPlanes (const Graphic3d_SetOfHClipPlane& thePlanes) -{ - myClipPlanes = thePlanes; -} - -const Graphic3d_SetOfHClipPlane& Visual3d_ContextView::GetClipPlanes() const +//======================================================================= +//function : ClipPlanes +//purpose : +//======================================================================= +const Graphic3d_SequenceOfHClipPlane& Visual3d_ContextView::ClipPlanes() const +{ + return myClipPlanes; +} + +//======================================================================= +//function : ChangeClipPlanes +//purpose : +//======================================================================= +Graphic3d_SequenceOfHClipPlane& Visual3d_ContextView::ChangeClipPlanes() { return myClipPlanes; } diff --git a/src/Visual3d/Visual3d_View.cxx b/src/Visual3d/Visual3d_View.cxx index cdf2c5ad5f..63e0a9bba4 100755 --- a/src/Visual3d/Visual3d_View.cxx +++ b/src/Visual3d/Visual3d_View.cxx @@ -745,12 +745,13 @@ void Visual3d_View::UpdateLights() MyCView.Context.ActiveLight = NULL; } -void Visual3d_View::UpdatePlanes() +void Visual3d_View::UpdatePlanes() { - MyCView.Context.ClipPlanes = MyContext.GetClipPlanes(); - + MyCView.Context.ClipPlanes = MyContext.ClipPlanes(); if (IsDeleted() || !IsDefined()) + { return; + } MyGraphicDriver->SetClipPlanes (MyCView); }