OCC22272 Small improvements in selection and presentation
[occt.git] / src / Graphic3d / Graphic3d_Structure.cdl
1 -- File:        Graphic3d_Structure.cdl
2 -- Created:     Mercredi 12 Juin 1991
3 -- Author:      NW,JPB,CAL
4 --              11/97 ; CAL : gestion du GraphicClear
5 --              11/97 ; CAL : ajout pointer StructPtr
6 --              11/97 ; CAL : amelioration de l'effacement SetManager
7 --              01/98 ; CAL : gestion du HLRValidation
8 --              05/98 ; CAL : gestion du GraphicConnect et Disconnect
9 --              02/00 ; GG  : Made Transform() methode not mutable.
10 --              31/05/01 ; GG : Add ResetDisplayPriority() method
11 --
12 ---Copyright:   MatraDatavision 1998
13 --
14
15 class Structure from Graphic3d inherits TShared
16
17         ---Version:
18
19         ---Purpose: This class allows the definition a graphic object.
20         --          This graphic structure can be displayed,
21         --          erased, or highlighted.
22         --          This graphic structure can be connected with
23         --          another graphic structure.
24         --  Keywords: Structure, StructureManager, Display, Erase, Highlight,
25         --           UnHighlight, Visible, Priority, Selectable, Visible,
26         --           Visual, Connection, Ancestors, Descendants, Transformation
27
28         ---Warning:
29         ---References:
30
31 uses
32
33         Array2OfReal            from TColStd,
34         SequenceOfAddress       from TColStd,
35
36         Color                   from Quantity,
37
38         GenId                   from Aspect,
39         TypeOfHighlightMethod   from Aspect,
40
41         DataStructureManager    from Graphic3d,
42         AspectFillArea3d        from Graphic3d,
43         AspectLine3d            from Graphic3d,
44         AspectMarker3d          from Graphic3d,
45         AspectText3d            from Graphic3d,
46         CStructure              from Graphic3d,
47         GraphicDriver           from Graphic3d,
48         Group                   from Graphic3d,
49         SequenceOfGroup         from Graphic3d,
50         HSequenceOfGroup        from Graphic3d,
51         SequenceOfStructure     from Graphic3d,
52         HSequenceOfStructure    from Graphic3d,
53         MapOfStructure          from Graphic3d,
54         Plotter                 from Graphic3d,
55         StructureManager        from Graphic3d,
56         TypeOfComposition       from Graphic3d,
57         TypeOfConnection        from Graphic3d,
58         TypeOfPrimitive         from Graphic3d,
59         TypeOfStructure         from Graphic3d,
60         Vector                  from Graphic3d,
61         VertexNC                from Graphic3d,
62         Vertex                  from Graphic3d,
63         TransModeFlags          from Graphic3d,
64         Pnt                     from gp
65
66 raises
67
68         PriorityDefinitionError         from Graphic3d,
69         StructureDefinitionError        from Graphic3d,
70         TransformError                  from Graphic3d
71
72 is
73
74         ------------------------
75         -- Category: Constructor
76         ------------------------
77
78         Create ( AManager       : StructureManager from Graphic3d )
79                 returns mutable Structure from Graphic3d;
80         ---Level: Public
81         ---Purpose: Creates a graphic object in the manager <AManager>.
82         --          It will appear in all the views of the visualiser.
83         --  Warning: The default values AspectLine, AspectFillArea,
84         --          AspectText and AspectMarker are NOT applied to the
85         --          structure.
86         --          The structure is not displayed when it is created.
87
88         ---------------------------------------------------
89         -- Category: Methods to modify the class definition
90         ---------------------------------------------------
91
92         --------------------------------------------------------
93         -- Summary of Display Priorities                      --
94         --                                                    --
95         -- Structure display priorities  control the order in --
96         -- which structures are redrawn.                      --
97         --                                                    --
98         -- When  you  display  a structure, you  specify  its --
99         -- priority.  The  lower  the  value, the  lower  the --
100         -- display priority. When the display is regenerated, --
101         -- the structures  with the lowest priority are drawn --
102         -- first.                                             --
103         -- For  structures  with the  same display  priority, --
104         -- the  order in which they were displayed determines --
105         -- determines the drawing order.                      --
106         --                                                    --
107         -- CAS.CADE supports 11 structure display priorities, --
108         -- 0 to 10.                                           --
109         --------------------------------------------------------
110
111         Clear ( me              : mutable;
112                 WithDestruction : Boolean from Standard = Standard_True )
113                 is virtual;
114         ---Level: Public
115         ---Purpose: if WithDestruction == Standard_True then
116         --              suppress all the groups of primitives in the structure.
117         --              and it is mandatory to create a new group in <me>.
118         --          if WithDestruction == Standard_False then
119         --              clears all the groups of primitives in the structure.
120         --              and all the groups are conserved and empty.
121         --          They will be erased at the next screen update.
122         --          The structure itself is conserved.
123         --          The transformation and the attributes of <me> are conserved.
124         --          The childs of <me> are conserved.
125         ---Category: Methods to modify the class definition
126
127         Destroy ( me    : mutable )
128                 is virtual;
129         ---Level: Public
130         ---Purpose: Suppresses the structure <me>.
131         --          It will be erased at the next screen update.
132         ---Category: Methods to modify the class definition
133         ---C++: alias ~
134
135         Display ( me    : mutable )
136                 is virtual;
137         ---Level: Public
138         ---Purpose: Displays the structure <me> in all the views of
139         --          the visualiser.
140         ---Category: Methods to modify the class definition
141
142         Display ( me            : mutable;
143                   Priority      : Integer from Standard )
144         ---Level: Public
145         ---Purpose: Displays the structure <me> in all the views of
146         --          the visualiser, while modifying its current priority.
147         --          Note: Display Priorities
148         --          Structure display priorities control the order in which
149         --          structures are redrawn.   When you display a
150         --          structure, you specify its priority. The lower the value,
151         --          the lower the display priority. When the display is
152         --          regenerated, the structures with the lowest priority
153         --          are drawn first. For structures with the same display
154         --          priority, the order in which they were displayed
155         --          determines the drawing order. Open CASCADE
156         --          supports 11 structure display priorities, 0 to 10.
157         --          Warning: Raises PriorityDefinitionError if <Priority> is
158         --          greater than 10 or a negative value.
159         raises PriorityDefinitionError from Graphic3d is static;
160
161         DisplayPriority ( me )
162                 returns Integer from Standard
163                 is static;
164         ---Level: Public
165         ---Purpose: Returns the current display priority for the
166         --          structure <me>.
167         ---Category: Methods to modify the class definition
168
169         Erase ( me      : mutable )
170                 is virtual;
171         ---Level: Public
172         ---Purpose: Erases the structure <me> in all the views
173         --          of the visualiser.
174         ---Category: Methods to modify the class definition
175
176         Highlight ( me          : mutable;
177                     Method      : TypeOfHighlightMethod from Aspect )
178                 is static;
179         ---Level: Public
180         ---Purpose: Highlights the structure <me> in all the
181         --          views of the visualiser, using the following methods:
182         --
183         --   TOHM_COLOR         = drawn in the highlight color
184         --                                (default white)
185         --          TOHM_BLINK          = blinking
186         --   TOHM_BOUNDBOX      = enclosed by the boundary box
187         --                                (default white)
188         --
189         ---Category: Methods to modify the class definition
190
191         Remove ( me     : mutable )
192                 is static;
193         ---Level: Public
194         ---Purpose: Suppress the structure <me>.
195         --          It will be erased at the next screen update.
196         --  Warning: No more graphic operations in <me> after this call.
197         --  Category: Methods to modify the class definition
198
199         SetHighlightColor ( me          : mutable;
200                             AColor      : Color from Quantity )
201                 is static;
202         ---Level: Public
203         ---Purpose: Modifies the highlight color for the Highlight method
204         --          with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
205         ---Category: Methods to modify the class definition
206
207         SetInfiniteState ( me           : mutable;
208                            AFlag        : Boolean from Standard )
209                 is static;
210         ---Level: Internal
211         ---Purpose: Modifies the coordinates of the boundary box
212         --          of the structure <me>.
213         --          if <AFlag> is Standard_True then <me> is infinite and
214         --          the MinMaxValues method or the MinMaxCoord method return :
215         --          XMin = YMin = ZMin = RealFirst ().
216         --          XMax = YMax = ZMax = RealLast ().
217         --          By default, <me> is not infinite but empty.
218         ---Category: Methods to modify the class definition
219
220         SetDisplayPriority ( me         : mutable;
221                              Priority   : Integer from Standard )
222         ---Level: Public
223         ---Purpose: Modifies the order of displaying the structure.
224         --          Values are between 0 et 10.
225         --          The priority 10 being displayed first.
226         --          The default value is 5
227         --  Category: Methods to modify the class definition
228         --  Warning: If <me> is displayed then the SetDisplayPriority
229         --          method erase <me> and display <me> with the
230         --          new priority.
231         --          Raises PriorityDefinitionError if <Priority> is
232         --          greater than 10 or a negative value.
233         raises PriorityDefinitionError from Graphic3d is static;
234
235         ResetDisplayPriority ( me               : mutable)
236                 is static;
237         ---Level: Public
238         ---Purpose: Reset the current priority of the structure to the
239         --          previous priority.
240         --  Category: Methods to modify the class definition
241         --  Warning: If <me> is displayed then the SetDisplayPriority
242         --          method erase <me> and display <me> with the
243         --          previous priority.
244
245         SetPick ( me            : mutable;
246                   AValue        : Boolean from Standard )
247                 is static;
248         ---Level: Public
249         ---Purpose: Modifies the detectability indicator to Standard_True
250         --          or Standard_False for the structure <me>.
251         --          The default value at the definition of <me> is
252         --          Standard_True.
253         ---Category: Methods to modify the class definition
254
255         SetPrimitivesAspect ( me        : mutable;
256                               CTX       : AspectLine3d from Graphic3d )
257                 is static;
258         ---Level: Public
259         ---Purpose: Modifies the default attributes for lines
260         --          in the structure <me>.
261         ---Category: Methods to modify the class definition
262
263         SetPrimitivesAspect ( me        : mutable;
264                               CTX       : AspectFillArea3d from Graphic3d )
265                 is static;
266         ---Level: Public
267         ---Purpose: Modifies the default attributes for faces
268         --          in the structure <me>.
269         ---Category: Methods to modify the class definition
270
271         SetPrimitivesAspect ( me        : mutable;
272                               CTX       : AspectText3d from Graphic3d )
273                 is static;
274         ---Level: Public
275         ---Purpose: Modifies the default attributes for text
276         --          in the structure <me>.
277         ---Category: Methods to modify the class definition
278
279         SetPrimitivesAspect ( me        : mutable;
280                               CTX       : AspectMarker3d from Graphic3d )
281                 is static;
282         ---Level: Public
283         ---Purpose: Modifies the default attributes for markers
284         --          in the structure <me>.
285         ---Category: Methods to modify the class definition
286
287         SetVisible ( me         : mutable;
288                      AValue     : Boolean from Standard )
289                 is static;
290         ---Level: Public
291         ---Purpose: Modifies the visibility indicator to Standard_True or
292         --          Standard_False for the structure <me>.
293         --          The default value at the definition of <me> is
294         --          Standard_True.
295         ---Category: Methods to modify the class definition
296
297         SetManager ( me                 : mutable;
298                      AManager           : StructureManager from Graphic3d;
299                      WithPropagation    : Boolean from Standard = Standard_False)
300                 is static;
301         ---Level: Public
302         ---Purpose: Moves the graphic object <me> in the manager <AManager>.
303         --          If <WithPropagation> is Standard_True then all the connected
304         --          graphic objects to <me> are moved.
305
306         SetVisual ( me          : mutable;
307                     AVisual     : TypeOfStructure from Graphic3d )
308                 is virtual;
309         ---Level: Public
310         ---Purpose: Modifies the visualisation mode for the structure <me>.
311         ---Warning: It is not possible to display a structure with
312         --          an incompatible display mode.
313         --          If the display mode is different from the current one,
314         --          the structure is erased.
315         --
316         --          TOS_WIREFRAME for a wireframe visualisation
317         --          TOS_SHADING for a shaded visualisation
318         --          TOS_ALL for all visualisations
319         --          TOS_COMPUTED for a computed visualisation
320         --          The default value is TOS_ALL
321         --
322         ---Category: Methods to modify the class definition
323
324         SetZoomLimit ( me                       : mutable;
325                        LimitInf, LimitSup       : Real from Standard )
326         ---Level: Internal
327         ---Purpose: Modifies the minimum and maximum zoom coefficients
328         --          for the structure <me>.
329         --          The default value at the definition of <me> is unlimited.
330         --  Category: Methods to modify the class definition
331         --  Warning: Raises StructureDefinitionError if <LimitInf> is
332         --          greater than <LimitSup> or if <LimitInf> or
333         --          <LimitSup> is a negative value.
334         raises StructureDefinitionError from Graphic3d is static;
335
336         UnHighlight ( me        : mutable )
337                 is static;
338         ---Level: Public
339         ---Purpose: Suppresses the highlight for the structure <me>
340         --           in all the views of the visualiser.
341         ---Category: Methods to modify the class definition
342
343         ----------------------------
344         -- Category: Compute methods
345         ----------------------------
346
347         Compute ( me    : mutable;
348                   aProjector    : DataStructureManager from Graphic3d )
349                 returns Structure from Graphic3d is virtual;
350         ---Level: Advanced
351         ---Purpose: Returns the new Structure defined for the new visualization
352         ---Category: Methods to modify the class definition
353
354         Compute ( me    : mutable;
355                   aProjector    : DataStructureManager from Graphic3d;
356                   AMatrix       : Array2OfReal from TColStd )
357                 returns Structure from Graphic3d is virtual;
358         ---Level: Advanced
359         ---Purpose: Returns the new Structure defined for the new visualization
360         ---Category: Methods to modify the class definition
361
362         Compute ( me    : mutable;
363                   aProjector    : DataStructureManager from Graphic3d;
364                   aStructure    : in out Structure from Graphic3d )
365                 is virtual;
366         ---Level: Advanced
367         ---Purpose: Returns the new Structure defined for the new visualization
368         ---Category: Methods to modify the class definition
369
370         Compute ( me    : mutable;
371                   aProjector    : DataStructureManager from Graphic3d;
372                   AMatrix       : Array2OfReal from TColStd;
373                   aStructure    : in out Structure from Graphic3d )
374                 is virtual;
375         ---Level: Advanced
376         ---Purpose: Returns the new Structure defined for the new visualization
377         ---Category: Methods to modify the class definition
378
379         ReCompute ( me  : mutable );
380         ---Level: Advanced
381         ---Purpose: Forces a new construction of the structure <me>
382         --          if <me> is displayed and TOS_COMPUTED.
383         ---Category: Methods to modify the class definition
384
385         ReCompute ( me          : mutable;
386                     aProjector  : DataStructureManager from Graphic3d );
387         ---Level: Advanced
388         ---Purpose: Forces a new construction of the structure <me>
389         --          if <me> is displayed in <aProjetor> and TOS_COMPUTED.
390         ---Category: Methods to modify the class definition
391
392         ----------------------------
393         -- Category: Inquire methods
394         ----------------------------
395
396         ContainsFacet ( me )
397                 returns Boolean from Standard
398                 is static;
399         ---Level: Public
400         ---Purpose: Returns Standard_True if the structure <me> contains
401         --          Polygons, Triangles or Quadrangles.
402         ---Category: Inquire methods
403
404         Exploration ( me;
405                       ElementNumber     : Integer from Standard;
406                       AVertex           : out VertexNC from Graphic3d;
407                       AVector           : out Vector from Graphic3d )
408                 returns Boolean from Standard
409                 is static;
410         ---Level: Internal
411         ---Purpose: Explores a structure element of <me>.
412         --          Returns Standard_True if the exploration succeded and
413         --          Standard_False if the exploration is done or if the
414         --          specified structure element is not in the structure.
415         --          <AVertex> contains the coordinates, the normal and
416         --          the color of the vertex found in the structure element.
417         --          <AVector> contains the normal of the face.
418         --  Warning: - The structure element number is given by
419         --          Visual3d_ViewManager::Pick method.
420         --          - The primitive type is given by
421         --          Graphic3d_Structure::Type method.
422         --          - The normal is (0.0, 0.0, 0.0) when the normal is not
423         --          specified in the structure element.
424         --          - The color is (0.0, 0.0, 0.0) when the color is not
425         --          specified in the structure element.
426         --          - To initialize the exploration, you have to call the
427         --          Graphic3d_Structure::Type method before this method.
428         --
429         -- Programming example :
430         --
431         -- // Define a graphic device
432         -- Handle(Graphic3d_GraphicDevice) GD =
433         --                      new Graphic3d_GraphicDevice ("dummy:0.0");
434         --
435         -- // Define a view manager
436         -- Handle(Visual3d_ViewManager) VM = new Visual3d_ViewManager (GD);
437         --
438         -- // Define a view
439         -- Handle(Visual3d_View) V = new Visual3d_View (VM);
440         --
441         -- // Define a window
442         -- Handle(Aspect_Window) W = new Aspect_Window
443         --      (GD, "Graphic View 1", 0.695, 0.695, 0.600, 0.600,
444         --              Xw_WQ_3DQUALITY, Quantity_NOC_MATRAGRAY);
445         --
446         -- // Define a context pick
447         -- Visual3d_ContextPick CTXP;
448         --
449         -- // Activate the view
450         -- V->SetWindow (W);
451         -- V->Activate ();
452         --
453         -- // Create a structure
454         -- Handle(Graphic3d_Structure) S = new Graphic3d_Structure (V);
455         -- Handle(Graphic3d_Group) G = new Graphic3d_Group (S);
456         --
457         -- // Create a polygon
458         -- G->Polygon (PtsArray);
459         --
460         -- // Display the structure
461         -- S->Display ();
462         --
463         -- // Pick
464         -- Visual3d_PickDescriptor PDes (CTXP);
465         -- PDes.Clear ();
466         -- PDes = V->Pick (CTXP, W, x, y);
467         --
468         -- // Explore the top structure
469         -- Standard_Boolean Next = Standard_True;
470         -- Graphic3d_Vertex AVertex;
471         -- Graphic3d_Vector AVector;
472         -- if ((PDes.TopStructure ())->Type () == Graphic3d_TOP_POLYGON)
473         --      while (Next) {
474         --           Next = S->Exploration (PDes.TopElementNumber (),
475         --                                      AVertex, AVector);
476         --           if (Next) {
477         --              cout << "Point " << AVertex.X () << " , "
478         --              << AVertex.Y () << " , " << AVertex.Z () << "\n";
479         --              if (! AVector.LengthZero ())
480         --                   cout << "Normal " << AVector.X () << " , "
481         --                   << AVector.Y () << " , " << AVector.Z () << "\n";
482         --              cout << flush;
483         --           }
484         --      }
485         --
486         ---Category: Inquire methods
487
488         FillArea3dAspect ( me )
489                 returns AspectFillArea3d from Graphic3d
490                 is static;
491         ---Level: Public
492         ---Purpose: Returns the values of the current default attributes.
493         ---Category: Inquire methods
494
495         Groups ( me )
496                 returns SequenceOfGroup from Graphic3d
497                 is static;
498         ---C++: return const &
499         ---Level: Internal
500         ---Purpose: Returns the groups sequence included in the structure <me> (internal storage).
501         ---Category: Inquire methods
502
503         NumberOfGroups ( me )
504                 returns Integer from Standard
505                 is static;
506         ---Level: Public
507         ---Purpose: Returns the current number of groups in the
508         --          structure <me>.
509         ---Category: Inquire methods
510
511         HighlightColor ( me )
512                 returns Color from Quantity
513                 is static;
514         ---Level: Public
515         ---Purpose: Returns the highlight color for the Highlight method
516         --          with the highlight method TOHM_COLOR or TOHM_BOUNDBOX.
517         ---Category: Inquire methods
518
519         IsDeleted ( me )
520                 returns Boolean from Standard
521                 is static;
522         ---Level: Public
523         ---Purpose: Returns Standard_True if the structure <me> is deleted.
524         --          <me> is deleted after the call Remove (me).
525         ---Category: Inquire methods
526
527         IsDisplayed ( me )
528                 returns Boolean from Standard
529                 is virtual;
530         ---Level: Public
531         ---Purpose: Returns the display indicator for the structure <me>.
532         ---Category: Inquire methods
533
534         IsEmpty ( me )
535                 returns Boolean from Standard
536                 is static;
537         ---Level: Public
538         ---Purpose: Returns Standard_True if the structure <me> is empty.
539         --  Warning: A structure is empty if :
540         --              it do not have group or all the groups are empties
541         --              and it do not have descendant or all the descendants
542         --              are empties.
543         ---Category: Inquire methods
544
545         IsInfinite ( me )
546                 returns Boolean from Standard
547                 is static;
548         ---Level: Internal
549         ---Purpose: Returns Standard_True if the structure <me> is infinite.
550         ---Category: Inquire methods
551
552         IsHighlighted ( me )
553                 returns Boolean from Standard
554                 is virtual;
555         ---Level: Public
556         ---Purpose: Returns the highlight indicator for the structure <me>.
557         ---Category: Inquire methods
558
559         IsSelectable ( me )
560                 returns Boolean from Standard
561                 is static;
562         ---Level: Public
563         ---Purpose: Returns the detectability indicator for the structure <me>.
564         ---Category: Inquire methods
565
566         IsRotated ( me )
567                 returns Boolean from Standard
568                 is static;
569         ---Level: Public
570         ---Purpose: Returns Standard_True if the structure <me> is rotated.
571         --          <=> The transformation != Identity, != Scale, != Translation.
572         ---Category: Inquire methods
573
574         IsTransformed ( me )
575                 returns Boolean from Standard
576                 is static;
577         ---Level: Public
578         ---Purpose: Returns Standard_True if the structure <me> is transformed.
579         --          <=> The transformation != Identity.
580         ---Category: Inquire methods
581
582         IsVisible ( me )
583                 returns Boolean from Standard
584                 is static;
585         ---Level: Public
586         ---Purpose: Returns the visibility indicator for the structure <me>.
587         ---Category: Inquire methods
588
589         Line3dAspect ( me )
590                 returns AspectLine3d from Graphic3d
591                 is static;
592         ---Level: Public
593         ---Purpose: Returns the values of the current default attributes.
594         ---Category: Inquire methods
595
596         Marker3dAspect ( me )
597                 returns AspectMarker3d from Graphic3d
598                 is static;
599         ---Purpose: Returns the current group of graphic attributes used
600         -- for 3d marker primitives.
601
602         MinMaxValues ( me;
603                        XMin, YMin, ZMin : out Real from Standard;
604                        XMax, YMax, ZMax : out Real from Standard )
605                 is static;
606         ---Level: Public
607         ---Purpose: Returns the coordinates of the boundary box
608         --          of the structure <me>.
609         --  Warning: If the structure <me> is empty or infinite then :
610         --          XMin = YMin = ZMin = RealFirst ().
611         --          XMax = YMax = ZMax = RealLast ().
612         ---Category: Inquire methods
613
614         PrimitivesAspect ( me;
615                            CTXL : out AspectLine3d from Graphic3d;
616                            CTXT : out AspectText3d from Graphic3d;
617                            CTXM : out AspectMarker3d from Graphic3d;
618                            CTXF : out AspectFillArea3d from Graphic3d )
619                 is static;
620         ---Level: Public
621         ---Purpose: Returns the current values of the default attributes.
622         ---Category: Inquire methods
623
624         Text3dAspect ( me )
625                 returns AspectText3d from Graphic3d
626                 is static;
627         ---Level: Public
628         ---Purpose: Returns the values of the current default attributes.
629         ---Category: Inquire methods
630
631         Type ( me;
632                ElementNumber    : Integer from Standard )
633                 returns TypeOfPrimitive from Graphic3d
634                 is static;
635         ---Level: Public
636         ---Purpose: Returns the primitive type stored in the structure
637         --          element <ElementNumber>.
638         --          Initialises the exploration of this primitive.
639         --          If the structure element is not a primitive, returns
640         --          Graphic3d_TOP_UNDEFINED.
641         --  Warning: The structure element number is given by
642         --          Visual3d_ViewManager::Pick method.
643         ---Category: Inquire methods
644
645         Visual ( me )
646                 returns TypeOfStructure from Graphic3d
647                 is static;
648         ---Level: Public
649         ---Purpose: Returns the visualisation mode for the structure <me>.
650         ---Category: Inquire methods
651
652         ----------------------------------------------------
653         -- Category: Methods to manage the structure network
654         ----------------------------------------------------
655
656         -----------------------------------------------------
657         -- Summary of Structure Hierarchies                --
658         --                                                 --
659         -- The root  is the top  of a  structure hierarchy --
660         -- or structure network.                           --
661         --                                                 --
662         -- The attributes of a parent structure are passed --
663         -- passed to its descendants.                      --
664         --                                                 --
665         -- The  attributes  of the  descendant  structures --
666         -- don't affect the parent.                        --
667         --                                                 --
668         -- Recursive structure networks are not supported. --
669         -----------------------------------------------------
670
671         AcceptConnection ( myclass;
672                            AStructure1  : Structure from Graphic3d;
673                            AStructure2  : Structure from Graphic3d;
674                            AType        : TypeOfConnection from Graphic3d )
675                 returns Boolean from Standard;
676         ---Level: Internal
677         ---Purpose: Returns Standard_True if the connection is possible between
678         --          <AStructure1> and <AStructure2> without a creation
679         --          of a cycle.
680         --
681         --          It's not possible to call the method
682         --             AStructure1->Connect (AStructure2, TypeOfConnection)
683         --          if
684         --          - the set of all ancestors of <AStructure1> contains
685         --            <AStructure1> and if the
686         --            TypeOfConnection == TOC_DESCENDANT
687         --          - the set of all descendants of <AStructure1> contains
688         --            <AStructure2> and if the
689         --            TypeOfConnection == TOC_ANCESTOR
690         ---Category: Methods to manage the structure network
691
692         Ancestors ( me; SG: in out MapOfStructure from Graphic3d )
693                 is static;
694         ---Level: Internal
695         ---Purpose: Returns the group of structures to which <me> is connected.
696         ---Category: Methods to manage the structure network
697
698         Connect ( me            : mutable;
699                   AStructure    : Structure from Graphic3d;
700                   AType         : TypeOfConnection from Graphic3d;
701                   WithCheck     : Boolean from Standard = Standard_False );
702         ---Level: Public
703         ---Purpose: If Atype is TOC_DESCENDANT then add <AStructure>
704         --          as a child structure of  <me>.
705         --          If Atype is TOC_ANCESTOR then add <AStructure>
706         --          as a parent structure of <me>.
707         --          The connection propagates Display, Highlight, Erase,
708         --          Remove, and stacks the transformations.
709         --          No connection if the graph of the structures
710         --          contains a cycle and <WithCheck> is Standard_True;
711         ---Category: Methods to manage the structure network
712
713         Descendants ( me; SG : in out MapOfStructure from Graphic3d )
714                 is static;
715         ---Level: Internal
716         ---Purpose: Returns the group of structures connected to <me>.
717         ---Category: Methods to manage the structure network
718
719         Disconnect ( me         : mutable;
720                      AStructure : Structure from Graphic3d )
721                 is static;
722         ---Level: Public
723         ---Purpose: Suppress the connection between <AStructure> and <me>.
724         ---Category: Methods to manage the structure network
725
726         DisconnectAll ( me      : mutable;
727                         AType   : TypeOfConnection from Graphic3d )
728                 is static;
729         ---Level: Public
730         ---Purpose: If Atype is TOC_DESCENDANT then suppress all
731         --          the connections with the child structures of <me>.
732         --          If Atype is TOC_ANCESTOR then suppress all
733         --          the connections with the parent structures of <me>.
734         ---Category: Methods to manage the structure network
735
736         Network ( myclass;
737                   AStructure    : Structure from Graphic3d;
738                   AType         : TypeOfConnection from Graphic3d;
739                   ASet          : in out MapOfStructure from Graphic3d );
740         ---Level: Internal
741         ---Purpose: Returns <ASet> the group of structures :
742         --          - directly or indirectly connected to <AStructure> if the
743         --            TypeOfConnection == TOC_DESCENDANT
744         --          - to which <AStructure> is directly or indirectly connected
745         --            if the TypeOfConnection == TOC_ANCESTOR
746         ---Category: Methods to manage the structure network
747
748         SetOwner ( me   : mutable;
749                    Owner        : Address from Standard )
750                 is static;
751         ---Level: Advanced
752
753         Owner ( me )
754                 returns Address from Standard
755                 is static;
756         ---Level: Advanced
757
758         SetHLRValidation ( me   : mutable;
759                            AFlag        : Boolean from Standard )
760                 is static;
761         ---Level: Advanced
762
763         HLRValidation ( me )
764                 returns Boolean from Standard
765                 is static;
766         ---Level: Advanced
767
768         -----------------------------------------------------------
769         -- Category: Methods to manage the structure transformation
770         -----------------------------------------------------------
771
772         Composition ( me )
773                 returns TypeOfComposition from Graphic3d
774                 is static;
775         ---Level: Public
776         ---Purpose: Returns the type of composition applied to matrices
777         --          of transformation of <me>.
778         ---Category: Methods to manage the structure transformation
779
780         SetTransform ( me       : mutable;
781                        AMatrix  : Array2OfReal from TColStd;
782                        AType    : TypeOfComposition from Graphic3d )
783         ---Level: Public
784         ---Purpose: Modifies the current local modelling transformation
785         --          in the structure <me>.
786         --
787         --          It is defined as a 4*4 real matrix.
788         --
789         --          -------------------
790         --          | a11 a12 a13  t1 |
791         --          | a21 a22 a23  t2 |
792         --          | a31 a32 a33  t3 |
793         --          |  0   0   0   1  |
794         --          -------------------
795         --
796         --          TypeOfComposition : TOC_REPLACE
797         --                              TOC_POSTCONCATENATE
798         --
799         -- Then the modified Local Modelling Transformation is composed
800         -- with the current Global Modelling Transformation to create a
801         -- new Composite Modelling Transformation.
802         --
803         -- The compose type specifies the role of the current local
804         -- modelling transformation (L) in composing the new value for
805         -- the current local modelling transformation (L'), which is
806         -- then combined with the current global modelling transforma-
807         -- tion (G) to calculate the new composite modelling transfor-
808         -- mation (C).
809         --
810         -- TOC_REPLACE
811         -- The transformation matrix (T) replaces the value of
812         -- current local modelling transformation (L).
813         --
814         --      L' <- T
815         --      C <- G x L'
816         --
817         -- TOC_POSTCONCATENATE
818         -- The current local modelling transformation (L) is multiplied
819         -- by the transformation matrix (T):
820         --
821         --      L' <- T x L
822         --      C <- G x L'
823         --
824         --  Category: Methods to manage the structure transformation
825         --  Warning: Raises TransformError if the matrix is not a 4x4 matrix.
826         raises TransformError from Graphic3d is static;
827
828         -- Transform ( me               : mutable;
829         Transform ( me;
830                     AMatrix     : in out Array2OfReal from TColStd )
831                 is static;
832         ---Level: Public
833         ---Purpose: Returns the transformation associated with
834         --          the structure <me>.
835         ---Category: Methods to manage the structure transformation
836
837         SetTransformPersistence( me     : mutable;
838                                  AFlag  : TransModeFlags from Graphic3d;
839                                  APoint : Pnt from gp  )
840         ---Level: Public
841         ---Purpose: Modifies the current modelling transform persistence (pan, zoom or rotate)
842         is static;
843
844         SetTransformPersistence(  me  :  mutable;
845                                   AFlag  :  TransModeFlags  from  Graphic3d  )
846         --  Calls previous   method  with  point  (0,0,0)
847         is  static;
848
849
850         TransformPersistenceMode( me )
851                         returns TransModeFlags from Graphic3d
852         ---Level: Public
853         ---Purpose: Get the current modelling transform persistence (pan, zoom or rotate)
854         is static;
855
856         TransformPersistencePoint( me )
857                         returns Pnt from gp
858         ---Level: Public
859         ---Purpose: Get the current point of relative modelling transform persistence
860         is static;
861
862         ----------------------------
863         -- Category: Private methods
864         ----------------------------
865
866         Add ( me        : mutable;
867               AGroup    : Group from Graphic3d )
868                 is static private;
869         ---Level: Internal
870         ---Purpose: Inserts in the structure <me>, the group <G>.
871         --          It will be erased at the next screen update.
872         ---Category: Private methods
873
874         ComputeVisual ( me )
875                 returns TypeOfStructure from Graphic3d
876                 is static;
877         ---Level: Internal
878         ---Category: Private methods
879
880         GroupsWithFacet ( me    : mutable;
881                         ADelta  : Integer from Standard )
882                 is static private;
883         ---Level: Internal
884         ---Purpose: Manages the number of groups in the structure <me>
885         --          which contains facet.
886         --          Polygons, Triangles or Quadrangles.
887         --          <ADelta> = +1 or -1
888         ---Category: Private methods
889
890         Exploration ( me )
891                 is static;
892         ---Level: Internal
893         ---Purpose: Prints informations about the structure <me>.
894         ---Category: Private methods
895
896         GraphicClear ( me       : mutable;
897                        WithDestruction  : Boolean from Standard )
898                 is static;
899         ---Level: Internal
900         ---Purpose: Clears the structure <me>.
901         ---Category: Private methods
902
903         GraphicConnect ( me     : mutable;
904                          ADaughter      : Structure from Graphic3d )
905                 is static;
906         ---Level: Internal
907         ---Purpose:
908         ---Category: Private methods
909
910         GraphicDisconnect ( me  : mutable;
911                             ADaughter   : Structure from Graphic3d )
912                 is static;
913         ---Level: Internal
914         ---Purpose:
915         ---Category: Private methods
916
917         GraphicHighlight ( me           : mutable;
918                            Method       : TypeOfHighlightMethod from Aspect )
919                 is static;
920         ---Level: Internal
921         ---Purpose: Highlights the structure <me>.
922         ---Category: Private methods
923
924         GraphicTransform ( me           : mutable;
925                            AMatrix      : Array2OfReal from TColStd )
926                 is static;
927         ---Level: Internal
928         ---Purpose:
929         ---Category: Private methods
930
931         GraphicUnHighlight ( me : mutable )
932                 is static;
933         ---Level: Internal
934         ---Purpose: Suppress the highlight for the structure <me>.
935         ---Category: Private methods
936
937         GroupLabels ( me        : mutable;
938                       LB, LE    : in out Integer from Standard )
939                 is static private;
940         ---Level: Internal
941         ---Purpose: Returns the labels for a new group in the structure <me>.
942         ---Category: Private methods
943
944         Identification ( me )
945                 returns Integer from Standard
946                 is static;
947         ---Level: Internal
948         ---Purpose: Returns the identification number of the structure <me>.
949         ---Category: Private methods
950
951         MinMaxCoord ( me;
952                       XMin, YMin, ZMin  : out Real from Standard;
953                       XMax, YMax, ZMax  : out Real from Standard )
954                 is static private;
955         ---Level: Internal
956         ---Purpose: Returns the extreme coordinates found in the
957         --          structure <me>.
958         --  Warning: If the structure <me> is empty or infinite then :
959         --          XMin = YMin = ZMin = RealFirst ().
960         --          XMax = YMax = ZMax = RealLast ().
961         ---Category: Private methods
962
963         Plot ( me       : mutable;
964                aPlotter : Plotter from Graphic3d )
965                 is virtual;
966         ---Level: Internal
967         ---Category: Private methods
968
969         PrintNetwork ( myclass;
970                        AStructure       : Structure from Graphic3d;
971                        AType            : TypeOfConnection from Graphic3d );
972         ---Level: Internal
973         ---Purpose: Prints informations about the network associated
974         --          with the structure <AStructure>.
975         ---Category: Private methods
976
977         Remove ( me     : mutable;
978                  APtr   : Address from Standard;
979                  AType  : TypeOfConnection from Graphic3d )
980                 is static;
981         ---Level: Internal
982         ---Purpose: Suppress the adress <APtr> in the list
983         --          of descendants or in the list of ancestors.
984         ---Category: Private methods
985
986         Remove ( me     : mutable;
987                  AGroup : Group from Graphic3d )
988                 is static private;
989         ---Level: Internal
990         ---Purpose: Suppress in the structure <me>, the group <AGroup>.
991         --          It will be erased at the next screen update.
992         ---Category: Private methods
993
994         SetComputeVisual ( me           : mutable;
995                            AVisual      : TypeOfStructure from Graphic3d )
996                 is static;
997         ---Level: Internal
998         ---Category: Private methods
999
1000         StructureManager ( me )
1001                 returns StructureManager from Graphic3d
1002                 is static private;
1003         ---Level: Internal
1004         ---Purpose: Returns the manager to which <me> is associated.
1005         ---Category: Private methods
1006
1007         Transforms ( myclass;
1008                      ATrsf              : Array2OfReal from TColStd;
1009                      X, Y, Z            : Real from Standard;
1010                      NewX, NewY, NewZ   : out Real from Standard );
1011         ---Level: Internal
1012         ---Purpose: Transforms <X>, <Y>, <Z> with the transformation <ATrsf>.
1013         ---Category: Private methods
1014
1015         Transforms ( myclass;
1016                      ATrsf      : Array2OfReal from TColStd;
1017                      Coord      : Vector from Graphic3d )
1018                 returns Vector from Graphic3d;
1019         ---Level: Internal
1020         ---Purpose: Transforms <Coord> with the transformation <ATrsf>.
1021         ---Category: Private methods
1022
1023         Transforms ( myclass;
1024                      ATrsf      : Array2OfReal from TColStd;
1025                      Coord      : Vertex from Graphic3d )
1026                 returns Vertex from Graphic3d;
1027         ---Level: Internal
1028         ---Purpose: Transforms <Coord> with the transformation <ATrsf>.
1029         ---Category: Private methods
1030
1031         Update ( me )
1032                 is static private;
1033         ---Level: Internal
1034         ---Purpose: Calls the Update method of the StructureManager which
1035         --          contains the Structure <me>.
1036         ---Category: Private methods
1037
1038         UpdateStructure ( me    : mutable;
1039                           CTXL  : AspectLine3d from Graphic3d;
1040                           CTXT  : AspectText3d from Graphic3d;
1041                           CTXM  : AspectMarker3d from Graphic3d;
1042                           CTXF  : AspectFillArea3d from Graphic3d )
1043                 is static private;
1044         ---Level: Internal
1045         ---Purpose: Updates the c structure associated to <me>.
1046         ---Category: Private methods
1047
1048         CStructure ( me )
1049                 returns Address from Standard
1050                 is static;
1051         ---Level: Internal
1052         ---Purpose: Returns the c structure associated to <me>.
1053         ---Category: Private methods
1054
1055 --\f
1056
1057 --\f
1058
1059 fields
1060
1061 --
1062 -- Class        :       Graphic3d_Structure
1063 --
1064 -- Purpose      :       Declaration of variables specific to
1065 --                      graphic structures.
1066 -- Reminder     :       A structure is defined in a manager.
1067 --                      It is a sequence of groups of primitives.
1068 --
1069
1070         -- the associated C structure
1071         MyCStructure            :       CStructure from Graphic3d;
1072
1073         -- the group identifier generator
1074         MyGroupGenId            :       GenId from Aspect;
1075
1076         -- the structures to which the structure is attached
1077         MyAncestors             :       SequenceOfAddress from TColStd;
1078
1079         -- the structures attached to the structure
1080         MyDescendants           :       SequenceOfAddress from TColStd;
1081
1082         -- the sequence of groups
1083         MyGroups                :       SequenceOfGroup from Graphic3d;
1084
1085         -- the graphic driver used
1086         MyGraphicDriver         :       GraphicDriver from Graphic3d;
1087
1088         -- the highlight method of the structure
1089         MyHighlightColor        :       Color from Quantity;
1090         MyHighlightMethod       :       TypeOfHighlightMethod from Aspect;
1091
1092         -- the manager accepting the structure
1093         MyPtrStructureManager           :       Address from Standard is protected;
1094         MyFirstPtrStructureManager      :       Address from Standard is protected;
1095         MyOwner                         :       Address from Standard;
1096
1097         -- the type of visualisation accepted by the structure
1098         MyVisual                :       TypeOfStructure from Graphic3d;
1099         MyComputeVisual         :       TypeOfStructure from Graphic3d is protected;
1100
1101 friends
1102
1103         -- a lot of methods of Group use the methods of Structure
1104         class Group     from Graphic3d
1105
1106 end Structure;