0027067: Avoid use of virtual methods for implementation of destructors in legacy...
[occt.git] / src / Graphic3d / Graphic3d_Structure.hxx
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
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Graphic3d_CStructure.hxx>
24 #include <Graphic3d_IndexedMapOfAddress.hxx>
25 #include <Quantity_Color.hxx>
26 #include <Aspect_TypeOfHighlightMethod.hxx>
27 #include <Graphic3d_StructureManagerPtr.hxx>
28 #include <Standard_Address.hxx>
29 #include <Graphic3d_TypeOfStructure.hxx>
30 #include <MMgt_TShared.hxx>
31 #include <Standard_Boolean.hxx>
32 #include <Standard_Integer.hxx>
33 #include <Graphic3d_ZLayerId.hxx>
34 #include <Graphic3d_SequenceOfHClipPlane.hxx>
35 #include <Standard_Real.hxx>
36 #include <TColStd_Array2OfReal.hxx>
37 #include <Graphic3d_SequenceOfGroup.hxx>
38 #include <Graphic3d_TypeOfConnection.hxx>
39 #include <Graphic3d_MapOfStructure.hxx>
40 #include <Graphic3d_TypeOfComposition.hxx>
41 #include <Graphic3d_TransformPers.hxx>
42 #include <Graphic3d_TransModeFlags.hxx>
43 #include <Graphic3d_BndBox4f.hxx>
44 #include <Graphic3d_BndBox4d.hxx>
45 #include <Graphic3d_Vertex.hxx>
46 class Graphic3d_PriorityDefinitionError;
47 class Graphic3d_StructureDefinitionError;
48 class Graphic3d_TransformError;
49 class Graphic3d_Group;
50 class Graphic3d_StructureManager;
51 class Quantity_Color;
52 class Graphic3d_AspectLine3d;
53 class Graphic3d_AspectFillArea3d;
54 class Graphic3d_AspectText3d;
55 class Graphic3d_AspectMarker3d;
56 class Graphic3d_DataStructureManager;
57 class Bnd_Box;
58 class gp_Pnt;
59 class Graphic3d_Vector;
60
61
62 class Graphic3d_Structure;
63 DEFINE_STANDARD_HANDLE(Graphic3d_Structure, MMgt_TShared)
64
65 //! This class allows the definition a graphic object.
66 //! This graphic structure can be displayed,
67 //! erased, or highlighted.
68 //! This graphic structure can be connected with
69 //! another graphic structure.
70 //! Keywords: Structure, StructureManager, Display, Erase, Highlight,
71 //! UnHighlight, Visible, Priority, Selectable, Visible,
72 //! Visual, Connection, Ancestors, Descendants, Transformation
73 class Graphic3d_Structure : public MMgt_TShared
74 {
75
76 public:
77
78   
79   //! Creates a graphic object in the manager theManager.
80   //! It will appear in all the views of the visualiser.
81   //! Warning: The default values AspectLine, AspectFillArea, AspectText and AspectMarker are NOT applied to the structure.
82   //! The structure is not displayed when it is created.
83   Standard_EXPORT Graphic3d_Structure(const Handle(Graphic3d_StructureManager)& theManager);
84   
85   //! Creates a shadow link to existing graphic object.
86   Standard_EXPORT Graphic3d_Structure(const Handle(Graphic3d_StructureManager)& theManager, const Handle(Graphic3d_Structure)& thePrs);
87   
88   //! if WithDestruction == Standard_True then
89   //! suppress all the groups of primitives in the structure.
90   //! and it is mandatory to create a new group in <me>.
91   //! if WithDestruction == Standard_False then
92   //! clears all the groups of primitives in the structure.
93   //! and all the groups are conserved and empty.
94   //! They will be erased at the next screen update.
95   //! The structure itself is conserved.
96   //! The transformation and the attributes of <me> are conserved.
97   //! The childs of <me> are conserved.
98   Standard_EXPORT virtual void Clear (const Standard_Boolean WithDestruction = Standard_True);
99   
100   //! Suppresses the structure <me>.
101   //! It will be erased at the next screen update.
102   Standard_EXPORT ~Graphic3d_Structure();
103   
104   //! Displays the structure <me> in all the views of the visualiser.
105   Standard_EXPORT virtual void Display();
106   
107   //! Returns the current display priority for the
108   //! structure <me>.
109   Standard_EXPORT Standard_Integer DisplayPriority() const;
110   
111   //! Erases the structure <me> in all the views
112   //! of the visualiser.
113   Standard_EXPORT virtual void Erase();
114   
115   //! Highlights the structure <me> in all the views of the visualiser, using the following methods:
116   //! TOHM_COLOR    = drawn in the highlight color
117   //! TOHM_BOUNDBOX = enclosed by the boundary box
118   Standard_EXPORT void Highlight (const Aspect_TypeOfHighlightMethod theMethod, const Quantity_Color& theColor, const Standard_Boolean theToUpdateMgr = Standard_True);
119   
120   //! Suppress the structure <me>.
121   //! It will be erased at the next screen update.
122   //! Warning: No more graphic operations in <me> after this call.
123   //! Category: Methods to modify the class definition
124   Standard_EXPORT void Remove();
125   
126   //! Computes axis-aligned bounding box of a structure.
127   //! Category: Methods to modify the class definition
128   Standard_EXPORT void CalculateBoundBox();
129   
130   //! If <theToSet> is Standard_True then <me> is infinite and
131   //! the MinMaxValues method method return :
132   //! theXMin = theYMin = theZMin = RealFirst().
133   //! theXMax = theYMax = theZMax = RealLast().
134   //! By default, <me> is not infinite but empty.
135   Standard_EXPORT void SetInfiniteState (const Standard_Boolean theToSet);
136   
137   //! Modifies the order of displaying the structure.
138   //! Values are between 0 and 10.
139   //! Structures are drawn according to their display priorities
140   //! in ascending order.
141   //! A structure of priority 10 is displayed the last and appears over the others.
142   //! The default value is 5.
143   //! Category: Methods to modify the class definition
144   //! Warning: If <me> is displayed then the SetDisplayPriority
145   //! method erase <me> and display <me> with the
146   //! new priority.
147   //! Raises PriorityDefinitionError if <Priority> is
148   //! greater than 10 or a negative value.
149   Standard_EXPORT void SetDisplayPriority (const Standard_Integer Priority);
150   
151   //! Reset the current priority of the structure to the
152   //! previous priority.
153   //! Category: Methods to modify the class definition
154   //! Warning: If <me> is displayed then the SetDisplayPriority
155   //! method erase <me> and display <me> with the
156   //! previous priority.
157   Standard_EXPORT void ResetDisplayPriority();
158   
159   //! Set Z layer ID for the structure. The Z layer mechanism
160   //! allows to display structures presented in higher layers in overlay
161   //! of structures in lower layers by switching off z buffer depth
162   //! test between layers
163   Standard_EXPORT void SetZLayer (const Graphic3d_ZLayerId theLayerId);
164   
165   //! Get Z layer ID of displayed structure. The method
166   //! returns -1 if the structure has no ID (deleted from graphic driver).
167   Standard_EXPORT Graphic3d_ZLayerId GetZLayer() const;
168   
169   //! Changes a sequence of clip planes slicing the structure on rendering.
170   //! @param thePlanes [in] the set of clip planes.
171   Standard_EXPORT void SetClipPlanes (const Graphic3d_SequenceOfHClipPlane& thePlanes);
172   
173   //! Get clip planes slicing the structure on rendering.
174   //! @return set of clip planes.
175   Standard_EXPORT const Graphic3d_SequenceOfHClipPlane& GetClipPlanes() const;
176   
177   //! Modifies the default attributes for lines
178   //! in the structure <me>.
179   Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectLine3d)& CTX);
180   
181   //! Modifies the default attributes for faces
182   //! in the structure <me>.
183   Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectFillArea3d)& CTX);
184   
185   //! Modifies the default attributes for text
186   //! in the structure <me>.
187   Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectText3d)& CTX);
188   
189   //! Modifies the default attributes for markers
190   //! in the structure <me>.
191   Standard_EXPORT void SetPrimitivesAspect (const Handle(Graphic3d_AspectMarker3d)& CTX);
192   
193   //! Modifies the visibility indicator to Standard_True or
194   //! Standard_False for the structure <me>.
195   //! The default value at the definition of <me> is
196   //! Standard_True.
197   Standard_EXPORT void SetVisible (const Standard_Boolean AValue);
198   
199   //! Modifies the visualisation mode for the structure <me>.
200   Standard_EXPORT virtual void SetVisual (const Graphic3d_TypeOfStructure AVisual);
201   
202   //! Modifies the minimum and maximum zoom coefficients
203   //! for the structure <me>.
204   //! The default value at the definition of <me> is unlimited.
205   //! Category: Methods to modify the class definition
206   //! Warning: Raises StructureDefinitionError if <LimitInf> is
207   //! greater than <LimitSup> or if <LimitInf> or
208   //! <LimitSup> is a negative value.
209   Standard_EXPORT void SetZoomLimit (const Standard_Real LimitInf, const Standard_Real LimitSup);
210   
211   //! marks the structure <me> representing wired structure needed for
212   //! highlight only so it won't be added to BVH tree.
213   //! Category: Methods to modify the class definition
214   Standard_EXPORT void SetIsForHighlight (const Standard_Boolean isForHighlight);
215   
216   //! Suppresses the highlight for the structure <me>
217   //! in all the views of the visualiser.
218   Standard_EXPORT void UnHighlight();
219   
220   Standard_EXPORT virtual void Compute();
221   
222   //! Returns the new Structure defined for the new visualization
223   Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector);
224   
225   //! Returns the new Structure defined for the new visualization
226   Standard_EXPORT virtual Handle(Graphic3d_Structure) Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, const TColStd_Array2OfReal& AMatrix);
227   
228   //! Returns the new Structure defined for the new visualization
229   Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, Handle(Graphic3d_Structure)& aStructure);
230   
231   //! Returns the new Structure defined for the new visualization
232   Standard_EXPORT virtual void Compute (const Handle(Graphic3d_DataStructureManager)& aProjector, const TColStd_Array2OfReal& AMatrix, Handle(Graphic3d_Structure)& aStructure);
233   
234   //! Forces a new construction of the structure <me>
235   //! if <me> is displayed and TOS_COMPUTED.
236   Standard_EXPORT void ReCompute();
237   
238   //! Forces a new construction of the structure <me>
239   //! if <me> is displayed in <aProjetor> and TOS_COMPUTED.
240   Standard_EXPORT void ReCompute (const Handle(Graphic3d_DataStructureManager)& aProjector);
241   
242   //! Returns Standard_True if the structure <me> contains
243   //! Polygons, Triangles or Quadrangles.
244   Standard_EXPORT Standard_Boolean ContainsFacet() const;
245   
246   //! Returns the values of the current default attributes.
247   Standard_EXPORT Handle(Graphic3d_AspectFillArea3d) FillArea3dAspect() const;
248   
249   //! Returns the groups sequence included in the structure <me> (internal storage).
250   Standard_EXPORT const Graphic3d_SequenceOfGroup& Groups() const;
251   
252   //! Returns the current number of groups in the
253   //! structure <me>.
254   Standard_EXPORT Standard_Integer NumberOfGroups() const;
255   
256   //! Append new group to this structure.
257   Standard_EXPORT Handle(Graphic3d_Group) NewGroup();
258   
259   //! Returns the highlight color for the Highlight method
260   //! with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
261   Standard_EXPORT const Quantity_Color& HighlightColor() const;
262   
263   //! Returns Standard_True if the structure <me> is deleted.
264   //! <me> is deleted after the call Remove (me).
265   Standard_EXPORT Standard_Boolean IsDeleted() const;
266   
267   //! Returns the display indicator for the structure <me>.
268   Standard_EXPORT virtual Standard_Boolean IsDisplayed() const;
269   
270   //! Returns Standard_True if the structure <me> is empty.
271   //! Warning: A structure is empty if :
272   //! it do not have group or all the groups are empties
273   //! and it do not have descendant or all the descendants
274   //! are empties.
275   Standard_EXPORT Standard_Boolean IsEmpty() const;
276   
277   //! Returns Standard_True if the structure <me> is infinite.
278   Standard_EXPORT Standard_Boolean IsInfinite() const;
279   
280   //! Returns the highlight indicator for the structure <me>.
281   Standard_EXPORT virtual Standard_Boolean IsHighlighted() const;
282   
283   //! Returns Standard_True if the structure <me> is transformed.
284   //! <=> The transformation != Identity.
285   Standard_EXPORT Standard_Boolean IsTransformed() const;
286   
287   //! Returns the visibility indicator for the structure <me>.
288   Standard_EXPORT Standard_Boolean IsVisible() const;
289   
290   //! Returns the values of the current default attributes.
291   Standard_EXPORT Handle(Graphic3d_AspectLine3d) Line3dAspect() const;
292   
293   //! Returns the current group of graphic attributes used
294   //! for 3d marker primitives.
295   Standard_EXPORT Handle(Graphic3d_AspectMarker3d) Marker3dAspect() const;
296   
297   //! Returns the coordinates of the boundary box of the structure <me>.
298   //! If <theToIgnoreInfiniteFlag> is TRUE, the method returns actual graphical
299   //! boundaries of the Graphic3d_Group components. Otherwise, the
300   //! method returns boundaries taking into account infinite state
301   //! of the structure. This approach generally used for application
302   //! specific fit operation (e.g. fitting the model into screen,
303   //! not taking into accout infinite helper elements).
304   //! Warning: If the structure <me> is empty then the empty box is returned,
305   //! If the structure <me> is infinite then the whole box is returned.
306   Standard_EXPORT Bnd_Box MinMaxValues (const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
307   
308   //! Returns the current values of the default attributes.
309   Standard_EXPORT void PrimitivesAspect (Handle(Graphic3d_AspectLine3d)& CTXL, Handle(Graphic3d_AspectText3d)& CTXT, Handle(Graphic3d_AspectMarker3d)& CTXM, Handle(Graphic3d_AspectFillArea3d)& CTXF) const;
310   
311   //! Returns the values of the current default attributes.
312   Standard_EXPORT Handle(Graphic3d_AspectText3d) Text3dAspect() const;
313   
314   //! Returns the visualisation mode for the structure <me>.
315   Standard_EXPORT Graphic3d_TypeOfStructure Visual() const;
316   
317   //! Returns Standard_True if the connection is possible between
318   //! <AStructure1> and <AStructure2> without a creation
319   //! of a cycle.
320   //!
321   //! It's not possible to call the method
322   //! AStructure1->Connect (AStructure2, TypeOfConnection)
323   //! if
324   //! - the set of all ancestors of <AStructure1> contains
325   //! <AStructure1> and if the
326   //! TypeOfConnection == TOC_DESCENDANT
327   //! - the set of all descendants of <AStructure1> contains
328   //! <AStructure2> and if the
329   //! TypeOfConnection == TOC_ANCESTOR
330   Standard_EXPORT static Standard_Boolean AcceptConnection (const Handle(Graphic3d_Structure)& AStructure1, const Handle(Graphic3d_Structure)& AStructure2, const Graphic3d_TypeOfConnection AType);
331   
332   //! Returns the group of structures to which <me> is connected.
333   Standard_EXPORT void Ancestors (Graphic3d_MapOfStructure& SG) const;
334   
335   //! If Atype is TOC_DESCENDANT then add <AStructure>
336   //! as a child structure of  <me>.
337   //! If Atype is TOC_ANCESTOR then add <AStructure>
338   //! as a parent structure of <me>.
339   //! The connection propagates Display, Highlight, Erase,
340   //! Remove, and stacks the transformations.
341   //! No connection if the graph of the structures
342   //! contains a cycle and <WithCheck> is Standard_True;
343   Standard_EXPORT void Connect (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType, const Standard_Boolean WithCheck = Standard_False);
344   
345   //! Returns the group of structures connected to <me>.
346   Standard_EXPORT void Descendants (Graphic3d_MapOfStructure& SG) const;
347   
348   //! Suppress the connection between <AStructure> and <me>.
349   Standard_EXPORT void Disconnect (const Handle(Graphic3d_Structure)& AStructure);
350   
351   //! If Atype is TOC_DESCENDANT then suppress all
352   //! the connections with the child structures of <me>.
353   //! If Atype is TOC_ANCESTOR then suppress all
354   //! the connections with the parent structures of <me>.
355   Standard_EXPORT void DisconnectAll (const Graphic3d_TypeOfConnection AType);
356   
357   //! Returns <ASet> the group of structures :
358   //! - directly or indirectly connected to <AStructure> if the
359   //! TypeOfConnection == TOC_DESCENDANT
360   //! - to which <AStructure> is directly or indirectly connected
361   //! if the TypeOfConnection == TOC_ANCESTOR
362   Standard_EXPORT static void Network (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType, Graphic3d_MapOfStructure& ASet);
363   
364   Standard_EXPORT void SetOwner (const Standard_Address Owner);
365   
366   Standard_EXPORT Standard_Address Owner() const;
367   
368   Standard_EXPORT void SetHLRValidation (const Standard_Boolean AFlag);
369   
370   Standard_EXPORT Standard_Boolean HLRValidation() const;
371
372   //! Modifies the current local modelling transformation
373   //! in the structure <me>.
374   //!
375   //! It is defined as a 4*4 real matrix.
376   //!
377   //! -------------------
378   //! | a11 a12 a13  t1 |
379   //! | a21 a22 a23  t2 |
380   //! | a31 a32 a33  t3 |
381   //! |  0   0   0   1  |
382   //! -------------------
383   //!
384   //! TypeOfComposition : TOC_REPLACE
385   //! TOC_POSTCONCATENATE
386   //!
387   //! Then the modified Local Modelling Transformation is composed
388   //! with the current Global Modelling Transformation to create a
389   //! new Composite Modelling Transformation.
390   //!
391   //! The compose type specifies the role of the current local
392   //! modelling transformation (L) in composing the new value for
393   //! the current local modelling transformation (L'), which is
394   //! then combined with the current global modelling transforma-
395   //! tion (G) to calculate the new composite modelling transfor-
396   //! mation (C).
397   //!
398   //! TOC_REPLACE
399   //! The transformation matrix (T) replaces the value of
400   //! current local modelling transformation (L).
401   //!
402   //! L' <- T
403   //! C <- G x L'
404   //!
405   //! TOC_POSTCONCATENATE
406   //! The current local modelling transformation (L) is multiplied
407   //! by the transformation matrix (T):
408   //!
409   //! L' <- T x L
410   //! C <- G x L'
411   //!
412   //! Category: Methods to manage the structure transformation
413   //! Warning: Raises TransformError if the matrix is not a 4x4 matrix.
414   Standard_EXPORT void SetTransform (const TColStd_Array2OfReal& AMatrix, const Graphic3d_TypeOfComposition AType);
415   
416   //! Returns the transformation associated with
417   //! the structure <me>.
418   Standard_EXPORT void Transform (TColStd_Array2OfReal& AMatrix) const;
419   
420   //! Modifies the current modelling transform persistence (pan, zoom or rotate)
421   Standard_EXPORT void SetTransformPersistence (const Graphic3d_TransModeFlags& AFlag, const gp_Pnt& APoint);
422   
423   Standard_EXPORT void SetTransformPersistence (const Graphic3d_TransModeFlags& AFlag);
424   
425   //! Get the current modelling transform persistence (pan, zoom or rotate)
426   Standard_EXPORT Graphic3d_TransModeFlags TransformPersistenceMode() const;
427   
428   //! Get the current point of relative modelling transform persistence
429   Standard_EXPORT gp_Pnt TransformPersistencePoint() const;
430
431   //! @return transform persistence of the presentable object.
432   const Graphic3d_TransformPers& TransformPersistence() const;
433
434   //! Sets if the structure location has mutable nature (content or location will be changed regularly).
435   Standard_EXPORT void SetMutable (const Standard_Boolean theIsMutable);
436   
437   //! Returns true if structure has mutable nature (content or location are be changed regularly).
438   //! Mutable structure will be managed in different way than static onces.
439   Standard_EXPORT Standard_Boolean IsMutable() const;
440   
441   Standard_EXPORT Graphic3d_TypeOfStructure ComputeVisual() const;
442   
443   //! Clears the structure <me>.
444   Standard_EXPORT void GraphicClear (const Standard_Boolean WithDestruction);
445   
446   Standard_EXPORT void GraphicConnect (const Handle(Graphic3d_Structure)& ADaughter);
447   
448   Standard_EXPORT void GraphicDisconnect (const Handle(Graphic3d_Structure)& ADaughter);
449   
450   //! Highlights the structure <me>.
451   Standard_EXPORT void GraphicHighlight (const Aspect_TypeOfHighlightMethod Method);
452   
453   Standard_EXPORT void GraphicTransform (const TColStd_Array2OfReal& AMatrix);
454   
455   //! Suppress the highlight for the structure <me>.
456   Standard_EXPORT void GraphicUnHighlight();
457   
458   //! Returns the identification number of the structure <me>.
459   Standard_EXPORT Standard_Integer Identification() const;
460   
461   //! Prints informations about the network associated
462   //! with the structure <AStructure>.
463   Standard_EXPORT static void PrintNetwork (const Handle(Graphic3d_Structure)& AStructure, const Graphic3d_TypeOfConnection AType);
464   
465   //! Suppress the adress <APtr> in the list
466   //! of descendants or in the list of ancestors.
467   Standard_EXPORT void Remove (const Standard_Address APtr, const Graphic3d_TypeOfConnection AType);
468   
469   Standard_EXPORT void SetComputeVisual (const Graphic3d_TypeOfStructure AVisual);
470   
471   //! Transforms <X>, <Y>, <Z> with the transformation <ATrsf>.
472   Standard_EXPORT static void Transforms (const TColStd_Array2OfReal& ATrsf, const Standard_Real X, const Standard_Real Y, const Standard_Real Z, Standard_Real& NewX, Standard_Real& NewY, Standard_Real& NewZ);
473   
474   //! Transforms <Coord> with the transformation <ATrsf>.
475   Standard_EXPORT static Graphic3d_Vector Transforms (const TColStd_Array2OfReal& ATrsf, const Graphic3d_Vector& Coord);
476   
477   //! Transforms <Coord> with the transformation <ATrsf>.
478   Standard_EXPORT static Graphic3d_Vertex Transforms (const TColStd_Array2OfReal& ATrsf, const Graphic3d_Vertex& Coord);
479   
480   //! Returns the low-level structure
481     const Handle(Graphic3d_CStructure)& CStructure() const;
482
483 friend class Graphic3d_Group;
484
485
486   DEFINE_STANDARD_RTTIEXT(Graphic3d_Structure,MMgt_TShared)
487
488 protected:
489
490   
491   //! Transforms boundaries with <theTrsf> transformation.
492   Standard_EXPORT static void TransformBoundaries (const TColStd_Array2OfReal& theTrsf, Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin, Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax);
493   
494   //! Appends new descendant structure.
495   Standard_EXPORT Standard_Boolean AppendDescendant (const Standard_Address theDescendant);
496   
497   //! Removes the given descendant structure.
498   Standard_EXPORT Standard_Boolean RemoveDescendant (const Standard_Address theDescendant);
499   
500   //! Appends new ancestor structure.
501   Standard_EXPORT Standard_Boolean AppendAncestor (const Standard_Address theAncestor);
502   
503   //! Removes the given ancestor structure.
504   Standard_EXPORT Standard_Boolean RemoveAncestor (const Standard_Address theAncestor);
505
506   Graphic3d_StructureManagerPtr myStructureManager;
507   Graphic3d_StructureManagerPtr myFirstStructureManager;
508   Graphic3d_TypeOfStructure myComputeVisual;
509
510
511 private:
512
513   
514   //! Suppress in the structure <me>, the group theGroup.
515   //! It will be erased at the next screen update.
516   Standard_EXPORT void Remove (const Handle(Graphic3d_Group)& theGroup);
517   
518   //! Manages the number of groups in the structure <me>
519   //! which contains facet.
520   //! Polygons, Triangles or Quadrangles.
521   //! <ADelta> = +1 or -1
522   Standard_EXPORT void GroupsWithFacet (const Standard_Integer ADelta);
523   
524   //! Returns the extreme coordinates found in the structure <me> without transformation applied.
525   Standard_EXPORT Graphic3d_BndBox4f minMaxCoord() const;
526   
527   //! Gets untransformed bounding box from structure.
528   Standard_EXPORT void getBox (Graphic3d_BndBox4d& theBox, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
529   
530   //! Adds transformed (with myCStructure->Transformation) bounding box of structure to theBox.
531   Standard_EXPORT void addTransformed (Graphic3d_BndBox4d& theBox, const Standard_Boolean theToIgnoreInfiniteFlag = Standard_False) const;
532   
533   //! Returns the manager to which <me> is associated.
534   Standard_EXPORT Handle(Graphic3d_StructureManager) StructureManager() const;
535   
536   //! Calls the Update method of the StructureManager which
537   //! contains the Structure <me>.
538   Standard_EXPORT void Update() const;
539   
540   //! Updates the c structure associated to <me>.
541   Standard_EXPORT void UpdateStructure (const Handle(Graphic3d_AspectLine3d)& CTXL, const Handle(Graphic3d_AspectText3d)& CTXT, const Handle(Graphic3d_AspectMarker3d)& CTXM, const Handle(Graphic3d_AspectFillArea3d)& CTXF);
542
543   Handle(Graphic3d_CStructure) myCStructure;
544   Graphic3d_IndexedMapOfAddress myAncestors;
545   Graphic3d_IndexedMapOfAddress myDescendants;
546   Quantity_Color myHighlightColor;
547   Aspect_TypeOfHighlightMethod myHighlightMethod;
548   Standard_Address myOwner;
549   Graphic3d_TypeOfStructure myVisual;
550
551
552 };
553
554
555 #include <Graphic3d_Structure.lxx>
556
557
558
559
560
561 #endif // _Graphic3d_Structure_HeaderFile