0026885: Visualization - drop redundant aspects from structure level
[occt.git] / src / Graphic3d / Graphic3d_CStructure.hxx
CommitLineData
b311480e 1// Copyright (c) 1995-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15#ifndef _Graphic3d_CStructure_HeaderFile
16#define _Graphic3d_CStructure_HeaderFile
17
b7cd4ba7 18#include <Graphic3d_BndBox4f.hxx>
b64d84be 19#include <Graphic3d_Group.hxx>
20#include <Graphic3d_SequenceOfGroup.hxx>
51b10cd4 21#include <Graphic3d_SequenceOfHClipPlane.hxx>
63bcc448 22#include <Graphic3d_TypeOfComposition.hxx>
a272ed94 23#include <Graphic3d_ViewAffinity.hxx>
825aa485 24#include <Graphic3d_TransformPers.hxx>
63bcc448 25#include <Graphic3d_Vec3.hxx>
a1954302 26#include <Graphic3d_ZLayerId.hxx>
c357e426 27#include <InterfaceGraphic_Graphic3d.hxx>
bf75be98 28
c04c30b3 29class Graphic3d_GraphicDriver;
30class Graphic3d_StructureManager;
63bcc448 31
32//! Low-level graphic structure interface
33class Graphic3d_CStructure : public Standard_Transient
bf75be98 34{
35
36public:
37
63bcc448 38 //! @return graphic driver created this structure
39 const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const
40 {
41 return myGraphicDriver;
42 }
43
b64d84be 44 //! @return graphic groups
45 const Graphic3d_SequenceOfGroup& Groups() const
46 {
47 return myGroups;
48 }
49
63bcc448 50 //! @return associated clip planes
51 const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const
52 {
53 return myClipPlanes;
54 }
55
56 //! Pass clip planes to the associated graphic driver structure
57 void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; }
58
b7cd4ba7 59 //! @return bounding box of this presentation
60 const Graphic3d_BndBox4f& BoundingBox() const
61 {
62 return myBndBox;
63 }
64
65 //! @return bounding box of this presentation
66 //! without transformation matrix applied
67 Graphic3d_BndBox4f& ChangeBoundingBox()
68 {
69 return myBndBox;
70 }
71
a1954302 72 //! Return structure visibility flag
73 bool IsVisible() const { return visible != 0; }
74
75 //! Set z layer ID to display the structure in specified layer
76 void SetZLayer (const Graphic3d_ZLayerId theLayerIndex) { myZLayer = theLayerIndex; }
77
78 //! Get z layer ID
79 Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
80
63bcc448 81public:
82
83 //! Update structure visibility state
a1954302 84 virtual void OnVisibilityChanged() = 0;
63bcc448 85
86 //! Clear graphic data
87 virtual void Clear() = 0;
88
89 //! Connect other structure to this one
90 virtual void Connect (Graphic3d_CStructure& theStructure) = 0;
91
92 //! Disconnect other structure to this one
93 virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
94
63bcc448 95 //! Synchronize structure transformation
96 virtual void UpdateTransformation() = 0;
bf75be98 97
63bcc448 98 //! Highlight entire structure with color
99 virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
100 const Standard_Boolean theToCreate) = 0;
101
102 //! Highlight structure using boundary box
b64d84be 103 virtual void HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
104 const Standard_Boolean theToCreate) = 0;
63bcc448 105
679ecdee 106 //! Create shadow link to this structure
107 virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const = 0;
108
b64d84be 109 //! Create new group within this structure
110 virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct) = 0;
111
112 //! Remove group from this structure
113 virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup) = 0;
114
63bcc448 115public:
116
a1954302 117 int Id;
118 Graphic3d_ZLayerId myZLayer;
119 int Priority;
120 int PreviousPriority;
bf75be98 121
b7cd4ba7 122 CALL_DEF_COLOR HighlightColor;
bf75be98 123
6bd94e0d 124 Graphic3d_Mat4 Transformation;
bf75be98 125
126 int ContainsFacet;
127
a272ed94 128 Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
129
b7cd4ba7 130 unsigned IsInfinite : 1;
a1954302 131 unsigned stick : 1; //!< displaying state - should be set when structure has been added to scene graph (but can be in hidden state)
b7cd4ba7 132 unsigned highlight : 1;
a1954302 133 unsigned visible : 1; //!< visibility flag - can be used to suppress structure while leaving it in the scene graph
b7cd4ba7 134 unsigned HLRValidation : 1;
135 unsigned IsForHighlight : 1;
136 unsigned IsMutable : 1;
137 unsigned Is2dText : 1;
bf75be98 138
825aa485 139 Graphic3d_TransformPers TransformPersistence;
bf75be98 140
63bcc448 141protected:
7fd59977 142
63bcc448 143 //! Create empty structure.
144 Standard_EXPORT Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager);
7fd59977 145
63bcc448 146protected:
147
148 Handle(Graphic3d_GraphicDriver) myGraphicDriver;
b64d84be 149 Graphic3d_SequenceOfGroup myGroups;
b7cd4ba7 150 Graphic3d_BndBox4f myBndBox;
63bcc448 151 Graphic3d_SequenceOfHClipPlane myClipPlanes;
152
153public:
154
92efcf78 155 DEFINE_STANDARD_RTTIEXT(Graphic3d_CStructure,Standard_Transient) // Type definition
63bcc448 156
157};
7fd59977 158
494782f6 159DEFINE_STANDARD_HANDLE (Graphic3d_CStructure, Standard_Transient)
160
63bcc448 161#endif // _Graphic3d_CStructure_HeaderFile