0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / OpenGl / OpenGl_LayerList.hxx
... / ...
CommitLineData
1// Created on: 2012-02-02
2// Created by: Anton POLETAEV
3// Copyright (c) 2012-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _OpenGl_LayerList_Header
17#define _OpenGl_LayerList_Header
18
19#include <OpenGl_Layer.hxx>
20#include <OpenGl_LayerFilter.hxx>
21
22#include <NCollection_Sequence.hxx>
23#include <NCollection_DataMap.hxx>
24
25class OpenGl_Structure;
26
27typedef NCollection_Sequence<OpenGl_Layer> OpenGl_SequenceOfLayers;
28typedef NCollection_DataMap<int, int> OpenGl_LayerSeqIds;
29
30//! Class defining the list of layers.
31class OpenGl_LayerList
32{
33public:
34
35 //! Constructor
36 OpenGl_LayerList (const Standard_Integer theNbPriorities = 11);
37
38 //! Destructor
39 virtual ~OpenGl_LayerList();
40
41 //! Method returns the number of available priorities
42 Standard_Integer NbPriorities() const { return myNbPriorities; }
43
44 //! Number of displayed structures
45 Standard_Integer NbStructures() const { return myNbStructures; }
46
47 //! Return number of structures within immediate layers
48 Standard_Integer NbImmediateStructures() const { return myImmediateNbStructures; }
49
50 //! Insert a new layer with id.
51 void AddLayer (const Graphic3d_ZLayerId theLayerId);
52
53 //! Remove layer by its id.
54 void RemoveLayer (const Graphic3d_ZLayerId theLayerId);
55
56 //! Add structure to list with given priority. The structure will be inserted
57 //! to specified layer. If the layer isn't found, the structure will be put
58 //! to default bottom-level layer.
59 void AddStructure (const OpenGl_Structure* theStruct,
60 const Graphic3d_ZLayerId theLayerId,
61 const Standard_Integer thePriority,
62 Standard_Boolean isForChangePriority = Standard_False);
63
64 //! Remove structure from structure list and return its previous priority
65 void RemoveStructure (const OpenGl_Structure* theStructure);
66
67 //! Change structure z layer
68 //! If the new layer is not presented, the structure will be displayed
69 //! in default z layer
70 void ChangeLayer (const OpenGl_Structure* theStructure,
71 const Graphic3d_ZLayerId theOldLayerId,
72 const Graphic3d_ZLayerId theNewLayerId);
73
74 //! Changes structure priority within its ZLayer
75 void ChangePriority (const OpenGl_Structure* theStructure,
76 const Graphic3d_ZLayerId theLayerId,
77 const Standard_Integer theNewPriority);
78
79 //! Returns reference to the layer with given ID.
80 OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId);
81
82 //! Returns reference to the layer with given ID.
83 const OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId) const;
84
85 //! Assign new settings to the layer.
86 void SetLayerSettings (const Graphic3d_ZLayerId theLayerId,
87 const Graphic3d_ZLayerSettings& theSettings);
88
89 //! Render this element
90 void Render (const Handle(OpenGl_Workspace)& theWorkspace,
91 const Standard_Boolean theToDrawImmediate,
92 const OpenGl_LayerFilter theLayersToProcess) const;
93
94 //! Returns the set of OpenGL Z-layers.
95 const OpenGl_SequenceOfLayers& Layers() const { return myLayers; }
96
97 //! Returns the map of Z-layer IDs to indexes.
98 const OpenGl_LayerSeqIds& LayerIDs() const { return myLayerIds; }
99
100 //! Marks BVH tree for given priority list as dirty and
101 //! marks primitive set for rebuild.
102 void InvalidateBVHData (const Graphic3d_ZLayerId theLayerId);
103
104 //! Returns structure modification state (for ray-tracing).
105 Standard_Size ModificationStateOfRaytracable() const { return myModifStateOfRaytraceable; }
106
107protected:
108
109 // number of structures temporary put to default layer
110 OpenGl_SequenceOfLayers myLayers;
111 OpenGl_LayerSeqIds myLayerIds;
112 Standard_Integer myDefaultLayerIndex; //!< index of Graphic3d_ZLayerId_Default layer in myLayers sequence
113
114 Standard_Integer myNbPriorities;
115 Standard_Integer myNbStructures;
116 Standard_Integer myImmediateNbStructures; //!< number of structures within immediate layers
117
118 mutable Standard_Size myModifStateOfRaytraceable;
119
120public:
121
122 DEFINE_STANDARD_ALLOC
123
124};
125
126#endif //_OpenGl_LayerList_Header