b311480e |
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 |
5 | // |
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. |
10 | // |
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. |
13 | // |
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. |
20 | |
59f45b7c |
21 | |
22 | #ifndef _OpenGl_LayerList_Header |
23 | #define _OpenGl_LayerList_Header |
24 | |
25 | #include <OpenGl_PriorityList.hxx> |
26 | |
27 | #include <InterfaceGraphic_telem.hxx> |
28 | |
29 | #include <NCollection_Sequence.hxx> |
30 | #include <NCollection_DataMap.hxx> |
31 | |
32 | class OpenGl_Structure; |
33 | class Handle(OpenGl_Workspace); |
34 | |
35 | typedef NCollection_Sequence<OpenGl_PriorityList> OpenGl_SequenceOfLayers; |
36 | typedef NCollection_DataMap<int, int> OpenGl_LayerSeqIds; |
37 | |
38 | class OpenGl_LayerList |
39 | { |
40 | public: |
41 | |
42 | //! Constructor |
43 | OpenGl_LayerList (const Standard_Integer theNbPriorities = 11); |
44 | |
45 | //! Destructor |
46 | virtual ~OpenGl_LayerList (); |
47 | |
48 | //! Method returns the number of available priorities |
49 | Standard_Integer NbPriorities () const; |
50 | |
51 | //! Number of displayed structures |
52 | Standard_Integer NbStructures () const; |
53 | |
54 | //! Insert a new layer with id. |
55 | void AddLayer (const Standard_Integer theLayerId); |
56 | |
57 | //! Check whether the layer with given id is already created. |
58 | Standard_Boolean HasLayer (const Standard_Integer theLayerId) const; |
59 | |
60 | //! Remove layer by its id. |
61 | void RemoveLayer (const Standard_Integer theLayerId); |
62 | |
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); |
69 | |
70 | //! Remove structure from structure list and return its previous priority |
71 | void RemoveStructure (const OpenGl_Structure *theStructure, |
72 | const Standard_Integer theZLayerId); |
73 | |
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); |
80 | |
81 | //! Render this element |
82 | void Render (const Handle(OpenGl_Workspace) &theWorkspace) const; |
e276548b |
83 | |
84 | //! Returns the set of OpenGL Z-layers. |
85 | const OpenGl_SequenceOfLayers& Layers() const { return myLayers; } |
59f45b7c |
86 | |
e276548b |
87 | #ifdef HAVE_OPENCL |
88 | |
89 | //! Returns structure modification state (for ray-tracing). |
90 | Standard_Size ModificationState() const { return myModificationState; } |
91 | |
92 | #endif |
93 | |
59f45b7c |
94 | private: |
95 | |
96 | //! Get default layer |
97 | OpenGl_PriorityList& defaultLayer (); |
98 | |
99 | protected: |
100 | |
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; |
106 | |
e276548b |
107 | #ifdef HAVE_OPENCL |
108 | mutable Standard_Size myModificationState; |
109 | #endif |
110 | |
59f45b7c |
111 | public: |
65c62757 |
112 | DEFINE_STANDARD_ALLOC |
59f45b7c |
113 | }; |
114 | |
115 | #endif //_OpenGl_LayerList_Header |