OCC22362 AIS_LocalContext should be public class
[occt.git] / src / AIS / AIS_LocalContext.cdl
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>
5 --              
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()
18 --                       methods
19 --        
20 ---Copyright:    Matra Datavision 1996
21
22
23 class LocalContext from AIS inherits TShared from MMgt
24
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
34         --          
35         --          
36         --          -     automatically    highlight   shapes   and
37         --          InteractiveObjects  (highlight of  detected shape +
38         --          highlight of detected selectable...
39         --          
40
41 uses
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,    
49     Shape                     from TopoDS,
50     View                      from V3d,
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,
63     ClearMode                 from AIS,
64     InteractiveObject         from AIS,
65     Shape                     from AIS,
66     DataMapOfSelStat          from AIS,
67     LocalStatus               from AIS, 
68     StatusOfPick              from AIS,
69     StatusOfDetection         from AIS,
70     SequenceOfInteractive     from AIS
71
72 is
73
74     Create returns mutable LocalContext from AIS;
75     
76
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.
86
87
88     AcceptErase(me:mutable;aStatus : Boolean from Standard);
89     ---C++: inline
90     ---Purpose: authorize or not others contexts to erase
91     --          temporary displayed objects here;
92
93     AcceptErase(me) returns Boolean from Standard;
94     ---C++: inline
95
96     SetContext(me:mutable;aCtx:InteractiveContext from AIS);
97     
98     SelectionName(me) returns AsciiString from TCollection;
99     ---C++: inline
100     ---C++: return const&
101
102
103     Terminate(me: mutable; updateviewer : Boolean from Standard = Standard_True);
104
105     HasSameProjector(me;aPrj:Projector from Select3D)
106     returns Boolean from Standard;
107     ---Purpose: compares the current projector of the localContext
108     --          with <aPrj>
109     --          returns True if the projectors are identical.
110     --          (no need to update projection of selection primitives
111     --          when closing the local context)....
112
113     Reactivate(me:mutable);
114     ---Purpose: to be called when a upper local context was closed...
115     --          useful to put pack the right projector...
116
117                             ---Category: LOAD AND PREPARE 
118                             --           - INTERACTIVE   OBJECTS...
119                             --           - FILTERS
120                             --           - STANDARD MODES OF ACTIVATION
121
122
123
124
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...
132
133     Load(me             : mutable;
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
140     
141     Erase(me: mutable;
142           anInteractive   : InteractiveObject from AIS)
143     returns Boolean from Standard;
144     ---Purpose: returns true if done...
145           
146          
147     Remove(me          : mutable;
148            aSelectable : InteractiveObject from AIS)
149     returns Boolean from Standard;
150
151           
152     ClearPrs (me             : mutable;
153               anInteractive  : InteractiveObject from AIS;
154               aMode          : Integer from Standard)
155     returns Boolean from Standard;
156           
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
164     
165     
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...)
169  
170
171
172
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...
177                       
178     DeactivateMode(me         : mutable; 
179                   aSelectable: InteractiveObject from AIS; 
180                   aMode      : Integer from Standard );
181     Deactivate(me         : mutable; 
182                   aSelectable: InteractiveObject from AIS);
183
184     ActivateStandardMode(me:mutable;aType:ShapeEnum from TopAbs);
185     ---Purpose: decomposition of shapes into <aType>
186    
187     
188     DeactivateStandardMode(me:mutable;aType:ShapeEnum from TopAbs);
189
190     StandardModes(me) returns ListOfInteger from TColStd;
191     ---C++: return const &
192     ---C++: inline
193
194
195
196     AddFilter(me:mutable;aFilter:Filter from SelectMgr);
197
198     RemoveFilter(me:mutable;aFilter:     Filter from SelectMgr);
199
200     
201     ListOfFilter(me) returns ListOfFilter from SelectMgr;
202     ---C++: return const &
203     ---C++: inline
204
205     Filter(me) returns any OrFilter from SelectMgr;
206     ---C++: return const &
207     ---C++: inline
208     
209
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
213     --          main viewer.
214     --          Else the user has to manage the detected shape outside the
215     --          Shape Selector....
216     ---C++: inline
217
218
219
220     AutomaticHilight(me) returns Boolean;
221     ---C++: inline
222
223
224
225                     ---Category: THE SELECTION PROCESS
226
227
228     MoveTo(me:mutable;Xpix,Ypix : Integer from Standard;
229                          aview : View from V3d)
230     returns StatusOfDetection from AIS;
231
232
233     HasNextDetected(me) returns Boolean from Standard;
234     ---C++: inline
235     ---Purpose: returns True if more than one entity
236     --          was detected at the last Mouse position.
237     
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)
242
243     HilightPreviousDetected(me:mutable;aView:View from V3d)
244     returns Integer from Standard;
245
246     
247     UnhilightLastDetected(me:mutable;aView:View from V3d) returns Boolean from Standard;
248     ---Purpose: returns True if something was done...
249
250     Select(me: mutable;updateviewer : Boolean from Standard = Standard_True)
251     returns StatusOfPick from AIS;
252     ---Purpose: returns the number of selected
253     
254     ShiftSelect(me: mutable;updateviewer : Boolean from Standard = Standard_True)
255     returns StatusOfPick from AIS;
256
257     Select(me                      : mutable;
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;
262
263
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;
269
270     Select(me                      : mutable;
271            Polyline                : Array1OfPnt2d from TColgp;
272            aView                   : View from V3d;
273            updateviewer            : Boolean from Standard = Standard_True)
274     returns StatusOfPick from AIS;
275
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;
281
282     HilightPicked(me:mutable;updateviewer:Boolean from Standard =Standard_True) ;
283     
284     UnhilightPicked(me:mutable;updateviewer:Boolean from Standard = Standard_True) ;
285
286
287     UpdateSelected     (me           : mutable;
288                         updateviewer : Boolean from Standard = Standard_True); 
289
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.
297         
298
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
304
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);
313
314     AddOrRemoveSelected(me           : mutable;
315                         Ownr         : EntityOwner from SelectMgr;
316                         updateviewer : Boolean from Standard=Standard_True);
317
318
319
320     ClearSelected(me:mutable;updateviewer : Boolean from Standard=Standard_True);
321     ---Purpose: 
322
323                     
324                     ---Category: GET THE DETECTED
325
326
327     HasDetected     (me) returns Boolean from Standard;
328     ---C++: inline
329
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;
336
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;
342
343
344                     ---Category: GET THE SELECTED
345
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 &
354
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 &
364
365
366
367
368
369
370                   ---Category: Management Of Temporary Attributes
371
372     SetDisplayPriority(me      : mutable;
373                        anObject: InteractiveObject from AIS;
374                        Prior   : Integer from Standard);
375
376     DisplayedObjects(me;theMapToFill : in out MapOfTransient from TColStd)
377     returns Integer from Standard;
378
379     IsIn(me;anObject : InteractiveObject from AIS)
380     returns Boolean from Standard;
381
382
383     IsDisplayed(me;anObject : InteractiveObject from AIS)
384     returns Boolean from Standard;
385
386     IsDisplayed(me;anObject : InteractiveObject from AIS;
387                 aMode : Integer from Standard)
388     returns Boolean from Standard;
389
390     SelectionModes(me;anObject:InteractiveObject from AIS)
391     returns ListOfInteger from TColStd;
392     ---C++: return const &
393
394     SubIntensityOn(me:mutable; anObject : InteractiveObject from AIS ); 
395  
396     SubIntensityOff(me:mutable; anObject : InteractiveObject from AIS ); 
397     
398     Hilight(me: mutable; anObject  : InteractiveObject from AIS);
399
400     Hilight(me:mutable; anObject  : InteractiveObject from AIS;aCol:NameOfColor  from  Quantity);
401
402     Unhilight(me:mutable; anObject : InteractiveObject from AIS);
403
404     IsHilighted(me;anObject : InteractiveObject from AIS)
405     returns Boolean from Standard;
406
407     IsHilighted(me;
408                 anObject  : InteractiveObject from AIS;
409                 WithColor : out Boolean from Standard;
410                 HiCol     : out NameOfColor from Quantity)
411     returns Boolean from Standard;
412     
413     SetSensitivity(me:mutable;
414                         aPrecision: Real from Standard);
415     ---Level: Public
416     ---Purpose: Define the current selection sensitivity for
417     --          this local context according to the view size.
418     
419     SetSensitivity(me:mutable;
420                         aPrecision: Integer from Standard = 2);
421     ---Level: Public
422     ---Purpose: Define the current selection sensitivity for
423     --          this local context according to the view size.
424
425                         ---Category: IMMEDIATE MODE
426
427
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
431
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.
435
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.
439
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.
443
444     IsImmediateModeOn(me) returns Boolean from Standard;
445             
446                             ---Category: INTERNAL METHODS;
447
448     UpdateConversion(me:mutable);
449
450     UpdateSort(me:mutable);
451
452
453
454     Status(me) returns AsciiString from TCollection is private;
455     
456     Status(me;anObject : InteractiveObject from AIS)
457     returns any LocalStatus from AIS is private;
458     ---C++: return const&
459
460
461
462     LoadContextObjects(me:mutable);
463
464     UnloadContextObjects(me:mutable);
465
466     Process(me       : mutable;
467             anObject : SelectableObject from SelectMgr;
468             WithProj: Boolean from Standard = Standard_True) is static private;
469
470     Process(me:mutable;
471             WithProj: Boolean from Standard = Standard_True) is static private;
472     
473
474     ActivateStandardModes(me:mutable;anObject: SelectableObject from SelectMgr;
475             WithProj: Boolean from Standard = Standard_True)  is  static  private;
476
477     ManageDetected(me:mutable;
478                    aPickOwner : EntityOwner from SelectMgr;
479                    aview      : View  from  V3d) is static  private;
480
481     DetectedIndex(me:mutable) returns Integer from Standard is static private;
482     ---C++: inline
483     ---Purpose: returns 0  if the detected entity was Not FilterOK...
484   
485     Hilight(me:mutable;Own:EntityOwner from SelectMgr;aview:   View from V3d) is static  private; 
486     
487     
488     Unhilight(me:mutable;Ownr:EntityOwner from SelectMgr;aview: View from  V3d) is static  private;
489
490   
491     ClearObjects(me:mutable) is static private;
492
493     ClearDetected(me:mutable) is static private;
494
495     IsDecompositionOn(me) returns Boolean from Standard is static private;
496     
497     IsShape(me;anIndex:Integer from Standard) returns Boolean from Standard is static private;
498
499     IsValidForSelection(me;anIObj:InteractiveObject from AIS) returns Boolean from Standard is static private;
500     
501     IsValidIndex(me;anIndex:Integer from Standard) 
502     returns Boolean from Standard is static private;    
503     ---C++: inline
504     
505     ComesFromDecomposition(me; aPickedIndex : Integer from Standard)
506     returns Boolean from Standard is static private;
507
508
509     DisplayAreas(me:mutable;aviou:View from V3d);
510     
511     ClearAreas (me:mutable;
512                 aView: View from V3d) is static;
513     ---Level: Internal 
514
515     HasFilters(me;aType:ShapeEnum from TopAbs) 
516     returns Boolean from Standard is private;
517     
518     DisplaySensitive(me:mutable;aView : View from V3d) is static; 
519     
520     ClearSensitive(me:mutable;aView:View from V3d) is static;
521
522
523         
524     MainSelector(me) returns any ViewerSelector3d from StdSelect;
525     ---C++: inline
526     ---C++: return const&
527
528
529     HilightTriangle(me:mutable;Rank:Integer from Standard;aViou:View from V3d) is static private;
530     ---Level: Internal 
531
532
533     FindSelectedOwnerFromIO(me;anIObj:InteractiveObject from AIS)
534     returns EntityOwner from SelectMgr;
535
536     FindSelectedOwnerFromShape(me;aShape : Shape from TopoDS)
537     returns EntityOwner from SelectMgr;
538
539
540
541 fields
542
543     myCTX                              : InteractiveContext from AIS;
544     myLoadDisplayed,myAcceptStdMode    : Boolean from Standard;
545     myAcceptErase                      : Boolean from Standard;        
546
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;
552     
553             -- The Objects and their attributes...
554     
555     myActiveObjects  : DataMapOfSelStat    from AIS;  
556     
557     
558             -- The  Filters...
559         
560     myFilters              : OrFilter      from SelectMgr;
561     myListOfStandardMode   : ListOfInteger from TColStd;
562
563     -- VTN myStdFilters : Filter from SelectMgr [7]; --internal mgt
564     myStdFilters : Filter from SelectMgr [9]; --internal mgt
565  
566             -- Selection Process
567
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;          
573
574
575     myDetectedSeq  : SequenceOfInteger from TColStd;
576     myCurDetected  : Integer from Standard;
577
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().
583     
584 friends 
585
586     KeepTemporary from  InteractiveContext from AIS(me:mutable;anIObj:InteractiveObject from AIS;WhichMode  :  Integer  from  Standard  =  -1) 
587
588 end LocalContext;
589
590
591
592
593