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