973c2be1 |
1 | // Created on: 2014-02-02 |
b311480e |
2 | // Created by: Anton POLETAEV |
3 | // Copyright (c) -1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 2014-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
973c2be1 |
8 | // This library is free software; you can redistribute it and / or modify it |
9 | // under the terms of the GNU Lesser General Public version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
59f45b7c |
16 | |
17 | #ifndef _OpenGl_LayerList_Header |
18 | #define _OpenGl_LayerList_Header |
19 | |
20 | #include <OpenGl_PriorityList.hxx> |
21 | |
22 | #include <InterfaceGraphic_telem.hxx> |
23 | |
24 | #include <NCollection_Sequence.hxx> |
25 | #include <NCollection_DataMap.hxx> |
26 | |
27 | class OpenGl_Structure; |
28 | class Handle(OpenGl_Workspace); |
29 | |
30 | typedef NCollection_Sequence<OpenGl_PriorityList> OpenGl_SequenceOfLayers; |
31 | typedef NCollection_DataMap<int, int> OpenGl_LayerSeqIds; |
32 | |
33 | class OpenGl_LayerList |
34 | { |
35 | public: |
36 | |
37 | //! Constructor |
38 | OpenGl_LayerList (const Standard_Integer theNbPriorities = 11); |
39 | |
40 | //! Destructor |
41 | virtual ~OpenGl_LayerList (); |
42 | |
43 | //! Method returns the number of available priorities |
44 | Standard_Integer NbPriorities () const; |
45 | |
46 | //! Number of displayed structures |
47 | Standard_Integer NbStructures () const; |
48 | |
49 | //! Insert a new layer with id. |
50 | void AddLayer (const Standard_Integer theLayerId); |
51 | |
52 | //! Check whether the layer with given id is already created. |
53 | Standard_Boolean HasLayer (const Standard_Integer theLayerId) const; |
54 | |
55 | //! Remove layer by its id. |
56 | void RemoveLayer (const Standard_Integer theLayerId); |
57 | |
58 | //! Add structure to list with given priority. The structure will be inserted |
59 | //! to specified layer. If the layer isn't found, the structure will be put |
60 | //! to default bottom-level layer. |
61 | void AddStructure (const OpenGl_Structure *theStructure, |
62 | const Standard_Integer theLayerId, |
63 | const Standard_Integer thePriority); |
64 | |
65 | //! Remove structure from structure list and return its previous priority |
66 | void RemoveStructure (const OpenGl_Structure *theStructure, |
67 | const Standard_Integer theZLayerId); |
68 | |
69 | //! Change structure z layer |
70 | //! If the new layer is not presented, the structure will be displayed |
71 | //! in default z layer |
72 | void ChangeLayer (const OpenGl_Structure *theStructure, |
73 | const Standard_Integer theOldLayerId, |
74 | const Standard_Integer theNewLayerId); |
75 | |
76 | //! Render this element |
77 | void Render (const Handle(OpenGl_Workspace) &theWorkspace) const; |
e276548b |
78 | |
79 | //! Returns the set of OpenGL Z-layers. |
80 | const OpenGl_SequenceOfLayers& Layers() const { return myLayers; } |
59f45b7c |
81 | |
e276548b |
82 | #ifdef HAVE_OPENCL |
83 | |
84 | //! Returns structure modification state (for ray-tracing). |
85 | Standard_Size ModificationState() const { return myModificationState; } |
86 | |
87 | #endif |
88 | |
59f45b7c |
89 | private: |
90 | |
91 | //! Get default layer |
92 | OpenGl_PriorityList& defaultLayer (); |
93 | |
94 | protected: |
95 | |
96 | // number of structures temporary put to default layer |
97 | OpenGl_SequenceOfLayers myLayers; |
98 | OpenGl_LayerSeqIds myLayerIds; |
99 | Standard_Integer myNbPriorities; |
100 | Standard_Integer myNbStructures; |
101 | |
e276548b |
102 | #ifdef HAVE_OPENCL |
103 | mutable Standard_Size myModificationState; |
104 | #endif |
105 | |
59f45b7c |
106 | public: |
65c62757 |
107 | DEFINE_STANDARD_ALLOC |
59f45b7c |
108 | }; |
109 | |
110 | #endif //_OpenGl_LayerList_Header |