2 -- File: Graphic2d_View.cdl
3 -- Created: Tue Jul 13 09:19:31 1993
4 -- Author: Jean Louis FRENKEL
6 ---Copyright: Matra Datavision 1993
8 --- SAV 14/11/01 Added PickByCircle().
10 class View from Graphic2d inherits TShared from MMgt
14 ---Purpose: A View is a graphic object manager.
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,
32 WindowDriver from Aspect,
34 SequenceOfInteger from TColStd,
35 PickMode from Graphic2d
39 OverrideColorError from Graphic2d
42 -------------------------
43 -- Category: Constructors
44 -------------------------
47 returns mutable View from Graphic2d;
49 ---Purpose: Creates a view.
50 -- A view is a set of graphic objects.
51 -- The view manages this set.
53 ---------------------------------------------------
54 -- Category: Methods to modify the class definition
55 ---------------------------------------------------
58 aBuffer: Buffer from Graphic2d)
61 ---Purpose: Adds the grafic buffer <aBuffer> in the
63 -- Warning: Called by the constructor of <aBuffer>
64 ---Category: Methods to modify the class definition
67 aGraphicObject: GraphicObject from Graphic2d;
68 anAltitude: Integer from Standard = 1)
69 returns Integer is static private;
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
78 aGraphicObject: GraphicObject from Graphic2d;
79 anAltitude: Integer from Standard)
80 returns Integer is static private;
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
88 aGraphicObject: GraphicObject from Graphic2d)
89 returns Integer is static private;
91 ---Purpose: Removes the graphic object <aGraphicObject> from
93 -- and returns the previous rank of the deleted object in the display-list.
94 ---Category: Methods to modify the class definition
97 aBuffer: Buffer from Graphic2d)
100 ---Purpose: Removes the graphic buffer <aBuffer> from
102 ---Category: Methods to modify the class definition
107 ---Purpose: Removes all the graphic objects from the view <me>.
108 ---Category: Methods to modify the class definition
113 ---Purpose: Forbids the drawing of all graphic objects in <me>.
114 ---Category: Methods to modify the class definition
117 aGraphicObject: GraphicObject from Graphic2d)
120 ---Purpose: Forbids the drawing of the specified graphic object in <me>.
121 ---Category: Methods to modify the class definition
123 Destroy (me: mutable)
126 ---Purpose: Deletes <me>
127 ---Category: Methods to modify the class definition
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)
142 ---Purpose: Fully updates the driver <aDriver> in function of
143 -- modifications of the graphic objects displayed
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.
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)
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
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)
176 ---Purpose: Partially updates the driver <aDriver> with
177 -- the graphic object <aGraphicObject> in the
178 -- the view <me> with the defined mapping parameters.
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)
189 ---Purpose: Partially updates the driver <aDriver> with
190 -- the primitive <aPrimitive> in the
191 -- the view <me> with the defined mapping parameters.
194 ----------------------------
195 -- Category: Inquire methods
196 ----------------------------
199 returns DisplayList from Graphic2d
202 ---Purpose: Returns the list of graphic objects displayed in <me>.
203 ---Category: Inquire methods
205 IsIn (me; aGraphicObject: GraphicObject from Graphic2d)
206 returns Boolean from Standard
209 ---Purpose: Returns Standard_True if the graphic object
210 -- <aGraphicObject> is displayed in <me>,
211 -- Standard_False if not.
212 ---Category: Inquire methods
214 MinMax (me; aList: DisplayList from Graphic2d;
215 Minx, Maxx, Miny, Maxy: out Length from Quantity)
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
226 MinMax (me; Minx, Maxx, Miny, Maxy: out Length from Quantity)
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
237 MarkerMinMax (me; aList: DisplayList from Graphic2d;
238 Minx, Maxx, Miny, Maxy: out Length from Quantity)
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
249 MarkerMinMax (me; Minx, Maxx, Miny, Maxy: out Length from Quantity)
252 ---Purpose: Returns the coordinates of the boundary box of all
253 -- markers referenced in the graphic objects displayed
255 -- Warning: If <me> is empty or without markers
256 -- returns Minx = Miny = RealLast () and
257 -- returns Maxx = Maxy = RealFirst ()
258 ---Category: Inquire methods
261 aGraphicObject: GraphicObject from Graphic2d)
262 returns Integer is static private;
264 ---Purpose: Returns the rank of
265 -- the graphic object <aGraphicObject> in the display-list.
266 ---Category: Inquire methods
269 aGraphicObject: GraphicObject from Graphic2d)
270 returns Integer is static private;
272 ---Purpose: Returns the altitude of
273 -- the graphic object <aGraphicObject> in the display-list.
274 ---Category: Inquire methods
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
288 ---Purpose: Returns the list of graphic objects picked.
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
298 ---Purpose: Returns the list of graphic objects picked.
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;
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.
316 ---------------------------------
317 -- Category: Highlight management
318 ---------------------------------
320 DefaultOverrideColor (me)
321 returns Integer from Standard
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;
330 returns Boolean from Standard
333 ---Purpose: Returns Standard_True if the override color index
334 -- is defined, Standard_False if not.
335 ---Category: Highlight management
337 SetDefaultOverrideColor (me: mutable;
338 anIndex: Integer from Standard)
341 ---Purpose: Sets the override color index.
342 ---Category: Highlight management
344 ----------------------------------
345 -- Category: Deflection Management
346 ----------------------------------
348 --------------------------------------------------------
349 -- Summary of Chordal Deflection --
351 -- All drawings of curves or circles are made with --
352 -- respect to a maximal chordal deflection. --
354 -- The absolute deflection is given through the --
355 -- method: SetDeflection. --
357 -- The relative deflection is given through the --
358 -- method: SetDeflectionCoefficient --
359 -- In this case the deflection will be : --
360 -- SizeOfObject * DeflectionCoefficient --
362 --------------------------------------------------------
364 SetTypeOfDeflection (me: mutable;
365 aTypeOfDeflection: TypeOfDeflection from Aspect =
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
375 returns TypeOfDeflection from Aspect
378 ---Purpose: Returns the deflection type.
379 ---Category: Deflection Management
381 SetDeflection (me: mutable; aDeflection: Length from Quantity = 0.001)
384 ---Purpose: Sets the absolute deflection value.
385 ---Category: Deflection Management
388 returns Real from Standard
391 ---Purpose: Returns the absolute deflection value.
392 ---Category: Deflection Management
394 SetDeflectionCoefficient (me: mutable;
395 aCoefficient: Real from Standard = 0.00033)
398 ---Purpose: Sets the relative deflection coefficient.
399 -- default value = 0.00033
400 ---Category: Deflection Management
402 DeflectionCoefficient (me)
403 returns Real from Standard
406 ---Purpose: Returns the relative deflection coefficient.
407 ---Category: Deflection Management
409 SetTextPrecision (me: mutable; aPrecision: Real from Standard = 0.0015)
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
419 returns Real from Standard
422 ---Purpose: Returns the text precision.
423 ---Category: Text Management
425 ----------------------------
426 -- Category: Convert methods
427 ----------------------------
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)
437 ---Category: Convert methods
439 Convert (me; aViewMapping: ViewMapping from Graphic2d;
440 aScalar: Real from Standard; aScale: Real from Standard)
441 returns Real from Standard
445 ---Category: Convert methods
447 ----------------------
448 -- Category: Inquiries
449 ----------------------
451 Drawer(me) returns mutable Drawer from Graphic2d is static;
453 ---Purpose: Returns the attached drawer of this view.
454 ---Category: Inquiries
457 myGraphicObjects: SequenceOfGraphicObject from Graphic2d;
458 myGraphicAltitudes: SequenceOfInteger from TColStd;
459 myBuffers: SequenceOfBuffer from Graphic2d;
460 myPickList: DisplayList from Graphic2d;
462 myDefaultOverrideColor: Integer from Standard;
463 myOverrideColorIsDef: Boolean from Standard;
465 myDeflection: Length from Quantity;
466 myDeflectionCoefficient: Real from Standard;
467 myTypeOfDeflection: TypeOfDeflection from Aspect;
469 -- myDrawer: Drawer from Graphic2d;
470 myDrawer: TransientManager from Graphic2d;
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;
483 class GraphicObject from Graphic2d,
484 class Buffer from Graphic2d,
485 class Primitive from Graphic2d
487 end View from Graphic2d;