1 -- File: AIS_LocalContext.cdl
2 -- Created: Wed Sep 4 16:13:24 1996
3 -- Author: Robert COUBLANC
4 -- <rob@robox.paris1.matra-dtv.fr>
6 -- Modified May 20th 98 :
7 -- Modification in Management of selected entities
8 -- Now we store the selected entity Owner in AIS_Selection.
9 -- (no more links with Session...)
10 -- Modifications in Management of hilight of detected entities
11 -- VTN 23/11/99 BUC60614 Avoid to crash because
12 -- myStdFilters array is too short.
13 -- GG : BUC60688 25/05/00 Add SetSensitivity() methods
14 -- GG : IMP150501 Remove oboslete method DragTo
15 -- (See AIS_InteractiveContext)
16 -- ZSV : IMP160701 Add InitDetected(),MoreDetected(),NextDetected(),
17 -- DetectedCurrentShape(),DetectedCurrentObject()
20 ---Copyright: Matra Datavision 1996
23 class LocalContext from AIS inherits TShared from MMgt
25 ---Purpose: Defines a specific context for selection.
26 -- It becomes possible to:
27 -- + Load InteractiveObjects with a mode to be
28 -- activated + associate InteractiveObjects with a
29 -- set of temporary selectable Objects.... + +
30 -- activate StandardMode of selection for Entities
31 -- inheriting BasicShape from AIS (Selection Of
32 -- vertices, edges, wires,faces... + Add Filters
33 -- acting on detected owners of sensitive primitives
36 -- - automatically highlight shapes and
37 -- InteractiveObjects (highlight of detected shape +
38 -- highlight of detected selectable...
42 AsciiString from TCollection,
43 ListOfInteger from TColStd,
44 SequenceOfInteger from TColStd,
45 MapOfTransient from TColStd,
46 Array1OfPnt2d from TColgp,
47 NameOfColor from Quantity,
48 ShapeEnum from TopAbs,
51 PresentationManager3d from PrsMgr,
52 Projector from Select3D,
53 IndexedMapOfOwner from SelectMgr,
54 EntityOwner from SelectMgr,
55 OrFilter from SelectMgr,
56 Filter from SelectMgr,
57 SelectionManager from SelectMgr,
58 SelectableObject from SelectMgr ,
59 ListOfFilter from SelectMgr,
60 BRepOwner from StdSelect,
61 ViewerSelector3d from StdSelect,
62 InteractiveContext from AIS,
64 InteractiveObject from AIS,
66 DataMapOfSelStat from AIS,
68 StatusOfPick from AIS,
69 StatusOfDetection from AIS,
70 SequenceOfInteractive from AIS
74 Create returns mutable LocalContext from AIS;
77 Create (aCtx : InteractiveContext from AIS;
78 anIndex : Integer from Standard;
79 LoadDisplayed : Boolean from Standard=Standard_True;
80 AcceptStandardModes : Boolean from Standard=Standard_True;
81 AcceptErase : Boolean from Standard= Standard_False;
82 UseBothViewers : Boolean from Standard= Standard_False)
83 returns mutable LocalContext from AIS;
84 ---Purpose: Constructor By Default, the displayed objects are
85 -- automatically loaded.
88 AcceptErase(me:mutable;aStatus : Boolean from Standard);
90 ---Purpose: authorize or not others contexts to erase
91 -- temporary displayed objects here;
93 AcceptErase(me) returns Boolean from Standard;
96 SetContext(me:mutable;aCtx:InteractiveContext from AIS);
98 SelectionName(me) returns AsciiString from TCollection;
100 ---C++: return const&
103 Terminate(me: mutable; updateviewer : Boolean from Standard = Standard_True);
105 HasSameProjector(me;aPrj:Projector from Select3D)
106 returns Boolean from Standard;
107 ---Purpose: compares the current projector of the localContext
109 -- returns True if the projectors are identical.
110 -- (no need to update projection of selection primitives
111 -- when closing the local context)....
113 Reactivate(me:mutable);
114 ---Purpose: to be called when a upper local context was closed...
115 -- useful to put pack the right projector...
117 ---Category: LOAD AND PREPARE
118 -- - INTERACTIVE OBJECTS...
120 -- - STANDARD MODES OF ACTIVATION
125 Display(me : mutable;
126 anInteractive : InteractiveObject from AIS;
127 DisplayMode : Integer from Standard = 0;
128 AllowShapeDecomposition: Boolean from Standard = Standard_True;
129 ActivationMode : Integer from Standard = 0)
130 returns Boolean from Standard;
131 ---Purpose: returns true if done...
134 anInteractive : InteractiveObject from AIS;
135 AllowShapeDecomposition: Boolean from Standard = Standard_True;
136 ActivationMode : Integer from Standard = 0)
137 returns Boolean from Standard;
138 ---Purpose: loads <anInteractive> with nodisplay...
139 -- returns true if done
142 anInteractive : InteractiveObject from AIS)
143 returns Boolean from Standard;
144 ---Purpose: returns true if done...
148 aSelectable : InteractiveObject from AIS)
149 returns Boolean from Standard;
152 ClearPrs (me : mutable;
153 anInteractive : InteractiveObject from AIS;
154 aMode : Integer from Standard)
155 returns Boolean from Standard;
157 SetShapeDecomposition(me : mutable;
158 aStoredObject : InteractiveObject from AIS;
159 aStatus : Boolean from Standard);
160 ---Purpose: allows or forbids the shape decomposition into
161 -- Activated Standard Mode for <aStoredObject>
162 -- does nothing if the object doesn't inherits
163 -- BasicShape from AIS
166 Clear(me:mutable;atype: ClearMode from AIS = AIS_CM_All);
167 ---Purpose: according to <atype> , clears the different parts of
168 -- the selector (filters, modeof activation, objects...)
173 ActivateMode (me : mutable;
174 aSelectable: InteractiveObject from AIS;
175 aMode : Integer from Standard );
176 ---Purpose: optional : activation of a mode which is not 0 for a selectable...
178 DeactivateMode(me : mutable;
179 aSelectable: InteractiveObject from AIS;
180 aMode : Integer from Standard );
181 Deactivate(me : mutable;
182 aSelectable: InteractiveObject from AIS);
184 ActivateStandardMode(me:mutable;aType:ShapeEnum from TopAbs);
185 ---Purpose: decomposition of shapes into <aType>
188 DeactivateStandardMode(me:mutable;aType:ShapeEnum from TopAbs);
190 StandardModes(me) returns ListOfInteger from TColStd;
191 ---C++: return const &
196 AddFilter(me:mutable;aFilter:Filter from SelectMgr);
198 RemoveFilter(me:mutable;aFilter: Filter from SelectMgr);
201 ListOfFilter(me) returns ListOfFilter from SelectMgr;
202 ---C++: return const &
205 Filter(me) returns any OrFilter from SelectMgr;
206 ---C++: return const &
210 SetAutomaticHilight(me:mutable ; aStatus:Boolean) ;
211 ---Purpose: if <aStatus> = True , the shapes or subshapes detected
212 -- by the selector will be automatically hilighted in the
214 -- Else the user has to manage the detected shape outside the
215 -- Shape Selector....
220 AutomaticHilight(me) returns Boolean;
225 ---Category: THE SELECTION PROCESS
228 MoveTo(me:mutable;Xpix,Ypix : Integer from Standard;
229 aview : View from V3d)
230 returns StatusOfDetection from AIS;
233 HasNextDetected(me) returns Boolean from Standard;
235 ---Purpose: returns True if more than one entity
236 -- was detected at the last Mouse position.
238 HilightNextDetected(me:mutable;aView:View from V3d)
239 returns Integer from Standard;
240 ---Purpose: returns True if last detected. the next detected will
241 -- be first one (endless loop)
243 HilightPreviousDetected(me:mutable;aView:View from V3d)
244 returns Integer from Standard;
247 UnhilightLastDetected(me:mutable;aView:View from V3d) returns Boolean from Standard;
248 ---Purpose: returns True if something was done...
250 Select(me: mutable;updateviewer : Boolean from Standard = Standard_True)
251 returns StatusOfPick from AIS;
252 ---Purpose: returns the number of selected
254 ShiftSelect(me: mutable;updateviewer : Boolean from Standard = Standard_True)
255 returns StatusOfPick from AIS;
258 XPMin,YPMin,XPMax,YPMax : Integer from Standard;
259 aView : View from V3d;
260 updateviewer : Boolean from Standard = Standard_True)
261 returns StatusOfPick from AIS;
264 ShiftSelect(me : mutable;
265 XPMin,YPMin,XPMax,YPMax : Integer from Standard;
266 aView : View from V3d;
267 updateviewer : Boolean from Standard = Standard_True)
268 returns StatusOfPick from AIS;
271 Polyline : Array1OfPnt2d from TColgp;
272 aView : View from V3d;
273 updateviewer : Boolean from Standard = Standard_True)
274 returns StatusOfPick from AIS;
276 ShiftSelect(me : mutable;
277 Polyline : Array1OfPnt2d from TColgp;
278 aView : View from V3d;
279 updateviewer : Boolean from Standard = Standard_True)
280 returns StatusOfPick from AIS;
282 HilightPicked(me:mutable;updateviewer:Boolean from Standard =Standard_True) ;
284 UnhilightPicked(me:mutable;updateviewer:Boolean from Standard = Standard_True) ;
287 UpdateSelected (me : mutable;
288 updateviewer : Boolean from Standard = Standard_True);
290 UpdateSelected (me : mutable;
291 anobj : InteractiveObject from AIS;
292 updateviewer : Boolean from Standard = Standard_True);
293 ---Purpose: Part of advanced selection highlighting mechanism.
294 -- If no owners belonging to anobj are selected, calls anobj->ClearSelected(),
295 -- otherwise calls anobj->HilightSelected(). This method can be used to avoid
296 -- redrawing the whole selection belonging to several Selectable Objects.
299 SetSelected(me : mutable;
300 anobj : InteractiveObject from AIS;
301 updateviewer : Boolean from Standard=Standard_True);
302 ---Purpose: useful to update selection with objects coming from
303 -- Collector or stack
305 AddOrRemoveSelected(me : mutable;
306 anobj : InteractiveObject from AIS;
307 updateviewer : Boolean from Standard=Standard_True);
308 ---Purpose: useful to update selection with objects coming from
309 -- Collector or stack
310 AddOrRemoveSelected(me : mutable;
311 aShape : Shape from TopoDS;
312 updateviewer : Boolean from Standard=Standard_True);
314 AddOrRemoveSelected(me : mutable;
315 Ownr : EntityOwner from SelectMgr;
316 updateviewer : Boolean from Standard=Standard_True);
320 ClearSelected(me:mutable;updateviewer : Boolean from Standard=Standard_True);
324 ---Category: GET THE DETECTED
327 HasDetected (me) returns Boolean from Standard;
330 InitDetected(me: mutable);
331 MoreDetected(me) returns Boolean from Standard;
332 NextDetected(me: mutable);
333 DetectedCurrentShape(me) returns Shape from TopoDS;
334 ---C++: return const &
335 DetectedCurrentObject(me) returns InteractiveObject from AIS;
337 HasDetectedShape(me) returns Boolean from Standard;
338 DetectedShape (me) returns Shape from TopoDS;
339 ---C++: return const &
340 DetectedInteractive(me) returns InteractiveObject from AIS;
341 DetectedOwner (me) returns EntityOwner from SelectMgr;
344 ---Category: GET THE SELECTED
346 InitSelected (me: mutable);
347 MoreSelected(me) returns Boolean from Standard;
348 NextSelected(me:mutable);
349 HasShape(me) returns Boolean from Standard;
350 ---Purpose: returns TRUE if the detected entity is a shape
351 -- coming from a Decomposition of an element.
352 SelectedShape(me) returns Shape from TopoDS;
353 ---C++: return const &
355 SelectedOwner(me) returns EntityOwner from SelectMgr;
356 IsSelected(me;aniobj: InteractiveObject from AIS) returns Boolean from Standard;
357 IsSelected(me;anOwner: EntityOwner from SelectMgr) returns Boolean from Standard;
358 SelectedInteractive(me) returns InteractiveObject from AIS;
359 HasApplicative (me) returns Boolean from Standard;
360 ---Purpose: returns TRUE if an interactive element
361 -- was associated with the current picked entity.
362 SelectedApplicative(me) returns any Transient from Standard;
363 ---C++: return const &
370 ---Category: Management Of Temporary Attributes
372 SetDisplayPriority(me : mutable;
373 anObject: InteractiveObject from AIS;
374 Prior : Integer from Standard);
376 DisplayedObjects(me;theMapToFill : in out MapOfTransient from TColStd)
377 returns Integer from Standard;
379 IsIn(me;anObject : InteractiveObject from AIS)
380 returns Boolean from Standard;
383 IsDisplayed(me;anObject : InteractiveObject from AIS)
384 returns Boolean from Standard;
386 IsDisplayed(me;anObject : InteractiveObject from AIS;
387 aMode : Integer from Standard)
388 returns Boolean from Standard;
390 SelectionModes(me;anObject:InteractiveObject from AIS)
391 returns ListOfInteger from TColStd;
392 ---C++: return const &
394 SubIntensityOn(me:mutable; anObject : InteractiveObject from AIS );
396 SubIntensityOff(me:mutable; anObject : InteractiveObject from AIS );
398 Hilight(me: mutable; anObject : InteractiveObject from AIS);
400 Hilight(me:mutable; anObject : InteractiveObject from AIS;aCol:NameOfColor from Quantity);
402 Unhilight(me:mutable; anObject : InteractiveObject from AIS);
404 IsHilighted(me;anObject : InteractiveObject from AIS)
405 returns Boolean from Standard;
408 anObject : InteractiveObject from AIS;
409 WithColor : out Boolean from Standard;
410 HiCol : out NameOfColor from Quantity)
411 returns Boolean from Standard;
413 SetSensitivity(me:mutable;
414 aPrecision: Real from Standard);
416 ---Purpose: Define the current selection sensitivity for
417 -- this local context according to the view size.
419 SetSensitivity(me:mutable;
420 aPrecision: Integer from Standard = 2);
422 ---Purpose: Define the current selection sensitivity for
423 -- this local context according to the view size.
425 ---Category: IMMEDIATE MODE
428 BeginImmediateDraw (me:mutable) returns Boolean from Standard;
429 ---Purpose: initializes the list of presentations to be displayed
430 -- returns False if No Local COnte
432 ImmediateAdd (me:mutable;anIObj:InteractiveObject from AIS;aMode:Integer from Standard=0)
433 returns Boolean from Standard;
434 ---Purpose: returns True if <anIObj> has been stored in the list.
436 ImmediateRemove (me:mutable;anIObj:InteractiveObject from AIS;aMode:Integer from Standard=0)
437 returns Boolean from Standard;
438 ---Purpose: returns True if <anIObj> has been removed from the list.
440 EndImmediateDraw(me:mutable;aView : View from V3d;DoubleBuf:Boolean from Standard=Standard_False)
441 returns Boolean from Standard;
442 ---Purpose: returns True if the immediate display has been done.
444 IsImmediateModeOn(me) returns Boolean from Standard;
446 ---Category: INTERNAL METHODS;
448 UpdateConversion(me:mutable);
450 UpdateSort(me:mutable);
454 Status(me) returns AsciiString from TCollection is private;
456 Status(me;anObject : InteractiveObject from AIS)
457 returns any LocalStatus from AIS is private;
458 ---C++: return const&
462 LoadContextObjects(me:mutable);
464 UnloadContextObjects(me:mutable);
466 Process(me : mutable;
467 anObject : SelectableObject from SelectMgr;
468 WithProj: Boolean from Standard = Standard_True) is static private;
471 WithProj: Boolean from Standard = Standard_True) is static private;
474 ActivateStandardModes(me:mutable;anObject: SelectableObject from SelectMgr;
475 WithProj: Boolean from Standard = Standard_True) is static private;
477 ManageDetected(me:mutable;
478 aPickOwner : EntityOwner from SelectMgr;
479 aview : View from V3d) is static private;
481 DetectedIndex(me:mutable) returns Integer from Standard is static private;
483 ---Purpose: returns 0 if the detected entity was Not FilterOK...
485 Hilight(me:mutable;Own:EntityOwner from SelectMgr;aview: View from V3d) is static private;
488 Unhilight(me:mutable;Ownr:EntityOwner from SelectMgr;aview: View from V3d) is static private;
491 ClearObjects(me:mutable) is static private;
493 ClearDetected(me:mutable) is static private;
495 IsDecompositionOn(me) returns Boolean from Standard is static private;
497 IsShape(me;anIndex:Integer from Standard) returns Boolean from Standard is static private;
499 IsValidForSelection(me;anIObj:InteractiveObject from AIS) returns Boolean from Standard is static private;
501 IsValidIndex(me;anIndex:Integer from Standard)
502 returns Boolean from Standard is static private;
505 ComesFromDecomposition(me; aPickedIndex : Integer from Standard)
506 returns Boolean from Standard is static private;
509 DisplayAreas(me:mutable;aviou:View from V3d);
511 ClearAreas (me:mutable;
512 aView: View from V3d) is static;
515 HasFilters(me;aType:ShapeEnum from TopAbs)
516 returns Boolean from Standard is private;
518 DisplaySensitive(me:mutable;aView : View from V3d) is static;
520 ClearSensitive(me:mutable;aView:View from V3d) is static;
524 MainSelector(me) returns any ViewerSelector3d from StdSelect;
526 ---C++: return const&
529 HilightTriangle(me:mutable;Rank:Integer from Standard;aViou:View from V3d) is static private;
533 FindSelectedOwnerFromIO(me;anIObj:InteractiveObject from AIS)
534 returns EntityOwner from SelectMgr;
536 FindSelectedOwnerFromShape(me;aShape : Shape from TopoDS)
537 returns EntityOwner from SelectMgr;
543 myCTX : InteractiveContext from AIS;
544 myLoadDisplayed,myAcceptStdMode : Boolean from Standard;
545 myAcceptErase : Boolean from Standard;
547 mySM : SelectionManager from SelectMgr;
548 myMainVS : ViewerSelector3d from StdSelect;
549 myMainPM : PresentationManager3d from PrsMgr;
550 mySelName : AsciiString from TCollection;
551 myCollVS : ViewerSelector3d from StdSelect;
553 -- The Objects and their attributes...
555 myActiveObjects : DataMapOfSelStat from AIS;
560 myFilters : OrFilter from SelectMgr;
561 myListOfStandardMode : ListOfInteger from TColStd;
563 -- VTN myStdFilters : Filter from SelectMgr [7]; --internal mgt
564 myStdFilters : Filter from SelectMgr [9]; --internal mgt
568 myAutoHilight : Boolean from Standard;
569 myMapOfOwner : IndexedMapOfOwner from SelectMgr;
570 mylastindex : Integer from Standard;
571 mylastgood : Integer from Standard;
572 myCurrentOwner : Integer from Standard;
575 myDetectedSeq : SequenceOfInteger from TColStd;
576 myCurDetected : Integer from Standard;
578 -- the detected objects.
579 myAISDetectedSeq : SequenceOfInteractive from AIS;
580 myAISCurDetected : Integer from Standard;
581 -- This variables is used by following functions:
582 -- InitDetected(), MoreDetected(), NextDetected(), DetectedCurrentShape(), DetectedCurrentObject().
586 KeepTemporary from InteractiveContext from AIS(me:mutable;anIObj:InteractiveObject from AIS;WhichMode : Integer from Standard = -1)