1 // Created on: 1996-12-18
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _AIS_InteractiveContext_HeaderFile
18 #define _AIS_InteractiveContext_HeaderFile
20 #include <AIS_DataMapOfILC.hxx>
21 #include <AIS_DataMapOfIOStatus.hxx>
22 #include <AIS_DisplayMode.hxx>
23 #include <AIS_DisplayStatus.hxx>
24 #include <AIS_ClearMode.hxx>
25 #include <AIS_KindOfInteractive.hxx>
26 #include <AIS_ListOfInteractive.hxx>
27 #include <AIS_Selection.hxx>
28 #include <AIS_StatusOfDetection.hxx>
29 #include <AIS_StatusOfPick.hxx>
30 #include <AIS_TypeOfIso.hxx>
31 #include <Aspect_TypeOfFacingModel.hxx>
32 #include <Prs3d_Drawer.hxx>
33 #include <Prs3d_TypeOfHighlight.hxx>
34 #include <PrsMgr_PresentationManager3d.hxx>
35 #include <SelectMgr_IndexedMapOfOwner.hxx>
36 #include <SelectMgr_ListOfFilter.hxx>
37 #include <SelectMgr_PickingStrategy.hxx>
38 #include <Standard.hxx>
39 #include <Standard_Type.hxx>
40 #include <StdSelect_ViewerSelector3d.hxx>
41 #include <TCollection_AsciiString.hxx>
42 #include <TColgp_Array1OfPnt2d.hxx>
43 #include <TColStd_ListOfInteger.hxx>
44 #include <TopAbs_ShapeEnum.hxx>
45 #include <Quantity_Color.hxx>
47 class SelectMgr_SelectionManager;
49 class AIS_InteractiveObject;
50 class SelectMgr_OrFilter;
52 class AIS_LocalContext;
53 class TopLoc_Location;
54 class TCollection_ExtendedString;
55 class Prs3d_LineAspect;
56 class Prs3d_BasicAspect;
57 class SelectMgr_EntityOwner;
58 class SelectMgr_Filter;
59 class TCollection_AsciiString;
61 //! The Interactive Context allows you to manage
62 //! graphic behavior and selection of Interactive Objects
63 //! in one or more viewers. Class methods make this
64 //! highly transparent.
65 //! It is essential to remember that an Interactive Object
66 //! which is already known by the Interactive Context
67 //! must be modified using Context methods. You can
68 //! only directly call the methods available for an
69 //! Interactive Object if it has not been loaded into an
70 //! Interactive Context.
71 //! You must distinguish two states in the Interactive Context:
72 //! - No Open Local Context, also known as the Neutral Point.
73 //! - One or several open local contexts, each
74 //! representing a temporary state of selection and presentation.
75 //! Some methods can only be used in open Local
76 //! Context; others in closed Local Context; others do
77 //! not have the same behavior in one state as in the other.
78 //! The possiblities of use for local contexts are
79 //! numerous depending on the type of operation that
80 //! you want to perform, for example:
81 //! - working on all visualized interactive objects,
82 //! - working on only a few objects,
83 //! - working on a single object.
84 //! 1. When you want ot work on one type of entity, you
85 //! may open a local context with the option
86 //! UseDisplayedObjects set to false. DisplayedObjects
87 //! allows you to recover the visualized Interactive
88 //! Objects which have a given Type and
89 //! Signature from Neutral Point.
90 //! 2. You must keep in mind the fact that when you open
91 //! a Local Context with default options:
92 //! - The Interactive Objects visualized at Neutral Point
93 //! are activated with their default selection mode. You
94 //! must deactivate those which you do not want ot use.
95 //! - The Shape type Interactive Objects are
96 //! automatically decomposed into sub-shapes when
97 //! standard activation modes are launched.
98 //! - The "temporary" Interactive Objects present in the
99 //! Local Contexts are not automatically taken into
100 //! account. You have to load them manually if you
101 //! want to use them.
102 //! - The stages could be the following:
103 //! - Open a Local Context with the right options;
104 //! - Load/Visualize the required complementary
105 //! objects with the desired activation modes.
106 //! - Activate Standard modes if necessary
107 //! - Create its filters and add them to the Local Context
108 //! - Detect/Select/recover the desired entities
109 //! - Close the Local Context with the adequate index.
110 //! - It is useful to create an interactive editor, to which
111 //! you pass the Interactive Context. This will take care
112 //! of setting up the different contexts of
113 //! selection/presentation according to the operation
114 //! which you want to perform.
116 //! Selection of parts of the objects can also be done without opening a local context.
117 //! Interactive context itself supports decomposed object selection with selection filters
118 //! support. Note that each selectable object must specify the selection mode that is
119 //! responsible for selection of object as a whole (global selection mode). By default, global
120 //! selection mode is equal to 0, but it might be redefined if needed. Sub-part selection
121 //! of the objects without using local context provides a possibility to activate part
122 //! selection modes along with global selection mode.
123 class AIS_InteractiveContext : public Standard_Transient
125 friend class AIS_LocalContext;
126 DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext, Standard_Transient)
129 //! Constructs the interactive context object defined by
130 //! the principal viewer MainViewer.
131 Standard_EXPORT AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer);
134 Standard_EXPORT virtual ~AIS_InteractiveContext();
136 Standard_EXPORT void SetAutoActivateSelection (const Standard_Boolean Auto);
138 Standard_EXPORT Standard_Boolean GetAutoActivateSelection() const;
140 //! Setup picking strategy - which entities detected by picking line will be accepted, considering Selection Filters.
141 //! By default (SelectMgr_PickingStrategy_FirstAcceptable), Selection Filters reduce the list of entities
142 //! so that the context accepts topmost in remaining.
144 //! This means that entities behind non-selectable (by filters) parts can be picked by user.
145 //! If this behavior is undesirable, and user wants that non-selectable (by filters) parts
146 //! should remain an obstacle for picking, SelectMgr_PickingStrategy_OnlyTopmost can be set instead.
148 //! Notice, that since Selection Manager operates only objects registered in it,
149 //! SelectMgr_PickingStrategy_OnlyTopmost will NOT prevent picking entities behind
150 //! visible by unregistered in Selection Manager presentations (e.g. deactivated).
151 //! Hence, SelectMgr_PickingStrategy_OnlyTopmost changes behavior only with Selection Filters enabled.
152 void SetPickingStrategy (const SelectMgr_PickingStrategy theStrategy)
154 myPickingStrategy = theStrategy;
157 //! Return picking strategy; SelectMgr_PickingStrategy_FirstAcceptable by default.
158 SelectMgr_PickingStrategy PickingStrategy() const { return myPickingStrategy; }
160 //! Controls the choice between the using the display
161 //! and selection modes of open local context which you
162 //! have defined and activating those available by default.
163 //! If a local context is open and if updateviewer equals
164 //! Standard_False, the Interactive Object anIobj is
165 //! displayed in the default active mode. This will be the
166 //! object's default display mode, if there is one.
167 //! Otherwise, it will be the context mode. The Interactive
168 //! Object's default selection mode is activated. In
169 //! general, this is 0.
170 //! This syntax has the same behavior as local context,
171 //! open or closed. If you want to view the object in open
172 //! local context without selection, use the syntax below,
173 //! setting aSelectionMode to -1.
174 Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj,
175 const Standard_Boolean theToUpdateViewer);
177 //! Controls the choice between the using the display
178 //! and selection modes of open local context which you
179 //! have defined and activating those available by default.
180 //! If no Local Context is opened. and the Interactive
181 //! Object theIObj has no display mode of its own, the
182 //! default display mode, 0, is used. Likewise, if theIObj
183 //! has no selection mode of its own, the default one, 0, is used.
184 //! If a local context is open and if theToUpdateViewer equals
185 //! Standard_False, the presentation of the Interactive
186 //! Object activates the selection mode; the object is
187 //! displayed but no viewer will be updated.
188 //! If theSelectionMode equals -1, theIObj will not be
189 //! activated: it will be displayed but will not be selectable.
190 //! Use this if you want to view the object in open local
191 //! context without selection. Note: This option is only
192 //! available in Local Context.
193 //! If theToAllowDecomposition equals true, theIObj can have
194 //! subshapes detected by selection mechanisms. theIObj
195 //! must be able to give a shape selection modes which
196 //! fit the AIS_Shape selection modes:
200 Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj,
201 const Standard_Integer theDispMode,
202 const Standard_Integer theSelectionMode,
203 const Standard_Boolean theToUpdateViewer,
204 const Standard_Boolean theToAllowDecomposition = Standard_True,
205 const AIS_DisplayStatus theDispStatus = AIS_DS_None);
207 //! Allows you to load the Interactive Object aniobj
208 //! with a given selection mode SelectionMode, and/or
209 //! with the desired decomposition option, whether the
210 //! object is visualized or not. If AllowDecomp =
211 //! Standard_True and, if the interactive object is of
212 //! the "Shape" type, these "standard" selection
213 //! modes will be automatically activated as a function
214 //! of the modes present in the Local Context.
215 //! The loaded objects will be selectable but
216 //! displayable in highlighting only when detected by the Selector.
217 //! This method is available only when Local Contexts are open.
218 Standard_EXPORT void Load (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer SelectionMode = -1, const Standard_Boolean AllowDecomp = Standard_False);
220 //! Hides the object. The object's presentations are simply
221 //! flagged as invisible and therefore excluded from redrawing.
222 //! To show hidden objects, use Display().
223 Standard_EXPORT void Erase (const Handle(AIS_InteractiveObject)& theIObj,
224 const Standard_Boolean theToUpdateViewer);
226 //! Hides all objects. The object's presentations are simply
227 //! flagged as invisible and therefore excluded from redrawing.
228 //! To show all hidden objects, use DisplayAll().
229 Standard_EXPORT void EraseAll (const Standard_Boolean theToUpdateViewer);
231 //! Displays all hidden objects.
232 Standard_EXPORT void DisplayAll (const Standard_Boolean theToUpdateViewer);
235 //! Hides selected objects. The object's presentations are simply
236 //! flagged as invisible and therefore excluded from redrawing.
237 //! To show hidden objects, use Display().
238 Standard_EXPORT void EraseSelected (const Standard_Boolean theToUpdateViewer);
240 //! Displays selected objects if a local context is open.
241 //! Displays current objects if there is no active local context.
242 //! Objects selected when there is no open local context
243 //! are called current objects; those selected in open
244 //! local context, selected objects.
245 //! If a local context is open and if updateviewer equals
246 //! Standard_False, the presentation of the Interactive
247 //! Object activates the selection mode; the object is
248 //! displayed but no viewer will be updated.
249 Standard_EXPORT void DisplaySelected (const Standard_Boolean theToUpdateViewer);
251 //! Changes the status of a temporary object. It will be
252 //! kept at the neutral point, i.e. put in the list of
253 //! displayed objects along withwith its temporary
254 //! attributes. These include display mode and
255 //! selection mode, for example.
256 //! Returns true if done.
257 //! inWhichLocal gives the local context in which anIObj
258 //! is displayed. By default, the index -1 refers to the last
259 //! Local Context opened.
260 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
261 Standard_EXPORT Standard_Boolean KeepTemporary (const Handle(AIS_InteractiveObject)& anIObj, const Standard_Integer InWhichLocal = -1);
263 //! Empties the graphic presentation of the mode
264 //! indexed by aMode.
265 //! If a local context is open and if updateviewer equals
266 //! Standard_False, the presentation of the Interactive
267 //! Object activates the selection mode; the object is
268 //! displayed but no viewer will be updated.
270 //! Removes anIobj. anIobj is still active if it was
271 //! previously activated.
272 Standard_EXPORT void ClearPrs (const Handle(AIS_InteractiveObject)& theIObj,
273 const Standard_Integer theMode,
274 const Standard_Boolean theToUpdateViewer);
276 //! Removes aniobj from every viewer. aniobj is no
277 //! longer referenced in the Context.
278 //! If a local context is open and if updateviewer equals
279 //! Standard_False, the presentation of the Interactive
280 //! Object activates the selection mode; the object is
281 //! displayed but no viewer will be updated.
282 Standard_EXPORT void Remove (const Handle(AIS_InteractiveObject)& theIObj,
283 const Standard_Boolean theToUpdateViewer);
285 //! Removes all the objects from all opened Local Contexts
286 //! and from the Neutral Point
287 Standard_EXPORT void RemoveAll (const Standard_Boolean theToUpdateViewer);
289 //! Updates the display in the viewer to take dynamic
290 //! detection into account. On dynamic detection by the
291 //! mouse cursor, sensitive primitives are highlighted.
292 //! The highlight color of entities detected by mouse
293 //! movement is white by default.
294 //! If a local context is open and if updateviewer equals
295 //! Standard_False, the presentation of the Interactive
296 //! Object activates the selection mode; the object is
297 //! displayed but no viewer will be updated.
298 Standard_DEPRECATED("Deprecated method Hilight()")
299 void Hilight (const Handle(AIS_InteractiveObject)& theObj,
300 const Standard_Boolean theIsToUpdateViewer)
302 return HilightWithColor (theObj, myStyles[Prs3d_TypeOfHighlight_Dynamic], theIsToUpdateViewer);
305 //! Changes the color of all the lines of the object in view,
306 //! aniobj. It paints these lines the color passed as the
308 //! If a local context is open and if updateviewer equals
309 //! Standard_False, the presentation of the Interactive
310 //! Object activates the selection mode; the object is
311 //! displayed but no viewer will be updated.
312 Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& theObj,
313 const Handle(Prs3d_Drawer)& theStyle,
314 const Standard_Boolean theToUpdateViewer);
317 //! Removes hilighting from the entity aniobj. Updates the viewer.
318 //! If a local context is open and if updateviewer equals
319 //! Standard_False, the presentation of the Interactive
320 //! Object activates the selection mode; the object is
321 //! displayed but no viewer will be updated.
322 Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& theIObj,
323 const Standard_Boolean theToUpdateViewer);
325 //! Sets the display priority aPriority of the seen parts
326 //! presentation of the entity anIobj.
327 Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aPriority);
329 //! Set Z layer id for interactive object.
330 //! The Z layers can be used to display temporarily presentations of some object in front of the other objects in the scene.
331 //! The ids for Z layers are generated by V3d_Viewer.
332 Standard_EXPORT void SetZLayer (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theLayerId);
334 //! Get Z layer id set for displayed interactive object.
335 Standard_EXPORT Standard_Integer GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const;
337 //! Recomputes the seen parts presentation of the entity
338 //! aniobj. If allmodes equals true, all presentations are
339 //! present in the object even if unseen.
340 //! If a local context is open and if updateviewer equals
341 //! Standard_False, the presentation of the Interactive
342 //! Object activates the selection mode; the object is
343 //! displayed but no viewer will be updated.
344 Standard_EXPORT void Redisplay (const Handle(AIS_InteractiveObject)& theIObj,
345 const Standard_Boolean theToUpdateViewer,
346 const Standard_Boolean theAllModes = Standard_False);
348 //! Recomputes the Prs/Selection of displayed objects of
349 //! a given type and a given signature.
350 //! if signature = -1 doesnt take signature criterion.
351 Standard_EXPORT void Redisplay (const AIS_KindOfInteractive theTypeOfObject,
352 const Standard_Integer theSignature,
353 const Standard_Boolean theToUpdateViewer);
355 //! Recomputes the displayed presentations, flags the others
356 //! Doesn't update presentations
357 Standard_EXPORT void RecomputePrsOnly (const Handle(AIS_InteractiveObject)& theIObj,
358 const Standard_Boolean theToUpdateViewer,
359 const Standard_Boolean theAllModes = Standard_False);
361 //! Recomputes the active selections, flags the others
362 //! Doesn't update presentations
363 Standard_EXPORT void RecomputeSelectionOnly (const Handle(AIS_InteractiveObject)& anIObj);
365 //! Updates displayed interactive object by checking and
366 //! recomputing its flagged as "to be recomputed" presentation
367 //! and selection structures. This method does not force any
368 //! recomputation on its own. The method recomputes selections
369 //! even if they are loaded without activation in particular selector.
370 Standard_EXPORT void Update (const Handle(AIS_InteractiveObject)& theIObj,
371 const Standard_Boolean theUpdateViewer);
374 //! Sets the display mode of seen Interactive Objects.
375 //! aMode provides the display mode index of the entity aniobj.
376 //! If updateviewer equals Standard_True, the
377 //! predominant mode aMode will overule the context mode.
378 //! If a local context is open and if updateviewer equals
379 //! Standard_False, the presentation of the Interactive
380 //! Object returns to the default selection mode; the
381 //! object is displayed but no viewer will be updated.
382 //! Note that display mode 3 is only used if you have an
383 //! AIS_Textured Shape.
384 Standard_EXPORT void SetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
385 const Standard_Integer theMode,
386 const Standard_Boolean theToUpdateViewer);
389 //! Unsets the display mode of seen Interactive Objects.
390 //! aMode provides the display mode index of the entity aniobj.
391 //! If updateviewer equals Standard_True, the
392 //! predominant mode aMode will overule the context mode.
393 //! If a local context is open and if updateviewer equals
394 //! Standard_False, the presentation of the Interactive
395 //! Object returns to the default selection mode; the
396 //! object is displayed but no viewer will be updated.
397 Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
398 const Standard_Boolean theToUpdateViewer);
400 //! Setup pixel tolerance for MoveTo() operation.
401 Standard_EXPORT void SetPixelTolerance (const Standard_Integer thePrecision = 2);
403 //! Returns the pixel tolerance, default is 2.
404 //! Pixel Tolerance extends sensitivity within MoveTo() operation (picking by point)
405 //! and can be adjusted by application based on user input precision (e.g. screen pixel density, input device precision, etc.).
406 Standard_EXPORT Standard_Integer PixelTolerance() const;
408 //! Allows to manage sensitivity of a particular selection of interactive object theObject
409 //! and changes previous sensitivity value of all sensitive entities in selection with theMode
410 //! to the given theNewSensitivity.
411 Standard_EXPORT void SetSelectionSensitivity (const Handle(AIS_InteractiveObject)& theObject,
412 const Standard_Integer theMode,
413 const Standard_Integer theNewSensitivity);
415 //! Puts the location aLocation on the initial graphic
416 //! representation and the selection for the entity aniobj.
417 //! In other words, aniobj is visible and selectable at a
418 //! position other than initial position.
419 //! Graphic and selection primitives are not recomputed.
420 //! To clean the view correctly, you must reset the previous location.
421 Standard_EXPORT void SetLocation (const Handle(AIS_InteractiveObject)& aniobj, const TopLoc_Location& aLocation);
423 //! Puts the entity aniobj back into its initial position.
424 Standard_EXPORT void ResetLocation (const Handle(AIS_InteractiveObject)& aniobj);
427 //! Returns true if the entity aniobj has a location.
428 Standard_EXPORT Standard_Boolean HasLocation (const Handle(AIS_InteractiveObject)& aniobj) const;
431 //! Returns the location of the entity aniobj.
432 Standard_EXPORT TopLoc_Location Location (const Handle(AIS_InteractiveObject)& aniobj) const;
434 //! change the current facing model apply on polygons for
435 //! SetColor(), SetTransparency(), SetMaterial() methods
436 //! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is
437 //! applying both on the front and back face.
438 Standard_EXPORT void SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& aniobj, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE);
440 //! Sets the color of the selected entity.
441 //! If a local context is open and if updateviewer equals
442 //! Standard_False, the presentation of the Interactive
443 //! Object activates the selection mode; the object is
444 //! displayed but no viewer will be updated.
445 Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& theIObj,
446 const Quantity_Color& theColor,
447 const Standard_Boolean theToUpdateViewer);
449 //! Removes the color selection for the selected entity.
450 //! If a local context is open and if updateviewer equals
451 //! Standard_False, the presentation of the Interactive
452 //! Object activates the selection mode; the object is
453 //! displayed but no viewer will be updated.
454 Standard_EXPORT void UnsetColor (const Handle(AIS_InteractiveObject)& theIObj,
455 const Standard_Boolean theToUpdateViewer);
458 //! Sets the width of the entity aniobj.
459 //! If a local context is open and if updateviewer equals
460 //! Standard_False, the presentation of the Interactive
461 //! Object activates the selection mode; the object is
462 //! displayed but no viewer will be updated.
463 Standard_EXPORT virtual void SetWidth (const Handle(AIS_InteractiveObject)& theIObj,
464 const Standard_Real theValue,
465 const Standard_Boolean theToUpdateViewer);
468 //! Removes the width setting of the entity aniobj.
469 //! If a local context is open and if updateviewer equals
470 //! Standard_False, the presentation of the Interactive
471 //! Object activates the selection mode; the object is
472 //! displayed but no viewer will be updated.
473 Standard_EXPORT virtual void UnsetWidth (const Handle(AIS_InteractiveObject)& theIObj,
474 const Standard_Boolean theToUpdateViewer);
477 //! Provides the type of material setting for the view of
478 //! the entity aniobj.
479 //! If a local context is open and if updateviewer equals
480 //! Standard_False, the presentation of the Interactive
481 //! Object activates the selection mode; the object is
482 //! displayed but no viewer will be updated.
483 Standard_EXPORT void SetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
484 const Graphic3d_MaterialAspect& theMaterial,
485 const Standard_Boolean theToUpdateViewer);
488 //! Removes the type of material setting for viewing the
490 //! If a local context is open and if updateviewer equals
491 //! Standard_False, the presentation of the Interactive
492 //! Object activates the selection mode; the object is
493 //! displayed but no viewer will be updated.
494 Standard_EXPORT void UnsetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
495 const Standard_Boolean theToUpdateViewer);
497 //! Provides the transparency settings for viewing the
498 //! entity aniobj. The transparency value aValue may be
499 //! between 0.0, opaque, and 1.0, fully transparent.
500 //! If a local context is open and if updateviewer equals
501 //! Standard_False, the presentation of the Interactive
502 //! Object activates the selection mode; the object is
503 //! displayed but no viewer will be updated.
504 Standard_EXPORT void SetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
505 const Standard_Real theValue,
506 const Standard_Boolean theToUpdateViewer);
509 //! Removes the transparency settings for viewing the
510 //! entity aniobj. The transparency value aValue may be
511 //! between 0.0, opaque, and 1.0, fully transparent.
512 //! If a local context is open and if updateviewer equals
513 //! Standard_False, the presentation of the Interactive
514 //! Object activates the selection mode; the object is
515 //! displayed but no viewer will be updated.
516 Standard_EXPORT void UnsetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
517 const Standard_Boolean theToUpdateViewer);
520 //! Sets the attributes of the interactive object aniobj by
521 //! plugging the attribute manager aDrawer into the local
522 //! context. The graphic attributes of aDrawer such as
523 //! visualization mode, color, and material, are then used
524 //! to display aniobj.
525 //! If a local context is open and if updateviewer equals
526 //! Standard_False, the presentation of the Interactive
527 //! Object activates the selection mode; the object is
528 //! displayed but no viewer will be updated.
529 Standard_EXPORT void SetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
530 const Handle(Prs3d_Drawer)& theDrawer,
531 const Standard_Boolean theToUpdateViewer);
534 //! Removes the settings for local attributes of the entity
535 //! anObj and returns to the Neutral Point attributes or
536 //! those of the previous local context.
537 //! If a local context is open and if updateviewer equals
538 //! Standard_False, the presentation of the Interactive
539 //! Object activates the selection mode; the object is
540 //! displayed but no viewer will be updated.
541 Standard_EXPORT void UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
542 const Standard_Boolean theToUpdateViewer);
544 //! Sets up polygon offsets for the given AIS_InteractiveObject.
545 //! It simply calls anObj->SetPolygonOffsets()
546 Standard_EXPORT void SetPolygonOffsets (const Handle(AIS_InteractiveObject)& theIObj,
547 const Standard_Integer theMode,
548 const Standard_ShortReal theFactor,
549 const Standard_ShortReal theUnits,
550 const Standard_Boolean theToUpdateViewer);
552 //! simply calls anObj->HasPolygonOffsets()
553 Standard_EXPORT Standard_Boolean HasPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj) const;
555 //! Retrieves current polygon offsets settings for <anObj>.
556 Standard_EXPORT void PolygonOffsets (const Handle(AIS_InteractiveObject)& anObj, Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const;
558 //! Sets the size aSize of the trihedron.
559 //! Is used to change the default value 100 mm for
560 //! display of trihedra.
561 //! Use of this function in one of your own interactive
562 //! objects requires a call to the Compute function of the
563 //! new class. This will recalculate the presentation for
564 //! every trihedron displayed.
565 //! If a local context is open and if updateviewer equals
566 //! Standard_False, the presentation of the Interactive
567 //! Object activates the selection mode; the object is
568 //! displayed but no viewer will be updated.
569 Standard_EXPORT void SetTrihedronSize (const Standard_Real theSize,
570 const Standard_Boolean theToUpdateViewer);
572 //! returns the current value of trihedron size.
573 Standard_EXPORT Standard_Real TrihedronSize() const;
576 //! Sets the plane size defined by the length in the X
577 //! direction XSize and that in the Y direction YSize.
578 //! If a local context is open and if updateviewer equals
579 //! Standard_False, the presentation of the Interactive
580 //! Object activates the selection mode; the object is
581 //! displayed but no viewer will be updated.
582 Standard_EXPORT void SetPlaneSize (const Standard_Real theSizeX,
583 const Standard_Real theSizeY,
584 const Standard_Boolean theToUpdateViewer);
587 //! Sets the plane size aSize.
588 //! If a local context is open and if updateviewer equals
589 //! Standard_False, the presentation of the Interactive
590 //! Object activates the selection mode; the object is
591 //! displayed but no viewer will be updated.
592 //! May be used if PlaneSize returns true.
593 Standard_EXPORT void SetPlaneSize (const Standard_Real theSize,
594 const Standard_Boolean theToUpdateViewer);
596 //! Returns true if the length in the X direction XSize is
597 //! the same as that in the Y direction YSize.
598 Standard_EXPORT Standard_Boolean PlaneSize (Standard_Real& XSize, Standard_Real& YSize) const;
600 //! Returns the display status of the entity anIobj.
601 //! This will be one of the following:
602 //! - DS_Displayed displayed in main viewer
603 //! - DS_Erased hidden in main viewer
604 //! - DS_Temporary temporarily displayed
605 //! - DS_None nowhere displayed.
606 Standard_EXPORT AIS_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const;
609 //! Returns true if anIobj is displayed in the interactive context.
610 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const;
612 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode) const;
614 //! Returns true if the object is marked as highlighted via its global
616 //! @param theObj [in] the object to check
617 Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const;
619 //! Returns true if the owner is marked as selected
620 //! @param theOwner [in] the owner to check
621 Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner) const;
623 //! Returns highlight style of the object if it is marked as highlighted via global status
624 //! @param theObj [in] the object to check
625 Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
626 Handle(Prs3d_Drawer)& theStyle) const;
628 //! Returns highlight style of the owner if it is selected
629 //! @param theOwner [in] the owner to check
630 Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
631 Handle(Prs3d_Drawer)& theStyle) const;
633 //! Returns the display priority of the entity anIobj. This
634 //! will be display mode of anIobj if it is in the main
636 Standard_EXPORT Standard_Integer DisplayPriority (const Handle(AIS_InteractiveObject)& anIobj) const;
639 //! Returns true if a view of the Interactive Object aniobj has color.
640 Standard_EXPORT Standard_Boolean HasColor (const Handle(AIS_InteractiveObject)& aniobj) const;
642 //! Returns the color Color of the entity aniobj in the interactive context.
643 Standard_EXPORT void Color (const Handle(AIS_InteractiveObject)& aniobj, Quantity_Color& acolor) const;
646 //! Returns the width of the Interactive Object aniobj in
647 //! the interactive context.
648 Standard_EXPORT virtual Standard_Real Width (const Handle(AIS_InteractiveObject)& aniobj) const;
651 //! Returns the status astatus of the Interactive Context
652 //! for the view of the Interactive Object anObj.
653 Standard_EXPORT void Status (const Handle(AIS_InteractiveObject)& anObj, TCollection_ExtendedString& astatus) const;
655 //! Sets transform persistence.
656 Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
657 const Handle(Graphic3d_TransformPers)& theTrsfPers);
659 Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
660 void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
661 const Graphic3d_TransModeFlags& theFlag,
662 const gp_Pnt& thePoint = gp_Pnt (0.0, 0.0, 0.0))
664 SetTransformPersistence (theObj, Graphic3d_TransformPers::FromDeprecatedParams (theFlag, thePoint));
667 //! Updates the current viewer, the viewer in Neutral Point.
668 //! Objects selected when there is no open local context
669 //! are called current objects; those selected in open
670 //! local context, selected objects.
671 Standard_EXPORT void UpdateCurrentViewer();
673 //! Returns the display mode setting.
674 //! Note that mode 3 is only used.
675 Standard_Integer DisplayMode() const { return myDefaultDrawer->DisplayMode(); }
677 //! Returns highlight style settings.
678 const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
680 //! Setup highlight style settings.
681 void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
682 const Handle(Prs3d_Drawer)& theStyle) { myStyles[theStyleType] = theStyle; }
684 //! Returns current dynamic highlight style settings.
686 //! - the color of dynamic highlight is Quantity_NOC_CYAN1;
687 //! - the presentation for dynamic highlight is completely opaque;
688 //! - the type of highlight is Aspect_TOHM_COLOR.
689 const Handle(Prs3d_Drawer)& HighlightStyle() const
691 return myStyles[Prs3d_TypeOfHighlight_Dynamic];
694 //! Setup the style of dynamic highlighting.
695 void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
697 //! Returns current selection style settings.
699 //! - the color of selection is Quantity_NOC_GRAY80;
700 //! - the presentation for selection is completely opaque;
701 //! - the type of highlight is Aspect_TOHM_COLOR.
702 const Handle(Prs3d_Drawer)& SelectionStyle() const
704 return myStyles[Prs3d_TypeOfHighlight_Selected];
707 //! Setup the style of selection highlighting.
708 void SetSelectionStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Selected] = theStyle; }
710 //! Sub-intensity allows temporary highlighting of particular
711 //! objects with specified color in a manner of selection highlight,
712 //! but without actual selection (e.g., global status and owner's
713 //! selection state will not be updated).
714 //! The method returns the color of such highlighting.
715 //! By default, it is Quantity_NOC_GRAY40.
716 const Quantity_Color& SubIntensityColor() const
718 return myStyles[Prs3d_TypeOfHighlight_SubIntensity]->Color();
721 //! Sub-intensity allows temporary highlighting of particular
722 //! objects with specified color in a manner of selection highlight,
723 //! but without actual selection (e.g., global status and owner's
724 //! selection state will not be updated).
725 //! The method sets up the color for such highlighting.
726 //! By default, this is Quantity_NOC_GRAY40.
727 void SetSubIntensityColor (const Quantity_Color& theColor)
729 myStyles[Prs3d_TypeOfHighlight_SubIntensity]->SetColor (theColor);
732 //! Sets the display mode of seen Interactive Objects.
733 //! aMode provides the display mode index of the entity aniobj.
734 //! If updateviewer equals Standard_True, the
735 //! predominant mode aMode will overule the context mode.
736 //! If a local context is open and if updateviewer equals
737 //! Standard_False, the presentation of the Interactive
738 //! Object returns to the default selection mode; the
739 //! object is displayed but no viewer will be updated.
740 //! Note that display mode 3 is only used if you have an
741 //! AIS_Textured Shape.
742 Standard_EXPORT void SetDisplayMode (const Standard_Integer theMode,
743 const Standard_Boolean theToUpdateViewer);
746 //! Sets the deviation coefficient aCoefficient.
747 //! Drawings of curves or patches are made with respect
748 //! to a maximal chordal deviation. A Deviation coefficient
749 //! is used in the shading display mode. The shape is
750 //! seen decomposed into triangles. These are used to
751 //! calculate reflection of light from the surface of the
752 //! object. The triangles are formed from chords of the
753 //! curves in the shape. The deviation coefficient
754 //! aCoefficient gives the highest value of the angle with
755 //! which a chord can deviate from a tangent to a curve.
756 //! If this limit is reached, a new triangle is begun.
757 //! This deviation is absolute and is set through the
758 //! method: SetMaximalChordialDeviation. The default
760 //! In drawing shapes, however, you are allowed to ask
761 //! for a relative deviation. This deviation will be:
762 //! SizeOfObject * DeviationCoefficient.
764 Standard_EXPORT void SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
765 const Standard_Real theCoefficient,
766 const Standard_Boolean theToUpdateViewer);
768 Standard_EXPORT void SetDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
769 const Standard_Real theAngle,
770 const Standard_Boolean theToUpdateViewer);
772 //! Calls the AIS_Shape SetAngleAndDeviation to set
773 //! both Angle and Deviation coefficients
774 Standard_EXPORT void SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
775 const Standard_Real theAngle,
776 const Standard_Boolean theToUpdateViewer);
779 //! Sets the deviation coefficient aCoefficient for
780 //! removal of hidden lines created by different
781 //! viewpoints in different presentations. The Default value is 0.02.
782 Standard_EXPORT void SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
783 const Standard_Real theCoefficient,
784 const Standard_Boolean theToUpdateViewer);
786 Standard_EXPORT void SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
787 const Standard_Real theAngle,
788 const Standard_Boolean theToUpdateViewer);
790 //! Computes a HLRAngle and a
791 //! HLRDeviationCoefficient by means of the angle
792 //! anAngle and sets the corresponding methods in the
793 //! default drawing tool with these values.
794 Standard_EXPORT void SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
795 const Standard_Real theAngle,
796 const Standard_Boolean theToUpdateViewer);
798 //! Sets the deviation coefficient aCoefficient.
799 //! Drawings of curves or patches are made with respect
800 //! to a maximal chordal deviation. A Deviation coefficient
801 //! is used in the shading display mode. The shape is
802 //! seen decomposed into triangles. These are used to
803 //! calculate reflection of light from the surface of the
804 //! object. The triangles are formed from chords of the
805 //! curves in the shape. The deviation coefficient
806 //! aCoefficient gives the highest value of the angle with
807 //! which a chord can deviate from a tangent to a curve.
808 //! If this limit is reached, a new triangle is begun.
809 //! This deviation is absolute and is set through the
810 //! method: SetMaximalChordialDeviation. The default
812 //! In drawing shapes, however, you are allowed to ask
813 //! for a relative deviation. This deviation will be:
814 //! SizeOfObject * DeviationCoefficient.
816 Standard_EXPORT void SetDeviationCoefficient (const Standard_Real aCoefficient);
818 //! Returns the deviation coefficient.
819 //! Drawings of curves or patches are made with respect
820 //! to a maximal chordal deviation. A Deviation coefficient
821 //! is used in the shading display mode. The shape is
822 //! seen decomposed into triangles. These are used to
823 //! calculate reflection of light from the surface of the
824 //! object. The triangles are formed from chords of the
825 //! curves in the shape. The deviation coefficient gives
826 //! the highest value of the angle with which a chord can
827 //! deviate from a tangent to a curve. If this limit is
828 //! reached, a new triangle is begun.
829 //! This deviation is absolute and is set through
830 //! Prs3d_Drawer::SetMaximalChordialDeviation. The
831 //! default value is 0.001.
832 //! In drawing shapes, however, you are allowed to ask
833 //! for a relative deviation. This deviation will be:
834 //! SizeOfObject * DeviationCoefficient.
835 Standard_EXPORT Standard_Real DeviationCoefficient() const;
837 //! default 12 degrees
838 Standard_EXPORT void SetDeviationAngle (const Standard_Real anAngle);
840 Standard_EXPORT Standard_Real DeviationAngle() const;
842 //! Sets the deviation coefficient aCoefficient for
843 //! removal of hidden lines created by different
844 //! viewpoints in different presentations. The Default value is 0.02.
845 Standard_EXPORT void SetHLRDeviationCoefficient (const Standard_Real aCoefficient);
848 //! Returns the real number value of the hidden line
849 //! removal deviation coefficient.
850 //! A Deviation coefficient is used in the shading display
851 //! mode. The shape is seen decomposed into triangles.
852 //! These are used to calculate reflection of light from the
853 //! surface of the object.
854 //! The triangles are formed from chords of the curves in
855 //! the shape. The deviation coefficient give the highest
856 //! value of the angle with which a chord can deviate
857 //! from a tangent to a curve. If this limit is reached, a
858 //! new triangle is begun.
859 //! To find the hidden lines, hidden line display mode
860 //! entails recalculation of the view at each different
861 //! projector perspective.
862 //! Because hidden lines entail calculations of more than
863 //! usual complexity to decompose them into these
864 //! triangles, a deviation coefficient allowing greater
865 //! tolerance is used. This increases efficiency in calculation.
866 //! The Default value is 0.02.
867 Standard_EXPORT Standard_Real HLRDeviationCoefficient() const;
869 //! Sets the HLR angle anAngle.
870 Standard_EXPORT void SetHLRAngle (const Standard_Real anAngle);
873 //! Returns the real number value of the deviation angle
874 //! in hidden line removal views in this interactive context.
875 //! The default value is 20*PI/180.
876 Standard_EXPORT Standard_Real HLRAngle() const;
878 //! compute with anangle a HLRAngle and a HLRDeviationCoefficient
879 //! and set them in myHLRAngle and in myHLRDeviationCoefficient
880 //! of myDefaultDrawer ;
881 //! anAngle is in radian ; ( 1 deg < angle in deg < 20 deg)
882 Standard_EXPORT void SetHLRAngleAndDeviation (const Standard_Real anAngle);
884 //! Initializes hidden line aspect in the default drawing tool, or Drawer.
885 //! The default values are:
886 //! Color: Quantity_NOC_YELLOW
887 //! Type of line: Aspect_TOL_DASH
889 Standard_EXPORT Handle(Prs3d_LineAspect) HiddenLineAspect() const;
892 //! Sets the hidden line aspect anAspect.
893 //! anAspect defines display attributes for hidden lines in
895 Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& anAspect) const;
897 //! returns Standard_True if the hidden lines are to be drawn.
898 //! By default the hidden lines are not drawn.
899 Standard_EXPORT Standard_Boolean DrawHiddenLine() const;
901 Standard_EXPORT void EnableDrawHiddenLine() const;
903 Standard_EXPORT void DisableDrawHiddenLine() const;
905 //! Sets the number of U and V isoparameters displayed.
906 Standard_EXPORT void SetIsoNumber (const Standard_Integer NbIsos, const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
908 //! Returns the number of U and V isoparameters displayed.
909 Standard_EXPORT Standard_Integer IsoNumber (const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
911 //! Returns True if drawing isoparameters on planes is enabled.
912 Standard_EXPORT void IsoOnPlane (const Standard_Boolean SwitchOn);
914 //! Returns True if drawing isoparameters on planes is enabled.
915 //! if <forUIsos> = False,
916 Standard_EXPORT Standard_Boolean IsoOnPlane() const;
918 //! Enables or disables on-triangulation build for isolines for a particular object.
919 //! In case if on-triangulation builder is disabled, default on-plane
920 //! builder will compute isolines for the object given.
921 Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theIsEnabled,
922 const Handle(AIS_InteractiveObject)& theObject);
924 //! Enables or disables on-triangulation build for isolines for default drawer.
925 //! In case if on-triangulation builder is disabled, default on-plane
926 //! builder will compute isolines for the object given.
927 Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theToSwitchOn);
929 //! Returns true if drawing isolines on triangulation algorithm is enabled.
930 Standard_EXPORT Standard_Boolean IsoOnTriangulation() const;
932 //! Sets the graphic basic aspect to the current presentation of
933 //! ALL selected objects.
934 //! Flag globalChange has no effect (left to simplify porting).
935 //! Updates the viewer when <updateViewer> is TRUE
936 Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
937 const Standard_Boolean theToUpdateViewer);
939 //! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
940 //! This is done by the view theView passing this position to the main viewer and updating it.
941 //! Functions in both Neutral Point and local contexts.
942 //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
943 Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer theXPix,
944 const Standard_Integer theYPix,
945 const Handle(V3d_View)& theView,
946 const Standard_Boolean theToRedrawOnUpdate);
948 //! returns True if other entities were detected in the
949 //! last mouse detection
950 Standard_EXPORT Standard_Boolean HasNextDetected() const;
952 //! if more than 1 object is detected by the selector,
953 //! only the "best" owner is hilighted at the mouse position.
954 //! This Method allows the user to hilight one after another
955 //! the other detected entities.
956 //! if The method select is called, the selected entity
957 //! will be the hilighted one!
958 //! returns the Rank of hilighted entity
959 //! WARNING : Loop Method. When all the detected entities
960 //! have been hilighted , the next call will hilight
961 //! the first one again
962 Standard_EXPORT Standard_Integer HilightNextDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
964 //! Same as previous methods in reverse direction...
965 Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
967 //! Adds object in the selection.
968 Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
970 //! Adds object in the selection.
971 AIS_StatusOfPick AddSelect (const Handle(AIS_InteractiveObject)& theObject)
973 return AddSelect (theObject->GlobalSelOwner());
976 //! Selects everything found in the bounding rectangle
977 //! defined by the pixel minima and maxima, XPMin,
978 //! YPMin, XPMax, and YPMax in the view, aView
979 //! The objects detected are passed to the main viewer,
980 //! which is then updated.
981 Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer theXPMin,
982 const Standard_Integer theYPMin,
983 const Standard_Integer theXPMax,
984 const Standard_Integer theYPMax,
985 const Handle(V3d_View)& theView,
986 const Standard_Boolean theToUpdateViewer);
988 //! polyline selection; clears the previous picked list
989 Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& thePolyline,
990 const Handle(V3d_View)& theView,
991 const Standard_Boolean theToUpdateViewer);
993 //! Stores and hilights the previous detected; Unhilights
994 //! the previous picked.
995 Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean theToUpdateViewer);
997 //! adds the last detected to the list of previous picked.
998 //! if the last detected was already declared as picked,
999 //! removes it from the Picked List.
1000 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean theToUpdateViewer);
1002 //! adds the last detected to the list of previous picked.
1003 //! if the last detected was already declared as picked,
1004 //! removes it from the Picked List.
1005 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
1006 const Handle(V3d_View)& theView,
1007 const Standard_Boolean theToUpdateViewer);
1009 //! rectangle of selection ; adds new detected entities into the
1010 //! picked list, removes the detected entities that were already stored...
1011 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Integer theXPMin,
1012 const Standard_Integer theYPMin,
1013 const Standard_Integer theXPMax,
1014 const Standard_Integer theYPMax,
1015 const Handle(V3d_View)& theView,
1016 const Standard_Boolean theToUpdateViewer);
1018 //! Specify whether selected object must be hilighted when mouse cursor
1019 //! is moved above it (in MoveTo method). By default this value is false and
1020 //! selected object is not hilighted in this case.
1021 void SetToHilightSelected (const Standard_Boolean toHilight) { myToHilightSelected = toHilight; }
1023 //! Return value specified whether selected object must be hilighted
1024 //! when mouse cursor is moved above it
1025 Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
1027 //! @name OBSOLETE METHODS THAT ARE VALID FOR LOCAL CONTEXT ONLY
1029 //! Updates the view of the current object in open context.
1030 //! Objects selected when there is no open local context
1031 //! are called current objects; those selected in open
1032 //! local context, selected objects.
1033 //! If a local context is open and if updateviewer equals
1034 //! Standard_False, the presentation of the Interactive
1035 //! Object activates the selection mode; the object is
1036 //! displayed but no viewer will be updated.
1037 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1038 Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& theIObj,
1039 const Standard_Boolean theToUpdateViewer);
1042 //! Allows to add or remove the object given to the list of current and highlight/unhighlight it
1043 //! correspondingly. Is valid for global context only; for local context use method AddOrRemoveSelected.
1044 //! Since this method makes sence only for neutral point selection of a whole object, if 0 selection
1045 //! of the object is empty this method simply does nothing.
1046 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1047 Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
1048 const Standard_Boolean theIsToUpdateViewer);
1050 //! Updates the list of current objects, i.e. hilights new
1051 //! current objects, removes hilighting from former current objects.
1052 //! Objects selected when there is no open local context
1053 //! are called current objects; those selected in open
1054 //! local context, selected objects.
1055 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1056 Standard_EXPORT void UpdateCurrent();
1058 //! Returns true if there is a non-null interactive object in Neutral Point.
1059 //! Objects selected when there is no open local context are called current objects;
1060 //! those selected in open local context, selected objects.
1061 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1062 Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const;
1065 //! Initializes a scan of the current selected objects in
1067 //! Objects selected when there is no open local context
1068 //! are called current objects; those selected in open
1069 //! local context, selected objects.
1070 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1071 Standard_EXPORT void InitCurrent();
1074 //! Returns true if there is another object found by the
1075 //! scan of the list of current objects.
1076 //! Objects selected when there is no open local context
1077 //! are called current objects; those selected in open
1078 //! local context, selected objects.
1079 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1080 Standard_EXPORT Standard_Boolean MoreCurrent() const;
1083 //! Continues the scan to the next object in the list of
1084 //! current objects.
1085 //! Objects selected when there is no open local context
1086 //! are called current objects; those selected in open
1087 //! local context, selected objects.
1088 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1089 Standard_EXPORT void NextCurrent();
1092 //! Returns the current interactive object.
1093 //! Objects selected when there is no open local context
1094 //! are called current objects; those selected in open
1095 //! local context, selected objects.
1096 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1097 Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
1099 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1100 Standard_EXPORT Standard_Integer NbCurrents();
1102 //! Highlights current objects.
1103 //! Objects selected when there is no open local context
1104 //! are called current objects; those selected in open
1105 //! local context, selected objects.
1106 //! If a local context is open and if updateviewer equals
1107 //! Standard_False, the presentation of the Interactive
1108 //! Object activates the selection mode; the object is
1109 //! displayed but no viewer will be updated.
1110 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1111 Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer);
1113 //! Removes highlighting from current objects.
1114 //! Objects selected when there is no open local context
1115 //! are called current objects; those selected in open
1116 //! local context, selected objects.
1117 //! If a local context is open and if updateviewer equals
1118 //! Standard_False, the presentation of the Interactive
1119 //! Object activates the selection mode; the object is
1120 //! displayed but no viewer will be updated.
1121 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1122 Standard_EXPORT void UnhilightCurrents (const Standard_Boolean theToUpdateViewer);
1124 //! Empties previous current objects in order to get the
1125 //! current objects detected by the selector using
1127 //! Objects selected when there is no open local context
1128 //! are called current objects; those selected in open
1129 //! local context, selected objects.
1130 //! If a local context is open and if updateviewer equals
1131 //! Standard_False, the presentation of the Interactive
1132 //! Object activates the selection mode; the object is
1133 //! displayed but no viewer will be updated.
1134 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1135 Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer);
1137 //! @return current mouse-detected shape or empty (null) shape, if current interactive object
1138 //! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
1139 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1140 Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
1142 //! @return current mouse-detected interactive object or null object, if there is no currently detected interactives
1143 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1144 Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
1146 //! @name COMMON SELECTION METHODS VALID FOR BOTH GLOBAL AND LOCAL CONTEXT
1148 //! Unhighlights previously selected owners and marks them as not selected.
1149 //! Marks owner given as selected and highlights it.
1150 //! Performs selection filters check.
1151 Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
1152 const Standard_Boolean theToUpdateViewer);
1154 //! Puts the interactive object aniObj in the list of
1155 //! selected objects.
1156 //! If a local context is open and if updateviewer equals
1157 //! Standard_False, the presentation of the Interactive
1158 //! Object activates the selection mode; the object is
1159 //! displayed but no viewer will be updated.
1160 //! Performs selection filters check.
1161 Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
1162 const Standard_Boolean theToUpdateViewer);
1164 //! Updates the list of selected objects:
1165 //! i.e. highlights the newely selected ones and unhighlights previously selected objects.
1166 Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer);
1168 //! Allows to highlight or unhighlight the owner given depending on its selection status
1169 Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
1170 const Standard_Boolean theToUpdateViewer);
1172 //! Highlights selected objects.
1173 //! If a local context is open and if updateviewer equals
1174 //! Standard_False, the presentation of the Interactive
1175 //! Object activates the selection mode; the object is
1176 //! displayed but no viewer will be updated.
1177 Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer);
1179 //! Removes highlighting from selected objects.
1180 //! If a local context is open and if updateviewer equals
1181 //! Standard_False, the presentation of the Interactive
1182 //! Object activates the selection mode; the object is
1183 //! displayed but no viewer will be updated.
1184 Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer);
1186 //! Empties previous selected objects in order to get the
1187 //! selected objects detected by the selector using
1189 //! If a local context is open and if updateviewer equals
1190 //! Standard_False, the presentation of the Interactive
1191 //! Object activates the selection mode; the object is
1192 //! displayed but no viewer will be updated.
1193 Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer);
1195 //! No right to Add a selected Shape (Internal Management
1196 //! of shape Selection).
1197 //! A Previous selected shape may only be removed.
1198 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1199 Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& theShape,
1200 const Standard_Boolean theToUpdateViewer);
1202 //! Allows to highlight or unhighlight the owner given depending on its selection status
1203 Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
1204 const Standard_Boolean theToUpdateViewer);
1206 //! Returns true is the owner given is selected
1207 Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const;
1209 //! Returns true is the object given is selected
1210 Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& theObj) const;
1212 //! Returns the first selected object in the list of current selected.
1213 Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject();
1215 //! Initializes a scan of the selected objects.
1216 Standard_EXPORT void InitSelected();
1218 //! Returns true if there is another object found by the
1219 //! scan of the list of selected objects.
1220 Standard_EXPORT Standard_Boolean MoreSelected() const;
1222 //! Continues the scan to the next object in the list of
1223 //! selected objects.
1224 Standard_EXPORT void NextSelected();
1226 Standard_EXPORT Standard_Integer NbSelected();
1228 //! Returns true if the interactive context has a shape
1229 //! selected in it which results from the decomposition of
1231 //! If HasSelectedShape returns true, SelectedShape
1232 //! returns the shape which has been shown to be
1233 //! selected. Interactive returns the Interactive Object
1234 //! from which the shape has been selected.
1235 //! If HasSelectedShape returns false, Interactive
1236 //! returns the interactive entity selected by the click of the mouse.
1237 Standard_EXPORT Standard_Boolean HasSelectedShape() const;
1239 //! Returns the selected shape.
1240 Standard_EXPORT TopoDS_Shape SelectedShape() const;
1242 //! Returns the owner of the selected entity resulting
1243 //! from the decomposition of another entity.
1244 Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const;
1246 //! Returns a collection containing all entity owners
1247 //! created for the interactive object <theIObj> in
1248 //! the selection mode theMode (in all active modes
1249 //! if the Mode == -1)
1250 Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
1251 const Handle(AIS_InteractiveObject)& theIObj,
1252 const Standard_Integer theMode = -1) const;
1254 Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const;
1256 //! Returns true if the applicative object has an owner
1257 //! from Interactive attributed to it.
1258 Standard_EXPORT Standard_Boolean HasApplicative() const;
1261 //! Returns the owner of the applicative entity detected
1262 //! in interactive context. The owner can be a shape for
1263 //! a set of sub-shapes or a sub-shape for sub-shapes
1264 //! which it is composed of.
1265 Standard_EXPORT Handle(Standard_Transient) Applicative() const;
1268 //! Returns true if there is a mouse-detected entity in local context.
1269 //! If there is no open local context, the objects selected
1270 //! are called current objects; selected objects if there is
1271 //! one. Iterators allow entities to be recovered in either
1272 //! case. This method is one of a set which allows you to
1273 //! manipulate the objects which have been placed in these two lists.
1274 Standard_EXPORT Standard_Boolean HasDetected() const;
1277 //! Returns true if there is a detected shape in local context.
1278 //! If there is no open local context, the objects selected
1279 //! are called current objects; selected objects if there is
1280 //! one. Iterators allow entities to be recovered in either
1281 //! case. This method is one of a set which allows you to
1282 //! manipulate the objects which have been placed in these two lists.
1283 Standard_EXPORT Standard_Boolean HasDetectedShape() const;
1286 //! Returns the shape detected in local context.
1287 //! If there is no open local context, the objects selected
1288 //! are called current objects; selected objects if there is
1289 //! one. Iterators allow entities to be recovered in either
1290 //! case. This method is one of a set which allows you to
1291 //! manipulate the objects which have been placed in these two lists.
1292 Standard_EXPORT const TopoDS_Shape& DetectedShape() const;
1295 //! Returns the interactive objects last detected in open context.
1296 //! If there is no open local context, the objects selected
1297 //! are called current objects; selected objects if there is
1298 //! one. Iterators allow entities to be recovered in either
1299 //! case. This method is one of a set which allows you to
1300 //! manipulate the objects which have been placed in these two lists.
1301 Standard_EXPORT Handle(AIS_InteractiveObject) DetectedInteractive() const;
1303 //! returns the owner of the detected sensitive primitive.
1304 Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedOwner() const;
1307 //! Initialization for iteration through mouse-detected objects in
1308 //! interactive context or in local context if it is opened.
1309 Standard_EXPORT void InitDetected();
1312 //! @return true if there is more mouse-detected objects after the current one
1313 //! during iteration through mouse-detected interactive objects.
1314 Standard_EXPORT Standard_Boolean MoreDetected() const;
1317 //! Gets next current object during iteration through mouse-detected
1318 //! interactive objects.
1319 Standard_EXPORT void NextDetected();
1321 //! Opens local contexts and specifies how this is to be
1322 //! done. The options listed above function in the following manner:
1323 //! - UseDisplayedObjects -allows you to load or not
1324 //! load the interactive objects visualized at Neutral
1325 //! Point in the local context which you open. If false,
1326 //! the local context is empty after being opened. If
1327 //! true, the objects at Neutral Point are loaded by their
1328 //! default selection mode.
1329 //! - AllowShapeDecomposition -AIS_Shape allows or
1330 //! prevents decomposition in standard shape location
1331 //! mode of objects at Neutral Point which are
1332 //! type-"privileged". This Flag is only taken into
1333 //! account when UseDisplayedObjects is true.
1334 //! - AcceptEraseOfObjects -authorises other local
1335 //! contexts to erase the interactive objects present in
1336 //! this context. This option is rarely used.
1337 //! - BothViewers - Has no use currently defined.
1338 //! This method returns the index of the created local
1339 //! context. It should be kept and used to close the context.
1340 //! Opening a local context allows you to prepare an
1341 //! environment for temporary presentations and
1342 //! selections which will disappear once the local context is closed.
1343 //! You can open several local contexts, but only the last
1344 //! one will be active.
1345 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1346 Standard_EXPORT Standard_Integer OpenLocalContext (const Standard_Boolean UseDisplayedObjects = Standard_True, const Standard_Boolean AllowShapeDecomposition = Standard_True, const Standard_Boolean AcceptEraseOfObjects = Standard_False, const Standard_Boolean BothViewers = Standard_False);
1348 //! Allows you to close local contexts. For greater
1349 //! security, you should close the context with the
1350 //! index Index given on opening.
1351 //! When you close a local context, the one before,
1352 //! which is still on the stack, reactivates. If none is
1353 //! left, you return to Neutral Point.
1354 //! If a local context is open and if updateviewer
1355 //! equals Standard_False, the presentation of the
1356 //! Interactive Object activates the selection mode; the
1357 //! object is displayed but no viewer will be updated.
1359 //! When the index isn't specified, the current context
1360 //! is closed. This option can be dangerous, as other
1361 //! Interactive Functions can open local contexts
1362 //! without necessarily warning the user.
1363 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1364 Standard_EXPORT void CloseLocalContext (const Standard_Integer theIndex = -1,
1365 const Standard_Boolean theToUpdateViewer = Standard_True);
1367 //! returns -1 if no opened local context.
1368 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1369 Standard_EXPORT Standard_Integer IndexOfCurrentLocal() const;
1372 //! Allows you to close all local contexts at one go and
1373 //! return to Neutral Point.
1374 //! If a local context is open and if updateviewer equals
1375 //! Standard_False, the presentation of the Interactive
1376 //! Object activates the selection mode; the object is
1377 //! displayed but no viewer will be updated.
1378 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1379 Standard_EXPORT void CloseAllContexts (const Standard_Boolean theToUpdateViewer);
1381 //! to be used only with no opened
1382 //! local context.. displays and activates objects in their
1383 //! original state before local contexts were opened...
1384 Standard_EXPORT void ResetOriginalState (const Standard_Boolean theToUpdateViewer);
1386 //! clears Objects/Filters/Activated Modes list in the current opened local context.
1387 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1388 Standard_EXPORT void ClearLocalContext (const AIS_ClearMode TheMode = AIS_CM_All);
1390 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1391 Standard_EXPORT void UseDisplayedObjects();
1393 //! when a local Context is opened, one is able to
1394 //! use/not use the displayed objects at neutral point
1396 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1397 Standard_EXPORT void NotUseDisplayedObjects();
1399 //! initializes the list of presentations to be displayed
1400 //! returns False if no local context is opened.
1401 Standard_EXPORT Standard_Boolean BeginImmediateDraw();
1403 //! returns True if <anIObj> has been stored in the list.
1404 Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0);
1406 //! returns True if the immediate display has been done.
1407 Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_View)& theView);
1409 //! Uses the First Active View of Main Viewer!
1410 //! returns True if the immediate display has been done.
1411 Standard_EXPORT Standard_Boolean EndImmediateDraw();
1413 Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
1416 //! Sets the highlighting status aStatus of detected and
1417 //! selected entities.
1418 //! Whether you are in Neutral Point or local context, this
1419 //! is automatically managed by the Interactive Context.
1420 //! This function allows you to disconnect the automatic mode.
1421 Standard_EXPORT void SetAutomaticHilight (const Standard_Boolean aStatus);
1424 //! Returns true if the automatic highlight mode is active
1425 //! in an open context.
1426 Standard_EXPORT Standard_Boolean AutomaticHilight() const;
1428 //! Activates the selection mode aMode whose index is
1429 //! given, for the given interactive entity anIobj.
1430 Standard_EXPORT void Activate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode = 0, const Standard_Boolean theIsForce = Standard_False);
1432 //! Activates the given selection mode for the all displayed objects.
1433 Standard_EXPORT void Activate (const Standard_Integer theMode,
1434 const Standard_Boolean theIsForce = Standard_False);
1436 //! Deactivates all the activated selection modes
1438 Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIObj);
1441 //! Deactivates all the activated selection modes of the
1442 //! interactive object anIobj with a given selection mode aMode.
1443 Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode);
1445 //! Deactivates the given selection mode for all displayed objects.
1446 Standard_EXPORT void Deactivate (const Standard_Integer theMode);
1448 //! Deactivates all the activated selection mode at all displayed objects.
1449 Standard_EXPORT void Deactivate();
1451 //! Returns the list of activated selection modes in an open context.
1452 Standard_EXPORT void ActivatedModes (const Handle(AIS_InteractiveObject)& anIobj, TColStd_ListOfInteger& theList) const;
1454 //! to be Used only with opened local context and
1455 //! if <anIobj> is of type shape...
1456 //! if <aStatus> = True <anIobj> will be sensitive to
1457 //! shape selection modes activation.
1458 //! = False, <anIobj> will not be senstive
1460 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1461 Standard_EXPORT void SetShapeDecomposition (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean aStatus);
1464 //! Sets the temporary graphic attributes of the entity
1465 //! anObj. These are provided by the attribute manager
1466 //! aDrawer and are valid for a particular local context only.
1467 //! If a local context is open and if updateviewer equals
1468 //! Standard_False, the presentation of the Interactive
1469 //! Object activates the selection mode; the object is
1470 //! displayed but no viewer will be updated.
1471 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1472 Standard_EXPORT void SetTemporaryAttributes (const Handle(AIS_InteractiveObject)& theIObj,
1473 const Handle(Prs3d_Drawer)& theDrawer,
1474 const Standard_Boolean theToUpdateViewer);
1477 //! Highlights, and removes highlights from, the displayed
1478 //! object aniobj which is displayed at Neutral Point with
1479 //! subintensity color; available only for active local
1480 //! context. There is no effect if there is no local context.
1481 //! If a local context is open and if updateviewer equals
1482 //! Standard_False, the presentation of the Interactive
1483 //! Object activates the selection mode; the object is
1484 //! displayed but no viewer will be updated.
1485 Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& theIObj,
1486 const Standard_Boolean theToUpdateViewer);
1489 //! Removes the subintensity option for the entity aniobj.
1490 //! If a local context is open and if updateviewer equals
1491 //! Standard_False, the presentation of the Interactive
1492 //! Object activates the selection mode; the object is
1493 //! displayed but no viewer will be updated.
1494 Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& theIObj,
1495 const Standard_Boolean theToUpdateViewer);
1497 //! hilights/unhilights displayed objects which are displayed at
1498 //! neutral state with subintensity color;
1499 //! available only for active local context.
1500 //! No effect if no local context.
1501 Standard_EXPORT void SubIntensityOn (const Standard_Boolean theToUpdateViewer);
1503 //! removes subintensity option for all objects.
1504 Standard_EXPORT void SubIntensityOff (const Standard_Boolean theToUpdateViewer);
1506 //! Allows you to add the filter aFilter to Neutral Point or
1507 //! to a local context if one or more selection modes have been activated.
1508 //! Only type filters may be active in Neutral Point.
1509 Standard_EXPORT void AddFilter (const Handle(SelectMgr_Filter)& aFilter);
1512 //! Removes a filter from Neutral Point or a local context
1513 //! if one or more selection modes have been activated.
1514 //! Only type filters are activated in Neutral Point.
1515 Standard_EXPORT void RemoveFilter (const Handle(SelectMgr_Filter)& aFilter);
1517 //! Remove a filter to Neutral Point or a local context if
1518 //! one or more selection modes have been activated.
1519 //! Only type filters are active in Neutral Point.
1520 Standard_EXPORT void RemoveFilters();
1522 //! Provides an alternative to the Display methods when
1523 //! activating specific selection modes. This has the
1524 //! effect of activating the corresponding selection mode
1525 //! aStandardActivation for all objects in Local Context
1526 //! which accept decomposition into sub-shapes.
1527 //! Every new Object which has been loaded into the
1528 //! interactive context and which answers these
1529 //! decomposition criteria is automatically activated
1530 //! according to these modes.
1532 //! If you have opened a local context by loading an
1533 //! object with the default options
1534 //! (<AllowShapeDecomposition >= Standard_True), all
1535 //! objects of the "Shape" type are also activated with
1536 //! the same modes. You can act on the state of these
1537 //! "Standard" objects by using SetShapeDecomposition(Status).
1538 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1539 Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1542 //! Provides an alternative to the Display methods when
1543 //! deactivating specific selection modes. This has the
1544 //! effect of deactivating the corresponding selection
1545 //! mode aStandardActivation for all objects in Local
1546 //! Context which accept decomposition into sub-shapes.
1547 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1548 Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1551 //! Returns the list of activated standard selection modes
1552 //! available in a local context.
1553 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1554 Standard_EXPORT const TColStd_ListOfInteger& ActivatedStandardModes() const;
1557 //! Returns the list of filters active in a local context.
1558 Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
1560 //! Returns the default attribute manager.
1561 //! This contains all the color and line attributes which
1562 //! can be used by interactive objects which do not have
1563 //! their own attributes.
1564 const Handle(Prs3d_Drawer)& DefaultDrawer() const { return myDefaultDrawer; }
1566 //! Returns the current viewer.
1567 const Handle(V3d_Viewer)& CurrentViewer() const { return myMainVwr; }
1569 //! Returns the list of displayed objects of a particular
1570 //! Type WhichKind and Signature WhichSignature. By
1571 //! Default, WhichSignature equals -1. This means that
1572 //! there is a check on type only.
1573 Standard_EXPORT void DisplayedObjects (AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1575 //! gives the list of displayed objects of a particular
1576 //! Type and signature.
1577 //! by Default, <WhichSignature> = -1 means
1578 //! control only on <WhichKind>.
1579 Standard_EXPORT void DisplayedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1582 //! Returns the list theListOfIO of erased objects (hidden objects)
1583 //! particular Type WhichKind and Signature WhichSignature.
1584 //! By Default, WhichSignature equals 1. This means
1585 //! that there is a check on type only.
1586 Standard_EXPORT void ErasedObjects (AIS_ListOfInteractive& theListOfIO) const;
1588 //! gives the list of erased objects (hidden objects)
1589 //! Type and signature
1590 //! by Default, <WhichSignature> = -1 means
1591 //! control only on <WhichKind>.
1592 Standard_EXPORT void ErasedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& theListOfIO) const;
1595 //! Returns the list theListOfIO of objects with indicated display status
1596 //! particular Type WhichKind and Signature WhichSignature.
1597 //! By Default, WhichSignature equals 1. This means
1598 //! that there is a check on type only.
1599 Standard_EXPORT void ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1601 //! gives the list of objects with indicated display status
1602 //! Type and signature
1603 //! by Default, <WhichSignature> = -1 means
1604 //! control only on <WhichKind>.
1605 Standard_EXPORT void ObjectsByDisplayStatus (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1607 //! fills <aListOfIO> with objects of a particular
1608 //! Type and Signature with no consideration of display status.
1609 //! by Default, <WhichSignature> = -1 means
1610 //! control only on <WhichKind>.
1611 //! if <WhichKind> = AIS_KOI_None and <WhichSignature> = -1,
1612 //! all the objects are put into the list.
1613 Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO, const AIS_KindOfInteractive WhichKind = AIS_KOI_None, const Standard_Integer WhichSignature = -1) const;
1615 //! Returns true if there is an open context.
1616 Standard_Boolean HasOpenedContext() const { return myCurLocalIndex != 0; }
1618 //! This method is only intended for advanced operation, particularly with
1619 //! the aim to improve performance when many objects have to be selected
1620 //! together. Otherwise, you should use other (non-internal) methods of
1621 //! class AIS_InteractiveContext without trying to obtain an instance of
1622 //! AIS_LocalContext.
1623 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1624 Handle(AIS_LocalContext) LocalContext() const { return myCurLocalIndex > 0 ? myLocalContexts (myCurLocalIndex) : Handle(AIS_LocalContext)(); }
1626 const Handle(SelectMgr_SelectionManager)& SelectionManager() const { return mgrSelector; }
1628 const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const { return myMainPM; }
1630 const Handle(StdSelect_ViewerSelector3d)& MainSelector() const { return myMainSel; }
1632 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1633 Standard_EXPORT Handle(StdSelect_ViewerSelector3d) LocalSelector() const;
1635 //! Clears all the structures which don't
1636 //! belong to objects displayed at neutral point
1637 //! only effective when no Local Context is opened...
1638 //! returns the number of removed structures from the viewers.
1639 Standard_EXPORT Standard_Integer PurgeDisplay();
1641 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1642 Standard_EXPORT Standard_Integer HighestIndex() const;
1644 Standard_EXPORT void DisplayActiveSensitive (const Handle(V3d_View)& aView);
1646 Standard_EXPORT void ClearActiveSensitive (const Handle(V3d_View)& aView);
1648 //! Fits the view correspondingly to the bounds of selected objects.
1649 //! Infinite objects are ignored if infinite state of AIS_InteractiveObject
1651 Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
1652 const Standard_Real theMargin,
1653 const Standard_Boolean theToUpdate);
1655 //! Fits the view correspondingly to the bounds of selected objects.
1656 //! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
1657 Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView);
1659 Standard_EXPORT void DisplayActiveSensitive (const Handle(AIS_InteractiveObject)& anObject, const Handle(V3d_View)& aView);
1661 //! returns if possible,
1662 //! the first local context where the object is seen
1663 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1664 Standard_EXPORT Standard_Boolean IsInLocal (const Handle(AIS_InteractiveObject)& anObject, Standard_Integer& TheIndex) const;
1666 //! Rebuilds 1st level of BVH selection forcibly
1667 Standard_EXPORT void RebuildSelectionStructs();
1669 //! setup object visibility in specified view,
1670 //! has no effect if object is not disaplyed in this context.
1671 Standard_EXPORT void SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisible);
1673 //! Disconnects theObjToDisconnect from theAssembly and removes dependent selection structures
1674 Standard_EXPORT void Disconnect (const Handle(AIS_InteractiveObject)& theAssembly, const Handle(AIS_InteractiveObject)& theObjToDisconnect = NULL);
1676 //! Query objects visible or hidden in specified view due to affinity mask.
1677 Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisibleInView, const AIS_DisplayStatus theStatus = AIS_DS_None) const;
1679 //! Redraws immediate structures in all views of the viewer given taking into account its visibility.
1680 Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
1684 Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
1686 Standard_EXPORT void EraseGlobal (const Handle(AIS_InteractiveObject)& theIObj,
1687 const Standard_Boolean theToUpdateViewer);
1689 Standard_EXPORT void ClearGlobal (const Handle(AIS_InteractiveObject)& theIObj,
1690 const Standard_Boolean theToUpdateViewer);
1692 Standard_EXPORT void ClearGlobalPrs (const Handle(AIS_InteractiveObject)& theObj,
1693 const Standard_Integer theMode,
1694 const Standard_Boolean theToUpdateViewer);
1696 Standard_EXPORT void InitAttributes();
1698 Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
1701 Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
1702 const Standard_Boolean theToUpdateViewer);
1705 Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
1706 const Standard_Boolean theToUpdateViewer);
1708 //! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
1709 Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
1711 //! Helper function that highlights the owner given with <theStyle> without
1712 //! performing AutoHighlight checks, e.g. is used for dynamic highlight.
1713 Standard_EXPORT void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
1714 const Handle(V3d_Viewer)& theViewer = NULL);
1716 //! Helper function that highlights the owner given with <theStyle> with check
1717 //! for AutoHighlight, e.g. is used for selection.
1718 Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
1720 //! Helper function that highlights global owner of the object given with <theStyle> with check
1721 //! for AutoHighlight, e.g. is used for selection.
1722 //! If global owner is null, it simply highlights the whole object
1723 Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
1724 const Handle(Prs3d_Drawer)& theStyle,
1725 const Standard_Integer theDispMode) const;
1727 //! Helper function that unhighlights all owners that are stored in current AIS_Selection.
1728 //! The function updates global status and selection state of owner and interactive object.
1729 //! If the parameter <theIsToHilightSubIntensity> is set to true, interactive objects with sub-intensity
1730 //! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
1731 Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
1733 //! Helper function that unhighlights global selection owner of given interactive.
1734 //! The function does not perform any updates of global or owner status
1735 Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const;
1737 //! Helper function that turns on sub-intensity in global status and highlights
1738 //! given objects with sub-intensity color
1739 //! @param theObject [in] the object. If NULL is given, than sub-intensity will be turned on for
1740 //! all inveractive objects of the context
1741 //! @param theDispMode [in] display mode. If -1 is given, sub-intensity will be turned on for
1742 //! all display modes in global status's list of modes
1743 //! @param theIsDisplayedOnly [in] is true if sub-intensity should be applied only to objects with
1744 //! status AIS_DS_Displayed
1745 Standard_EXPORT void turnOnSubintensity (const Handle(AIS_InteractiveObject)& theObject = NULL,
1746 const Standard_Integer theDispMode = -1,
1747 const Standard_Boolean theIsDisplayedOnly = Standard_True) const;
1749 //! Helper function that highlights the object with sub-intensity color without any checks
1750 //! @param theObject [in] the object that will be highlighted
1751 //! @param theMode [in] display mode
1752 Standard_EXPORT void highlightWithSubintensity (const Handle(AIS_InteractiveObject)& theObject,
1753 const Standard_Integer theMode) const;
1755 //! Helper function that highlights the owner with sub-intensity color without any checks
1756 //! @param theOwner [in] the owner that will be highlighted
1757 //! @param theMode [in] display mode
1758 Standard_EXPORT void highlightWithSubintensity (const Handle(SelectMgr_EntityOwner)& theOwner,
1759 const Standard_Integer theMode) const;
1761 //! Helper function that returns correct dynamic highlight style for the object:
1762 //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1763 //! dynamic highlight style of interactive context will be returned.
1764 //! @param theObj [in] the object to check
1765 const Handle(Prs3d_Drawer)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj,
1766 const Handle(SelectMgr_EntityOwner)& theOwner) const
1768 const Handle(Prs3d_Drawer)& aHiDrawer = theObj->DynamicHilightAttributes();
1769 if (!aHiDrawer.IsNull())
1774 return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
1777 //! Helper function that returns correct selection style for the object:
1778 //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1779 //! selection style of interactive context will be returned.
1780 //! @param theObj [in] the object to check
1781 const Handle(Prs3d_Drawer)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj,
1782 const Handle(SelectMgr_EntityOwner)& theOwner) const
1784 const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
1785 if (!aHiDrawer.IsNull())
1790 return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalSelected : Prs3d_TypeOfHighlight_Selected];
1793 //! Assign the context to the object or throw exception if object was already assigned to another context.
1794 void setContextToObject (const Handle(AIS_InteractiveObject)& theObj)
1796 if (theObj->HasInteractiveContext())
1798 if (theObj->myCTXPtr != this)
1800 throw Standard_ProgramError("AIS_InteractiveContext - object has been already displayed in another context!");
1805 theObj->SetContext (this);
1809 //! Return display mode for highlighting.
1810 Standard_Integer getHilightMode (const Handle(AIS_InteractiveObject)& theObj,
1811 const Handle(Prs3d_Drawer)& theStyle,
1812 const Standard_Integer theDispMode) const
1814 if (!theStyle.IsNull()
1815 && theStyle->DisplayMode() != -1
1816 && theObj->AcceptDisplayMode (theStyle->DisplayMode()))
1818 return theStyle->DisplayMode();
1820 else if (theDispMode != -1)
1824 else if (theObj->HasDisplayMode())
1826 return theObj->DisplayMode();
1828 return myDefaultDrawer->DisplayMode();
1831 //! Removes dynamic highlight draw
1832 void clearDynamicHighlight() const
1834 if (myLastinMain.IsNull())
1837 if (myLastinMain->IsAutoHilight())
1839 myMainPM->ClearImmediateDraw();
1843 myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
1849 AIS_DataMapOfIOStatus myObjects;
1850 Handle(SelectMgr_SelectionManager) mgrSelector;
1851 Handle(PrsMgr_PresentationManager3d) myMainPM;
1852 Handle(V3d_Viewer) myMainVwr;
1853 Handle(StdSelect_ViewerSelector3d) myMainSel;
1854 Handle(SelectMgr_EntityOwner) myLastPicked;
1855 Handle(SelectMgr_EntityOwner) myLastinMain;
1856 Standard_Boolean myWasLastMain;
1857 Standard_Boolean myToHilightSelected;
1858 Handle(AIS_Selection) mySelection;
1859 Handle(SelectMgr_OrFilter) myFilters;
1860 Handle(Prs3d_Drawer) myDefaultDrawer;
1861 Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
1862 AIS_DataMapOfILC myLocalContexts;
1863 Standard_Integer myCurLocalIndex;
1864 TColStd_SequenceOfInteger myDetectedSeq;
1865 Standard_Integer myCurDetected;
1866 Standard_Integer myCurHighlighted;
1867 SelectMgr_PickingStrategy myPickingStrategy; //!< picking strategy to be applied within MoveTo()
1868 Standard_Boolean myIsAutoActivateSelMode;
1872 DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
1874 #endif // _AIS_InteractiveContext_HeaderFile