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