1 // Created on: 2012-02-02
2 // Created by: Anton POLETAEV
3 // Copyright (c) -1999 Matra Datavision
4 // Copyright (c) 2012-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
22 #ifndef _OpenGl_LayerList_Header
23 #define _OpenGl_LayerList_Header
25 #include <OpenGl_PriorityList.hxx>
27 #include <InterfaceGraphic_telem.hxx>
29 #include <NCollection_Sequence.hxx>
30 #include <NCollection_DataMap.hxx>
32 class OpenGl_Structure;
33 class Handle(OpenGl_Workspace);
35 typedef NCollection_Sequence<OpenGl_PriorityList> OpenGl_SequenceOfLayers;
36 typedef NCollection_DataMap<int, int> OpenGl_LayerSeqIds;
38 class OpenGl_LayerList
43 OpenGl_LayerList (const Standard_Integer theNbPriorities = 11);
46 virtual ~OpenGl_LayerList ();
48 //! Method returns the number of available priorities
49 Standard_Integer NbPriorities () const;
51 //! Number of displayed structures
52 Standard_Integer NbStructures () const;
54 //! Insert a new layer with id.
55 void AddLayer (const Standard_Integer theLayerId);
57 //! Check whether the layer with given id is already created.
58 Standard_Boolean HasLayer (const Standard_Integer theLayerId) const;
60 //! Remove layer by its id.
61 void RemoveLayer (const Standard_Integer theLayerId);
63 //! Add structure to list with given priority. The structure will be inserted
64 //! to specified layer. If the layer isn't found, the structure will be put
65 //! to default bottom-level layer.
66 void AddStructure (const OpenGl_Structure *theStructure,
67 const Standard_Integer theLayerId,
68 const Standard_Integer thePriority);
70 //! Remove structure from structure list and return its previous priority
71 void RemoveStructure (const OpenGl_Structure *theStructure,
72 const Standard_Integer theZLayerId);
74 //! Change structure z layer
75 //! If the new layer is not presented, the structure will be displayed
76 //! in default z layer
77 void ChangeLayer (const OpenGl_Structure *theStructure,
78 const Standard_Integer theOldLayerId,
79 const Standard_Integer theNewLayerId);
81 //! Render this element
82 void Render (const Handle(OpenGl_Workspace) &theWorkspace) const;
84 //! Returns the set of OpenGL Z-layers.
85 const OpenGl_SequenceOfLayers& Layers() const { return myLayers; }
89 //! Returns structure modification state (for ray-tracing).
90 Standard_Size ModificationState() const { return myModificationState; }
97 OpenGl_PriorityList& defaultLayer ();
101 // number of structures temporary put to default layer
102 OpenGl_SequenceOfLayers myLayers;
103 OpenGl_LayerSeqIds myLayerIds;
104 Standard_Integer myNbPriorities;
105 Standard_Integer myNbStructures;
108 mutable Standard_Size myModificationState;
112 DEFINE_STANDARD_ALLOC
115 #endif //_OpenGl_LayerList_Header