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> |
bf75be98 |
27 | |
c04c30b3 |
28 | class Graphic3d_GraphicDriver; |
29 | class Graphic3d_StructureManager; |
63bcc448 |
30 | |
31 | //! Low-level graphic structure interface |
32 | class Graphic3d_CStructure : public Standard_Transient |
bf75be98 |
33 | { |
34 | |
35 | public: |
36 | |
63bcc448 |
37 | //! @return graphic driver created this structure |
38 | const Handle(Graphic3d_GraphicDriver)& GraphicDriver() const |
39 | { |
40 | return myGraphicDriver; |
41 | } |
42 | |
b64d84be |
43 | //! @return graphic groups |
44 | const Graphic3d_SequenceOfGroup& Groups() const |
45 | { |
46 | return myGroups; |
47 | } |
48 | |
63bcc448 |
49 | //! @return associated clip planes |
50 | const Graphic3d_SequenceOfHClipPlane& ClipPlanes() const |
51 | { |
52 | return myClipPlanes; |
53 | } |
54 | |
55 | //! Pass clip planes to the associated graphic driver structure |
56 | void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes) { myClipPlanes = thePlanes; } |
57 | |
b7cd4ba7 |
58 | //! @return bounding box of this presentation |
59 | const Graphic3d_BndBox4f& BoundingBox() const |
60 | { |
61 | return myBndBox; |
62 | } |
63 | |
64 | //! @return bounding box of this presentation |
65 | //! without transformation matrix applied |
66 | Graphic3d_BndBox4f& ChangeBoundingBox() |
67 | { |
68 | return myBndBox; |
69 | } |
70 | |
a1954302 |
71 | //! Return structure visibility flag |
72 | bool IsVisible() const { return visible != 0; } |
73 | |
74 | //! Set z layer ID to display the structure in specified layer |
75 | void SetZLayer (const Graphic3d_ZLayerId theLayerIndex) { myZLayer = theLayerIndex; } |
76 | |
77 | //! Get z layer ID |
78 | Graphic3d_ZLayerId ZLayer() const { return myZLayer; } |
79 | |
63bcc448 |
80 | public: |
81 | |
82 | //! Update structure visibility state |
a1954302 |
83 | virtual void OnVisibilityChanged() = 0; |
63bcc448 |
84 | |
85 | //! Clear graphic data |
86 | virtual void Clear() = 0; |
87 | |
88 | //! Connect other structure to this one |
89 | virtual void Connect (Graphic3d_CStructure& theStructure) = 0; |
90 | |
91 | //! Disconnect other structure to this one |
92 | virtual void Disconnect (Graphic3d_CStructure& theStructure) = 0; |
93 | |
63bcc448 |
94 | //! Synchronize structure transformation |
95 | virtual void UpdateTransformation() = 0; |
bf75be98 |
96 | |
63bcc448 |
97 | //! Highlight entire structure with color |
98 | virtual void HighlightWithColor (const Graphic3d_Vec3& theColor, |
99 | const Standard_Boolean theToCreate) = 0; |
100 | |
101 | //! Highlight structure using boundary box |
b64d84be |
102 | virtual void HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct, |
103 | const Standard_Boolean theToCreate) = 0; |
63bcc448 |
104 | |
679ecdee |
105 | //! Create shadow link to this structure |
106 | virtual Handle(Graphic3d_CStructure) ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const = 0; |
107 | |
b64d84be |
108 | //! Create new group within this structure |
109 | virtual Handle(Graphic3d_Group) NewGroup (const Handle(Graphic3d_Structure)& theStruct) = 0; |
110 | |
111 | //! Remove group from this structure |
112 | virtual void RemoveGroup (const Handle(Graphic3d_Group)& theGroup) = 0; |
113 | |
63bcc448 |
114 | public: |
115 | |
a1954302 |
116 | int Id; |
117 | Graphic3d_ZLayerId myZLayer; |
118 | int Priority; |
119 | int PreviousPriority; |
bf75be98 |
120 | |
b6472664 |
121 | Quantity_Color HighlightColor; |
bf75be98 |
122 | |
6bd94e0d |
123 | Graphic3d_Mat4 Transformation; |
bf75be98 |
124 | |
125 | int ContainsFacet; |
126 | |
a272ed94 |
127 | Handle(Graphic3d_ViewAffinity) ViewAffinity; //!< view affinity mask |
128 | |
b7cd4ba7 |
129 | unsigned IsInfinite : 1; |
a1954302 |
130 | unsigned stick : 1; //!< displaying state - should be set when structure has been added to scene graph (but can be in hidden state) |
b7cd4ba7 |
131 | unsigned highlight : 1; |
a1954302 |
132 | unsigned visible : 1; //!< visibility flag - can be used to suppress structure while leaving it in the scene graph |
b7cd4ba7 |
133 | unsigned HLRValidation : 1; |
134 | unsigned IsForHighlight : 1; |
135 | unsigned IsMutable : 1; |
136 | unsigned Is2dText : 1; |
bf75be98 |
137 | |
825aa485 |
138 | Graphic3d_TransformPers TransformPersistence; |
bf75be98 |
139 | |
63bcc448 |
140 | protected: |
7fd59977 |
141 | |
63bcc448 |
142 | //! Create empty structure. |
143 | Standard_EXPORT Graphic3d_CStructure (const Handle(Graphic3d_StructureManager)& theManager); |
7fd59977 |
144 | |
63bcc448 |
145 | protected: |
146 | |
147 | Handle(Graphic3d_GraphicDriver) myGraphicDriver; |
b64d84be |
148 | Graphic3d_SequenceOfGroup myGroups; |
b7cd4ba7 |
149 | Graphic3d_BndBox4f myBndBox; |
63bcc448 |
150 | Graphic3d_SequenceOfHClipPlane myClipPlanes; |
151 | |
152 | public: |
153 | |
92efcf78 |
154 | DEFINE_STANDARD_RTTIEXT(Graphic3d_CStructure,Standard_Transient) // Type definition |
63bcc448 |
155 | |
156 | }; |
7fd59977 |
157 | |
494782f6 |
158 | DEFINE_STANDARD_HANDLE (Graphic3d_CStructure, Standard_Transient) |
159 | |
63bcc448 |
160 | #endif // _Graphic3d_CStructure_HeaderFile |