summaryrefslogtreecommitdiff
path: root/src/Graphic2d/Graphic2d_View.cdl
blob: 4b9be79e4dc884f6c2e21b7b6156b4cb01ebf04e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487

-- File:	Graphic2d_View.cdl
-- Created:	Tue Jul 13 09:19:31 1993
-- Author:	Jean Louis FRENKEL
--		<jlf@stylox>
---Copyright:	 Matra Datavision 1993

--- SAV 14/11/01 Added PickByCircle().

class View from Graphic2d inherits TShared from MMgt

	---Version:

	---Purpose: A View is a graphic object manager.

	---Keywords:
	---Warning:
	---References:

uses
	Buffer			        from Graphic2d,
	GraphicObject		    from Graphic2d,
	Primitive		        from Graphic2d,
	DisplayList		        from Graphic2d,
	SequenceOfGraphicObject	from Graphic2d,
	SequenceOfBuffer     	from Graphic2d,
	Drawer			        from Graphic2d,
	ViewMapping		        from Graphic2d,
	TransientManager	    from Graphic2d,
    TypeOfDeflection	    from Aspect,
	Driver			        from Aspect,
	WindowDriver		    from Aspect,
	Length			        from Quantity,
	SequenceOfInteger	    from TColStd,
	PickMode                from Graphic2d

raises

	OverrideColorError	from Graphic2d
	
is
	-------------------------
	-- Category: Constructors
	-------------------------

	Create
	returns mutable View from Graphic2d;
	---Level: Public
	---Purpose: Creates a view.
	--	    A view is a set of graphic objects.
	--	    The view manages this set.

	---------------------------------------------------
	-- Category: Methods to modify the class definition
	---------------------------------------------------

	Add (me: mutable;
		aBuffer: Buffer from Graphic2d)
	is static private;
	---Level: Internal
	---Purpose: Adds the grafic buffer <aBuffer> in the
	--	    view  <me>.
	--  Warning: Called by the constructor of <aBuffer>
	---Category: Methods to modify the class definition

	Add (me: mutable;
		aGraphicObject: GraphicObject from Graphic2d;
		anAltitude: Integer from Standard = 1)
	returns Integer is static private;
	---Level: Internal
	---Purpose: Adds the graphic object <aGraphicObject> in the
	--	    view  <me> at the altitude <anAltitude>.
	--  and returns the rank of the object in the display-list. 
	--  Warning: Called by the constructor of <aGraphicObject>
	---Category: Methods to modify the class definition

	Change (me: mutable;
		aGraphicObject: GraphicObject from Graphic2d;
		anAltitude: Integer from Standard)
	returns Integer is static private;
	---Level: Internal
	---Purpose: Changes the altitude <anAltitude> of 
	--  the graphic object <aGraphicObject>
	--  and returns the updated rank of the object in the display-list. 
	---Category: Methods to modify the class definition

	Remove (me: mutable;
		aGraphicObject: GraphicObject from Graphic2d)
	returns Integer is static private;
	---Level: Internal
	---Purpose: Removes the graphic object <aGraphicObject> from
	--	    the view <me>.
	--  and returns the previous rank of the deleted object in the display-list. 
	---Category: Methods to modify the class definition

	Remove (me: mutable;
		aBuffer: Buffer from Graphic2d)
	is static private;
	---Level: Internal
	---Purpose: Removes the graphic buffer <aBuffer> from
	--	    the view <me>.
	---Category: Methods to modify the class definition

	Remove (me: mutable)
	is static;
	---Level: Public
	---Purpose: Removes all the graphic objects from the view <me>.
	---Category: Methods to modify the class definition

	Erase (me: mutable)
	is static;
	---Level: Public
	---Purpose: Forbids the drawing of all graphic objects in <me>.
	---Category: Methods to modify the class definition

	Erase (me: mutable;
		aGraphicObject: GraphicObject from Graphic2d)
	is static private;
	---Level: Public
	---Purpose: Forbids the drawing of the specified graphic object in <me>.
	---Category: Methods to modify the class definition

	Destroy (me: mutable)
	is static;
	---Level: Public
	---Purpose: Deletes <me>
	---Category: Methods to modify the class definition
	---C++: alias ~

	-------------------
	-- Category: Update
	-------------------

	Update (me: mutable;
		aDriver: Driver from Aspect;
		aViewMapping: ViewMapping from Graphic2d;
		aXPosition, aYPosition: Real from Standard;
		aScale: Real from Standard;
		ClearBefore: Boolean from Standard = Standard_True)
	is static;
	---Level: Public
	---Purpose: Fully updates the driver <aDriver> in function of
	--	    modifications of the graphic objects displayed
	--	    in the view <me>.
	--	    <aViewMapping> defines the "map from".
	--	    <aXPosition>, <aYPosition>, <aScale> define the "map to".
	--	    The entire window which supporting the view will be
	--	    cleared before if <ClearBefore> flag is TRUE.
	---Category: Update

	TinyUpdate (me: mutable;
		aDriver: Driver from Aspect;
		aViewMapping: ViewMapping from Graphic2d;
		aXPosition, aYPosition: Real from Standard;
		aScale: Real from Standard;
		Reset: Boolean from Standard = Standard_False)
	is static;
	---Level: Public
	---Purpose: Partially updates the driver <aDriver> in function of
	--	    modifications of the graphic objects displayed
	--	    in the view <me> with the defined mapping parameters
	--	    and reset the update pointer if <Reset> is TRUE.
	--  Warning: Only the new primitives created since the last Update
	--	    are drawn. All others primitives are in the fixed
	--	    background.
	---Category: Update

	Update (me: mutable;
		aDriver: Driver from Aspect;
		aGraphicObject: GraphicObject from Graphic2d;
		aViewMapping: ViewMapping from Graphic2d;
		aXPosition, aYPosition: Real from Standard;
		aScale: Real from Standard)
	is static;
	---Level: Public
	---Purpose: Partially updates the driver <aDriver> with
	--          the graphic object <aGraphicObject> in the
	--	    the view <me> with the defined mapping parameters.
	---Category: Update

	Update (me: mutable;
		aDriver: Driver from Aspect;
		aPrimitive: Primitive from Graphic2d;
		aViewMapping: ViewMapping from Graphic2d;
		aXPosition, aYPosition: Real from Standard;
		aScale: Real from Standard)
	is static;
	---Level: Public
	---Purpose: Partially updates the driver <aDriver> with
	--          the primitive <aPrimitive> in the
	--	    the view <me> with the defined mapping parameters.
	---Category: Update

	----------------------------
	-- Category: Inquire methods
	----------------------------

	DisplayList (me)
	returns DisplayList from Graphic2d
	is static;
	---Level: Public
	---Purpose: Returns the list of graphic objects displayed in <me>.
	---Category: Inquire methods

	IsIn (me; aGraphicObject: GraphicObject from Graphic2d)
	returns Boolean from Standard
	is static;
	---Level: Public
	---Purpose: Returns Standard_True if the graphic object
	--	    <aGraphicObject> is displayed in <me>,
	--	    Standard_False if not.
	---Category: Inquire methods

	MinMax (me; aList: DisplayList from Graphic2d;
		Minx, Maxx, Miny, Maxy: out Length from Quantity)
	is static;
	---Level: Public
	---Purpose: Returns the coordinates of the boundary box of all
	--	    graphic objects referenced in the list <aList>.
	--  Warning: All markers are ignored.
	--  Warning: If <aList> is empty or contains markers and nothing else
	--	    returns Minx = Miny = RealLast () and
	--	    returns Maxx = Maxy = RealFirst ()
	---Category: Inquire methods

	MinMax (me; Minx, Maxx, Miny, Maxy: out Length from Quantity)
	is static;
	---Level: Public
	---Purpose: Returns the coordinates of the boundary box of all
	--	    graphic objects displayed in the view <me>.
	--  Warning: All markers are ignored.
	--  Warning: If <me> is empty or contains markers and nothing else
	--	    returns Minx = Miny = RealLast () and
	--	    returns Maxx = Maxy = RealFirst ()
	---Category: Inquire methods

	MarkerMinMax (me; aList: DisplayList from Graphic2d;
		Minx, Maxx, Miny, Maxy: out Length from Quantity)
	is static;
	---Level: Public
	---Purpose: Returns the coordinates of the boundary box of all
	--	    markers referenced in the graphic objects referenced
	--	    in the list <aList>.
	--  Warning: If <aList> is empty or without markers
	--	    returns Minx = Miny = RealLast () and
	--	    returns Maxx = Maxy = RealFirst ()
	---Category: Inquire methods

	MarkerMinMax (me; Minx, Maxx, Miny, Maxy: out Length from Quantity)
	is static;
	---Level: Public
	---Purpose: Returns the coordinates of the boundary box of all
	--	    markers referenced in the graphic objects displayed
	--	    in the view <me>.
	--  Warning: If <me> is empty or without markers
	--	    returns Minx = Miny = RealLast () and
	--	    returns Maxx = Maxy = RealFirst ()
	---Category: Inquire methods

	Position (me;
		aGraphicObject: GraphicObject from Graphic2d)
	returns Integer is static private;
	---Level: Internal
	---Purpose: Returns the rank of 
	--  the graphic object <aGraphicObject> in the display-list.
	---Category: Inquire methods

	Altitude (me;
		aGraphicObject: GraphicObject from Graphic2d)
	returns Integer is static private;
	---Level: Internal
	---Purpose: Returns the altitude of 
	--  the graphic object <aGraphicObject> in the display-list.
	---Category: Inquire methods

	-----------------
	-- Category: Pick
	-----------------

--	Pick (me; aViewMapping: ViewMapping from Graphic2d;
	Pick (me : mutable; aViewMapping: ViewMapping from Graphic2d;
		X, Y, aPrecision: Real from Standard;
		aXPosition, aYPosition: Real from Standard;
		aScale: Real from Standard)
	returns DisplayList from Graphic2d
	is static;
	---Level: Internal
	---Purpose: Returns the list of graphic objects picked.

    	---SAV
	PickByCircle(me : mutable; aViewMapping : ViewMapping from Graphic2d;
		                   X, Y, Radius : Real from Standard;
		                   aXPosition, aYPosition : Real from Standard;
		                   aScale: Real from Standard)
	returns DisplayList from Graphic2d
	is static;
	---Level: Internal
	---Purpose: Returns the list of graphic objects picked.


    Pick( me: mutable; aViewMapping: ViewMapping from Graphic2d;
	      Xmin, Ymin, Xmax, Ymax: Real from Standard;
		  aXPosition, aYPosition: Real from Standard;
		  aScale: Real from Standard; 
		  aPickMode: PickMode from Graphic2d = Graphic2d_PM_INCLUDE )
	returns DisplayList from Graphic2d;

	---Level: Internal
	---Purpose: Returns Standard_True if the primitive <me> is:
	--          included in rectangle (<aPickMode = PM_INCLUDE>),
	--          excluded from rectangle (<aPickMode = PM_EXLUDE>),
	--          intersected by rectangle (<aPickMode = PM_INTERSECT>),
	--          defined by Xmin, Ymin, Xmax, Ymax. 
	--	        Standard_False if not.

	---------------------------------
	-- Category: Highlight management
	---------------------------------

	DefaultOverrideColor (me)
	returns Integer from Standard
	---Level: Public
	---Purpose: Returns the override color index.
	---Category: Highlight management
	---Warning: Raises OverrideColorError if the
	--          override color index is not defined.
	raises OverrideColorError from Graphic2d is static;

	IsDefinedColor (me)
	returns Boolean from Standard
	is static;
	---Level: Public
	---Purpose: Returns Standard_True if the override color index
	--	    is defined, Standard_False if not.
	---Category: Highlight management

	SetDefaultOverrideColor (me: mutable;
		anIndex: Integer from Standard)
	is static;
	---Level: Public
	---Purpose: Sets the override color index.
	---Category: Highlight management

	----------------------------------
	-- Category: Deflection Management
	----------------------------------

	--------------------------------------------------------
	-- Summary of Chordal Deflection                      --
	--                                                    --
	-- All drawings of curves or circles are made with    --
	-- respect to a maximal chordal deflection.           --
	--                                                    --
	-- The absolute deflection is given through the       --
	-- method: SetDeflection.                             --
	--                                                    --
	-- The relative deflection is given through the       --
	-- method: SetDeflectionCoefficient                   --
	-- In this case the deflection will be :              --
	-- SizeOfObject * DeflectionCoefficient               --
	--                                                    --
	--------------------------------------------------------

	SetTypeOfDeflection (me: mutable;
		aTypeOfDeflection: TypeOfDeflection from  Aspect =
						Aspect_TOD_RELATIVE)
	is static;
	---Level: Internal
	---Purpose: by default: TOD_RELATIVE;
	--	    However, except for the shapes, the drawing will be
	--	    made using the absolute deflection.
	---Category: Deflection Management

   	TypeOfDeflection(me)
	returns TypeOfDeflection from Aspect
	is static;
	---Level: Internal
	---Purpose: Returns the deflection type.
	---Category: Deflection Management

	SetDeflection (me: mutable; aDeflection: Length from Quantity = 0.001)
	is static;
	---Level: Internal
	---Purpose: Sets the absolute deflection value.
	---Category: Deflection Management

	Deflection (me)
	returns Real from Standard
	is static;
	---Level: Internal
	---Purpose: Returns the absolute deflection value.
	---Category: Deflection Management

	SetDeflectionCoefficient (me: mutable;
		aCoefficient: Real from Standard = 0.00033)
	is static;
	---Level: Internal
	---Purpose: Sets the relative deflection coefficient.
	--	    default value = 0.00033
	---Category: Deflection Management

	DeflectionCoefficient (me)
	returns Real from Standard
	is static;
	---Level: Internal
	---Purpose: Returns the relative deflection coefficient.
	---Category: Deflection Management

 	SetTextPrecision (me: mutable; aPrecision: Real from Standard = 0.0015)
 	is static;
 	---Level: Internal
 	---Purpose: Sets the MIN viewable text height precision in Device space,
 	--	    the texts whose the size is < to this precision
 	--	    is drawn at screen with an outlined or filled rectangle. 
 	--          The default text precision value is 0.0015
 	---Category: Text Management
 
 	TextPrecision (me)
 	returns Real from Standard
 	is static;
 	---Level: Internal
 	---Purpose: Returns the text precision.
 	---Category: Text Management

	----------------------------
	-- Category: Convert methods
	----------------------------

	Convert (me; aViewMapping: ViewMapping from Graphic2d;
		aDrawPositionX, aDrawPositionY: Real from Standard;
		aXPosition, aYPosition: Real from Standard;
		aScale: Real from Standard;
		aX,  aY: out Real from Standard)
	is static;
	---Level: Internal
	---Purpose: ????
	---Category: Convert methods

	Convert (me; aViewMapping: ViewMapping from Graphic2d;
		aScalar: Real from Standard; aScale: Real from Standard)
	returns Real from Standard
	is static;
	---Level: Internal
	---Purpose: ????
	---Category: Convert methods

	----------------------
	-- Category: Inquiries
	----------------------

	Drawer(me) returns mutable Drawer from Graphic2d is static;
	---Level: Internal
	---Purpose: Returns the attached drawer of this view.
	---Category: Inquiries 

fields
	myGraphicObjects:	SequenceOfGraphicObject from Graphic2d;
	myGraphicAltitudes:	SequenceOfInteger from TColStd;
	myBuffers:			SequenceOfBuffer from Graphic2d;
	myPickList:			DisplayList from Graphic2d;

	myDefaultOverrideColor:	Integer from Standard;
	myOverrideColorIsDef:	Boolean from Standard;

	myDeflection:			 Length from Quantity;
	myDeflectionCoefficient: Real from Standard;
	myTypeOfDeflection:		 TypeOfDeflection from Aspect;

--	myDrawer:			Drawer from Graphic2d;
	myDrawer:			TransientManager from Graphic2d;

	myXCenter:	    ShortReal from Standard;
	myYCenter:	    ShortReal from Standard;
	mySize:		    ShortReal from Standard;
	myXPosition:    ShortReal from Standard;
	myYPosition:    ShortReal from Standard;
	myScale:	    ShortReal from Standard;
	myZoom:		    ShortReal from Standard;
	myTextPrecision:ShortReal from Standard;

friends

	class GraphicObject from Graphic2d,
	class Buffer from Graphic2d,
	class Primitive from Graphic2d

end View from Graphic2d;