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
|
-- File: Graphic2d_Primitive.cdl
-- Created: Tue Jun 22 16:33:45 1993
-- Author: Jean Louis FRENKEL, Gerard GRAS.
-- <jlf@stylox>
-- Updated: GG 19/08/98 PERFORMANCE
-- A new method ComputeMinMax(...) could be redefined for
-- each primitive to recompute the MinMax values at the right time.
-- GG 14/04/00 G002 Add SetPickedIndex() method
-- Add DrawElement() and DrawVertex() methods
-- GG 05/05/00 G002 Add IsOn() method.
-- Add Highlight(),Unhilight(),IsHighlighted()
-- HighlightIndex() methods.
-- TCL : 12-06-00 : G002 : new method Pick( Xmin, Ymin, Xmax, Ymax,...)
-- TCL : 07-07-00 : G002 : new method HighlightIndices()
-- method HighlightIndex() was removed
-- TCL : 25-07-00 : G002 : new methods SetDisplayMode( aMode ) and DisplayMode()
-- SAV : 14/11/01 : Added a set of methods (marked SAV before declaration)
-- to provide highlighting/selection
-- of SetOfMarkers elements. These methods should be redefined
-- for other SetOf<>.
--
-- SAV : 03/07/02 : SetElementsSelected() prototype changed to avoid regression
-- during elements single selection.
---Copyright: Matra Datavision 1993
deferred class Primitive from Graphic2d inherits TShared from MMgt
---Version:
---Purpose: Groups all drawing elements which can be stored
-- in a graphic object.
-- Each primitive have a postion in the space model.
uses
Buffer from Graphic2d,
GOPtr from Graphic2d,
Drawer from Graphic2d,
GraphicObject from Graphic2d,
TypeOfPrimitive from Graphic2d,
Length from Quantity,
PickMode from Graphic2d,
HSequenceOfInteger from TColStd,
-- IFStream from Aspect,
FStream from Aspect,
MapOfInteger from TColStd
is
-------------------------
-- Category: Constructors
-------------------------
Initialize (aGraphicObject: GraphicObject from Graphic2d);
---Level: Public
---Purpose: Creates a primitive in a graphic object <aGraphicObject>.
---Category: Constructors
----------------------------------------------
-- Category: Methods to manage color attribute
----------------------------------------------
SetColorIndex(me: mutable; anIndex: Integer from Standard)
is static;
---Level: Public
---Purpose: Defines the index, in the color map, of the primitive color.
-- Warning: For an image, this method defines the color of the
-- boundary rectangle.
---Category: Methods to manage color attribute
ColorIndex (me)
returns Integer from Standard
is static;
---Level: Public
---Purpose: Returns the index, in the color map, of the primitive color.
-- Warning: For an image, it is the color of the border.
---Category: Methods to manage color attribute
--------------------------
-- Category: Draw and Pick
--------------------------
Draw (me : mutable; aDrawer: Drawer from Graphic2d)
is deferred;
---Level: Internal
---Purpose: Draws the primitive <me>.
DrawElement (me : mutable; aDrawer: Drawer from Graphic2d;
anElement: Integer from Standard)
is virtual protected;
---Level: Internal
---Purpose: Draws the element <anElement> of the primitive <me>.
---SAV
DrawPickedElements(me : mutable; aDrawer: Drawer from Graphic2d )
is virtual protected;
---Level: Internal
---Purpose: Draws the all picked elements of the primitive <me>.
---SAV
DrawSelectedElements(me : mutable; aDrawer: Drawer from Graphic2d )
is virtual protected;
---Level: Internal
---Purpose: Draws the all picked elements of the primitive <me>.
---SAV
SetElementsSelected(me : mutable) returns Boolean from Standard
is virtual;
---Level: Public
---Purpose: Declares that previously highlighted elements will be selected ones.
-- Warning: If a descendant redefines this method then it must return <true>!
---SAV
HasSelectedElements(me : mutable)
returns Boolean from Standard is virtual;
---Level: Public
---SAV
ClearSelectedElements(me : mutable)
is virtual;
---Level: Public
DrawVertex (me : mutable; aDrawer: Drawer from Graphic2d;
aVertex: Integer from Standard)
is virtual protected;
---Level: Internal
---Purpose: Draws the vertex <aVertex> of the primitive <me>.
Pick (me : mutable; X, Y: ShortReal from Standard;
aPrecision: ShortReal from Standard;
aDrawer: Drawer from Graphic2d)
returns Boolean from Standard
is deferred protected;
---Level: Internal
---Purpose: Returns Standard_True if the primitive <me> is picked,
-- Standard_False if not.
---SAV
PickByCircle (me : mutable; X, Y, Radius : ShortReal 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 picked,
-- Standard_False if not.
Pick( me: mutable; Xmin, Ymin, Xmax, Ymax: ShortReal 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.
NumOfElemIndices( me ) returns Integer from Standard
is virtual;
---Level: Internal
---Purpose: Returns number of elements of primitive
NumOfVertIndices( me ) returns Integer from Standard
is virtual;
---Level: Internal
---Purpose: Returns number of vertices of primitive
SetPickedIndex (me : mutable; anIndex: Integer from Standard)
is static protected;
---Level: Public
---Purpose: Sets the index of the picked primitive element if any.
---Category: Methods to manage picking
PickedIndex (me) returns Integer from Standard is static;
---Level: Public
---Purpose: Returns the index of the last picked primitive element.
-- Warning: This is available only if the Pick() method has
-- returned Standard_True.
---Category: Methods to manage picking
---SAV
PickedIndices(me) returns MapOfInteger from TColStd is static;
---C++: return const &
Highlight (me: mutable;
anIndex: Integer from Standard = 0)
is static;
---Level: Public
---Purpose: Highlights the primitive <me> or a part of the
-- primitive with the override color of the view.
-- When <anIndex> is 0 all the primitive is highlighted
-- >0 only the requested element is highlighted.
-- <0 only the requested vertex is highlighted.
---Category: Methods to manage the highlight
Unhighlight (me: mutable)
is static;
---Level: Public
---Purpose: Suppress the highlight on the primitive <me>.
---Category: Methods to manage the highlight
IsHighlighted (me)
returns Boolean from Standard
is static;
---Level: Public
---Purpose: Returns Standard_True if the primitive <me>
-- is highlighted, Standard_False if not.
---Category: Methods to manage the highlight
HighlightIndices(me) returns HSequenceOfInteger from TColStd;
---Level: Public
---Purpose: Returns the sequence of highlight indices of the primitive <me>
---Category: Methods to manage the highlight
SetDisplayMode( me: mutable; aMode: Integer from Standard );
---Level : Public;
---Purpose : Sets the display mode of primitive
---Category : Methods to manage the display mode
DisplayMode( me ) returns Integer from Standard;
---Level : Public;
---Purpose : Indicates the display mode of primitive
---Category : Methods to manage the display mode
----------------------------
-- Category: Private methods
----------------------------
MinMax (me : mutable; Minx, Maxx, Miny, Maxy: out ShortReal from Standard)
returns Boolean from Standard is static;
---Level: Internal
---Purpose: Returns TRUE and the min max values of <me>.
-- or FALSE when the primitive is empty.
-- Called by the method Graphic2d_GraphicObject::MinMax
ComputeMinMax (me : mutable)
returns Boolean from Standard is virtual protected;
---Level: Internal
---Purpose: Computes the MinMax of the primitive if possible.
IsOn( myclass;
aX1, aY1, aX2, aY2,
aPrecision: ShortReal from Standard)
returns Boolean from Standard is protected ;
---Level: Internal
---Purpose: Returns Standard_True if (<aX1>, <aY1>) is closed
-- to the point (<aX2>, <aY2>).
---Category: Class methods
IsInMinMax (me : mutable; X, Y: ShortReal from Standard;
aPrecision: ShortReal from Standard)
returns Boolean from Standard;
---Level: Internal
---Purpose: Returns Standard_True if the point <X>, <Y> is in the
-- rectangle defined by the min max values of <me>.
-- Warning: If <me> is in a transformed GraphicObject then
-- the min max values are transformed.
Drawer(me) returns mutable Drawer from Graphic2d is protected;
---Level: Internal
---Purpose: Returns the attached drawer of the view of this Primitive.
---Category: Inquiries
PGraphicObject(me) returns GOPtr from Graphic2d is private;
---Level: Internal
---Purpose: Returns the graphic-object back pointer of this Primitive.
---Category: Inquiries
ResetIndex (me: mutable) is protected;
---Level: Internal
---Purpose: Resets the starting traversal index to this primitive.
SetFamily (me : mutable; aFamily: TypeOfPrimitive from Graphic2d)
is protected;
---Level: Internal
---Purpose: Sets the family of this primitive.
Family (me) returns TypeOfPrimitive is protected;
---Level: Internal
---Purpose: Returns the family of this primitive
----------------------------------------------------------------------
Save(me; aFStream: in out FStream from Aspect) is deferred;
-- Retrieve(me; anIFStream: in out IFStream from Aspect) is deferred;
fields
myGOPtr : GOPtr from Graphic2d is protected;
myMinX : ShortReal from Standard is protected;
myMinY : ShortReal from Standard is protected;
myMaxX : ShortReal from Standard is protected;
myMaxY : ShortReal from Standard is protected;
myColorIndex : Integer from Standard is protected;
myPickedIndex : Integer from Standard;
---SAV
myPickedIndices : MapOfInteger from TColStd is protected;
myTypeOfPrimitive : TypeOfPrimitive from Graphic2d;
mySeqOfHighInd : HSequenceOfInteger from TColStd;
myNumOfElem : Integer from Standard is protected;
myNumOfVert : Integer from Standard is protected;
myDisplayMode : Integer from Standard is protected;
friends
class Buffer from Graphic2d,
Draw from class GraphicObject from Graphic2d
(me: mutable;
aDrawer: Drawer from Graphic2d;
Reset: Boolean from Standard),
Draw from class GraphicObject from Graphic2d
(me: mutable;
aDrawer: Drawer from Graphic2d;
aPrimitive: Primitive from Graphic2d),
Pick from class GraphicObject from Graphic2d
(me : mutable;
X, Y: Real from Standard;
aPrecision: Real from Standard;
aDrawer: Drawer from Graphic2d),
---SAV
PickByCircle from class GraphicObject from Graphic2d
(me : mutable;
X, Y: Real from Standard;
Radius: Real from Standard;
aDrawer: Drawer from Graphic2d),
Pick from class GraphicObject from Graphic2d
( me : mutable;
Xmin, Ymin, Xmax, Ymax: Real from Standard;
aDrawer: Drawer from Graphic2d;
aPickMode: PickMode from Graphic2d ),
MinMax from class GraphicObject from Graphic2d
(me;
Minx, Maxx, Miny, Maxy: out Length from Quantity),
MarkerMinMax from class GraphicObject from Graphic2d
(me;
Minx, Maxx, Miny, Maxy: out Length from Quantity),
RemovePrimitive from class GraphicObject from Graphic2d
(me: mutable;
aPrimitive: Primitive from Graphic2d),
Draw from class TransientManager from Graphic2d
(me: mutable;
aPrimitive: Primitive from Graphic2d),
DrawElement from class TransientManager from Graphic2d
(me: mutable;
aPrimitive: Primitive from Graphic2d;
anIndex: Integer from Standard),
DrawVertex from class TransientManager from Graphic2d
(me: mutable;
aPrimitive: Primitive from Graphic2d;
anIndex: Integer from Standard),
---SAV
DrawPickedElements from class TransientManager from Graphic2d
(me : mutable;
aPrimitive : Primitive from Graphic2d )
end Primitive from Graphic2d;
|