0027818: Visualization - provide an interface to define highlight presentation properties
[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>
8e5fb5ea 20#include <Graphic3d_HighlightStyle.hxx>
b64d84be 21#include <Graphic3d_SequenceOfGroup.hxx>
51b10cd4 22#include <Graphic3d_SequenceOfHClipPlane.hxx>
63bcc448 23#include <Graphic3d_TypeOfComposition.hxx>
a272ed94 24#include <Graphic3d_ViewAffinity.hxx>
825aa485 25#include <Graphic3d_TransformPers.hxx>
63bcc448 26#include <Graphic3d_Vec3.hxx>
a1954302 27#include <Graphic3d_ZLayerId.hxx>
1f7f5a90 28#include <Geom_Transformation.hxx>
bf75be98 29
c04c30b3 30class Graphic3d_GraphicDriver;
31class Graphic3d_StructureManager;
63bcc448 32
33//! Low-level graphic structure interface
34class Graphic3d_CStructure : public Standard_Transient
bf75be98 35{
36
37public:
38
63bcc448 39 //! @return graphic driver created this structure
40 const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const
41 {
42 return myGraphicDriver;
43 }
44
b64d84be 45 //! @return graphic groups
46 const Graphic3d_SequenceOfGroup& Groups() const
47 {
48 return myGroups;
49 }
50
1f7f5a90 51 //! Return transformation.
52 const Handle(Geom_Transformation)& Transformation() const { return myTrsf; }
53
54 //! Assign transformation.
55 virtual void SetTransformation (const Handle(Geom_Transformation)& theTrsf) { myTrsf = theTrsf; }
56
778cd667 57 //! Return transformation persistence.
58 const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTrsfPers; }
59
60 //! Set transformation persistence.
61 void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers) { myTrsfPers = theTrsfPers; }
62
63bcc448 63 //! @return associated clip planes
3202bf1e 64 const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const
63bcc448 65 {
66 return myClipPlanes;
67 }
68
69 //! Pass clip planes to the associated graphic driver structure
3202bf1e 70 void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) { myClipPlanes = thePlanes; }
63bcc448 71
b7cd4ba7 72 //! @return bounding box of this presentation
73 const Graphic3d_BndBox4f& BoundingBox() const
74 {
75 return myBndBox;
76 }
77
78 //! @return bounding box of this presentation
79 //! without transformation matrix applied
80 Graphic3d_BndBox4f& ChangeBoundingBox()
81 {
82 return myBndBox;
83 }
84
a1954302 85 //! Return structure visibility flag
86 bool IsVisible() const { return visible != 0; }
87
3fe9ce0e 88 //! Return structure visibility considering both View Affinity and global visibility state.
89 bool IsVisible (const Standard_Integer theViewId) const
90 {
91 return visible != 0
92 && (ViewAffinity.IsNull()
93 || ViewAffinity->IsVisible (theViewId));
94 }
95
a1954302 96 //! Set z layer ID to display the structure in specified layer
97 void SetZLayer (const Graphic3d_ZLayerId theLayerIndex) { myZLayer = theLayerIndex; }
98
99 //! Get z layer ID
100 Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
101
8e5fb5ea 102 //! Returns valid handle to highlight style of the structure in case if
103 //! highlight flag is set to true
104 const Handle(Graphic3d_HighlightStyle)& HighlightStyle() const { return myHighlightStyle; }
105
63bcc448 106public:
107
108 //! Update structure visibility state
a1954302 109 virtual void OnVisibilityChanged() = 0;
63bcc448 110
111 //! Clear graphic data
112 virtual void Clear() = 0;
113
114 //! Connect other structure to this one
115 virtual void Connect (Graphic3d_CStructure& theStructure) = 0;
116
117 //! Disconnect other structure to this one
118 virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
119
8e5fb5ea 120 //! Highlights structure with the given style
121 virtual void GraphicHighlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
122 const Handle(Graphic3d_Structure)& theStruct) = 0;
63bcc448 123
8e5fb5ea 124 //! Unhighlights the structure and invalidates pointer to structure's highlight
125 //! style
126 virtual void GraphicUnhighlight() = 0;
63bcc448 127
679ecdee 128 //! Create shadow link to this structure
129 virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const = 0;
130
b64d84be 131 //! Create new group within this structure
132 virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct) = 0;
133
134 //! Remove group from this structure
135 virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup) = 0;
136
63bcc448 137public:
138
a1954302 139 int Id;
140 Graphic3d_ZLayerId myZLayer;
141 int Priority;
142 int PreviousPriority;
bf75be98 143
bf75be98 144 int ContainsFacet;
145
a272ed94 146 Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
147
b7cd4ba7 148 unsigned IsInfinite : 1;
a1954302 149 unsigned stick : 1; //!< displaying state - should be set when structure has been added to scene graph (but can be in hidden state)
b7cd4ba7 150 unsigned highlight : 1;
a1954302 151 unsigned visible : 1; //!< visibility flag - can be used to suppress structure while leaving it in the scene graph
b7cd4ba7 152 unsigned HLRValidation : 1;
153 unsigned IsForHighlight : 1;
154 unsigned IsMutable : 1;
155 unsigned Is2dText : 1;
bf75be98 156
63bcc448 157protected:
7fd59977 158
63bcc448 159 //! Create empty structure.
160 Standard_EXPORT Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager);
7fd59977 161
63bcc448 162protected:
163
164 Handle(Graphic3d_GraphicDriver) myGraphicDriver;
b64d84be 165 Graphic3d_SequenceOfGroup myGroups;
b7cd4ba7 166 Graphic3d_BndBox4f myBndBox;
1f7f5a90 167 Handle(Geom_Transformation) myTrsf;
778cd667 168 Handle(Graphic3d_TransformPers) myTrsfPers;
3202bf1e 169 Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
8e5fb5ea 170 Handle(Graphic3d_HighlightStyle) myHighlightStyle; //! Current highlight style; is set only if highlight flag is true
63bcc448 171
172public:
173
92efcf78 174 DEFINE_STANDARD_RTTIEXT(Graphic3d_CStructure,Standard_Transient) // Type definition
63bcc448 175
176};
7fd59977 177
494782f6 178DEFINE_STANDARD_HANDLE (Graphic3d_CStructure, Standard_Transient)
179
63bcc448 180#endif // _Graphic3d_CStructure_HeaderFile