0025180: Visualization - Homogeneous transformation API in TKV3d
[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>
1f7f5a90 27#include <Geom_Transformation.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
1f7f5a90 50 //! Return transformation.
51 const Handle(Geom_Transformation)& Transformation() const { return myTrsf; }
52
53 //! Assign transformation.
54 virtual void SetTransformation (const Handle(Geom_Transformation)& theTrsf) { myTrsf = theTrsf; }
55
778cd667 56 //! Return transformation persistence.
57 const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myTrsfPers; }
58
59 //! Set transformation persistence.
60 void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers) { myTrsfPers = theTrsfPers; }
61
63bcc448 62 //! @return associated clip planes
3202bf1e 63 const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const
63bcc448 64 {
65 return myClipPlanes;
66 }
67
68 //! Pass clip planes to the associated graphic driver structure
3202bf1e 69 void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) { myClipPlanes = thePlanes; }
63bcc448 70
b7cd4ba7 71 //! @return bounding box of this presentation
72 const Graphic3d_BndBox4f& BoundingBox() const
73 {
74 return myBndBox;
75 }
76
77 //! @return bounding box of this presentation
78 //! without transformation matrix applied
79 Graphic3d_BndBox4f& ChangeBoundingBox()
80 {
81 return myBndBox;
82 }
83
a1954302 84 //! Return structure visibility flag
85 bool IsVisible() const { return visible != 0; }
86
3fe9ce0e 87 //! Return structure visibility considering both View Affinity and global visibility state.
88 bool IsVisible (const Standard_Integer theViewId) const
89 {
90 return visible != 0
91 && (ViewAffinity.IsNull()
92 || ViewAffinity->IsVisible (theViewId));
93 }
94
a1954302 95 //! Set z layer ID to display the structure in specified layer
96 void SetZLayer (const Graphic3d_ZLayerId theLayerIndex) { myZLayer = theLayerIndex; }
97
98 //! Get z layer ID
99 Graphic3d_ZLayerId ZLayer() const { return myZLayer; }
100
63bcc448 101public:
102
103 //! Update structure visibility state
a1954302 104 virtual void OnVisibilityChanged() = 0;
63bcc448 105
106 //! Clear graphic data
107 virtual void Clear() = 0;
108
109 //! Connect other structure to this one
110 virtual void Connect (Graphic3d_CStructure& theStructure) = 0;
111
112 //! Disconnect other structure to this one
113 virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0;
114
63bcc448 115 //! Highlight entire structure with color
116 virtual void HighlightWithColor (const Graphic3d_Vec3& theColor,
117 const Standard_Boolean theToCreate) = 0;
118
119 //! Highlight structure using boundary box
b64d84be 120 virtual void HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
121 const Standard_Boolean theToCreate) = 0;
63bcc448 122
679ecdee 123 //! Create shadow link to this structure
124 virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const = 0;
125
b64d84be 126 //! Create new group within this structure
127 virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct) = 0;
128
129 //! Remove group from this structure
130 virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup) = 0;
131
63bcc448 132public:
133
a1954302 134 int Id;
135 Graphic3d_ZLayerId myZLayer;
136 int Priority;
137 int PreviousPriority;
bf75be98 138
b6472664 139 Quantity_Color HighlightColor;
bf75be98 140
bf75be98 141 int ContainsFacet;
142
a272ed94 143 Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask
144
b7cd4ba7 145 unsigned IsInfinite : 1;
a1954302 146 unsigned stick : 1; //!< displaying state - should be set when structure has been added to scene graph (but can be in hidden state)
b7cd4ba7 147 unsigned highlight : 1;
a1954302 148 unsigned visible : 1; //!< visibility flag - can be used to suppress structure while leaving it in the scene graph
b7cd4ba7 149 unsigned HLRValidation : 1;
150 unsigned IsForHighlight : 1;
151 unsigned IsMutable : 1;
152 unsigned Is2dText : 1;
bf75be98 153
63bcc448 154protected:
7fd59977 155
63bcc448 156 //! Create empty structure.
157 Standard_EXPORT Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager);
7fd59977 158
63bcc448 159protected:
160
161 Handle(Graphic3d_GraphicDriver) myGraphicDriver;
b64d84be 162 Graphic3d_SequenceOfGroup myGroups;
b7cd4ba7 163 Graphic3d_BndBox4f myBndBox;
1f7f5a90 164 Handle(Geom_Transformation) myTrsf;
778cd667 165 Handle(Graphic3d_TransformPers) myTrsfPers;
3202bf1e 166 Handle(Graphic3d_SequenceOfHClipPlane) myClipPlanes;
63bcc448 167
168public:
169
92efcf78 170 DEFINE_STANDARD_RTTIEXT(Graphic3d_CStructure,Standard_Transient) // Type definition
63bcc448 171
172};
7fd59977 173
494782f6 174DEFINE_STANDARD_HANDLE (Graphic3d_CStructure, Standard_Transient)
175
63bcc448 176#endif // _Graphic3d_CStructure_HeaderFile