42cf5bc1 |
1 | // Created on: 1991-06-12 |
2 | // Created by: NW,JPB,CAL |
3 | // Copyright (c) 1991-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Graphic3d_Structure_HeaderFile |
18 | #define _Graphic3d_Structure_HeaderFile |
19 | |
42cf5bc1 |
20 | #include <Graphic3d_CStructure.hxx> |
42cf5bc1 |
21 | #include <Graphic3d_MapOfStructure.hxx> |
7dd7c146 |
22 | #include <Graphic3d_SequenceOfGroup.hxx> |
23 | #include <Graphic3d_SequenceOfHClipPlane.hxx> |
7dd7c146 |
24 | #include <Graphic3d_TypeOfConnection.hxx> |
25 | #include <Graphic3d_TypeOfStructure.hxx> |
825aa485 |
26 | #include <Graphic3d_TransformPers.hxx> |
7dd7c146 |
27 | #include <Graphic3d_ZLayerId.hxx> |
28 | #include <NCollection_IndexedMap.hxx> |
29 | |
42cf5bc1 |
30 | class Graphic3d_StructureManager; |
42cf5bc1 |
31 | class Graphic3d_DataStructureManager; |
32 | class Bnd_Box; |
42cf5bc1 |
33 | |
25e59720 |
34 | DEFINE_STANDARD_HANDLE(Graphic3d_Structure, Standard_Transient) |
42cf5bc1 |
35 | |
36 | //! This class allows the definition a graphic object. |
7dd7c146 |
37 | //! This graphic structure can be displayed, erased, or highlighted. |
38 | //! This graphic structure can be connected with another graphic structure. |
25e59720 |
39 | class Graphic3d_Structure : public Standard_Transient |
42cf5bc1 |
40 | { |
7dd7c146 |
41 | DEFINE_STANDARD_RTTIEXT(Graphic3d_Structure, Standard_Transient) |
42 | friend class Graphic3d_Group; |
42cf5bc1 |
43 | public: |
44 | |
42cf5bc1 |
45 | //! Creates a graphic object in the manager theManager. |
46 | //! It will appear in all the views of the visualiser. |
42cf5bc1 |
47 | //! The structure is not displayed when it is created. |
7dd7c146 |
48 | //! @param theManager structure manager holding this structure |
49 | //! @param theLinkPrs another structure for creating a shadow (linked) structure |
50 | Standard_EXPORT Graphic3d_Structure (const Handle(Graphic3d_StructureManager)& theManager, |
51 | const Handle(Graphic3d_Structure)& theLinkPrs = Handle(Graphic3d_Structure)()); |
42cf5bc1 |
52 | |
53 | //! if WithDestruction == Standard_True then |
54 | //! suppress all the groups of primitives in the structure. |
55 | //! and it is mandatory to create a new group in <me>. |
56 | //! if WithDestruction == Standard_False then |
57 | //! clears all the groups of primitives in the structure. |
58 | //! and all the groups are conserved and empty. |
59 | //! They will be erased at the next screen update. |
60 | //! The structure itself is conserved. |
61 | //! The transformation and the attributes of <me> are conserved. |
62 | //! The childs of <me> are conserved. |
dad7fede |
63 | virtual void Clear (const Standard_Boolean WithDestruction = Standard_True) |
64 | { |
65 | clear (WithDestruction); |
66 | } |
42cf5bc1 |
67 | |
68 | //! Suppresses the structure <me>. |
69 | //! It will be erased at the next screen update. |
7dd7c146 |
70 | Standard_EXPORT virtual ~Graphic3d_Structure(); |
42cf5bc1 |
71 | |
72 | //! Displays the structure <me> in all the views of the visualiser. |
73 | Standard_EXPORT virtual void Display(); |
7dd7c146 |
74 | |
75 | //! Returns the current display priority for this structure. |
e463b2f6 |
76 | Graphic3d_DisplayPriority DisplayPriority() const { return myCStructure->Priority(); } |
77 | |
78 | //! Modifies the order of displaying the structure. |
79 | //! Values are between 0 and 10. |
80 | //! Structures are drawn according to their display priorities in ascending order. |
81 | //! A structure of priority 10 is displayed the last and appears over the others. |
82 | //! The default value is 5. |
83 | //! Warning: If structure is displayed then the SetDisplayPriority method erases it and displays with the new priority. |
84 | //! Raises Graphic3d_PriorityDefinitionError if Priority is greater than 10 or a negative value. |
85 | Standard_EXPORT void SetDisplayPriority (const Graphic3d_DisplayPriority thePriority); |
86 | |
87 | Standard_DEPRECATED("Deprecated since OCCT7.7, Graphic3d_DisplayPriority should be passed instead of integer number to SetDisplayPriority()") |
88 | void SetDisplayPriority (const Standard_Integer thePriority) { SetDisplayPriority ((Graphic3d_DisplayPriority )thePriority); } |
89 | |
90 | //! Reset the current priority of the structure to the previous priority. |
91 | //! Warning: If structure is displayed then the SetDisplayPriority() method erases it and displays with the previous priority. |
92 | Standard_EXPORT void ResetDisplayPriority(); |
42cf5bc1 |
93 | |
dad7fede |
94 | //! Erases this structure in all the views of the visualiser. |
95 | virtual void Erase() { erase(); } |
42cf5bc1 |
96 | |
8e5fb5ea |
97 | //! Highlights the structure in all the views with the given style |
98 | //! @param theStyle [in] the style (type of highlighting: box/color, color and opacity) |
99 | //! @param theToUpdateMgr [in] defines whether related computed structures will be |
100 | //! highlighted via structure manager or not |
f838dac4 |
101 | Standard_EXPORT void Highlight (const Handle(Graphic3d_PresentationAttributes)& theStyle, const Standard_Boolean theToUpdateMgr = Standard_True); |
42cf5bc1 |
102 | |
103 | //! Suppress the structure <me>. |
104 | //! It will be erased at the next screen update. |
105 | //! Warning: No more graphic operations in <me> after this call. |
106 | //! Category: Methods to modify the class definition |
107 | Standard_EXPORT void Remove(); |
108 | |
109 | //! Computes axis-aligned bounding box of a structure. |
770fa4d4 |
110 | Standard_EXPORT virtual void CalculateBoundBox(); |
42cf5bc1 |
111 | |
7dd7c146 |
112 | //! Sets infinite flag. |
113 | //! When TRUE, the MinMaxValues method returns: |
42cf5bc1 |
114 | //! theXMin = theYMin = theZMin = RealFirst(). |
115 | //! theXMax = theYMax = theZMax = RealLast(). |
7dd7c146 |
116 | //! By default, structure is created not infinite but empty. |
4065c66c |
117 | void SetInfiniteState (const Standard_Boolean theToSet) |
118 | { |
119 | if (!myCStructure.IsNull()) { myCStructure->IsInfinite = theToSet ? 1 : 0; } |
120 | } |
7dd7c146 |
121 | |
42cf5bc1 |
122 | //! Set Z layer ID for the structure. The Z layer mechanism |
123 | //! allows to display structures presented in higher layers in overlay |
124 | //! of structures in lower layers by switching off z buffer depth |
125 | //! test between layers |
126 | Standard_EXPORT void SetZLayer (const Graphic3d_ZLayerId theLayerId); |
127 | |
7dd7c146 |
128 | //! Get Z layer ID of displayed structure. |
129 | //! The method returns -1 if the structure has no ID (deleted from graphic driver). |
130 | Graphic3d_ZLayerId GetZLayer() const { return myCStructure->ZLayer(); } |
42cf5bc1 |
131 | |
132 | //! Changes a sequence of clip planes slicing the structure on rendering. |
133 | //! @param thePlanes [in] the set of clip planes. |
4065c66c |
134 | void SetClipPlanes (const Handle(Graphic3d_SequenceOfHClipPlane)& thePlanes) |
135 | { |
136 | if (!myCStructure.IsNull()) { myCStructure->SetClipPlanes (thePlanes); } |
137 | } |
42cf5bc1 |
138 | |
139 | //! Get clip planes slicing the structure on rendering. |
140 | //! @return set of clip planes. |
7dd7c146 |
141 | const Handle(Graphic3d_SequenceOfHClipPlane)& ClipPlanes() const { return myCStructure->ClipPlanes(); } |
2831708b |
142 | |
42cf5bc1 |
143 | //! Modifies the visibility indicator to Standard_True or |
144 | //! Standard_False for the structure <me>. |
145 | //! The default value at the definition of <me> is |
146 | //! Standard_True. |
147 | Standard_EXPORT void SetVisible (const Standard_Boolean AValue); |
148 | |
149 | //! Modifies the visualisation mode for the structure <me>. |
150 | Standard_EXPORT virtual void SetVisual (const Graphic3d_TypeOfStructure AVisual); |
151 | |
152 | //! Modifies the minimum and maximum zoom coefficients |
153 | //! for the structure <me>. |
154 | //! The default value at the definition of <me> is unlimited. |
155 | //! Category: Methods to modify the class definition |
156 | //! Warning: Raises StructureDefinitionError if <LimitInf> is |
157 | //! greater than <LimitSup> or if <LimitInf> or |
158 | //! <LimitSup> is a negative value. |
159 | Standard_EXPORT void SetZoomLimit (const Standard_Real LimitInf, const Standard_Real LimitSup); |
7dd7c146 |
160 | |
161 | //! Marks the structure <me> representing wired structure needed for highlight only so it won't be added to BVH tree. |
4065c66c |
162 | void SetIsForHighlight (const Standard_Boolean isForHighlight) |
163 | { |
164 | if (!myCStructure.IsNull()) { myCStructure->IsForHighlight = isForHighlight; } |
165 | } |
42cf5bc1 |
166 | |
167 | //! Suppresses the highlight for the structure <me> |
168 | //! in all the views of the visualiser. |
169 | Standard_EXPORT void UnHighlight(); |
170 | |
7dd7c146 |
171 | virtual void Compute() |
172 | { |
173 | // |
174 | } |
7dd7c146 |
175 | |
42cf5bc1 |
176 | //! Returns the new Structure defined for the new visualization |
b5163d2f |
177 | virtual void computeHLR (const Handle(Graphic3d_Camera)& theProjector, |
178 | Handle(Graphic3d_Structure)& theStructure) |
7dd7c146 |
179 | { |
180 | (void )theProjector; |
7dd7c146 |
181 | (void )theStructure; |
182 | } |
1f7f5a90 |
183 | |
42cf5bc1 |
184 | //! Forces a new construction of the structure <me> |
185 | //! if <me> is displayed and TOS_COMPUTED. |
186 | Standard_EXPORT void ReCompute(); |
187 | |
188 | //! Forces a new construction of the structure <me> |
189 | //! if <me> is displayed in <aProjetor> and TOS_COMPUTED. |
190 | Standard_EXPORT void ReCompute (const Handle(Graphic3d_DataStructureManager)& aProjector); |
191 | |
7dd7c146 |
192 | //! Returns the groups sequence included in this structure. |
193 | const Graphic3d_SequenceOfGroup& Groups() const { return myCStructure->Groups(); } |
194 | |
195 | //! Returns the current number of groups in this structure. |
196 | Standard_Integer NumberOfGroups() const { return myCStructure->Groups().Length(); } |
42cf5bc1 |
197 | |
198 | //! Append new group to this structure. |
199 | Standard_EXPORT Handle(Graphic3d_Group) NewGroup(); |
7dd7c146 |
200 | |
201 | //! Returns the last created group or creates new one if list is empty. |
202 | Handle(Graphic3d_Group) CurrentGroup() |
203 | { |
204 | if (Groups().IsEmpty()) |
205 | { |
206 | return NewGroup(); |
207 | } |
208 | return Groups().Last(); |
209 | } |
210 | |
211 | //! Returns the highlight attributes. |
212 | const Handle(Graphic3d_PresentationAttributes)& HighlightStyle() const { return myCStructure->HighlightStyle(); } |
213 | |
214 | //! Returns TRUE if this structure is deleted (after Remove() call). |
215 | Standard_Boolean IsDeleted() const { return myCStructure.IsNull(); } |
42cf5bc1 |
216 | |
7dd7c146 |
217 | //! Returns the display indicator for this structure. |
4065c66c |
218 | virtual Standard_Boolean IsDisplayed() const |
219 | { |
220 | return !myCStructure.IsNull() |
221 | && myCStructure->stick != 0; |
222 | } |
42cf5bc1 |
223 | |
224 | //! Returns Standard_True if the structure <me> is empty. |
225 | //! Warning: A structure is empty if : |
226 | //! it do not have group or all the groups are empties |
227 | //! and it do not have descendant or all the descendants |
228 | //! are empties. |
229 | Standard_EXPORT Standard_Boolean IsEmpty() const; |
230 | |
231 | //! Returns Standard_True if the structure <me> is infinite. |
7dd7c146 |
232 | Standard_Boolean IsInfinite() const |
233 | { |
234 | return IsDeleted() |
235 | || myCStructure->IsInfinite; |
236 | } |
42cf5bc1 |
237 | |
7dd7c146 |
238 | //! Returns the highlight indicator for this structure. |
4065c66c |
239 | virtual Standard_Boolean IsHighlighted() const |
240 | { |
241 | return !myCStructure.IsNull() |
242 | && myCStructure->highlight != 0; |
243 | } |
42cf5bc1 |
244 | |
7dd7c146 |
245 | //! Returns TRUE if the structure is transformed. |
246 | Standard_Boolean IsTransformed() const |
247 | { |
4065c66c |
248 | return !myCStructure.IsNull() |
249 | && !myCStructure->Transformation().IsNull() |
250 | && myCStructure->Transformation()->Form() != gp_Identity; |
7dd7c146 |
251 | } |
42cf5bc1 |
252 | |
7dd7c146 |
253 | //! Returns the visibility indicator for this structure. |
4065c66c |
254 | Standard_Boolean IsVisible() const |
255 | { |
256 | return !myCStructure.IsNull() |
257 | && myCStructure->visible != 0; |
258 | } |
2831708b |
259 | |
42cf5bc1 |
260 | //! Returns the coordinates of the boundary box of the structure <me>. |
261 | //! If <theToIgnoreInfiniteFlag> is TRUE, the method returns actual graphical |
262 | //! boundaries of the Graphic3d_Group components. Otherwise, the |
263 | //! method returns boundaries taking into account infinite state |
264 | //! of the structure. This approach generally used for application |
265 | //! specific fit operation (e.g. fitting the model into screen, |
54adc5e9 |
266 | //! not taking into account infinite helper elements). |
42cf5bc1 |
267 | //! Warning: If the structure <me> is empty then the empty box is returned, |
268 | //! If the structure <me> is infinite then the whole box is returned. |
269 | Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const; |
2831708b |
270 | |
42cf5bc1 |
271 | //! Returns the visualisation mode for the structure <me>. |
7dd7c146 |
272 | Graphic3d_TypeOfStructure Visual() const { return myVisual; } |
42cf5bc1 |
273 | |
274 | //! Returns Standard_True if the connection is possible between |
275 | //! <AStructure1> and <AStructure2> without a creation |
276 | //! of a cycle. |
277 | //! |
278 | //! It's not possible to call the method |
279 | //! AStructure1->Connect (AStructure2, TypeOfConnection) |
280 | //! if |
281 | //! - the set of all ancestors of <AStructure1> contains |
282 | //! <AStructure1> and if the |
283 | //! TypeOfConnection == TOC_DESCENDANT |
284 | //! - the set of all descendants of <AStructure1> contains |
285 | //! <AStructure2> and if the |
286 | //! TypeOfConnection == TOC_ANCESTOR |
7dd7c146 |
287 | Standard_EXPORT static Standard_Boolean AcceptConnection (Graphic3d_Structure* theStructure1, |
288 | Graphic3d_Structure* theStructure2, |
289 | Graphic3d_TypeOfConnection theType); |
42cf5bc1 |
290 | |
291 | //! Returns the group of structures to which <me> is connected. |
292 | Standard_EXPORT void Ancestors (Graphic3d_MapOfStructure& SG) const; |
293 | |
294 | //! If Atype is TOC_DESCENDANT then add <AStructure> |
295 | //! as a child structure of <me>. |
296 | //! If Atype is TOC_ANCESTOR then add <AStructure> |
297 | //! as a parent structure of <me>. |
298 | //! The connection propagates Display, Highlight, Erase, |
299 | //! Remove, and stacks the transformations. |
300 | //! No connection if the graph of the structures |
301 | //! contains a cycle and <WithCheck> is Standard_True; |
7dd7c146 |
302 | Standard_EXPORT void Connect (Graphic3d_Structure* theStructure, |
303 | Graphic3d_TypeOfConnection theType, |
304 | Standard_Boolean theWithCheck = Standard_False); |
305 | |
306 | Standard_DEPRECATED("Deprecated short-cut") |
307 | void Connect (const Handle(Graphic3d_Structure)& thePrs) |
308 | { |
309 | Connect (thePrs.get(), Graphic3d_TOC_DESCENDANT); |
310 | } |
42cf5bc1 |
311 | |
312 | //! Returns the group of structures connected to <me>. |
313 | Standard_EXPORT void Descendants (Graphic3d_MapOfStructure& SG) const; |
314 | |
315 | //! Suppress the connection between <AStructure> and <me>. |
7dd7c146 |
316 | Standard_EXPORT void Disconnect (Graphic3d_Structure* theStructure); |
317 | |
318 | Standard_DEPRECATED("Deprecated alias for Disconnect()") |
319 | void Remove (const Handle(Graphic3d_Structure)& thePrs) { Disconnect (thePrs.get()); } |
42cf5bc1 |
320 | |
321 | //! If Atype is TOC_DESCENDANT then suppress all |
322 | //! the connections with the child structures of <me>. |
323 | //! If Atype is TOC_ANCESTOR then suppress all |
324 | //! the connections with the parent structures of <me>. |
325 | Standard_EXPORT void DisconnectAll (const Graphic3d_TypeOfConnection AType); |
7dd7c146 |
326 | |
327 | Standard_DEPRECATED("Deprecated alias for DisconnectAll()") |
328 | void RemoveAll() { DisconnectAll (Graphic3d_TOC_DESCENDANT); } |
42cf5bc1 |
329 | |
330 | //! Returns <ASet> the group of structures : |
331 | //! - directly or indirectly connected to <AStructure> if the |
332 | //! TypeOfConnection == TOC_DESCENDANT |
333 | //! - to which <AStructure> is directly or indirectly connected |
334 | //! if the TypeOfConnection == TOC_ANCESTOR |
7dd7c146 |
335 | Standard_EXPORT static void Network (Graphic3d_Structure* theStructure, |
336 | const Graphic3d_TypeOfConnection theType, |
337 | NCollection_Map<Graphic3d_Structure*>& theSet); |
42cf5bc1 |
338 | |
7dd7c146 |
339 | void SetOwner (const Standard_Address theOwner) { myOwner = theOwner; } |
42cf5bc1 |
340 | |
7dd7c146 |
341 | Standard_Address Owner() const { return myOwner; } |
42cf5bc1 |
342 | |
4065c66c |
343 | void SetHLRValidation (const Standard_Boolean theFlag) |
344 | { |
345 | if (!myCStructure.IsNull()) { myCStructure->HLRValidation = theFlag ? 1 : 0; } |
346 | } |
7dd7c146 |
347 | |
348 | //! Hidden parts stored in this structure are valid if: |
349 | //! 1) the owner is defined. |
350 | //! 2) they are not invalid. |
351 | Standard_Boolean HLRValidation() const |
352 | { |
353 | return myOwner != NULL |
354 | && myCStructure->HLRValidation != 0; |
355 | } |
6bd94e0d |
356 | |
1f7f5a90 |
357 | //! Return local transformation. |
7f24b768 |
358 | const Handle(TopLoc_Datum3D)& Transformation() const { return myCStructure->Transformation(); } |
1f7f5a90 |
359 | |
360 | //! Modifies the current local transformation |
7f24b768 |
361 | Standard_EXPORT void SetTransformation (const Handle(TopLoc_Datum3D)& theTrsf); |
1f7f5a90 |
362 | |
778cd667 |
363 | //! Modifies the current transform persistence (pan, zoom or rotate) |
364 | Standard_EXPORT void SetTransformPersistence (const Handle(Graphic3d_TransformPers)& theTrsfPers); |
825aa485 |
365 | |
366 | //! @return transform persistence of the presentable object. |
778cd667 |
367 | const Handle(Graphic3d_TransformPers)& TransformPersistence() const { return myCStructure->TransformPersistence(); } |
825aa485 |
368 | |
42cf5bc1 |
369 | //! Sets if the structure location has mutable nature (content or location will be changed regularly). |
4065c66c |
370 | void SetMutable (const Standard_Boolean theIsMutable) |
371 | { |
372 | if (!myCStructure.IsNull()) { myCStructure->IsMutable = theIsMutable; } |
373 | } |
374 | |
42cf5bc1 |
375 | //! Returns true if structure has mutable nature (content or location are be changed regularly). |
376 | //! Mutable structure will be managed in different way than static onces. |
4065c66c |
377 | Standard_Boolean IsMutable() const |
378 | { |
379 | return !myCStructure.IsNull() |
380 | && myCStructure->IsMutable; |
381 | } |
382 | |
7dd7c146 |
383 | Graphic3d_TypeOfStructure ComputeVisual() const { return myComputeVisual; } |
4065c66c |
384 | |
42cf5bc1 |
385 | //! Clears the structure <me>. |
386 | Standard_EXPORT void GraphicClear (const Standard_Boolean WithDestruction); |
4065c66c |
387 | |
388 | void GraphicConnect (const Handle(Graphic3d_Structure)& theDaughter) |
389 | { |
390 | if (!myCStructure.IsNull()) { myCStructure->Connect (*theDaughter->myCStructure); } |
391 | } |
392 | |
393 | void GraphicDisconnect (const Handle(Graphic3d_Structure)& theDaughter) |
394 | { |
395 | if (!myCStructure.IsNull()) { myCStructure->Disconnect (*theDaughter->myCStructure); } |
396 | } |
8e5fb5ea |
397 | |
1f7f5a90 |
398 | //! Internal method which sets new transformation without calling graphic manager callbacks. |
4065c66c |
399 | void GraphicTransform (const Handle(TopLoc_Datum3D)& theTrsf) |
400 | { |
401 | if (!myCStructure.IsNull()) { myCStructure->SetTransformation (theTrsf); } |
402 | } |
8e5fb5ea |
403 | |
7dd7c146 |
404 | //! Returns the identification number of this structure. |
e463b2f6 |
405 | Standard_Integer Identification() const { return myCStructure->Identification(); } |
42cf5bc1 |
406 | |
21c7c457 |
407 | //! Prints information about the network associated |
42cf5bc1 |
408 | //! with the structure <AStructure>. |
409 | Standard_EXPORT static void PrintNetwork (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType); |
410 | |
7dd7c146 |
411 | //! Suppress the structure in the list of descendants or in the list of ancestors. |
412 | Standard_EXPORT void Remove (Graphic3d_Structure* thePtr, |
413 | const Graphic3d_TypeOfConnection theType); |
42cf5bc1 |
414 | |
7dd7c146 |
415 | void SetComputeVisual (const Graphic3d_TypeOfStructure theVisual) |
416 | { |
417 | // The ComputeVisual is saved only if the structure is declared TOS_ALL, TOS_WIREFRAME or TOS_SHADING. |
418 | // This declaration permits to calculate proper representation of the structure calculated by Compute instead of passage to TOS_COMPUTED. |
419 | if (theVisual != Graphic3d_TOS_COMPUTED) |
420 | { |
421 | myComputeVisual = theVisual; |
422 | } |
423 | } |
42cf5bc1 |
424 | |
1f7f5a90 |
425 | //! Transforms theX, theY, theZ with the transformation theTrsf. |
426 | Standard_EXPORT static void Transforms (const gp_Trsf& theTrsf, |
427 | const Standard_Real theX, const Standard_Real theY, const Standard_Real theZ, |
428 | Standard_Real& theNewX, Standard_Real& theNewY, Standard_Real& theNewZ); |
429 | |
42cf5bc1 |
430 | //! Returns the low-level structure |
778cd667 |
431 | const Handle(Graphic3d_CStructure)& CStructure() const { return myCStructure; } |
42cf5bc1 |
432 | |
bc73b006 |
433 | //! Dumps the content of me into the stream |
434 | Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const; |
435 | |
42cf5bc1 |
436 | protected: |
437 | |
42cf5bc1 |
438 | //! Transforms boundaries with <theTrsf> transformation. |
1f7f5a90 |
439 | Standard_EXPORT static void TransformBoundaries (const gp_Trsf& theTrsf, |
440 | Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin, |
441 | Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax); |
442 | |
42cf5bc1 |
443 | //! Appends new descendant structure. |
7dd7c146 |
444 | Standard_EXPORT Standard_Boolean AppendDescendant (Graphic3d_Structure* theDescendant); |
42cf5bc1 |
445 | |
446 | //! Removes the given descendant structure. |
7dd7c146 |
447 | Standard_EXPORT Standard_Boolean RemoveDescendant (Graphic3d_Structure* theDescendant); |
42cf5bc1 |
448 | |
449 | //! Appends new ancestor structure. |
7dd7c146 |
450 | Standard_EXPORT Standard_Boolean AppendAncestor (Graphic3d_Structure* theAncestor); |
42cf5bc1 |
451 | |
452 | //! Removes the given ancestor structure. |
7dd7c146 |
453 | Standard_EXPORT Standard_Boolean RemoveAncestor (Graphic3d_Structure* theAncestor); |
42cf5bc1 |
454 | |
dad7fede |
455 | //! Clears all the groups of primitives in the structure. |
456 | Standard_EXPORT void clear (const Standard_Boolean WithDestruction); |
457 | |
458 | //! Erases this structure in all the views of the visualiser. |
459 | Standard_EXPORT void erase(); |
460 | |
42cf5bc1 |
461 | private: |
462 | |
42cf5bc1 |
463 | //! Suppress in the structure <me>, the group theGroup. |
464 | //! It will be erased at the next screen update. |
465 | Standard_EXPORT void Remove (const Handle(Graphic3d_Group)& theGroup); |
466 | |
42cf5bc1 |
467 | //! Returns the extreme coordinates found in the structure <me> without transformation applied. |
468 | Standard_EXPORT Graphic3d_BndBox4f minMaxCoord() const; |
469 | |
470 | //! Gets untransformed bounding box from structure. |
7c3ef2f7 |
471 | Standard_EXPORT void getBox (Graphic3d_BndBox3d& theBox, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const; |
42cf5bc1 |
472 | |
473 | //! Adds transformed (with myCStructure->Transformation) bounding box of structure to theBox. |
7c3ef2f7 |
474 | Standard_EXPORT void addTransformed (Graphic3d_BndBox3d& theBox, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const; |
42cf5bc1 |
475 | |
476 | //! Returns the manager to which <me> is associated. |
477 | Standard_EXPORT Handle(Graphic3d_StructureManager) StructureManager() const; |
478 | |
50d06d8f |
479 | //! Calls the Update method of the StructureManager which contains the Structure <me>. |
480 | //! If theUpdateLayer is true then invalidates bounding box of ZLayer. |
481 | Standard_EXPORT void Update (const bool theUpdateLayer = false) const; |
2831708b |
482 | |
483 | protected: |
42cf5bc1 |
484 | |
7dd7c146 |
485 | Graphic3d_StructureManager* myStructureManager; |
486 | Handle(Graphic3d_CStructure) myCStructure; |
487 | NCollection_IndexedMap<Graphic3d_Structure*> myAncestors; |
488 | NCollection_IndexedMap<Graphic3d_Structure*> myDescendants; |
489 | Standard_Address myOwner; |
490 | Graphic3d_TypeOfStructure myVisual; |
491 | Graphic3d_TypeOfStructure myComputeVisual; |
42cf5bc1 |
492 | |
42cf5bc1 |
493 | }; |
494 | |
42cf5bc1 |
495 | #endif // _Graphic3d_Structure_HeaderFile |