Integration of OCCT 6.5.0 from SVN
[occt.git] / src / SelectMgr / SelectMgr_ViewerSelector.cdl
CommitLineData
7fd59977 1-- File: SelectMgr_ViewerSelector.cdl
2-- Created: Fri Feb 10 09:42:17 1995
3-- Author: Mister rmi
4-- <rmi@photon>
5--modified by rob -FEB 01 1996
6-- -JUL 23 1997 : optimize recompute of selections...
7-- insert real sleep/awake option....
8-- -APR 02 1998 : improvment of selection.
9-- Sort with new Criterions
10-- (depth + size +...)
11-- store detected in a best way...
12---Copyright: Matra Datavision 1995
13
14
15deferred class ViewerSelector from SelectMgr inherits TShared from MMgt
16
17 ---Purpose: A framework to define finding, sorting the sensitive
18 -- primitives in a view. Services are also provided to
19 -- define the return of the owners of those primitives
20 -- selected. The primitives are sorted by criteria such
21 -- as priority of the primitive or its depth in the view
22 -- relative to that of other primitives.
23 -- This framework is undefined for either 2D or 3D,
24 -- and is consequently used by both
25 -- StdSelect_ViewerSelector2d and
26 -- StdSelect_ViewerSelector3d, which inherit it, and
27 -- which in turn, return 2D and 3D owners of sensitive
28 -- primitives respectively.
29 -- Note that in 3D, the inheriting framework
30 -- StdSelect_ViewerSelector3d is only to be used
31 -- if you do not want to use the services provided by
32 -- AIS. In 2D, you will, however, need the services
33 -- provided by the StdSelect_ViewerSelector2d.
34 -- Two tools are available to find and select objects
35 -- found at a given position in the view. If you want to
36 -- select the owners of all the objects detected at
37 -- point x,y, you use the Init - More - Next - Picked
38 -- loop. If, on the other hand, you want to select only
39 -- one object detected at that point, you use the Init -
40 -- More - OnePicked loop. In this iteration, More is
41 -- used to see if an object was picked and
42 -- OnePicked, to get the object closest to the pick position.
43 -- Viewer selectors are driven by
44 -- SelectMgr_SelectionManager, and manipulate
45 -- the SelectMgr_Selection objects given to them by
46 -- the selection manager.
47
48uses
49 AsciiString from TCollection,
50 SelectableObject from SelectMgr,
51 DataMapOfIntegerSensitive from SelectMgr,
52 DataMapOfSelectionActivation from SelectMgr,
53 Selection from SelectMgr,
54 Box2d from Bnd,
55 HArray1OfInteger from TColStd,
56 ListOfInteger from TColStd,
57 SequenceOfInteger from TColStd,
58 MapOfTransient from TColStd,
59 IndexedMapOfInteger from TColStd,
60 IndexedDataMapOfOwnerCriterion from SelectMgr,
61 SensitiveEntity from SelectBasics,
62 SortAlgo from SelectBasics,
63 EntityOwner from SelectMgr,
64 StateOfSelection from SelectMgr,
65 Array1OfPnt2d from TColgp
66
67is
68
69 Initialize ;
70
71
72
73
74 Convert (me:mutable;aSelection : mutable Selection from SelectMgr) is virtual;
75 ---Level: Public
76 ---Purpose: to be redefined if conversion is necessary for SensitiveEntities...
77
78
79
80 ---Category: Activation/Desactivation Of Selection For Objects
81 -- No general method like "activate a mode (integer) " is possible
82 -- here because objects inside the selection view are of different type
83 --
84
85
86 Activate (me : mutable;
87 aSelection : Selection from SelectMgr;
88 AutomaticProj : Boolean = Standard_True)
89 is static private;
90 ---Level: Internal
91
92
93
94
95 ---Category: Management Methods . Some following methods are private
96 -- because they owed to be called only through The Selection Manager !!
97
98 Clear(me:mutable) is static;
99 ---Level: Public
100 ---Purpose: Empties all the tables, removes all selections...
101
102 UpdateConversion(me :mutable) is static;
103 ---Level: Public
104 ---Purpose: converts all the sensitive entities ;
105
106 Deactivate (me : mutable;
107 aSelection : Selection from SelectMgr)
108 is static private;
109 ---Level: Internal
110
111 Sleep (me:mutable) is static private;
112 ---Level: Internal
113 ---Purpose: Desactivates all the objects of the view;
114 -- no object in this view will be selectable;
115
116 Awake (me :mutable;AutomaticProj : Boolean = Standard_True) is static private;
117 ---Level: Internal
118 ---Purpose: reactivates all the selection which were sleeping....
119
120 Sleep (me : mutable;
121 anObject : SelectableObject from SelectMgr) is static private;
122
123 Awake (me : mutable;
124 anObject : SelectableObject from SelectMgr;
125 AutomaticProj : Boolean = Standard_True) is static private;
126
127
128 Remove(me:mutable ; aSelection: Selection from SelectMgr) is static private;
129 ---Level: Public
130 ---Purpose: removes a Selection from the Selector
131
132
133
134 ---Category: SELECTION OPERATIONS
135 ------------=====================
136
137 SetSensitivity (me : mutable ; aTol:Real) is static;
138 ---Level: Public
139 ---Purpose: changes the Sensitivity of picking
140 -- Input value is Real.
141
142 SetClipping(me:mutable ; Xc,Yc,Height,Width:Real) is static;
143 ---Level: Public
144 ---Purpose: sets the clipping limits of dynamic picking
145 -- input value are Real
146
147 SetClipping(me:mutable ; aRectangle : Box2d from Bnd) is static;
148 ---Level: Public
149 ---Purpose: sets the clipping limits of dynamic picking
150 -- input value are Real
151
152
153
154
155 InitSelect (me : mutable ; Xr,Yr : Real) is static;
156 ---Level: Public
157 ---Purpose: Performs a pick action. Xr, Yr are the real 2D mouse
158 -- coordinates in the view. The selector looks for areas
159 -- and owners that are touched.
160
161 InitSelect (me : mutable ; aRect: Box2d from Bnd) is static;
162 ---Level: Public
163 ---Purpose: Performs a pick action. aRect is a Box2d (real
164 -- coordinates) for the selection. The selector looks for
165 -- areas and owners that are touched.
166
167 InitSelect (me : mutable ; Xmin,Ymin,Xmax,Ymax: Real) is static;
168 ---Purpose: Performs a pick action
169 -- - Xmin, Ymin define the coordinates of the minimum
170 -- point in the lower left hand corner of the selection
171 -- box, and XMax, YMax define the coordinates of
172 -- the maximum point in the upper right hand corner
173 -- of the selection box. The selector looks for areas
174 -- and owners that are touched.
175
176 InitSelect (me : mutable ; Polyline:Array1OfPnt2d from TColgp) is static;
177 ---Level: Public
178 ---Purpose: pick action - input values of a polyline selection for selection.
179
180
181
182
183 ---Category: RESULT OF SELECTION...
184 -- 2 Methods : *all the detected objects are given
185 -- (use More - Next - Picked loop)
186 -- *only one is wanted :
187 -- (use More to know if something was picked and OnePicked
188 -- to get the closest object of pick position).
189 --
190 --
191
192 SortResult(me:mutable) is virtual;
193 ---Purpose: Sorts the detected entites by priority and distance.
194 -- to be redefined if other criterion are used...
195
196 Init(me:mutable) is static;
197 ---Purpose: Begins an iteration scanning for the owners detected at a position in the view.
198 ---C++: inline
199
200 More(me:mutable) returns Boolean from Standard is static;
201 ---Purpose: Continues the interation scanning for the owners
202 -- detected at a position in the view, or
203 -- - continues the iteration scanning for the owner
204 -- closest to the position in the view.
205
206 Next(me:mutable) is static;
207 ---Purpose: Returns the next owner found in the iteration. This is
208 -- a scan for the owners detected at a position in the view.
209 ---C++: inline
210
211
212 Picked(me) returns any EntityOwner is static;
213 ---Level: Public
214 ---Purpose: Returns the current selected entity detected by the selector;
215
216
217 OnePicked(me:mutable) returns any EntityOwner is static;
218 ---Purpose: Returns the picked element with the highest priority,
219 -- and which is the closest to the last successful mouse position.
220
221 SetPickClosest(me: mutable; preferClosest: Boolean);
222 ---Purpose: Set preference of selecting one object for OnePicked() method:
223 -- - If True, objects with less depth (distance fron the view plane) are
224 -- preferred regardless of priority (priority is used then to choose among
225 -- objects with similar depth),
226 -- - If False, objects with higher priority are preferred regardless of the
227 -- depth which is used to choose among objects of the same priority.
228 ---C++: inline
229
230
231 NbPicked(me) returns Integer from Standard;
232 ---Purpose: Returns the number of owners found at a position in
233 -- the view by the Init - More - Next - Picked iteration.
234
235 Picked(me;aRank:Integer from Standard)
236 returns any EntityOwner from SelectMgr;
237 ---Purpose: Returns the entity which is at rank <aRank>
238 -- in the list of stored ones.
239
240
241 HasStored (me:mutable) returns Boolean is static;
242 ---Level: Public
243 ---Purpose: Returns True if a successful pick was stored,
244 -- i.e. LastPosition method means something...
245
246 LastPosition (me; Xr,Yr : out Real ) is static;
247 ---Level: Public
248 ---Purpose: Gives the last successful pick position;
249 -- is useful to get objects really picked
250
251
252
253
254
255 ---Category: INFORMATION ABOUT OBJECTS IN THE VIEWER SELECTOR
256
257
258 Contains (me;aSelectableObject: SelectableObject from SelectMgr)
259 returns Boolean is static;
260
261
262 Modes (me;
263 aSelectableObject:SelectableObject from SelectMgr;
264 ModeList : in out ListOfInteger from TColStd;
265 WantedState : StateOfSelection from SelectMgr = SelectMgr_SOS_Any) returns Boolean;
266 ---Purpose: Returns the list of selection modes ModeList found in
267 -- this selector for the selectable object aSelectableObject.
268 -- Returns true if aSelectableObject is referenced inside
269 -- this selector; returns false if the object is not present
270 -- in this selector.
271
272 IsActive (me;aSelectableObject:SelectableObject;aMode:Integer) returns Boolean is static ;
273 ---Purpose: Returns true if the selectable object
274 -- aSelectableObject having the selection mode aMode
275 -- is active in this selector.
276
277 IsInside (me;aSelectableObject:SelectableObject;aMode:Integer) returns Boolean is static ;
278 ---Purpose: Returns true if the selectable object
279 -- aSelectableObject having the selection mode aMode
280 -- is in this selector.
281
282 Status (me;aSelection :Selection from SelectMgr) returns StateOfSelection from SelectMgr;
283 ---Purpose: Returns the selection status Status of the selection aSelection.
284
285 Dump(me;S : in out OStream from Standard);
286
287
288 Status (me;aSelectableObject:SelectableObject) returns AsciiString from TCollection is static;
289
290 Status (me) returns AsciiString from TCollection is static;
291 ---Level: Internal
292 ---Purpose: gives general information about the Selector
293
294
295
296
297
298
299
300 ---Category: Internal Methods
301
302
303 NbBoxes(me:mutable) returns Integer is static private;
304 ---Level: Internal
305
306 UpdateSort (me:mutable) is static;
307 ---Level: Internal
308
309 LoadResult (me:mutable) is virtual protected;
310 ---Level: Internal
311
312 LoadResult (me:mutable;aBox:Box2d from Bnd) is virtual protected;
313 ---Level: Internal
314
315 LoadResult (me:mutable;Polyline:Array1OfPnt2d from TColgp) is virtual protected;
316 ---Level: Internal
317
318
319
320 Primitive(me;Rank:Integer from Standard)
321 returns SensitiveEntity from SelectBasics;
322 ---Level: Internal
323
324 Primitives(me)
325 returns DataMapOfIntegerSensitive from SelectMgr;
326 ---Level: Internal
327 ---C++: inline
328 ---C++: return const&
329
330 SetUpdateSortPossible( me: mutable; possible : Boolean from Standard );
331 IsUpdateSortPossible( me ) returns Boolean from Standard;
332
333
334fields
335
336--before selection
337 myentities : DataMapOfIntegerSensitive is protected;
338 myselections : DataMapOfSelectionActivation is protected;
339 toupdate : Boolean is protected;
340 tosort : Boolean is protected;
341 preferclosest: Boolean is protected;
342--for selection
343 mytolerance : Real is protected;
344 myselector : SortAlgo from SelectBasics is protected;
345 myclip : Box2d from Bnd is protected;
346 myactivenb : Integer;
347--after selection -results... we sort the list of indexes not the map...
348 mystored : IndexedDataMapOfOwnerCriterion from SelectMgr is protected;
349 myIndexes : HArray1OfInteger from TColStd;
350 myprim : SequenceOfInteger from TColStd; -- for debug only
351 myCurRank : Integer from Standard;
352
353 lastx : Real;
354 lasty : Real;
355
356 myUpdateSortPossible : Boolean from Standard;
357
358friends
359 class SelectionManager from SelectMgr
360
361end ViewerSelector;
362
363
364
365
366
367
368
369
370
371
372
373