0027824: Parasolid XMT file generates weird geometry after conversion
[occt.git] / src / OpenGl / OpenGl_LayerList.hxx
CommitLineData
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
c5751993 19#include <OpenGl_Layer.hxx>
91c60b57 20#include <OpenGl_LayerFilter.hxx>
59f45b7c 21
59f45b7c 22#include <NCollection_Sequence.hxx>
23#include <NCollection_DataMap.hxx>
24
25class OpenGl_Structure;
59f45b7c 26
c5751993 27typedef NCollection_Sequence<OpenGl_Layer> OpenGl_SequenceOfLayers;
59f45b7c 28typedef NCollection_DataMap<int, int> OpenGl_LayerSeqIds;
29
30class OpenGl_LayerList
31{
a1954302 32public:
33
59f45b7c 34 //! Constructor
35 OpenGl_LayerList (const Standard_Integer theNbPriorities = 11);
a1954302 36
59f45b7c 37 //! Destructor
a1954302 38 virtual ~OpenGl_LayerList();
39
59f45b7c 40 //! Method returns the number of available priorities
a1954302 41 Standard_Integer NbPriorities() const { return myNbPriorities; }
59f45b7c 42
43 //! Number of displayed structures
a1954302 44 Standard_Integer NbStructures() const { return myNbStructures; }
45
46 //! Return number of structures within immediate layers
47 Standard_Integer NbImmediateStructures() const { return myImmediateNbStructures; }
59f45b7c 48
49 //! Insert a new layer with id.
a1954302 50 void AddLayer (const Graphic3d_ZLayerId theLayerId);
51
59f45b7c 52 //! Remove layer by its id.
a1954302 53 void RemoveLayer (const Graphic3d_ZLayerId theLayerId);
54
59f45b7c 55 //! Add structure to list with given priority. The structure will be inserted
56 //! to specified layer. If the layer isn't found, the structure will be put
57 //! to default bottom-level layer.
a1954302 58 void AddStructure (const OpenGl_Structure* theStruct,
59 const Graphic3d_ZLayerId theLayerId,
60 const Standard_Integer thePriority,
61 Standard_Boolean isForChangePriority = Standard_False);
62
59f45b7c 63 //! Remove structure from structure list and return its previous priority
c357e426 64 void RemoveStructure (const OpenGl_Structure* theStructure);
a1954302 65
59f45b7c 66 //! Change structure z layer
67 //! If the new layer is not presented, the structure will be displayed
68 //! in default z layer
a1954302 69 void ChangeLayer (const OpenGl_Structure* theStructure,
70 const Graphic3d_ZLayerId theOldLayerId,
71 const Graphic3d_ZLayerId theNewLayerId);
c5751993 72
b7cd4ba7 73 //! Changes structure priority within its ZLayer
a1954302 74 void ChangePriority (const OpenGl_Structure* theStructure,
75 const Graphic3d_ZLayerId theLayerId,
76 const Standard_Integer theNewPriority);
b7cd4ba7 77
c5751993 78 //! Returns reference to the layer with given ID.
a1954302 79 OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId);
c5751993 80
81 //! Returns reference to the layer with given ID.
a1954302 82 const OpenGl_Layer& Layer (const Graphic3d_ZLayerId theLayerId) const;
83
84 //! Assign new settings to the layer.
85 void SetLayerSettings (const Graphic3d_ZLayerId theLayerId,
86 const Graphic3d_ZLayerSettings& theSettings);
87
59f45b7c 88 //! Render this element
a1954302 89 void Render (const Handle(OpenGl_Workspace)& theWorkspace,
91c60b57 90 const Standard_Boolean theToDrawImmediate,
91 const OpenGl_LayerFilter theLayersToProcess) const;
e276548b 92
93 //! Returns the set of OpenGL Z-layers.
94 const OpenGl_SequenceOfLayers& Layers() const { return myLayers; }
e276548b 95
50d06d8f 96 //! Returns the map of Z-layer IDs to indexes.
97 const OpenGl_LayerSeqIds& LayerIDs() const { return myLayerIds; }
98
b7cd4ba7 99 //! Marks BVH tree for given priority list as dirty and
100 //! marks primitive set for rebuild.
a1954302 101 void InvalidateBVHData (const Graphic3d_ZLayerId theLayerId);
b7cd4ba7 102
e276548b 103 //! Returns structure modification state (for ray-tracing).
104 Standard_Size ModificationState() const { return myModificationState; }
105
a1954302 106protected:
59f45b7c 107
108 // number of structures temporary put to default layer
109 OpenGl_SequenceOfLayers myLayers;
110 OpenGl_LayerSeqIds myLayerIds;
a1954302 111
59f45b7c 112 Standard_Integer myNbPriorities;
113 Standard_Integer myNbStructures;
a1954302 114 Standard_Integer myImmediateNbStructures; //!< number of structures within immediate layers
59f45b7c 115
e276548b 116 mutable Standard_Size myModificationState;
e276548b 117
a1954302 118public:
119
65c62757 120 DEFINE_STANDARD_ALLOC
a1954302 121
59f45b7c 122};
123
124#endif //_OpenGl_LayerList_Header