59f45b7c |
1 | // File: OpenGl_LayerList.hxx |
2 | // Created: 2 February 2012 |
3 | // Author: Anton POLETAEV |
4 | // Copyright: OPEN CASCADE 2012 |
5 | |
6 | #ifndef _OpenGl_LayerList_Header |
7 | #define _OpenGl_LayerList_Header |
8 | |
9 | #include <OpenGl_PriorityList.hxx> |
10 | |
11 | #include <InterfaceGraphic_telem.hxx> |
12 | |
13 | #include <NCollection_Sequence.hxx> |
14 | #include <NCollection_DataMap.hxx> |
15 | |
16 | class OpenGl_Structure; |
17 | class Handle(OpenGl_Workspace); |
18 | |
19 | typedef NCollection_Sequence<OpenGl_PriorityList> OpenGl_SequenceOfLayers; |
20 | typedef NCollection_DataMap<int, int> OpenGl_LayerSeqIds; |
21 | |
22 | class OpenGl_LayerList |
23 | { |
24 | public: |
25 | |
26 | //! Constructor |
27 | OpenGl_LayerList (const Standard_Integer theNbPriorities = 11); |
28 | |
29 | //! Destructor |
30 | virtual ~OpenGl_LayerList (); |
31 | |
32 | //! Method returns the number of available priorities |
33 | Standard_Integer NbPriorities () const; |
34 | |
35 | //! Number of displayed structures |
36 | Standard_Integer NbStructures () const; |
37 | |
38 | //! Insert a new layer with id. |
39 | void AddLayer (const Standard_Integer theLayerId); |
40 | |
41 | //! Check whether the layer with given id is already created. |
42 | Standard_Boolean HasLayer (const Standard_Integer theLayerId) const; |
43 | |
44 | //! Remove layer by its id. |
45 | void RemoveLayer (const Standard_Integer theLayerId); |
46 | |
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); |
53 | |
54 | //! Remove structure from structure list and return its previous priority |
55 | void RemoveStructure (const OpenGl_Structure *theStructure, |
56 | const Standard_Integer theZLayerId); |
57 | |
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); |
64 | |
65 | //! Render this element |
66 | void Render (const Handle(OpenGl_Workspace) &theWorkspace) const; |
67 | |
68 | private: |
69 | |
70 | //! Get default layer |
71 | OpenGl_PriorityList& defaultLayer (); |
72 | |
73 | protected: |
74 | |
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; |
80 | |
81 | public: |
65c62757 |
82 | DEFINE_STANDARD_ALLOC |
59f45b7c |
83 | }; |
84 | |
85 | #endif //_OpenGl_LayerList_Header |