Integration of OCCT 6.5.0 from SVN
[occt.git] / src / Graphic2d / Graphic2d_View.cdl
1
2 -- File:        Graphic2d_View.cdl
3 -- Created:     Tue Jul 13 09:19:31 1993
4 -- Author:      Jean Louis FRENKEL
5 --              <jlf@stylox>
6 ---Copyright:    Matra Datavision 1993
7
8 --- SAV 14/11/01 Added PickByCircle().
9
10 class View from Graphic2d inherits TShared from MMgt
11
12         ---Version:
13
14         ---Purpose: A View is a graphic object manager.
15
16         ---Keywords:
17         ---Warning:
18         ---References:
19
20 uses
21         Buffer                          from Graphic2d,
22         GraphicObject               from Graphic2d,
23         Primitive                       from Graphic2d,
24         DisplayList                     from Graphic2d,
25         SequenceOfGraphicObject from Graphic2d,
26         SequenceOfBuffer        from Graphic2d,
27         Drawer                          from Graphic2d,
28         ViewMapping                     from Graphic2d,
29         TransientManager            from Graphic2d,
30     TypeOfDeflection        from Aspect,
31         Driver                          from Aspect,
32         WindowDriver                from Aspect,
33         Length                          from Quantity,
34         SequenceOfInteger           from TColStd,
35         PickMode                from Graphic2d
36
37 raises
38
39         OverrideColorError      from Graphic2d
40         
41 is
42         -------------------------
43         -- Category: Constructors
44         -------------------------
45
46         Create
47         returns mutable View from Graphic2d;
48         ---Level: Public
49         ---Purpose: Creates a view.
50         --          A view is a set of graphic objects.
51         --          The view manages this set.
52
53         ---------------------------------------------------
54         -- Category: Methods to modify the class definition
55         ---------------------------------------------------
56
57         Add (me: mutable;
58                 aBuffer: Buffer from Graphic2d)
59         is static private;
60         ---Level: Internal
61         ---Purpose: Adds the grafic buffer <aBuffer> in the
62         --          view  <me>.
63         --  Warning: Called by the constructor of <aBuffer>
64         ---Category: Methods to modify the class definition
65
66         Add (me: mutable;
67                 aGraphicObject: GraphicObject from Graphic2d;
68                 anAltitude: Integer from Standard = 1)
69         returns Integer is static private;
70         ---Level: Internal
71         ---Purpose: Adds the graphic object <aGraphicObject> in the
72         --          view  <me> at the altitude <anAltitude>.
73         --  and returns the rank of the object in the display-list. 
74         --  Warning: Called by the constructor of <aGraphicObject>
75         ---Category: Methods to modify the class definition
76
77         Change (me: mutable;
78                 aGraphicObject: GraphicObject from Graphic2d;
79                 anAltitude: Integer from Standard)
80         returns Integer is static private;
81         ---Level: Internal
82         ---Purpose: Changes the altitude <anAltitude> of 
83         --  the graphic object <aGraphicObject>
84         --  and returns the updated rank of the object in the display-list. 
85         ---Category: Methods to modify the class definition
86
87         Remove (me: mutable;
88                 aGraphicObject: GraphicObject from Graphic2d)
89         returns Integer is static private;
90         ---Level: Internal
91         ---Purpose: Removes the graphic object <aGraphicObject> from
92         --          the view <me>.
93         --  and returns the previous rank of the deleted object in the display-list. 
94         ---Category: Methods to modify the class definition
95
96         Remove (me: mutable;
97                 aBuffer: Buffer from Graphic2d)
98         is static private;
99         ---Level: Internal
100         ---Purpose: Removes the graphic buffer <aBuffer> from
101         --          the view <me>.
102         ---Category: Methods to modify the class definition
103
104         Remove (me: mutable)
105         is static;
106         ---Level: Public
107         ---Purpose: Removes all the graphic objects from the view <me>.
108         ---Category: Methods to modify the class definition
109
110         Erase (me: mutable)
111         is static;
112         ---Level: Public
113         ---Purpose: Forbids the drawing of all graphic objects in <me>.
114         ---Category: Methods to modify the class definition
115
116         Erase (me: mutable;
117                 aGraphicObject: GraphicObject from Graphic2d)
118         is static private;
119         ---Level: Public
120         ---Purpose: Forbids the drawing of the specified graphic object in <me>.
121         ---Category: Methods to modify the class definition
122
123         Destroy (me: mutable)
124         is static;
125         ---Level: Public
126         ---Purpose: Deletes <me>
127         ---Category: Methods to modify the class definition
128         ---C++: alias ~
129
130         -------------------
131         -- Category: Update
132         -------------------
133
134         Update (me: mutable;
135                 aDriver: Driver from Aspect;
136                 aViewMapping: ViewMapping from Graphic2d;
137                 aXPosition, aYPosition: Real from Standard;
138                 aScale: Real from Standard;
139                 ClearBefore: Boolean from Standard = Standard_True)
140         is static;
141         ---Level: Public
142         ---Purpose: Fully updates the driver <aDriver> in function of
143         --          modifications of the graphic objects displayed
144         --          in the view <me>.
145         --          <aViewMapping> defines the "map from".
146         --          <aXPosition>, <aYPosition>, <aScale> define the "map to".
147         --          The entire window which supporting the view will be
148         --          cleared before if <ClearBefore> flag is TRUE.
149         ---Category: Update
150
151         TinyUpdate (me: mutable;
152                 aDriver: Driver from Aspect;
153                 aViewMapping: ViewMapping from Graphic2d;
154                 aXPosition, aYPosition: Real from Standard;
155                 aScale: Real from Standard;
156                 Reset: Boolean from Standard = Standard_False)
157         is static;
158         ---Level: Public
159         ---Purpose: Partially updates the driver <aDriver> in function of
160         --          modifications of the graphic objects displayed
161         --          in the view <me> with the defined mapping parameters
162         --          and reset the update pointer if <Reset> is TRUE.
163         --  Warning: Only the new primitives created since the last Update
164         --          are drawn. All others primitives are in the fixed
165         --          background.
166         ---Category: Update
167
168         Update (me: mutable;
169                 aDriver: Driver from Aspect;
170                 aGraphicObject: GraphicObject from Graphic2d;
171                 aViewMapping: ViewMapping from Graphic2d;
172                 aXPosition, aYPosition: Real from Standard;
173                 aScale: Real from Standard)
174         is static;
175         ---Level: Public
176         ---Purpose: Partially updates the driver <aDriver> with
177         --          the graphic object <aGraphicObject> in the
178         --          the view <me> with the defined mapping parameters.
179         ---Category: Update
180
181         Update (me: mutable;
182                 aDriver: Driver from Aspect;
183                 aPrimitive: Primitive from Graphic2d;
184                 aViewMapping: ViewMapping from Graphic2d;
185                 aXPosition, aYPosition: Real from Standard;
186                 aScale: Real from Standard)
187         is static;
188         ---Level: Public
189         ---Purpose: Partially updates the driver <aDriver> with
190         --          the primitive <aPrimitive> in the
191         --          the view <me> with the defined mapping parameters.
192         ---Category: Update
193
194         ----------------------------
195         -- Category: Inquire methods
196         ----------------------------
197
198         DisplayList (me)
199         returns DisplayList from Graphic2d
200         is static;
201         ---Level: Public
202         ---Purpose: Returns the list of graphic objects displayed in <me>.
203         ---Category: Inquire methods
204
205         IsIn (me; aGraphicObject: GraphicObject from Graphic2d)
206         returns Boolean from Standard
207         is static;
208         ---Level: Public
209         ---Purpose: Returns Standard_True if the graphic object
210         --          <aGraphicObject> is displayed in <me>,
211         --          Standard_False if not.
212         ---Category: Inquire methods
213
214         MinMax (me; aList: DisplayList from Graphic2d;
215                 Minx, Maxx, Miny, Maxy: out Length from Quantity)
216         is static;
217         ---Level: Public
218         ---Purpose: Returns the coordinates of the boundary box of all
219         --          graphic objects referenced in the list <aList>.
220         --  Warning: All markers are ignored.
221         --  Warning: If <aList> is empty or contains markers and nothing else
222         --          returns Minx = Miny = RealLast () and
223         --          returns Maxx = Maxy = RealFirst ()
224         ---Category: Inquire methods
225
226         MinMax (me; Minx, Maxx, Miny, Maxy: out Length from Quantity)
227         is static;
228         ---Level: Public
229         ---Purpose: Returns the coordinates of the boundary box of all
230         --          graphic objects displayed in the view <me>.
231         --  Warning: All markers are ignored.
232         --  Warning: If <me> is empty or contains markers and nothing else
233         --          returns Minx = Miny = RealLast () and
234         --          returns Maxx = Maxy = RealFirst ()
235         ---Category: Inquire methods
236
237         MarkerMinMax (me; aList: DisplayList from Graphic2d;
238                 Minx, Maxx, Miny, Maxy: out Length from Quantity)
239         is static;
240         ---Level: Public
241         ---Purpose: Returns the coordinates of the boundary box of all
242         --          markers referenced in the graphic objects referenced
243         --          in the list <aList>.
244         --  Warning: If <aList> is empty or without markers
245         --          returns Minx = Miny = RealLast () and
246         --          returns Maxx = Maxy = RealFirst ()
247         ---Category: Inquire methods
248
249         MarkerMinMax (me; Minx, Maxx, Miny, Maxy: out Length from Quantity)
250         is static;
251         ---Level: Public
252         ---Purpose: Returns the coordinates of the boundary box of all
253         --          markers referenced in the graphic objects displayed
254         --          in the view <me>.
255         --  Warning: If <me> is empty or without markers
256         --          returns Minx = Miny = RealLast () and
257         --          returns Maxx = Maxy = RealFirst ()
258         ---Category: Inquire methods
259
260         Position (me;
261                 aGraphicObject: GraphicObject from Graphic2d)
262         returns Integer is static private;
263         ---Level: Internal
264         ---Purpose: Returns the rank of 
265         --  the graphic object <aGraphicObject> in the display-list.
266         ---Category: Inquire methods
267
268         Altitude (me;
269                 aGraphicObject: GraphicObject from Graphic2d)
270         returns Integer is static private;
271         ---Level: Internal
272         ---Purpose: Returns the altitude of 
273         --  the graphic object <aGraphicObject> in the display-list.
274         ---Category: Inquire methods
275
276         -----------------
277         -- Category: Pick
278         -----------------
279
280 --      Pick (me; aViewMapping: ViewMapping from Graphic2d;
281         Pick (me : mutable; aViewMapping: ViewMapping from Graphic2d;
282                 X, Y, aPrecision: Real from Standard;
283                 aXPosition, aYPosition: Real from Standard;
284                 aScale: Real from Standard)
285         returns DisplayList from Graphic2d
286         is static;
287         ---Level: Internal
288         ---Purpose: Returns the list of graphic objects picked.
289
290         ---SAV
291         PickByCircle(me : mutable; aViewMapping : ViewMapping from Graphic2d;
292                                    X, Y, Radius : Real from Standard;
293                                    aXPosition, aYPosition : Real from Standard;
294                                    aScale: Real from Standard)
295         returns DisplayList from Graphic2d
296         is static;
297         ---Level: Internal
298         ---Purpose: Returns the list of graphic objects picked.
299
300
301     Pick( me: mutable; aViewMapping: ViewMapping from Graphic2d;
302               Xmin, Ymin, Xmax, Ymax: Real from Standard;
303                   aXPosition, aYPosition: Real from Standard;
304                   aScale: Real from Standard; 
305                   aPickMode: PickMode from Graphic2d = Graphic2d_PM_INCLUDE )
306         returns DisplayList from Graphic2d;
307
308         ---Level: Internal
309         ---Purpose: Returns Standard_True if the primitive <me> is:
310         --          included in rectangle (<aPickMode = PM_INCLUDE>),
311         --          excluded from rectangle (<aPickMode = PM_EXLUDE>),
312         --          intersected by rectangle (<aPickMode = PM_INTERSECT>),
313         --          defined by Xmin, Ymin, Xmax, Ymax. 
314         --              Standard_False if not.
315
316         ---------------------------------
317         -- Category: Highlight management
318         ---------------------------------
319
320         DefaultOverrideColor (me)
321         returns Integer from Standard
322         ---Level: Public
323         ---Purpose: Returns the override color index.
324         ---Category: Highlight management
325         ---Warning: Raises OverrideColorError if the
326         --          override color index is not defined.
327         raises OverrideColorError from Graphic2d is static;
328
329         IsDefinedColor (me)
330         returns Boolean from Standard
331         is static;
332         ---Level: Public
333         ---Purpose: Returns Standard_True if the override color index
334         --          is defined, Standard_False if not.
335         ---Category: Highlight management
336
337         SetDefaultOverrideColor (me: mutable;
338                 anIndex: Integer from Standard)
339         is static;
340         ---Level: Public
341         ---Purpose: Sets the override color index.
342         ---Category: Highlight management
343
344         ----------------------------------
345         -- Category: Deflection Management
346         ----------------------------------
347
348         --------------------------------------------------------
349         -- Summary of Chordal Deflection                      --
350         --                                                    --
351         -- All drawings of curves or circles are made with    --
352         -- respect to a maximal chordal deflection.           --
353         --                                                    --
354         -- The absolute deflection is given through the       --
355         -- method: SetDeflection.                             --
356         --                                                    --
357         -- The relative deflection is given through the       --
358         -- method: SetDeflectionCoefficient                   --
359         -- In this case the deflection will be :              --
360         -- SizeOfObject * DeflectionCoefficient               --
361         --                                                    --
362         --------------------------------------------------------
363
364         SetTypeOfDeflection (me: mutable;
365                 aTypeOfDeflection: TypeOfDeflection from  Aspect =
366                                                 Aspect_TOD_RELATIVE)
367         is static;
368         ---Level: Internal
369         ---Purpose: by default: TOD_RELATIVE;
370         --          However, except for the shapes, the drawing will be
371         --          made using the absolute deflection.
372         ---Category: Deflection Management
373
374         TypeOfDeflection(me)
375         returns TypeOfDeflection from Aspect
376         is static;
377         ---Level: Internal
378         ---Purpose: Returns the deflection type.
379         ---Category: Deflection Management
380
381         SetDeflection (me: mutable; aDeflection: Length from Quantity = 0.001)
382         is static;
383         ---Level: Internal
384         ---Purpose: Sets the absolute deflection value.
385         ---Category: Deflection Management
386
387         Deflection (me)
388         returns Real from Standard
389         is static;
390         ---Level: Internal
391         ---Purpose: Returns the absolute deflection value.
392         ---Category: Deflection Management
393
394         SetDeflectionCoefficient (me: mutable;
395                 aCoefficient: Real from Standard = 0.00033)
396         is static;
397         ---Level: Internal
398         ---Purpose: Sets the relative deflection coefficient.
399         --          default value = 0.00033
400         ---Category: Deflection Management
401
402         DeflectionCoefficient (me)
403         returns Real from Standard
404         is static;
405         ---Level: Internal
406         ---Purpose: Returns the relative deflection coefficient.
407         ---Category: Deflection Management
408
409         SetTextPrecision (me: mutable; aPrecision: Real from Standard = 0.0015)
410         is static;
411         ---Level: Internal
412         ---Purpose: Sets the MIN viewable text height precision in Device space,
413         --          the texts whose the size is < to this precision
414         --          is drawn at screen with an outlined or filled rectangle. 
415         --          The default text precision value is 0.0015
416         ---Category: Text Management
417  
418         TextPrecision (me)
419         returns Real from Standard
420         is static;
421         ---Level: Internal
422         ---Purpose: Returns the text precision.
423         ---Category: Text Management
424
425         ----------------------------
426         -- Category: Convert methods
427         ----------------------------
428
429         Convert (me; aViewMapping: ViewMapping from Graphic2d;
430                 aDrawPositionX, aDrawPositionY: Real from Standard;
431                 aXPosition, aYPosition: Real from Standard;
432                 aScale: Real from Standard;
433                 aX,  aY: out Real from Standard)
434         is static;
435         ---Level: Internal
436         ---Purpose: ????
437         ---Category: Convert methods
438
439         Convert (me; aViewMapping: ViewMapping from Graphic2d;
440                 aScalar: Real from Standard; aScale: Real from Standard)
441         returns Real from Standard
442         is static;
443         ---Level: Internal
444         ---Purpose: ????
445         ---Category: Convert methods
446
447         ----------------------
448         -- Category: Inquiries
449         ----------------------
450
451         Drawer(me) returns mutable Drawer from Graphic2d is static;
452         ---Level: Internal
453         ---Purpose: Returns the attached drawer of this view.
454         ---Category: Inquiries 
455
456 fields
457         myGraphicObjects:       SequenceOfGraphicObject from Graphic2d;
458         myGraphicAltitudes:     SequenceOfInteger from TColStd;
459         myBuffers:                      SequenceOfBuffer from Graphic2d;
460         myPickList:                     DisplayList from Graphic2d;
461
462         myDefaultOverrideColor: Integer from Standard;
463         myOverrideColorIsDef:   Boolean from Standard;
464
465         myDeflection:                    Length from Quantity;
466         myDeflectionCoefficient: Real from Standard;
467         myTypeOfDeflection:              TypeOfDeflection from Aspect;
468
469 --      myDrawer:                       Drawer from Graphic2d;
470         myDrawer:                       TransientManager from Graphic2d;
471
472         myXCenter:          ShortReal from Standard;
473         myYCenter:          ShortReal from Standard;
474         mySize:             ShortReal from Standard;
475         myXPosition:    ShortReal from Standard;
476         myYPosition:    ShortReal from Standard;
477         myScale:            ShortReal from Standard;
478         myZoom:             ShortReal from Standard;
479         myTextPrecision:ShortReal from Standard;
480
481 friends
482
483         class GraphicObject from Graphic2d,
484         class Buffer from Graphic2d,
485         class Primitive from Graphic2d
486
487 end View from Graphic2d;