0023663: Removing 2D viewer library
[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
4-- Copyright (c) 1999-2012 OPEN CASCADE SAS
5--
6-- The content of this file is subject to the Open CASCADE Technology Public
7-- License Version 6.5 (the "License"). You may not use the content of this file
8-- except in compliance with the License. Please obtain a copy of the License
9-- at http://www.opencascade.org and read it completely before using this file.
10--
11-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13--
14-- The Original Code and all software distributed under the License is
15-- distributed on an "AS IS" basis, without warranty of any kind, and the
16-- Initial Developer hereby disclaims all such warranties, including without
17-- limitation, any warranties of merchantability, fitness for a particular
18-- purpose or non-infringement. Please see the License for the specific terms
19-- and conditions governing the rights and limitations under the License.
20
7fd59977 21-- Modified May 20th 98 :
22-- Modification in Management of selected entities
23-- Now we store the selected entity Owner in AIS_Selection.
24-- (no more links with Session...)
25-- Modifications in Management of hilight of detected entities
26-- VTN 23/11/99 BUC60614 Avoid to crash because
27-- myStdFilters array is too short.
28-- GG : BUC60688 25/05/00 Add SetSensitivity() methods
29-- GG : IMP150501 Remove oboslete method DragTo
30-- (See AIS_InteractiveContext)
31-- ZSV : IMP160701 Add InitDetected(),MoreDetected(),NextDetected(),
32-- DetectedCurrentShape(),DetectedCurrentObject()
33-- methods
7fd59977 34
35
1bd2fa67 36class LocalContext from AIS inherits TShared from MMgt
7fd59977 37
38 ---Purpose: Defines a specific context for selection.
39 -- It becomes possible to:
40 -- + Load InteractiveObjects with a mode to be
41 -- activated + associate InteractiveObjects with a
42 -- set of temporary selectable Objects.... + +
43 -- activate StandardMode of selection for Entities
44 -- inheriting BasicShape from AIS (Selection Of
45 -- vertices, edges, wires,faces... + Add Filters
46 -- acting on detected owners of sensitive primitives
47 --
48 --
49 -- - automatically highlight shapes and
50 -- InteractiveObjects (highlight of detected shape +
51 -- highlight of detected selectable...
52 --
53
54uses
55 AsciiString from TCollection,
56 ListOfInteger from TColStd,
57 SequenceOfInteger from TColStd,
58 MapOfTransient from TColStd,
59 Array1OfPnt2d from TColgp,
60 NameOfColor from Quantity,
61 ShapeEnum from TopAbs,
62 Shape from TopoDS,
63 View from V3d,
64 PresentationManager3d from PrsMgr,
65 Projector from Select3D,
66 IndexedMapOfOwner from SelectMgr,
67 EntityOwner from SelectMgr,
68 OrFilter from SelectMgr,
69 Filter from SelectMgr,
70 SelectionManager from SelectMgr,
71 SelectableObject from SelectMgr ,
72 ListOfFilter from SelectMgr,
73 BRepOwner from StdSelect,
74 ViewerSelector3d from StdSelect,
3c982548 75 SensitivityMode from StdSelect,
7fd59977 76 InteractiveContext from AIS,
77 ClearMode from AIS,
78 InteractiveObject from AIS,
79 Shape from AIS,
80 DataMapOfSelStat from AIS,
81 LocalStatus from AIS,
82 StatusOfPick from AIS,
83 StatusOfDetection from AIS,
84 SequenceOfInteractive from AIS
85
86is
87
88 Create returns mutable LocalContext from AIS;
89
90
91 Create (aCtx : InteractiveContext from AIS;
92 anIndex : Integer from Standard;
93 LoadDisplayed : Boolean from Standard=Standard_True;
94 AcceptStandardModes : Boolean from Standard=Standard_True;
95 AcceptErase : Boolean from Standard= Standard_False;
96 UseBothViewers : Boolean from Standard= Standard_False)
97 returns mutable LocalContext from AIS;
98 ---Purpose: Constructor By Default, the displayed objects are
99 -- automatically loaded.
100
101
102 AcceptErase(me:mutable;aStatus : Boolean from Standard);
103 ---C++: inline
104 ---Purpose: authorize or not others contexts to erase
105 -- temporary displayed objects here;
106
107 AcceptErase(me) returns Boolean from Standard;
108 ---C++: inline
109
110 SetContext(me:mutable;aCtx:InteractiveContext from AIS);
111
112 SelectionName(me) returns AsciiString from TCollection;
113 ---C++: inline
114 ---C++: return const&
115
116
117 Terminate(me: mutable; updateviewer : Boolean from Standard = Standard_True);
118
119 HasSameProjector(me;aPrj:Projector from Select3D)
120 returns Boolean from Standard;
121 ---Purpose: compares the current projector of the localContext
122 -- with <aPrj>
123 -- returns True if the projectors are identical.
124 -- (no need to update projection of selection primitives
125 -- when closing the local context)....
126
127 Reactivate(me:mutable);
128 ---Purpose: to be called when a upper local context was closed...
129 -- useful to put pack the right projector...
130
131 ---Category: LOAD AND PREPARE
132 -- - INTERACTIVE OBJECTS...
133 -- - FILTERS
134 -- - STANDARD MODES OF ACTIVATION
135
136
137
138
139 Display(me : mutable;
140 anInteractive : InteractiveObject from AIS;
141 DisplayMode : Integer from Standard = 0;
142 AllowShapeDecomposition: Boolean from Standard = Standard_True;
143 ActivationMode : Integer from Standard = 0)
144 returns Boolean from Standard;
145 ---Purpose: returns true if done...
146
147 Load(me : mutable;
148 anInteractive : InteractiveObject from AIS;
149 AllowShapeDecomposition: Boolean from Standard = Standard_True;
150 ActivationMode : Integer from Standard = 0)
151 returns Boolean from Standard;
152 ---Purpose: loads <anInteractive> with nodisplay...
153 -- returns true if done
154
155 Erase(me: mutable;
156 anInteractive : InteractiveObject from AIS)
157 returns Boolean from Standard;
158 ---Purpose: returns true if done...
159
160
161 Remove(me : mutable;
162 aSelectable : InteractiveObject from AIS)
163 returns Boolean from Standard;
164
165
166 ClearPrs (me : mutable;
167 anInteractive : InteractiveObject from AIS;
168 aMode : Integer from Standard)
169 returns Boolean from Standard;
170
171 SetShapeDecomposition(me : mutable;
172 aStoredObject : InteractiveObject from AIS;
173 aStatus : Boolean from Standard);
174 ---Purpose: allows or forbids the shape decomposition into
175 -- Activated Standard Mode for <aStoredObject>
176 -- does nothing if the object doesn't inherits
177 -- BasicShape from AIS
178
179
180 Clear(me:mutable;atype: ClearMode from AIS = AIS_CM_All);
181 ---Purpose: according to <atype> , clears the different parts of
182 -- the selector (filters, modeof activation, objects...)
183
184
185
186
187 ActivateMode (me : mutable;
188 aSelectable: InteractiveObject from AIS;
189 aMode : Integer from Standard );
190 ---Purpose: optional : activation of a mode which is not 0 for a selectable...
191
192 DeactivateMode(me : mutable;
193 aSelectable: InteractiveObject from AIS;
194 aMode : Integer from Standard );
195 Deactivate(me : mutable;
196 aSelectable: InteractiveObject from AIS);
197
198 ActivateStandardMode(me:mutable;aType:ShapeEnum from TopAbs);
199 ---Purpose: decomposition of shapes into <aType>
200
201
202 DeactivateStandardMode(me:mutable;aType:ShapeEnum from TopAbs);
203
204 StandardModes(me) returns ListOfInteger from TColStd;
205 ---C++: return const &
206 ---C++: inline
207
208
209
210 AddFilter(me:mutable;aFilter:Filter from SelectMgr);
211
212 RemoveFilter(me:mutable;aFilter: Filter from SelectMgr);
213
214
215 ListOfFilter(me) returns ListOfFilter from SelectMgr;
216 ---C++: return const &
217 ---C++: inline
218
219 Filter(me) returns any OrFilter from SelectMgr;
220 ---C++: return const &
221 ---C++: inline
222
223
224 SetAutomaticHilight(me:mutable ; aStatus:Boolean) ;
225 ---Purpose: if <aStatus> = True , the shapes or subshapes detected
226 -- by the selector will be automatically hilighted in the
227 -- main viewer.
228 -- Else the user has to manage the detected shape outside the
229 -- Shape Selector....
230 ---C++: inline
231
232
233
234 AutomaticHilight(me) returns Boolean;
235 ---C++: inline
236
237
238
239 ---Category: THE SELECTION PROCESS
240
241
242 MoveTo(me:mutable;Xpix,Ypix : Integer from Standard;
243 aview : View from V3d)
244 returns StatusOfDetection from AIS;
245
246
247 HasNextDetected(me) returns Boolean from Standard;
248 ---C++: inline
249 ---Purpose: returns True if more than one entity
250 -- was detected at the last Mouse position.
251
252 HilightNextDetected(me:mutable;aView:View from V3d)
253 returns Integer from Standard;
254 ---Purpose: returns True if last detected. the next detected will
255 -- be first one (endless loop)
256
257 HilightPreviousDetected(me:mutable;aView:View from V3d)
258 returns Integer from Standard;
259
260
261 UnhilightLastDetected(me:mutable;aView:View from V3d) returns Boolean from Standard;
262 ---Purpose: returns True if something was done...
263
264 Select(me: mutable;updateviewer : Boolean from Standard = Standard_True)
265 returns StatusOfPick from AIS;
266 ---Purpose: returns the number of selected
267
268 ShiftSelect(me: mutable;updateviewer : Boolean from Standard = Standard_True)
269 returns StatusOfPick from AIS;
270
271 Select(me : mutable;
272 XPMin,YPMin,XPMax,YPMax : Integer from Standard;
273 aView : View from V3d;
274 updateviewer : Boolean from Standard = Standard_True)
275 returns StatusOfPick from AIS;
276
277
278 ShiftSelect(me : mutable;
279 XPMin,YPMin,XPMax,YPMax : Integer from Standard;
280 aView : View from V3d;
281 updateviewer : Boolean from Standard = Standard_True)
282 returns StatusOfPick from AIS;
283
284 Select(me : mutable;
285 Polyline : Array1OfPnt2d from TColgp;
286 aView : View from V3d;
287 updateviewer : Boolean from Standard = Standard_True)
288 returns StatusOfPick from AIS;
289
290 ShiftSelect(me : mutable;
291 Polyline : Array1OfPnt2d from TColgp;
292 aView : View from V3d;
293 updateviewer : Boolean from Standard = Standard_True)
294 returns StatusOfPick from AIS;
295
296 HilightPicked(me:mutable;updateviewer:Boolean from Standard =Standard_True) ;
297
298 UnhilightPicked(me:mutable;updateviewer:Boolean from Standard = Standard_True) ;
299
300
301 UpdateSelected (me : mutable;
302 updateviewer : Boolean from Standard = Standard_True);
303
304 UpdateSelected (me : mutable;
305 anobj : InteractiveObject from AIS;
306 updateviewer : Boolean from Standard = Standard_True);
307 ---Purpose: Part of advanced selection highlighting mechanism.
308 -- If no owners belonging to anobj are selected, calls anobj->ClearSelected(),
309 -- otherwise calls anobj->HilightSelected(). This method can be used to avoid
310 -- redrawing the whole selection belonging to several Selectable Objects.
311
312
313 SetSelected(me : mutable;
314 anobj : InteractiveObject from AIS;
315 updateviewer : Boolean from Standard=Standard_True);
316 ---Purpose: useful to update selection with objects coming from
317 -- Collector or stack
318
319 AddOrRemoveSelected(me : mutable;
320 anobj : InteractiveObject from AIS;
321 updateviewer : Boolean from Standard=Standard_True);
322 ---Purpose: useful to update selection with objects coming from
323 -- Collector or stack
324 AddOrRemoveSelected(me : mutable;
325 aShape : Shape from TopoDS;
326 updateviewer : Boolean from Standard=Standard_True);
327
328 AddOrRemoveSelected(me : mutable;
329 Ownr : EntityOwner from SelectMgr;
330 updateviewer : Boolean from Standard=Standard_True);
331
332
333
334 ClearSelected(me:mutable;updateviewer : Boolean from Standard=Standard_True);
335 ---Purpose:
336
337
338 ---Category: GET THE DETECTED
339
340
341 HasDetected (me) returns Boolean from Standard;
342 ---C++: inline
343
344 InitDetected(me: mutable);
345 MoreDetected(me) returns Boolean from Standard;
346 NextDetected(me: mutable);
347 DetectedCurrentShape(me) returns Shape from TopoDS;
348 ---C++: return const &
349 DetectedCurrentObject(me) returns InteractiveObject from AIS;
350
351 HasDetectedShape(me) returns Boolean from Standard;
352 DetectedShape (me) returns Shape from TopoDS;
353 ---C++: return const &
354 DetectedInteractive(me) returns InteractiveObject from AIS;
355 DetectedOwner (me) returns EntityOwner from SelectMgr;
356
357
358 ---Category: GET THE SELECTED
359
360 InitSelected (me: mutable);
361 MoreSelected(me) returns Boolean from Standard;
362 NextSelected(me:mutable);
363 HasShape(me) returns Boolean from Standard;
364 ---Purpose: returns TRUE if the detected entity is a shape
365 -- coming from a Decomposition of an element.
366 SelectedShape(me) returns Shape from TopoDS;
367 ---C++: return const &
368
369 SelectedOwner(me) returns EntityOwner from SelectMgr;
370 IsSelected(me;aniobj: InteractiveObject from AIS) returns Boolean from Standard;
371 IsSelected(me;anOwner: EntityOwner from SelectMgr) returns Boolean from Standard;
372 SelectedInteractive(me) returns InteractiveObject from AIS;
373 HasApplicative (me) returns Boolean from Standard;
374 ---Purpose: returns TRUE if an interactive element
375 -- was associated with the current picked entity.
376 SelectedApplicative(me) returns any Transient from Standard;
377 ---C++: return const &
378
379
380
381
382
383
384 ---Category: Management Of Temporary Attributes
385
386 SetDisplayPriority(me : mutable;
387 anObject: InteractiveObject from AIS;
388 Prior : Integer from Standard);
389
59f45b7c 390 SetZLayer( me : mutable;
391 theIObj : InteractiveObject from AIS;
392 theLayerId : Integer from Standard );
393 ---Purpose: Set Z layer id for interactive object. The layer can be
394 -- specified for displayed object only. The Z layers can be used to display
395 -- temporarily presentations of some object in front of the other objects
396 -- in the scene. The ids for Z layers are generated by V3d_Viewer.
397 -- Note that Z layers differ from under-/overlayer in V3d_View:
398 -- under-/overlayer are intended for specific 2D drawings that appear
399 -- behind/in front of all 3D presentations, while SetZLayer() method
400 -- applies to regular 3D presentations and does not imply any specific
401 -- drawing methods.
402
403 GetZLayer( me;
404 theIObj : InteractiveObject from AIS )
405 returns Integer from Standard;
406 ---Purpose: Get Z layer id set for displayed interactive object.
407 -- If the object doesn't exists in context or has no computed presentations,
408 -- the method returns -1.
409
7fd59977 410 DisplayedObjects(me;theMapToFill : in out MapOfTransient from TColStd)
411 returns Integer from Standard;
412
413 IsIn(me;anObject : InteractiveObject from AIS)
414 returns Boolean from Standard;
415
416
417 IsDisplayed(me;anObject : InteractiveObject from AIS)
418 returns Boolean from Standard;
419
420 IsDisplayed(me;anObject : InteractiveObject from AIS;
421 aMode : Integer from Standard)
422 returns Boolean from Standard;
423
424 SelectionModes(me;anObject:InteractiveObject from AIS)
425 returns ListOfInteger from TColStd;
426 ---C++: return const &
427
428 SubIntensityOn(me:mutable; anObject : InteractiveObject from AIS );
429
430 SubIntensityOff(me:mutable; anObject : InteractiveObject from AIS );
431
432 Hilight(me: mutable; anObject : InteractiveObject from AIS);
433
434 Hilight(me:mutable; anObject : InteractiveObject from AIS;aCol:NameOfColor from Quantity);
435
436 Unhilight(me:mutable; anObject : InteractiveObject from AIS);
437
438 IsHilighted(me;anObject : InteractiveObject from AIS)
439 returns Boolean from Standard;
440
441 IsHilighted(me;
442 anObject : InteractiveObject from AIS;
443 WithColor : out Boolean from Standard;
444 HiCol : out NameOfColor from Quantity)
445 returns Boolean from Standard;
446
3c982548 447 SetSensitivityMode(me : mutable;
448 aMode : SensitivityMode from StdSelect) is static;
449 ---Level: Public
450 ---Purpose: Sets the selection sensitivity mode. SM_WINDOW mode
451 -- uses the specified pixel tolerance to compute the sensitivity
452 -- value, SM_VIEW mode allows to define the sensitivity manually.
453
454 SensitivityMode(me) returns SensitivityMode from StdSelect;
455 ---Level: Public
456 ---Purpose: Returns the selection sensitivity mode.
457
7fd59977 458 SetSensitivity(me:mutable;
459 aPrecision: Real from Standard);
460 ---Level: Public
461 ---Purpose: Define the current selection sensitivity for
462 -- this local context according to the view size.
463
3c982548 464 Sensitivity (me) returns Real from Standard;
465 ---Level: Public
466 ---Purpose: Returns the selection sensitivity value.
467
468 SetPixelTolerance(me:mutable;
7fd59977 469 aPrecision: Integer from Standard = 2);
470 ---Level: Public
471 ---Purpose: Define the current selection sensitivity for
472 -- this local context according to the view size.
473
3c982548 474 PixelTolerance(me) returns Integer from Standard;
475 ---Level: Public
476 ---Purpose: Returns the pixel tolerance.
477
7fd59977 478 ---Category: IMMEDIATE MODE
479
480
481 BeginImmediateDraw (me:mutable) returns Boolean from Standard;
482 ---Purpose: initializes the list of presentations to be displayed
483 -- returns False if No Local COnte
484
485 ImmediateAdd (me:mutable;anIObj:InteractiveObject from AIS;aMode:Integer from Standard=0)
486 returns Boolean from Standard;
487 ---Purpose: returns True if <anIObj> has been stored in the list.
488
489 ImmediateRemove (me:mutable;anIObj:InteractiveObject from AIS;aMode:Integer from Standard=0)
490 returns Boolean from Standard;
491 ---Purpose: returns True if <anIObj> has been removed from the list.
492
493 EndImmediateDraw(me:mutable;aView : View from V3d;DoubleBuf:Boolean from Standard=Standard_False)
494 returns Boolean from Standard;
495 ---Purpose: returns True if the immediate display has been done.
496
497 IsImmediateModeOn(me) returns Boolean from Standard;
498
499 ---Category: INTERNAL METHODS;
500
501 UpdateConversion(me:mutable);
502
503 UpdateSort(me:mutable);
504
505
506
507 Status(me) returns AsciiString from TCollection is private;
508
509 Status(me;anObject : InteractiveObject from AIS)
510 returns any LocalStatus from AIS is private;
511 ---C++: return const&
512
513
514
515 LoadContextObjects(me:mutable);
516
517 UnloadContextObjects(me:mutable);
518
519 Process(me : mutable;
520 anObject : SelectableObject from SelectMgr;
521 WithProj: Boolean from Standard = Standard_True) is static private;
522
523 Process(me:mutable;
524 WithProj: Boolean from Standard = Standard_True) is static private;
525
526
527 ActivateStandardModes(me:mutable;anObject: SelectableObject from SelectMgr;
528 WithProj: Boolean from Standard = Standard_True) is static private;
529
530 ManageDetected(me:mutable;
531 aPickOwner : EntityOwner from SelectMgr;
532 aview : View from V3d) is static private;
533
534 DetectedIndex(me:mutable) returns Integer from Standard is static private;
535 ---C++: inline
536 ---Purpose: returns 0 if the detected entity was Not FilterOK...
537
538 Hilight(me:mutable;Own:EntityOwner from SelectMgr;aview: View from V3d) is static private;
539
540
541 Unhilight(me:mutable;Ownr:EntityOwner from SelectMgr;aview: View from V3d) is static private;
542
543
544 ClearObjects(me:mutable) is static private;
545
546 ClearDetected(me:mutable) is static private;
547
548 IsDecompositionOn(me) returns Boolean from Standard is static private;
549
550 IsShape(me;anIndex:Integer from Standard) returns Boolean from Standard is static private;
551
552 IsValidForSelection(me;anIObj:InteractiveObject from AIS) returns Boolean from Standard is static private;
553
554 IsValidIndex(me;anIndex:Integer from Standard)
555 returns Boolean from Standard is static private;
556 ---C++: inline
557
558 ComesFromDecomposition(me; aPickedIndex : Integer from Standard)
559 returns Boolean from Standard is static private;
560
561
562 DisplayAreas(me:mutable;aviou:View from V3d);
563
564 ClearAreas (me:mutable;
565 aView: View from V3d) is static;
566 ---Level: Internal
567
568 HasFilters(me;aType:ShapeEnum from TopAbs)
569 returns Boolean from Standard is private;
570
571 DisplaySensitive(me:mutable;aView : View from V3d) is static;
572
573 ClearSensitive(me:mutable;aView:View from V3d) is static;
574
575
576
577 MainSelector(me) returns any ViewerSelector3d from StdSelect;
578 ---C++: inline
579 ---C++: return const&
580
581
582 HilightTriangle(me:mutable;Rank:Integer from Standard;aViou:View from V3d) is static private;
583 ---Level: Internal
584
585
586 FindSelectedOwnerFromIO(me;anIObj:InteractiveObject from AIS)
1bd2fa67 587 returns EntityOwner from SelectMgr;
7fd59977 588
589 FindSelectedOwnerFromShape(me;aShape : Shape from TopoDS)
1bd2fa67 590 returns EntityOwner from SelectMgr;
7fd59977 591
592
593
594fields
595
596 myCTX : InteractiveContext from AIS;
597 myLoadDisplayed,myAcceptStdMode : Boolean from Standard;
598 myAcceptErase : Boolean from Standard;
599
600 mySM : SelectionManager from SelectMgr;
601 myMainVS : ViewerSelector3d from StdSelect;
602 myMainPM : PresentationManager3d from PrsMgr;
603 mySelName : AsciiString from TCollection;
604 myCollVS : ViewerSelector3d from StdSelect;
605
606 -- The Objects and their attributes...
607
608 myActiveObjects : DataMapOfSelStat from AIS;
609
610
611 -- The Filters...
612
613 myFilters : OrFilter from SelectMgr;
614 myListOfStandardMode : ListOfInteger from TColStd;
615
616 -- VTN myStdFilters : Filter from SelectMgr [7]; --internal mgt
617 myStdFilters : Filter from SelectMgr [9]; --internal mgt
618
619 -- Selection Process
620
621 myAutoHilight : Boolean from Standard;
622 myMapOfOwner : IndexedMapOfOwner from SelectMgr;
623 mylastindex : Integer from Standard;
624 mylastgood : Integer from Standard;
625 myCurrentOwner : Integer from Standard;
626
627
628 myDetectedSeq : SequenceOfInteger from TColStd;
629 myCurDetected : Integer from Standard;
630
631 -- the detected objects.
632 myAISDetectedSeq : SequenceOfInteractive from AIS;
633 myAISCurDetected : Integer from Standard;
634 -- This variables is used by following functions:
635 -- InitDetected(), MoreDetected(), NextDetected(), DetectedCurrentShape(), DetectedCurrentObject().
636
637friends
638
639 KeepTemporary from InteractiveContext from AIS(me:mutable;anIObj:InteractiveObject from AIS;WhichMode : Integer from Standard = -1)
640
641end LocalContext;
642
643
644
645
646