1 // File: OpenGl_LayerList.hxx
2 // Created: 2 February 2012
3 // Author: Anton POLETAEV
4 // Copyright: OPEN CASCADE 2012
6 #ifndef _OpenGl_LayerList_Header
7 #define _OpenGl_LayerList_Header
9 #include <OpenGl_PriorityList.hxx>
11 #include <InterfaceGraphic_telem.hxx>
13 #include <NCollection_Sequence.hxx>
14 #include <NCollection_DataMap.hxx>
16 class OpenGl_Structure;
17 class Handle(OpenGl_Workspace);
19 typedef NCollection_Sequence<OpenGl_PriorityList> OpenGl_SequenceOfLayers;
20 typedef NCollection_DataMap<int, int> OpenGl_LayerSeqIds;
22 class OpenGl_LayerList
27 OpenGl_LayerList (const Standard_Integer theNbPriorities = 11);
30 virtual ~OpenGl_LayerList ();
32 //! Method returns the number of available priorities
33 Standard_Integer NbPriorities () const;
35 //! Number of displayed structures
36 Standard_Integer NbStructures () const;
38 //! Insert a new layer with id.
39 void AddLayer (const Standard_Integer theLayerId);
41 //! Check whether the layer with given id is already created.
42 Standard_Boolean HasLayer (const Standard_Integer theLayerId) const;
44 //! Remove layer by its id.
45 void RemoveLayer (const Standard_Integer theLayerId);
47 //! Add structure to list with given priority. The structure will be inserted
48 //! to specified layer. If the layer isn't found, the structure will be put
49 //! to default bottom-level layer.
50 void AddStructure (const OpenGl_Structure *theStructure,
51 const Standard_Integer theLayerId,
52 const Standard_Integer thePriority);
54 //! Remove structure from structure list and return its previous priority
55 void RemoveStructure (const OpenGl_Structure *theStructure,
56 const Standard_Integer theZLayerId);
58 //! Change structure z layer
59 //! If the new layer is not presented, the structure will be displayed
60 //! in default z layer
61 void ChangeLayer (const OpenGl_Structure *theStructure,
62 const Standard_Integer theOldLayerId,
63 const Standard_Integer theNewLayerId);
65 //! Render this element
66 void Render (const Handle(OpenGl_Workspace) &theWorkspace) const;
71 OpenGl_PriorityList& defaultLayer ();
75 // number of structures temporary put to default layer
76 OpenGl_SequenceOfLayers myLayers;
77 OpenGl_LayerSeqIds myLayerIds;
78 Standard_Integer myNbPriorities;
79 Standard_Integer myNbStructures;
85 #endif //_OpenGl_LayerList_Header