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
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
|
-- File: Graphic2d_GraphicObject.cdl
-- Created: Tue Jun 22 16:52:21 1993
-- Authors: Jean Louis FRENKEL, Gerard GRAS
-- <jlf@stylox>
-- Modified: GG 27/04/00 G002 Add empty constructor and
-- SetView() method.
-- GG 14/04/00 G002 Add SetPickedIndex() method
-- TCl : 12-06-00 : G002 : new method Pick( Xmin, Ymin, Xmax, Ymax,...)
-- SAV : 14/11/01 Added PickByCircle() picking by a circle.
-- SAV : 16/08/02 Added field to control object status.
--
---Copyright: Matra Datavision 1993
class GraphicObject from Graphic2d inherits TShared from MMgt
---Purpose: Creates a 2D graphic object in a view.
-- A graphic object is a primitives manager.
uses
ViewPtr from Graphic2d,
Drawer from Graphic2d,
View from Graphic2d,
IndexedMapOfTransient from TColStd,
Primitive from Graphic2d,
CBitFields8 from Graphic2d,
TypeOfComposition from Graphic2d,
Length from Quantity,
GTrsf2d from gp,
PickMode from Graphic2d,
HSequenceOfInteger from TColStd,
DisplayStatus from Graphic2d
raises
OverrideColorError from Graphic2d,
OutOfRange from Standard
is
-------------------------
-- Category: Constructors
-------------------------
Create returns mutable GraphicObject from Graphic2d;
---Level: Public
---Purpose: Creates an unattached graphic object,
-- the attachment will be realized more later
-- using the method SetView().
Create (aView: View from Graphic2d)
returns mutable GraphicObject from Graphic2d;
---Level: Public
---Purpose: Creates a graphic object in the view <aView>.
-- A graphic object manages a sequence of primitives.
-- By default a graphic object is :
-- - empty.
-- - plottable.
-- - drawable.
-- - pickable.
-- - not displayed.
-- - not highlighted.
-- - a relative drawing priority of 0
---Category: Constructors
-------------------------------------------------
-- Category: Methods to manage the transformation
-------------------------------------------------
SetView( me: mutable; aView: View from Graphic2d );
---Level: Public
---Purpose: Attach the graphic object to this view
SetTransform (me : mutable; aTrsf : in GTrsf2d from gp;
aType : TypeOfComposition from Graphic2d = Graphic2d_TOC_REPLACE)
is static;
---Level: Public
---Purpose: Sets the transformation <aTrsf> applied to
-- the primitives according to the composition type.
---Category: Methods to manage the transformation
Transform (me)
returns GTrsf2d from gp
is static;
---Level: Public
---Purpose: Returns the transformation applied to
-- the primitives.
---C++: return const &
IsTransformed (me)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns Standard_True if the associated
-- transformation is not the Identity.
----------------------------------------
-- Category: Methods to manage the layer
----------------------------------------
SetLayer (me: mutable; aLayer: Integer from Standard)
is static;
---Level: Internal
---Purpose: Modifies the layer of the graphic object <me>.
---Category: Methods to manage the layer
Layer (me)
returns Integer from Standard
is static;
---Level: Internal
---Purpose: Returns the layer of the graphic object <me>.
---Category: Methods to manage the layer
-------------------------------------------------
-- Category: Methods to manage the drawing priority
-------------------------------------------------
SetPriority (me: mutable; aPriority: Integer from Standard)
---Level: Public
---Purpose: Modifies the drawing priority of the graphic object <me>.
-- <aPriority> of 0 is the lowest priority.
-- <aPriority> of MaxPriority() is the highest priority.
raises OutOfRange from Standard is static;
---Trigger: If <aPriority> is < 0 or > MaxPriority()
---Category: Methods to manage the priority
Priority (me)
returns Integer from Standard
is static;
---Level: Public
---Purpose: Returns the drawing priority of the graphic object
MaxPriority (me) returns Integer from Standard is virtual;
---Level: Public
---Purpose: Returns the max usable relative priority of the
-- "standard" graphic object.
------------------------------------------
-- Category: Methods to manage the plotter
------------------------------------------
EnablePlot (me: mutable)
is static;
---Level: Internal
---Purpose: Allows the drawing of graphic object <me> on a plotter.
---Category: Methods to manage the plotter
DisablePlot (me: mutable)
is static;
---Level: Internal
---Purpose: Forbids the drawing of graphic object <me> on a plotter.
---Category: Methods to manage the plotter
IsPlottable (me)
returns Boolean from Standard
is static;
---Level: Internal
---Purpose: Returns Standard_True if the graphic object <me>
-- is plottable, Standard_False if not.
---Category: Methods to manage the plotter
------------------------------------------
-- Category: Methods to manage the drawing
------------------------------------------
EnableDraw (me: mutable)
is static;
---Level: Public
---Purpose: Allows the drawing of graphic object <me>.
---Category: Methods to manage the drawing
DisableDraw (me: mutable)
is static;
---Level: Public
---Purpose: Forbids the drawing of graphic object <me>.
---Category: Methods to manage the drawing
IsDrawable (me)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns Standard_True if the graphic object <me>
-- is drawable, Standard_False if not.
---Category: Methods to manage the drawing
IsIn (me; aPrimitive: Primitive from Graphic2d)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns Standard_True if the primitive <aPrimitive>
-- is in the graphic object <me>, Standard_False if not.
---Category: Methods to manage the drawing
RemovePrimitive (me: mutable; aPrimitive: Primitive from Graphic2d)
is static;
---Level: Public
---Purpose: Removes the primitive <aPrimitive> from <me>.
---Category: Methods to manage the drawing
RemovePrimitives (me: mutable)
is static;
---Level: Public
---Purpose: Removes all the primitives from <me>.
---Category: Methods to manage the drawing
Remove (me: mutable)
is static;
---Level: Public
---Purpose: Removes <me> from the associated view.
-- If <me> was displayed or highlighted, <me>
-- is removed from the display list of the associated view.
---Category: Methods to manage the drawing
------------------------------------------
-- Category: Methods to manage the picking
------------------------------------------
EnablePick (me: mutable)
is static;
---Level: Public
---Purpose: Allows the picking on the graphic object <me>.
---Category: Methods to manage the picking
DisablePick (me: mutable)
is static;
---Level: Public
---Purpose: Forbids the picking on the graphic object <me>.
---Category: Methods to manage the picking
IsPickable (me)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns Standard_True if the graphic object <me>
-- is pickable, Standard_False if not.
---Category: Methods to manage the picking
---------------------------------------------
-- Category: Methods to manage the visibility
---------------------------------------------
Display (me: mutable)
is static;
---Level: Public
---Purpose: Allows the drawing of the graphic object <me>.
---Category: Methods to manage the visibility
Erase (me: mutable)
is static;
---Level: Public
---Purpose: Forbids the drawing of the graphic object <me>.
---Category: Methods to manage the visibility
IsDisplayed (me)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns Standard_True if the graphic object <me>
-- is displayed, Standard_False if not.
---Category: Methods to manage the visibility
--------------------------------------------
-- Category: Methods to manage the highlight
--------------------------------------------
Highlight (me: mutable)
---Level: Public
---Purpose: Highlights the graphic object <me> with the
-- override color of the view.
---Category: Methods to manage the highlight
-- Warning: Raises if the default override color of the view
-- has not been defined.
raises OverrideColorError from Graphic2d is static;
Highlight (me: mutable; aColorIndex: Integer from Standard)
is static;
---Level: Public
---Purpose: Highlights the graphic object <me> with the
-- specified color.
---Category: Methods to manage the highlight
Unhighlight (me: mutable)
is static;
---Level: Public
---Purpose: Suppress the highlight the graphic object <me>.
---Category: Methods to manage the highlight
IsHighlighted (me)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns Standard_True if the graphic object <me>
-- is highlighted, Standard_False if not.
---Category: Methods to manage the highlight
SetOffSet (me: mutable;
anOffSet: Integer from Standard)
is static;
---Level: Public
---Purpose: Specifies an offset applied to the original color
-- index when drawing a primitives, those already created
-- and the future one.
-- Warning: To reset the real color of the primitives when drawing
-- then you have to call this method with <anOffSet> = 0.
OffSet (me)
returns Integer from Standard
is static;
---Level: Public
---Purpose: Returns the offset applied to the original color
-- index of all primitives in the graphic object <me>.
---Category: Methods to manage the highlight
OverrideColor (me)
returns Integer from Standard
is static;
---Level: Public
---Purpose: Returns the current overridel color apply to
-- this graphic object.
---Category: Methods to manage the highlight
SetOverrideColor(me: mutable; indColor: Integer from Standard );
---Level: Public
---Purpose: Sets the current overridel color apply to
-- this graphic object.
---Category: Methods to manage the highlight
----------------------
-- Category: Inquiries
----------------------
Length(me) returns Integer from Standard is static;
---Level: Public
---Purpose: Returns the number of primitive of the graphic object.
---Category: Inquiries
Primitive(me; aRank: Integer from Standard)
returns mutable Primitive from Graphic2d
---Level: Public
---Purpose: Returns the primitive of rank <aRank>
--from the graphic object.
raises OutOfRange from Standard is static;
---Trigger: If <aRank> is < 1 or > Length()
---Category: Inquiries
MinMax (me; Minx, Maxx, Miny, Maxy: out Length from Quantity)
returns Boolean from Standard is virtual;
---Level: Public
---Purpose: Returns the min max values of <me>.
-- Warning: All markers are ignored.
-- Warning: If <me> is empty or not displayed or
-- contains markers and nothing else
-- returns FALSE and
-- Minx = Miny = RealFirst ()
-- Maxx = Maxy = RealLast ()
---Category: Inquiries
MarkerMinMax (me;
Minx, Maxx, Miny, Maxy: out Length from Quantity)
returns Boolean from Standard is virtual;
---Level: Public
---Purpose: Returns the min max values of all markers in <me>.
-- Warning: If <me> is empty or not displayed or without markers
-- returns FALSE and
-- Minx = Miny = RealFirst ()
-- Maxx = Maxy = RealLast ()
---Category: Inquiries
SetPickedIndex (me : mutable; anIndex: Integer from Standard)
is static protected;
---Level: Public
---Purpose: Sets the index of the picked primitive if any.
---Category: Methods to manage picking
PickedIndex(me) returns Integer from Standard;
---Level: Public
---Purpose: Returns the last picked primitive index in this.
-- Warning: This is available only if the Pick() method has
-- returned Standard_True.
---Category: Inquiries
----------------------------
-- Category: Private methods
----------------------------
Draw (me: mutable;
aDrawer: Drawer from Graphic2d;
Reset: Boolean from Standard)
is virtual protected;
---Level: Internal
---Purpose: Drawn the last Undrawn primitives managed by the
-- graphic object <me> in the drawer <aDrawer>.
-- Called by the methods :
-- - Graphic2d_View::TinyUpdate ()
---Category: Private methods
Draw (me: mutable;
aDrawer: Drawer from Graphic2d;
aPrimitive: Primitive from Graphic2d)
is virtual protected;
---Level: Internal
---Purpose: Drawn a primitive managed by the
-- graphic object <me> in the drawer <aDrawer>.
-- Called by the method Graphic2d_View::Update (aPrimitive)
---Category: Private methods
Redraw (me: mutable;
aDrawer: Drawer from Graphic2d)
is static private;
---Level: Internal
---Purpose: Drawn all the primitives managed by the
-- graphic object <me> in the drawer <aDrawer>.
-- Called by the method :
-- - Graphic2d_View::Update (aViewMapping, x, y, scale)
---Category: Private methods
Pick (me : mutable; X, Y: Real from Standard;
aPrecision: Real from Standard;
aDrawer: Drawer from Graphic2d)
returns Boolean from Standard
is virtual protected;
---Level: Internal
---Purpose: Returns Standard_True if the graphic object <me>
-- is picked, Standard_False if not.
-- Called by the method Graphic2d_View::Pick
---Category: Protected methods
PickByCircle (me : mutable; X, Y, Radius : Real from Standard;
aDrawer: Drawer from Graphic2d)
returns Boolean from Standard
is virtual protected;
---Level: Internal
---Purpose: Returns Standard_True if the graphic object <me>
-- is picked, Standard_False if not.
-- Called by the method Graphic2d_View::PickByCircle
---Category: Private methods
Pick( me: mutable; Xmin, Ymin, Xmax, Ymax: Real from Standard;
aDrawer: Drawer from Graphic2d;
aPickMode: PickMode from Graphic2d = Graphic2d_PM_INCLUDE )
returns Boolean from Standard is virtual protected;
---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.
PickList( me ) returns HSequenceOfInteger from TColStd;
---Level: Internal
---Purpose: Returns the sequence of picked primitives.
View (me)
returns mutable View from Graphic2d
is static private;
---Level: Internal
---Purpose: Returns the view which manages <me>.
-- Called by the constructor of Primitive.
---Category: Private methods
AddPrimitive (me: mutable; aPrimitive: Primitive from Graphic2d)
is static private;
---Level: Internal
---Purpose: Adds the primitive <aPrimitive> in <me>.
-- Called by the constructor of Primitive.
---Category: Private methods
SetIndex (me: mutable; aPrimitive: Primitive from Graphic2d)
is static private;
---Level: Internal
---Purpose: Sets the current index in the GraphicObject <me>
-- to the index of the primitive <aPrimitive>.
---Category: Private methods
IsUpToDate (me) returns Boolean from Standard
is static protected;
---Level: Internal
---Purpose: Returns TRUE when the graphic object is
-- up to date at screen;
BasePriority (me) returns Integer from Standard is virtual private;
---Level: Public
---Purpose: Returns the min usable absolute priority of the
-- "standard" graphic object.
fields
myViewPtr: ViewPtr from Graphic2d;
myPrimitives: IndexedMapOfTransient from TColStd;
myLayer: Integer from Standard;
myTrsf: GTrsf2d from gp;
myCBitFields: CBitFields8 from Graphic2d;
myOverrideColor: Integer from Standard is protected;
myCurrentIndex: Integer from Standard is protected;
myOffSet: Integer from Standard is protected;
-- myPickedIndex: Integer from Standard is protected;
myPickedIndex: Integer from Standard;
myIsUpToDate: Boolean from Standard is protected;
myIsTransformed: Boolean from Standard is protected;
myPriority: Integer from Standard;
myPickIndices: HSequenceOfInteger from TColStd;
myDisplayStatus : DisplayStatus from Graphic2d;
friends
class Primitive from Graphic2d,
class View from Graphic2d,
class TransientManager from Graphic2d
end GraphicObject from Graphic2d;
|