0024750: Replace instantiations of TCollection generic classes by NCollection templat...
[occt.git] / src / AIS / AIS_LocalContext.cdl
CommitLineData
b311480e 1-- Created on: 1996-09-04
2-- Created by: Robert COUBLANC
3-- Copyright (c) 1996-1999 Matra Datavision
973c2be1 4-- Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5--
973c2be1 6-- This file is part of Open CASCADE Technology software library.
b311480e 7--
d5f74e42 8-- This library is free software; you can redistribute it and/or modify it under
9-- the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10-- by the Free Software Foundation, with special exception defined in the file
11-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12-- distribution for complete text of the license and disclaimer of any warranty.
b311480e 13--
973c2be1 14-- Alternatively, this file may be used under the terms of Open CASCADE
15-- commercial license or contractual agreement.
b311480e 16
7fd59977 17-- Modified May 20th 98 :
18-- Modification in Management of selected entities
19-- Now we store the selected entity Owner in AIS_Selection.
20-- (no more links with Session...)
21-- Modifications in Management of hilight of detected entities
22-- VTN 23/11/99 BUC60614 Avoid to crash because
23-- myStdFilters array is too short.
7fd59977 24
1bd2fa67 25class LocalContext from AIS inherits TShared from MMgt
7fd59977 26
27 ---Purpose: Defines a specific context for selection.
28 -- It becomes possible to:
29 -- + Load InteractiveObjects with a mode to be
30 -- activated + associate InteractiveObjects with a
31 -- set of temporary selectable Objects.... + +
32 -- activate StandardMode of selection for Entities
33 -- inheriting BasicShape from AIS (Selection Of
34 -- vertices, edges, wires,faces... + Add Filters
35 -- acting on detected owners of sensitive primitives
36 --
37 --
38 -- - automatically highlight shapes and
39 -- InteractiveObjects (highlight of detected shape +
40 -- highlight of detected selectable...
41 --
42
43uses
44 AsciiString from TCollection,
45 ListOfInteger from TColStd,
46 SequenceOfInteger from TColStd,
47 MapOfTransient from TColStd,
48 Array1OfPnt2d from TColgp,
49 NameOfColor from Quantity,
50 ShapeEnum from TopAbs,
51 Shape from TopoDS,
52 View from V3d,
53 PresentationManager3d from PrsMgr,
7fd59977 54 IndexedMapOfOwner from SelectMgr,
55 EntityOwner from SelectMgr,
56 OrFilter from SelectMgr,
57 Filter from SelectMgr,
58 SelectionManager from SelectMgr,
59 SelectableObject from SelectMgr ,
60 ListOfFilter from SelectMgr,
61 BRepOwner from StdSelect,
62 ViewerSelector3d from StdSelect,
3c982548 63 SensitivityMode from StdSelect,
7fd59977 64 InteractiveContext from AIS,
65 ClearMode from AIS,
66 InteractiveObject from AIS,
67 Shape from AIS,
68 DataMapOfSelStat from AIS,
69 LocalStatus from AIS,
70 StatusOfPick from AIS,
71 StatusOfDetection from AIS,
72 SequenceOfInteractive from AIS
73
74is
75
6e33d3ce 76 Create returns LocalContext from AIS;
7fd59977 77
78
79 Create (aCtx : InteractiveContext from AIS;
80 anIndex : Integer from Standard;
81 LoadDisplayed : Boolean from Standard=Standard_True;
82 AcceptStandardModes : Boolean from Standard=Standard_True;
83 AcceptErase : Boolean from Standard= Standard_False;
84 UseBothViewers : Boolean from Standard= Standard_False)
6e33d3ce 85 returns LocalContext from AIS;
7fd59977 86 ---Purpose: Constructor By Default, the displayed objects are
87 -- automatically loaded.
88
89
90 AcceptErase(me:mutable;aStatus : Boolean from Standard);
91 ---C++: inline
92 ---Purpose: authorize or not others contexts to erase
93 -- temporary displayed objects here;
94
95 AcceptErase(me) returns Boolean from Standard;
96 ---C++: inline
97
98 SetContext(me:mutable;aCtx:InteractiveContext from AIS);
99
100 SelectionName(me) returns AsciiString from TCollection;
101 ---C++: inline
102 ---C++: return const&
103
104
105 Terminate(me: mutable; updateviewer : Boolean from Standard = Standard_True);
106
7fd59977 107 Reactivate(me:mutable);
108 ---Purpose: to be called when a upper local context was closed...
109 -- useful to put pack the right projector...
110
111 ---Category: LOAD AND PREPARE
112 -- - INTERACTIVE OBJECTS...
113 -- - FILTERS
114 -- - STANDARD MODES OF ACTIVATION
115
116
117
118
119 Display(me : mutable;
120 anInteractive : InteractiveObject from AIS;
121 DisplayMode : Integer from Standard = 0;
122 AllowShapeDecomposition: Boolean from Standard = Standard_True;
123 ActivationMode : Integer from Standard = 0)
124 returns Boolean from Standard;
125 ---Purpose: returns true if done...
126
127 Load(me : mutable;
128 anInteractive : InteractiveObject from AIS;
129 AllowShapeDecomposition: Boolean from Standard = Standard_True;
130 ActivationMode : Integer from Standard = 0)
131 returns Boolean from Standard;
132 ---Purpose: loads <anInteractive> with nodisplay...
133 -- returns true if done
134
135 Erase(me: mutable;
136 anInteractive : InteractiveObject from AIS)
137 returns Boolean from Standard;
138 ---Purpose: returns true if done...
139
140
141 Remove(me : mutable;
142 aSelectable : InteractiveObject from AIS)
143 returns Boolean from Standard;
144
145
146 ClearPrs (me : mutable;
147 anInteractive : InteractiveObject from AIS;
148 aMode : Integer from Standard)
149 returns Boolean from Standard;
150
151 SetShapeDecomposition(me : mutable;
152 aStoredObject : InteractiveObject from AIS;
153 aStatus : Boolean from Standard);
154 ---Purpose: allows or forbids the shape decomposition into
155 -- Activated Standard Mode for <aStoredObject>
156 -- does nothing if the object doesn't inherits
157 -- BasicShape from AIS
158
159
160 Clear(me:mutable;atype: ClearMode from AIS = AIS_CM_All);
161 ---Purpose: according to <atype> , clears the different parts of
162 -- the selector (filters, modeof activation, objects...)
163
164
165
166
167 ActivateMode (me : mutable;
168 aSelectable: InteractiveObject from AIS;
169 aMode : Integer from Standard );
170 ---Purpose: optional : activation of a mode which is not 0 for a selectable...
171
172 DeactivateMode(me : mutable;
173 aSelectable: InteractiveObject from AIS;
174 aMode : Integer from Standard );
175 Deactivate(me : mutable;
176 aSelectable: InteractiveObject from AIS);
177
178 ActivateStandardMode(me:mutable;aType:ShapeEnum from TopAbs);
179 ---Purpose: decomposition of shapes into <aType>
180
181
182 DeactivateStandardMode(me:mutable;aType:ShapeEnum from TopAbs);
183
184 StandardModes(me) returns ListOfInteger from TColStd;
185 ---C++: return const &
186 ---C++: inline
187
188
189
190 AddFilter(me:mutable;aFilter:Filter from SelectMgr);
191
192 RemoveFilter(me:mutable;aFilter: Filter from SelectMgr);
193
194
195 ListOfFilter(me) returns ListOfFilter from SelectMgr;
196 ---C++: return const &
197 ---C++: inline
198
199 Filter(me) returns any OrFilter from SelectMgr;
200 ---C++: return const &
201 ---C++: inline
202
203
204 SetAutomaticHilight(me:mutable ; aStatus:Boolean) ;
205 ---Purpose: if <aStatus> = True , the shapes or subshapes detected
206 -- by the selector will be automatically hilighted in the
207 -- main viewer.
208 -- Else the user has to manage the detected shape outside the
209 -- Shape Selector....
210 ---C++: inline
211
212
213
214 AutomaticHilight(me) returns Boolean;
215 ---C++: inline
216
7fd59977 217 ---Category: THE SELECTION PROCESS
218
679ecdee 219 MoveTo (me : mutable;
220 theXpix, theYpix : Integer from Standard;
221 theView : View from V3d;
222 theToRedrawImmediate : Boolean from Standard)
7fd59977 223 returns StatusOfDetection from AIS;
224
225
226 HasNextDetected(me) returns Boolean from Standard;
227 ---C++: inline
228 ---Purpose: returns True if more than one entity
229 -- was detected at the last Mouse position.
230
679ecdee 231 HilightNextDetected (me : mutable;
232 theView : View from V3d;
233 theToRedrawImmediate : Boolean from Standard)
7fd59977 234 returns Integer from Standard;
235 ---Purpose: returns True if last detected. the next detected will
236 -- be first one (endless loop)
237
679ecdee 238 HilightPreviousDetected (me : mutable;
239 theView : View from V3d;
240 theToRedrawImmediate : Boolean from Standard)
7fd59977 241 returns Integer from Standard;
242
7fd59977 243 UnhilightLastDetected(me:mutable;aView:View from V3d) returns Boolean from Standard;
244 ---Purpose: returns True if something was done...
245
246 Select(me: mutable;updateviewer : Boolean from Standard = Standard_True)
247 returns StatusOfPick from AIS;
248 ---Purpose: returns the number of selected
249
250 ShiftSelect(me: mutable;updateviewer : Boolean from Standard = Standard_True)
251 returns StatusOfPick from AIS;
252
253 Select(me : mutable;
254 XPMin,YPMin,XPMax,YPMax : Integer from Standard;
255 aView : View from V3d;
256 updateviewer : Boolean from Standard = Standard_True)
257 returns StatusOfPick from AIS;
258
259
260 ShiftSelect(me : mutable;
261 XPMin,YPMin,XPMax,YPMax : Integer from Standard;
262 aView : View from V3d;
263 updateviewer : Boolean from Standard = Standard_True)
264 returns StatusOfPick from AIS;
265
266 Select(me : mutable;
267 Polyline : Array1OfPnt2d from TColgp;
268 aView : View from V3d;
269 updateviewer : Boolean from Standard = Standard_True)
270 returns StatusOfPick from AIS;
271
272 ShiftSelect(me : mutable;
273 Polyline : Array1OfPnt2d from TColgp;
274 aView : View from V3d;
275 updateviewer : Boolean from Standard = Standard_True)
276 returns StatusOfPick from AIS;
277
278 HilightPicked(me:mutable;updateviewer:Boolean from Standard =Standard_True) ;
279
280 UnhilightPicked(me:mutable;updateviewer:Boolean from Standard = Standard_True) ;
281
282
283 UpdateSelected (me : mutable;
284 updateviewer : Boolean from Standard = Standard_True);
285
286 UpdateSelected (me : mutable;
287 anobj : InteractiveObject from AIS;
288 updateviewer : Boolean from Standard = Standard_True);
289 ---Purpose: Part of advanced selection highlighting mechanism.
290 -- If no owners belonging to anobj are selected, calls anobj->ClearSelected(),
291 -- otherwise calls anobj->HilightSelected(). This method can be used to avoid
292 -- redrawing the whole selection belonging to several Selectable Objects.
293
294
295 SetSelected(me : mutable;
296 anobj : InteractiveObject from AIS;
297 updateviewer : Boolean from Standard=Standard_True);
298 ---Purpose: useful to update selection with objects coming from
299 -- Collector or stack
300
301 AddOrRemoveSelected(me : mutable;
302 anobj : InteractiveObject from AIS;
303 updateviewer : Boolean from Standard=Standard_True);
304 ---Purpose: useful to update selection with objects coming from
305 -- Collector or stack
306 AddOrRemoveSelected(me : mutable;
307 aShape : Shape from TopoDS;
308 updateviewer : Boolean from Standard=Standard_True);
309
c398b00e 310 AddOrRemoveSelected(me : mutable;
311 theOwner : EntityOwner from SelectMgr;
312 toUpdateViewer : Boolean from Standard = Standard_True);
7fd59977 313
fb4b684a 314 ClearSelected (me : mutable;
315 toUpdateViewer : Boolean from Standard = Standard_True);
316 ---Purpose: Clears local context selection.
317 -- @param toUpdateViewer [in] if TRUE the viewer will be updated.
318
bc677575 319 ClearOutdatedSelection (me : mutable;
320 theIO : InteractiveObject from AIS;
321 toClearDeactivated : Boolean from Standard);
322 ---Purpose: Clears outdated selection and detection of owners for the
323 -- interactive object. Use this method if selection structures
324 -- of the interactive object have changed. The method unhilights
325 -- and removes outdated entity owners from lists of selected
326 -- and detected owners.
fb4b684a 327 -- @param theIO [in] the interactive object.
bc677575 328 -- @param toClearDeactivated [in] pass TRUE to treat deactivated
329 -- entity owners as 'outdated' when clearing the selection.
7fd59977 330
7fd59977 331 ---Category: GET THE DETECTED
332
7fd59977 333 HasDetected (me) returns Boolean from Standard;
334 ---C++: inline
335
336 InitDetected(me: mutable);
57ad5cbd 337 ---Purpose:
338 -- Initialization for iteration through mouse-detected objects in local context.
339
7fd59977 340 MoreDetected(me) returns Boolean from Standard;
57ad5cbd 341 ---Purpose:
342 -- @return true if there is more mouse-detected objects after the current one
343 -- during iteration through mouse-detected interactive objects.
344
7fd59977 345 NextDetected(me: mutable);
57ad5cbd 346 ---Purpose:
347 -- Gets next current object during iteration through mouse-detected
348 -- interactive objects.
349
7fd59977 350 DetectedCurrentShape(me) returns Shape from TopoDS;
351 ---C++: return const &
57ad5cbd 352 ---Purpose:
353 -- @return current mouse-detected shape or empty (null) shape, if current interactive object
354 -- is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
355
7fd59977 356 DetectedCurrentObject(me) returns InteractiveObject from AIS;
57ad5cbd 357 ---Purpose:
358 -- @return current mouse-detected interactive object or null object if there is no current detected.
7fd59977 359
360 HasDetectedShape(me) returns Boolean from Standard;
361 DetectedShape (me) returns Shape from TopoDS;
362 ---C++: return const &
363 DetectedInteractive(me) returns InteractiveObject from AIS;
364 DetectedOwner (me) returns EntityOwner from SelectMgr;
365
366
367 ---Category: GET THE SELECTED
368
369 InitSelected (me: mutable);
370 MoreSelected(me) returns Boolean from Standard;
371 NextSelected(me:mutable);
372 HasShape(me) returns Boolean from Standard;
373 ---Purpose: returns TRUE if the detected entity is a shape
374 -- coming from a Decomposition of an element.
51023771 375 HasSelectedShape(me) returns Boolean from Standard;
376 ---Purpose: returns true if current selection is not empty
377 -- and the owner of selected object contains a shape.
378 -- This method does not take into account decomposition
379 -- status of detected shape.
7fd59977 380 SelectedShape(me) returns Shape from TopoDS;
7fd59977 381
382 SelectedOwner(me) returns EntityOwner from SelectMgr;
383 IsSelected(me;aniobj: InteractiveObject from AIS) returns Boolean from Standard;
384 IsSelected(me;anOwner: EntityOwner from SelectMgr) returns Boolean from Standard;
385 SelectedInteractive(me) returns InteractiveObject from AIS;
386 HasApplicative (me) returns Boolean from Standard;
387 ---Purpose: returns TRUE if an interactive element
388 -- was associated with the current picked entity.
389 SelectedApplicative(me) returns any Transient from Standard;
390 ---C++: return const &
391
392
393
394
395
396
397 ---Category: Management Of Temporary Attributes
398
399 SetDisplayPriority(me : mutable;
400 anObject: InteractiveObject from AIS;
401 Prior : Integer from Standard);
402
403 DisplayedObjects(me;theMapToFill : in out MapOfTransient from TColStd)
404 returns Integer from Standard;
405
406 IsIn(me;anObject : InteractiveObject from AIS)
407 returns Boolean from Standard;
408
409
410 IsDisplayed(me;anObject : InteractiveObject from AIS)
411 returns Boolean from Standard;
412
413 IsDisplayed(me;anObject : InteractiveObject from AIS;
414 aMode : Integer from Standard)
415 returns Boolean from Standard;
416
417 SelectionModes(me;anObject:InteractiveObject from AIS)
418 returns ListOfInteger from TColStd;
419 ---C++: return const &
420
421 SubIntensityOn(me:mutable; anObject : InteractiveObject from AIS );
422
423 SubIntensityOff(me:mutable; anObject : InteractiveObject from AIS );
424
425 Hilight(me: mutable; anObject : InteractiveObject from AIS);
426
427 Hilight(me:mutable; anObject : InteractiveObject from AIS;aCol:NameOfColor from Quantity);
428
429 Unhilight(me:mutable; anObject : InteractiveObject from AIS);
430
431 IsHilighted(me;anObject : InteractiveObject from AIS)
432 returns Boolean from Standard;
433
434 IsHilighted(me;
435 anObject : InteractiveObject from AIS;
436 WithColor : out Boolean from Standard;
437 HiCol : out NameOfColor from Quantity)
438 returns Boolean from Standard;
3c982548 439
440 SetPixelTolerance(me:mutable;
f751596e 441 aPrecision: Real from Standard = 2);
7fd59977 442 ---Level: Public
443 ---Purpose: Define the current selection sensitivity for
444 -- this local context according to the view size.
445
f751596e 446 PixelTolerance(me) returns Real from Standard;
3c982548 447 ---Level: Public
448 ---Purpose: Returns the pixel tolerance.
449
7fd59977 450 ---Category: IMMEDIATE MODE
451
452
679ecdee 453 BeginImmediateDraw (me : mutable)
7fd59977 454 returns Boolean from Standard;
679ecdee 455 ---Purpose: Resets the transient list of presentations previously displayed in immediate mode
456 -- and begins accumulation of new list by following AddToImmediateList()/Color()/Highlight() calls.
457
458 ClearImmediateDraw (me : mutable) is virtual;
459 ---Purpose: Resets the transient list of presentations previously displayed in immediate mode.
7fd59977 460
679ecdee 461 ImmediateAdd (me : mutable;
462 theObj : InteractiveObject from AIS;
463 theMode : Integer from Standard = 0)
7fd59977 464 returns Boolean from Standard;
679ecdee 465 ---Purpose: Stores presentation theMode of object theObj in the transient list of presentations to be displayed in immediate mode.
466 -- Will be taken in account in EndImmediateDraw method.
7fd59977 467
679ecdee 468 EndImmediateDraw (me : mutable;
469 theView : View from V3d)
7fd59977 470 returns Boolean from Standard;
679ecdee 471 ---Purpose: Allows rapid drawing of the view theView by avoiding an update of the whole background.
472
473 IsImmediateModeOn (me) returns Boolean from Standard;
474 ---Purpose: Returns true if Presentation Manager is accumulating transient list of presentations to be displayed in immediate mode.
7fd59977 475
7fd59977 476 ---Category: INTERNAL METHODS;
477
7fd59977 478
b7c077b9 479 Status(me) returns AsciiString from TCollection;
7fd59977 480
481 Status(me;anObject : InteractiveObject from AIS)
b7c077b9 482 returns any LocalStatus from AIS;
7fd59977 483 ---C++: return const&
484
485
486
487 LoadContextObjects(me:mutable);
488
489 UnloadContextObjects(me:mutable);
490
491 Process(me : mutable;
f751596e 492 anObject : SelectableObject from SelectMgr) is static private;
7fd59977 493
f751596e 494 Process(me:mutable) is static private;
7fd59977 495
496
f751596e 497 ActivateStandardModes(me:mutable;anObject: SelectableObject from SelectMgr) is static private;
7fd59977 498
679ecdee 499 manageDetected (me : mutable;
500 thePickOwner : EntityOwner from SelectMgr;
501 theView : View from V3d;
502 theToRedrawImmediate : Boolean from Standard) is static private;
7fd59977 503
504 DetectedIndex(me:mutable) returns Integer from Standard is static private;
505 ---C++: inline
506 ---Purpose: returns 0 if the detected entity was Not FilterOK...
507
508 Hilight(me:mutable;Own:EntityOwner from SelectMgr;aview: View from V3d) is static private;
509
510
511 Unhilight(me:mutable;Ownr:EntityOwner from SelectMgr;aview: View from V3d) is static private;
512
513
514 ClearObjects(me:mutable) is static private;
515
516 ClearDetected(me:mutable) is static private;
517
518 IsDecompositionOn(me) returns Boolean from Standard is static private;
519
520 IsShape(me;anIndex:Integer from Standard) returns Boolean from Standard is static private;
521
522 IsValidForSelection(me;anIObj:InteractiveObject from AIS) returns Boolean from Standard is static private;
523
524 IsValidIndex(me;anIndex:Integer from Standard)
525 returns Boolean from Standard is static private;
526 ---C++: inline
527
528 ComesFromDecomposition(me; aPickedIndex : Integer from Standard)
529 returns Boolean from Standard is static private;
530
7fd59977 531 HasFilters(me;aType:ShapeEnum from TopAbs)
532 returns Boolean from Standard is private;
533
534 DisplaySensitive(me:mutable;aView : View from V3d) is static;
535
536 ClearSensitive(me:mutable;aView:View from V3d) is static;
537
f751596e 538 MainSelector(me) returns ViewerSelector3d from StdSelect;
7fd59977 539 ---C++: inline
540 ---C++: return const&
541
7fd59977 542 FindSelectedOwnerFromIO(me;anIObj:InteractiveObject from AIS)
1bd2fa67 543 returns EntityOwner from SelectMgr;
7fd59977 544
545 FindSelectedOwnerFromShape(me;aShape : Shape from TopoDS)
1bd2fa67 546 returns EntityOwner from SelectMgr;
7fd59977 547
548
549
550fields
551
552 myCTX : InteractiveContext from AIS;
553 myLoadDisplayed,myAcceptStdMode : Boolean from Standard;
554 myAcceptErase : Boolean from Standard;
555
556 mySM : SelectionManager from SelectMgr;
557 myMainVS : ViewerSelector3d from StdSelect;
558 myMainPM : PresentationManager3d from PrsMgr;
559 mySelName : AsciiString from TCollection;
560 myCollVS : ViewerSelector3d from StdSelect;
561
562 -- The Objects and their attributes...
563
564 myActiveObjects : DataMapOfSelStat from AIS;
565
566
567 -- The Filters...
568
569 myFilters : OrFilter from SelectMgr;
570 myListOfStandardMode : ListOfInteger from TColStd;
571
572 -- VTN myStdFilters : Filter from SelectMgr [7]; --internal mgt
573 myStdFilters : Filter from SelectMgr [9]; --internal mgt
574
575 -- Selection Process
576
577 myAutoHilight : Boolean from Standard;
578 myMapOfOwner : IndexedMapOfOwner from SelectMgr;
579 mylastindex : Integer from Standard;
580 mylastgood : Integer from Standard;
581 myCurrentOwner : Integer from Standard;
582
583
584 myDetectedSeq : SequenceOfInteger from TColStd;
585 myCurDetected : Integer from Standard;
586
57ad5cbd 587 -- The detected objects.
588
7fd59977 589 myAISDetectedSeq : SequenceOfInteractive from AIS;
57ad5cbd 590 -- the sequence of detected interative objects.
7fd59977 591 myAISCurDetected : Integer from Standard;
57ad5cbd 592 -- current detected interactive object.
593 -- This variable is used by following functions:
7fd59977 594 -- InitDetected(), MoreDetected(), NextDetected(), DetectedCurrentShape(), DetectedCurrentObject().
595
7fd59977 596end LocalContext;
597
598
599
600
601