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 //! Disables the mechanism of adaptive tolerance calculation in SelectMgr_ViewerSelector and
401 //! sets the given tolerance for ALL sensitive entities activated. For more information, see
402 //! SelectMgr_ViewerSelector documentation
403 //! Warning: When a local context is open the sensitivity is apply on it
404 //! instead on the main context.
405 Standard_EXPORT void SetPixelTolerance (const Standard_Integer aPrecision = 2);
407 //! Returns the pixel tolerance.
408 Standard_EXPORT Standard_Integer PixelTolerance() const;
410 //! Allows to manage sensitivity of a particular selection of interactive object theObject
411 //! and changes previous sensitivity value of all sensitive entities in selection with theMode
412 //! to the given theNewSensitivity.
413 Standard_EXPORT void SetSelectionSensitivity (const Handle(AIS_InteractiveObject)& theObject,
414 const Standard_Integer theMode,
415 const Standard_Integer theNewSensitivity);
417 //! Puts the location aLocation on the initial graphic
418 //! representation and the selection for the entity aniobj.
419 //! In other words, aniobj is visible and selectable at a
420 //! position other than initial position.
421 //! Graphic and selection primitives are not recomputed.
422 //! To clean the view correctly, you must reset the previous location.
423 Standard_EXPORT void SetLocation (const Handle(AIS_InteractiveObject)& aniobj, const TopLoc_Location& aLocation);
425 //! Puts the entity aniobj back into its initial position.
426 Standard_EXPORT void ResetLocation (const Handle(AIS_InteractiveObject)& aniobj);
429 //! Returns true if the entity aniobj has a location.
430 Standard_EXPORT Standard_Boolean HasLocation (const Handle(AIS_InteractiveObject)& aniobj) const;
433 //! Returns the location of the entity aniobj.
434 Standard_EXPORT TopLoc_Location Location (const Handle(AIS_InteractiveObject)& aniobj) const;
436 //! change the current facing model apply on polygons for
437 //! SetColor(), SetTransparency(), SetMaterial() methods
438 //! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is
439 //! applying both on the front and back face.
440 Standard_EXPORT void SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& aniobj, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE);
442 //! Sets the color of the selected entity.
443 //! If a local context is open and if updateviewer equals
444 //! Standard_False, the presentation of the Interactive
445 //! Object activates the selection mode; the object is
446 //! displayed but no viewer will be updated.
447 Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& theIObj,
448 const Quantity_Color& theColor,
449 const Standard_Boolean theToUpdateViewer);
451 //! Removes the color selection for the selected entity.
452 //! If a local context is open and if updateviewer equals
453 //! Standard_False, the presentation of the Interactive
454 //! Object activates the selection mode; the object is
455 //! displayed but no viewer will be updated.
456 Standard_EXPORT void UnsetColor (const Handle(AIS_InteractiveObject)& theIObj,
457 const Standard_Boolean theToUpdateViewer);
460 //! Sets the width of the entity aniobj.
461 //! If a local context is open and if updateviewer equals
462 //! Standard_False, the presentation of the Interactive
463 //! Object activates the selection mode; the object is
464 //! displayed but no viewer will be updated.
465 Standard_EXPORT virtual void SetWidth (const Handle(AIS_InteractiveObject)& theIObj,
466 const Standard_Real theValue,
467 const Standard_Boolean theToUpdateViewer);
470 //! Removes the width setting of the entity aniobj.
471 //! If a local context is open and if updateviewer equals
472 //! Standard_False, the presentation of the Interactive
473 //! Object activates the selection mode; the object is
474 //! displayed but no viewer will be updated.
475 Standard_EXPORT virtual void UnsetWidth (const Handle(AIS_InteractiveObject)& theIObj,
476 const Standard_Boolean theToUpdateViewer);
479 //! Provides the type of material setting for the view of
480 //! the entity aniobj.
481 //! If a local context is open and if updateviewer equals
482 //! Standard_False, the presentation of the Interactive
483 //! Object activates the selection mode; the object is
484 //! displayed but no viewer will be updated.
485 Standard_EXPORT void SetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
486 const Graphic3d_MaterialAspect& theMaterial,
487 const Standard_Boolean theToUpdateViewer);
490 //! Removes the type of material setting for viewing the
492 //! If a local context is open and if updateviewer equals
493 //! Standard_False, the presentation of the Interactive
494 //! Object activates the selection mode; the object is
495 //! displayed but no viewer will be updated.
496 Standard_EXPORT void UnsetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
497 const Standard_Boolean theToUpdateViewer);
499 //! Provides the transparency settings for viewing the
500 //! entity aniobj. The transparency value aValue may be
501 //! between 0.0, opaque, and 1.0, fully transparent.
502 //! If a local context is open and if updateviewer equals
503 //! Standard_False, the presentation of the Interactive
504 //! Object activates the selection mode; the object is
505 //! displayed but no viewer will be updated.
506 Standard_EXPORT void SetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
507 const Standard_Real theValue,
508 const Standard_Boolean theToUpdateViewer);
511 //! Removes the transparency settings for viewing the
512 //! entity aniobj. The transparency value aValue may be
513 //! between 0.0, opaque, and 1.0, fully transparent.
514 //! If a local context is open and if updateviewer equals
515 //! Standard_False, the presentation of the Interactive
516 //! Object activates the selection mode; the object is
517 //! displayed but no viewer will be updated.
518 Standard_EXPORT void UnsetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
519 const Standard_Boolean theToUpdateViewer);
522 //! Sets the attributes of the interactive object aniobj by
523 //! plugging the attribute manager aDrawer into the local
524 //! context. The graphic attributes of aDrawer such as
525 //! visualization mode, color, and material, are then used
526 //! to display aniobj.
527 //! If a local context is open and if updateviewer equals
528 //! Standard_False, the presentation of the Interactive
529 //! Object activates the selection mode; the object is
530 //! displayed but no viewer will be updated.
531 Standard_EXPORT void SetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
532 const Handle(Prs3d_Drawer)& theDrawer,
533 const Standard_Boolean theToUpdateViewer);
536 //! Removes the settings for local attributes of the entity
537 //! anObj and returns to the Neutral Point attributes or
538 //! those of the previous local context.
539 //! If a local context is open and if updateviewer equals
540 //! Standard_False, the presentation of the Interactive
541 //! Object activates the selection mode; the object is
542 //! displayed but no viewer will be updated.
543 Standard_EXPORT void UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
544 const Standard_Boolean theToUpdateViewer);
546 //! Sets up polygon offsets for the given AIS_InteractiveObject.
547 //! It simply calls anObj->SetPolygonOffsets()
548 Standard_EXPORT void SetPolygonOffsets (const Handle(AIS_InteractiveObject)& theIObj,
549 const Standard_Integer theMode,
550 const Standard_ShortReal theFactor,
551 const Standard_ShortReal theUnits,
552 const Standard_Boolean theToUpdateViewer);
554 //! simply calls anObj->HasPolygonOffsets()
555 Standard_EXPORT Standard_Boolean HasPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj) const;
557 //! Retrieves current polygon offsets settings for <anObj>.
558 Standard_EXPORT void PolygonOffsets (const Handle(AIS_InteractiveObject)& anObj, Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const;
560 //! Sets the size aSize of the trihedron.
561 //! Is used to change the default value 100 mm for
562 //! display of trihedra.
563 //! Use of this function in one of your own interactive
564 //! objects requires a call to the Compute function of the
565 //! new class. This will recalculate the presentation for
566 //! every trihedron displayed.
567 //! If a local context is open and if updateviewer equals
568 //! Standard_False, the presentation of the Interactive
569 //! Object activates the selection mode; the object is
570 //! displayed but no viewer will be updated.
571 Standard_EXPORT void SetTrihedronSize (const Standard_Real theSize,
572 const Standard_Boolean theToUpdateViewer);
574 //! returns the current value of trihedron size.
575 Standard_EXPORT Standard_Real TrihedronSize() const;
578 //! Sets the plane size defined by the length in the X
579 //! direction XSize and that in the Y direction YSize.
580 //! If a local context is open and if updateviewer equals
581 //! Standard_False, the presentation of the Interactive
582 //! Object activates the selection mode; the object is
583 //! displayed but no viewer will be updated.
584 Standard_EXPORT void SetPlaneSize (const Standard_Real theSizeX,
585 const Standard_Real theSizeY,
586 const Standard_Boolean theToUpdateViewer);
589 //! Sets the plane size aSize.
590 //! If a local context is open and if updateviewer equals
591 //! Standard_False, the presentation of the Interactive
592 //! Object activates the selection mode; the object is
593 //! displayed but no viewer will be updated.
594 //! May be used if PlaneSize returns true.
595 Standard_EXPORT void SetPlaneSize (const Standard_Real theSize,
596 const Standard_Boolean theToUpdateViewer);
598 //! Returns true if the length in the X direction XSize is
599 //! the same as that in the Y direction YSize.
600 Standard_EXPORT Standard_Boolean PlaneSize (Standard_Real& XSize, Standard_Real& YSize) const;
602 //! Returns the display status of the entity anIobj.
603 //! This will be one of the following:
604 //! - DS_Displayed displayed in main viewer
605 //! - DS_Erased hidden in main viewer
606 //! - DS_Temporary temporarily displayed
607 //! - DS_None nowhere displayed.
608 Standard_EXPORT AIS_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const;
611 //! Returns true if anIobj is displayed in the interactive context.
612 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const;
614 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode) const;
616 //! Returns true if the object is marked as highlighted via its global
618 //! @param theObj [in] the object to check
619 Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const;
621 //! Returns true if the owner is marked as selected
622 //! @param theOwner [in] the owner to check
623 Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner) const;
625 //! Returns highlight style of the object if it is marked as highlighted via global status
626 //! @param theObj [in] the object to check
627 Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
628 Handle(Prs3d_Drawer)& theStyle) const;
630 //! Returns highlight style of the owner if it is selected
631 //! @param theOwner [in] the owner to check
632 Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
633 Handle(Prs3d_Drawer)& theStyle) const;
635 //! Returns the display priority of the entity anIobj. This
636 //! will be display mode of anIobj if it is in the main
638 Standard_EXPORT Standard_Integer DisplayPriority (const Handle(AIS_InteractiveObject)& anIobj) const;
641 //! Returns true if a view of the Interactive Object aniobj has color.
642 Standard_EXPORT Standard_Boolean HasColor (const Handle(AIS_InteractiveObject)& aniobj) const;
644 //! Returns the color Color of the entity aniobj in the interactive context.
645 Standard_EXPORT void Color (const Handle(AIS_InteractiveObject)& aniobj, Quantity_Color& acolor) const;
648 //! Returns the width of the Interactive Object aniobj in
649 //! the interactive context.
650 Standard_EXPORT virtual Standard_Real Width (const Handle(AIS_InteractiveObject)& aniobj) const;
653 //! Returns the status astatus of the Interactive Context
654 //! for the view of the Interactive Object anObj.
655 Standard_EXPORT void Status (const Handle(AIS_InteractiveObject)& anObj, TCollection_ExtendedString& astatus) const;
657 //! Sets transform persistence.
658 Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
659 const Handle(Graphic3d_TransformPers)& theTrsfPers);
661 Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
662 void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
663 const Graphic3d_TransModeFlags& theFlag,
664 const gp_Pnt& thePoint = gp_Pnt (0.0, 0.0, 0.0))
666 SetTransformPersistence (theObj, Graphic3d_TransformPers::FromDeprecatedParams (theFlag, thePoint));
669 //! Updates the current viewer, the viewer in Neutral Point.
670 //! Objects selected when there is no open local context
671 //! are called current objects; those selected in open
672 //! local context, selected objects.
673 Standard_EXPORT void UpdateCurrentViewer();
675 //! Returns the display mode setting.
676 //! Note that mode 3 is only used.
677 Standard_Integer DisplayMode() const { return myDefaultDrawer->DisplayMode(); }
679 //! Returns highlight style settings.
680 const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
682 //! Setup highlight style settings.
683 void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
684 const Handle(Prs3d_Drawer)& theStyle) { myStyles[theStyleType] = theStyle; }
686 //! Returns current dynamic highlight style settings.
688 //! - the color of dynamic highlight is Quantity_NOC_CYAN1;
689 //! - the presentation for dynamic highlight is completely opaque;
690 //! - the type of highlight is Aspect_TOHM_COLOR.
691 const Handle(Prs3d_Drawer)& HighlightStyle() const
693 return myStyles[Prs3d_TypeOfHighlight_Dynamic];
696 //! Setup the style of dynamic highlighting.
697 void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
699 //! Returns current selection style settings.
701 //! - the color of selection is Quantity_NOC_GRAY80;
702 //! - the presentation for selection is completely opaque;
703 //! - the type of highlight is Aspect_TOHM_COLOR.
704 const Handle(Prs3d_Drawer)& SelectionStyle() const
706 return myStyles[Prs3d_TypeOfHighlight_Selected];
709 //! Setup the style of selection highlighting.
710 void SetSelectionStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Selected] = theStyle; }
712 //! Sub-intensity allows temporary highlighting of particular
713 //! objects with specified color in a manner of selection highlight,
714 //! but without actual selection (e.g., global status and owner's
715 //! selection state will not be updated).
716 //! The method returns the color of such highlighting.
717 //! By default, it is Quantity_NOC_GRAY40.
718 const Quantity_Color& SubIntensityColor() const
720 return myStyles[Prs3d_TypeOfHighlight_SubIntensity]->Color();
723 //! Sub-intensity allows temporary highlighting of particular
724 //! objects with specified color in a manner of selection highlight,
725 //! but without actual selection (e.g., global status and owner's
726 //! selection state will not be updated).
727 //! The method sets up the color for such highlighting.
728 //! By default, this is Quantity_NOC_GRAY40.
729 void SetSubIntensityColor (const Quantity_Color& theColor)
731 myStyles[Prs3d_TypeOfHighlight_SubIntensity]->SetColor (theColor);
734 //! Sets the display mode of seen Interactive Objects.
735 //! aMode provides the display mode index of the entity aniobj.
736 //! If updateviewer equals Standard_True, the
737 //! predominant mode aMode will overule the context mode.
738 //! If a local context is open and if updateviewer equals
739 //! Standard_False, the presentation of the Interactive
740 //! Object returns to the default selection mode; the
741 //! object is displayed but no viewer will be updated.
742 //! Note that display mode 3 is only used if you have an
743 //! AIS_Textured Shape.
744 Standard_EXPORT void SetDisplayMode (const Standard_Integer theMode,
745 const Standard_Boolean theToUpdateViewer);
748 //! Sets the deviation coefficient aCoefficient.
749 //! Drawings of curves or patches are made with respect
750 //! to a maximal chordal deviation. A Deviation coefficient
751 //! is used in the shading display mode. The shape is
752 //! seen decomposed into triangles. These are used to
753 //! calculate reflection of light from the surface of the
754 //! object. The triangles are formed from chords of the
755 //! curves in the shape. The deviation coefficient
756 //! aCoefficient gives the highest value of the angle with
757 //! which a chord can deviate from a tangent to a curve.
758 //! If this limit is reached, a new triangle is begun.
759 //! This deviation is absolute and is set through the
760 //! method: SetMaximalChordialDeviation. The default
762 //! In drawing shapes, however, you are allowed to ask
763 //! for a relative deviation. This deviation will be:
764 //! SizeOfObject * DeviationCoefficient.
766 Standard_EXPORT void SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
767 const Standard_Real theCoefficient,
768 const Standard_Boolean theToUpdateViewer);
770 Standard_EXPORT void SetDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
771 const Standard_Real theAngle,
772 const Standard_Boolean theToUpdateViewer);
774 //! Calls the AIS_Shape SetAngleAndDeviation to set
775 //! both Angle and Deviation coefficients
776 Standard_EXPORT void SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
777 const Standard_Real theAngle,
778 const Standard_Boolean theToUpdateViewer);
781 //! Sets the deviation coefficient aCoefficient for
782 //! removal of hidden lines created by different
783 //! viewpoints in different presentations. The Default value is 0.02.
784 Standard_EXPORT void SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
785 const Standard_Real theCoefficient,
786 const Standard_Boolean theToUpdateViewer);
788 Standard_EXPORT void SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
789 const Standard_Real theAngle,
790 const Standard_Boolean theToUpdateViewer);
792 //! Computes a HLRAngle and a
793 //! HLRDeviationCoefficient by means of the angle
794 //! anAngle and sets the corresponding methods in the
795 //! default drawing tool with these values.
796 Standard_EXPORT void SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
797 const Standard_Real theAngle,
798 const Standard_Boolean theToUpdateViewer);
800 //! Sets the deviation coefficient aCoefficient.
801 //! Drawings of curves or patches are made with respect
802 //! to a maximal chordal deviation. A Deviation coefficient
803 //! is used in the shading display mode. The shape is
804 //! seen decomposed into triangles. These are used to
805 //! calculate reflection of light from the surface of the
806 //! object. The triangles are formed from chords of the
807 //! curves in the shape. The deviation coefficient
808 //! aCoefficient gives the highest value of the angle with
809 //! which a chord can deviate from a tangent to a curve.
810 //! If this limit is reached, a new triangle is begun.
811 //! This deviation is absolute and is set through the
812 //! method: SetMaximalChordialDeviation. The default
814 //! In drawing shapes, however, you are allowed to ask
815 //! for a relative deviation. This deviation will be:
816 //! SizeOfObject * DeviationCoefficient.
818 Standard_EXPORT void SetDeviationCoefficient (const Standard_Real aCoefficient);
820 //! Returns the deviation coefficient.
821 //! Drawings of curves or patches are made with respect
822 //! to a maximal chordal deviation. A Deviation coefficient
823 //! is used in the shading display mode. The shape is
824 //! seen decomposed into triangles. These are used to
825 //! calculate reflection of light from the surface of the
826 //! object. The triangles are formed from chords of the
827 //! curves in the shape. The deviation coefficient gives
828 //! the highest value of the angle with which a chord can
829 //! deviate from a tangent to a curve. If this limit is
830 //! reached, a new triangle is begun.
831 //! This deviation is absolute and is set through
832 //! Prs3d_Drawer::SetMaximalChordialDeviation. The
833 //! default value is 0.001.
834 //! In drawing shapes, however, you are allowed to ask
835 //! for a relative deviation. This deviation will be:
836 //! SizeOfObject * DeviationCoefficient.
837 Standard_EXPORT Standard_Real DeviationCoefficient() const;
839 //! default 12 degrees
840 Standard_EXPORT void SetDeviationAngle (const Standard_Real anAngle);
842 Standard_EXPORT Standard_Real DeviationAngle() const;
844 //! Sets the deviation coefficient aCoefficient for
845 //! removal of hidden lines created by different
846 //! viewpoints in different presentations. The Default value is 0.02.
847 Standard_EXPORT void SetHLRDeviationCoefficient (const Standard_Real aCoefficient);
850 //! Returns the real number value of the hidden line
851 //! removal deviation coefficient.
852 //! A Deviation coefficient is used in the shading display
853 //! mode. The shape is seen decomposed into triangles.
854 //! These are used to calculate reflection of light from the
855 //! surface of the object.
856 //! The triangles are formed from chords of the curves in
857 //! the shape. The deviation coefficient give the highest
858 //! value of the angle with which a chord can deviate
859 //! from a tangent to a curve. If this limit is reached, a
860 //! new triangle is begun.
861 //! To find the hidden lines, hidden line display mode
862 //! entails recalculation of the view at each different
863 //! projector perspective.
864 //! Because hidden lines entail calculations of more than
865 //! usual complexity to decompose them into these
866 //! triangles, a deviation coefficient allowing greater
867 //! tolerance is used. This increases efficiency in calculation.
868 //! The Default value is 0.02.
869 Standard_EXPORT Standard_Real HLRDeviationCoefficient() const;
871 //! Sets the HLR angle anAngle.
872 Standard_EXPORT void SetHLRAngle (const Standard_Real anAngle);
875 //! Returns the real number value of the deviation angle
876 //! in hidden line removal views in this interactive context.
877 //! The default value is 20*PI/180.
878 Standard_EXPORT Standard_Real HLRAngle() const;
880 //! compute with anangle a HLRAngle and a HLRDeviationCoefficient
881 //! and set them in myHLRAngle and in myHLRDeviationCoefficient
882 //! of myDefaultDrawer ;
883 //! anAngle is in radian ; ( 1 deg < angle in deg < 20 deg)
884 Standard_EXPORT void SetHLRAngleAndDeviation (const Standard_Real anAngle);
886 //! Initializes hidden line aspect in the default drawing tool, or Drawer.
887 //! The default values are:
888 //! Color: Quantity_NOC_YELLOW
889 //! Type of line: Aspect_TOL_DASH
891 Standard_EXPORT Handle(Prs3d_LineAspect) HiddenLineAspect() const;
894 //! Sets the hidden line aspect anAspect.
895 //! anAspect defines display attributes for hidden lines in
897 Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& anAspect) const;
899 //! returns Standard_True if the hidden lines are to be drawn.
900 //! By default the hidden lines are not drawn.
901 Standard_EXPORT Standard_Boolean DrawHiddenLine() const;
903 Standard_EXPORT void EnableDrawHiddenLine() const;
905 Standard_EXPORT void DisableDrawHiddenLine() const;
907 //! Sets the number of U and V isoparameters displayed.
908 Standard_EXPORT void SetIsoNumber (const Standard_Integer NbIsos, const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
910 //! Returns the number of U and V isoparameters displayed.
911 Standard_EXPORT Standard_Integer IsoNumber (const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
913 //! Returns True if drawing isoparameters on planes is enabled.
914 Standard_EXPORT void IsoOnPlane (const Standard_Boolean SwitchOn);
916 //! Returns True if drawing isoparameters on planes is enabled.
917 //! if <forUIsos> = False,
918 Standard_EXPORT Standard_Boolean IsoOnPlane() const;
920 //! Enables or disables on-triangulation build for isolines for a particular object.
921 //! In case if on-triangulation builder is disabled, default on-plane
922 //! builder will compute isolines for the object given.
923 Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theIsEnabled,
924 const Handle(AIS_InteractiveObject)& theObject);
926 //! Enables or disables on-triangulation build for isolines for default drawer.
927 //! In case if on-triangulation builder is disabled, default on-plane
928 //! builder will compute isolines for the object given.
929 Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theToSwitchOn);
931 //! Returns true if drawing isolines on triangulation algorithm is enabled.
932 Standard_EXPORT Standard_Boolean IsoOnTriangulation() const;
934 //! Sets the graphic basic aspect to the current presentation of
935 //! ALL selected objects.
936 //! Flag globalChange has no effect (left to simplify porting).
937 //! Updates the viewer when <updateViewer> is TRUE
938 Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
939 const Standard_Boolean theToUpdateViewer);
941 //! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
942 //! This is done by the view theView passing this position to the main viewer and updating it.
943 //! Functions in both Neutral Point and local contexts.
944 //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
945 Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer theXPix,
946 const Standard_Integer theYPix,
947 const Handle(V3d_View)& theView,
948 const Standard_Boolean theToRedrawOnUpdate);
950 //! returns True if other entities were detected in the
951 //! last mouse detection
952 Standard_EXPORT Standard_Boolean HasNextDetected() const;
954 //! if more than 1 object is detected by the selector,
955 //! only the "best" owner is hilighted at the mouse position.
956 //! This Method allows the user to hilight one after another
957 //! the other detected entities.
958 //! if The method select is called, the selected entity
959 //! will be the hilighted one!
960 //! returns the Rank of hilighted entity
961 //! WARNING : Loop Method. When all the detected entities
962 //! have been hilighted , the next call will hilight
963 //! the first one again
964 Standard_EXPORT Standard_Integer HilightNextDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
966 //! Same as previous methods in reverse direction...
967 Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
969 //! Adds object in the selection.
970 Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
972 //! Adds object in the selection.
973 AIS_StatusOfPick AddSelect (const Handle(AIS_InteractiveObject)& theObject)
975 return AddSelect (theObject->GlobalSelOwner());
978 //! Selects everything found in the bounding rectangle
979 //! defined by the pixel minima and maxima, XPMin,
980 //! YPMin, XPMax, and YPMax in the view, aView
981 //! The objects detected are passed to the main viewer,
982 //! which is then updated.
983 Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer theXPMin,
984 const Standard_Integer theYPMin,
985 const Standard_Integer theXPMax,
986 const Standard_Integer theYPMax,
987 const Handle(V3d_View)& theView,
988 const Standard_Boolean theToUpdateViewer);
990 //! polyline selection; clears the previous picked list
991 Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& thePolyline,
992 const Handle(V3d_View)& theView,
993 const Standard_Boolean theToUpdateViewer);
995 //! Stores and hilights the previous detected; Unhilights
996 //! the previous picked.
997 Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean theToUpdateViewer);
999 //! adds the last detected to the list of previous picked.
1000 //! if the last detected was already declared as picked,
1001 //! removes it from the Picked List.
1002 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean theToUpdateViewer);
1004 //! adds the last detected to the list of previous picked.
1005 //! if the last detected was already declared as picked,
1006 //! removes it from the Picked List.
1007 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
1008 const Handle(V3d_View)& theView,
1009 const Standard_Boolean theToUpdateViewer);
1011 //! rectangle of selection ; adds new detected entities into the
1012 //! picked list, removes the detected entities that were already stored...
1013 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Integer theXPMin,
1014 const Standard_Integer theYPMin,
1015 const Standard_Integer theXPMax,
1016 const Standard_Integer theYPMax,
1017 const Handle(V3d_View)& theView,
1018 const Standard_Boolean theToUpdateViewer);
1020 //! Specify whether selected object must be hilighted when mouse cursor
1021 //! is moved above it (in MoveTo method). By default this value is false and
1022 //! selected object is not hilighted in this case.
1023 void SetToHilightSelected (const Standard_Boolean toHilight) { myToHilightSelected = toHilight; }
1025 //! Return value specified whether selected object must be hilighted
1026 //! when mouse cursor is moved above it
1027 Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
1029 //! @name OBSOLETE METHODS THAT ARE VALID FOR LOCAL CONTEXT ONLY
1031 //! Updates the view of the current object in open context.
1032 //! Objects selected when there is no open local context
1033 //! are called current objects; those selected in open
1034 //! local context, selected objects.
1035 //! If a local context is open and if updateviewer equals
1036 //! Standard_False, the presentation of the Interactive
1037 //! Object activates the selection mode; the object is
1038 //! displayed but no viewer will be updated.
1039 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1040 Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& theIObj,
1041 const Standard_Boolean theToUpdateViewer);
1044 //! Allows to add or remove the object given to the list of current and highlight/unhighlight it
1045 //! correspondingly. Is valid for global context only; for local context use method AddOrRemoveSelected.
1046 //! Since this method makes sence only for neutral point selection of a whole object, if 0 selection
1047 //! of the object is empty this method simply does nothing.
1048 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1049 Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
1050 const Standard_Boolean theIsToUpdateViewer);
1052 //! Updates the list of current objects, i.e. hilights new
1053 //! current objects, removes hilighting from former current objects.
1054 //! Objects selected when there is no open local context
1055 //! are called current objects; those selected in open
1056 //! local context, selected objects.
1057 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1058 Standard_EXPORT void UpdateCurrent();
1060 //! Returns true if there is a non-null interactive object in Neutral Point.
1061 //! Objects selected when there is no open local context are called current objects;
1062 //! those selected in open local context, selected objects.
1063 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1064 Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const;
1067 //! Initializes a scan of the current selected objects in
1069 //! Objects selected when there is no open local context
1070 //! are called current objects; those selected in open
1071 //! local context, selected objects.
1072 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1073 Standard_EXPORT void InitCurrent();
1076 //! Returns true if there is another object found by the
1077 //! scan of the list of current objects.
1078 //! Objects selected when there is no open local context
1079 //! are called current objects; those selected in open
1080 //! local context, selected objects.
1081 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1082 Standard_EXPORT Standard_Boolean MoreCurrent() const;
1085 //! Continues the scan to the next object in the list of
1086 //! current objects.
1087 //! Objects selected when there is no open local context
1088 //! are called current objects; those selected in open
1089 //! local context, selected objects.
1090 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1091 Standard_EXPORT void NextCurrent();
1094 //! Returns the current interactive object.
1095 //! Objects selected when there is no open local context
1096 //! are called current objects; those selected in open
1097 //! local context, selected objects.
1098 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1099 Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
1101 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1102 Standard_EXPORT Standard_Integer NbCurrents();
1104 //! Highlights current objects.
1105 //! Objects selected when there is no open local context
1106 //! are called current objects; those selected in open
1107 //! local context, selected objects.
1108 //! If a local context is open and if updateviewer equals
1109 //! Standard_False, the presentation of the Interactive
1110 //! Object activates the selection mode; the object is
1111 //! displayed but no viewer will be updated.
1112 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1113 Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer);
1115 //! Removes highlighting from current objects.
1116 //! Objects selected when there is no open local context
1117 //! are called current objects; those selected in open
1118 //! local context, selected objects.
1119 //! If a local context is open and if updateviewer equals
1120 //! Standard_False, the presentation of the Interactive
1121 //! Object activates the selection mode; the object is
1122 //! displayed but no viewer will be updated.
1123 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1124 Standard_EXPORT void UnhilightCurrents (const Standard_Boolean theToUpdateViewer);
1126 //! Empties previous current objects in order to get the
1127 //! current objects detected by the selector using
1129 //! Objects selected when there is no open local context
1130 //! are called current objects; those selected in open
1131 //! local context, selected objects.
1132 //! If a local context is open and if updateviewer equals
1133 //! Standard_False, the presentation of the Interactive
1134 //! Object activates the selection mode; the object is
1135 //! displayed but no viewer will be updated.
1136 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1137 Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer);
1139 //! @return current mouse-detected shape or empty (null) shape, if current interactive object
1140 //! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
1141 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1142 Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
1144 //! @return current mouse-detected interactive object or null object, if there is no currently detected interactives
1145 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1146 Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
1148 //! @name COMMON SELECTION METHODS VALID FOR BOTH GLOBAL AND LOCAL CONTEXT
1150 //! Unhighlights previously selected owners and marks them as not selected.
1151 //! Marks owner given as selected and highlights it.
1152 //! Performs selection filters check.
1153 Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
1154 const Standard_Boolean theToUpdateViewer);
1156 //! Puts the interactive object aniObj in the list of
1157 //! selected objects.
1158 //! If a local context is open and if updateviewer equals
1159 //! Standard_False, the presentation of the Interactive
1160 //! Object activates the selection mode; the object is
1161 //! displayed but no viewer will be updated.
1162 //! Performs selection filters check.
1163 Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
1164 const Standard_Boolean theToUpdateViewer);
1166 //! Updates the list of selected objects:
1167 //! i.e. highlights the newely selected ones and unhighlights previously selected objects.
1168 Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer);
1170 //! Allows to highlight or unhighlight the owner given depending on its selection status
1171 Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
1172 const Standard_Boolean theToUpdateViewer);
1174 //! Highlights selected objects.
1175 //! If a local context is open and if updateviewer equals
1176 //! Standard_False, the presentation of the Interactive
1177 //! Object activates the selection mode; the object is
1178 //! displayed but no viewer will be updated.
1179 Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer);
1181 //! Removes highlighting from selected objects.
1182 //! If a local context is open and if updateviewer equals
1183 //! Standard_False, the presentation of the Interactive
1184 //! Object activates the selection mode; the object is
1185 //! displayed but no viewer will be updated.
1186 Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer);
1188 //! Empties previous selected objects in order to get the
1189 //! selected objects detected by the selector using
1191 //! If a local context is open and if updateviewer equals
1192 //! Standard_False, the presentation of the Interactive
1193 //! Object activates the selection mode; the object is
1194 //! displayed but no viewer will be updated.
1195 Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer);
1197 //! No right to Add a selected Shape (Internal Management
1198 //! of shape Selection).
1199 //! A Previous selected shape may only be removed.
1200 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1201 Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& theShape,
1202 const Standard_Boolean theToUpdateViewer);
1204 //! Allows to highlight or unhighlight the owner given depending on its selection status
1205 Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
1206 const Standard_Boolean theToUpdateViewer);
1208 //! Returns true is the owner given is selected
1209 Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const;
1211 //! Returns true is the object given is selected
1212 Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& theObj) const;
1214 //! Returns the first selected object in the list of current selected.
1215 Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject();
1217 //! Initializes a scan of the selected objects.
1218 Standard_EXPORT void InitSelected();
1220 //! Returns true if there is another object found by the
1221 //! scan of the list of selected objects.
1222 Standard_EXPORT Standard_Boolean MoreSelected() const;
1224 //! Continues the scan to the next object in the list of
1225 //! selected objects.
1226 Standard_EXPORT void NextSelected();
1228 Standard_EXPORT Standard_Integer NbSelected();
1230 //! Returns true if the interactive context has a shape
1231 //! selected in it which results from the decomposition of
1233 //! If HasSelectedShape returns true, SelectedShape
1234 //! returns the shape which has been shown to be
1235 //! selected. Interactive returns the Interactive Object
1236 //! from which the shape has been selected.
1237 //! If HasSelectedShape returns false, Interactive
1238 //! returns the interactive entity selected by the click of the mouse.
1239 Standard_EXPORT Standard_Boolean HasSelectedShape() const;
1241 //! Returns the selected shape.
1242 Standard_EXPORT TopoDS_Shape SelectedShape() const;
1244 //! Returns the owner of the selected entity resulting
1245 //! from the decomposition of another entity.
1246 Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const;
1248 //! Returns a collection containing all entity owners
1249 //! created for the interactive object <theIObj> in
1250 //! the selection mode theMode (in all active modes
1251 //! if the Mode == -1)
1252 Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
1253 const Handle(AIS_InteractiveObject)& theIObj,
1254 const Standard_Integer theMode = -1) const;
1256 Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const;
1258 //! Returns true if the applicative object has an owner
1259 //! from Interactive attributed to it.
1260 Standard_EXPORT Standard_Boolean HasApplicative() const;
1263 //! Returns the owner of the applicative entity detected
1264 //! in interactive context. The owner can be a shape for
1265 //! a set of sub-shapes or a sub-shape for sub-shapes
1266 //! which it is composed of.
1267 Standard_EXPORT Handle(Standard_Transient) Applicative() const;
1270 //! Returns true if there is a mouse-detected entity in local context.
1271 //! If there is no open local context, the objects selected
1272 //! are called current objects; selected objects if there is
1273 //! one. Iterators allow entities to be recovered in either
1274 //! case. This method is one of a set which allows you to
1275 //! manipulate the objects which have been placed in these two lists.
1276 Standard_EXPORT Standard_Boolean HasDetected() const;
1279 //! Returns true if there is a detected shape in local context.
1280 //! If there is no open local context, the objects selected
1281 //! are called current objects; selected objects if there is
1282 //! one. Iterators allow entities to be recovered in either
1283 //! case. This method is one of a set which allows you to
1284 //! manipulate the objects which have been placed in these two lists.
1285 Standard_EXPORT Standard_Boolean HasDetectedShape() const;
1288 //! Returns the shape detected in local context.
1289 //! If there is no open local context, the objects selected
1290 //! are called current objects; selected objects if there is
1291 //! one. Iterators allow entities to be recovered in either
1292 //! case. This method is one of a set which allows you to
1293 //! manipulate the objects which have been placed in these two lists.
1294 Standard_EXPORT const TopoDS_Shape& DetectedShape() const;
1297 //! Returns the interactive objects last detected in open context.
1298 //! If there is no open local context, the objects selected
1299 //! are called current objects; selected objects if there is
1300 //! one. Iterators allow entities to be recovered in either
1301 //! case. This method is one of a set which allows you to
1302 //! manipulate the objects which have been placed in these two lists.
1303 Standard_EXPORT Handle(AIS_InteractiveObject) DetectedInteractive() const;
1305 //! returns the owner of the detected sensitive primitive.
1306 Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedOwner() const;
1309 //! Initialization for iteration through mouse-detected objects in
1310 //! interactive context or in local context if it is opened.
1311 Standard_EXPORT void InitDetected();
1314 //! @return true if there is more mouse-detected objects after the current one
1315 //! during iteration through mouse-detected interactive objects.
1316 Standard_EXPORT Standard_Boolean MoreDetected() const;
1319 //! Gets next current object during iteration through mouse-detected
1320 //! interactive objects.
1321 Standard_EXPORT void NextDetected();
1323 //! Opens local contexts and specifies how this is to be
1324 //! done. The options listed above function in the following manner:
1325 //! - UseDisplayedObjects -allows you to load or not
1326 //! load the interactive objects visualized at Neutral
1327 //! Point in the local context which you open. If false,
1328 //! the local context is empty after being opened. If
1329 //! true, the objects at Neutral Point are loaded by their
1330 //! default selection mode.
1331 //! - AllowShapeDecomposition -AIS_Shape allows or
1332 //! prevents decomposition in standard shape location
1333 //! mode of objects at Neutral Point which are
1334 //! type-"privileged". This Flag is only taken into
1335 //! account when UseDisplayedObjects is true.
1336 //! - AcceptEraseOfObjects -authorises other local
1337 //! contexts to erase the interactive objects present in
1338 //! this context. This option is rarely used.
1339 //! - BothViewers - Has no use currently defined.
1340 //! This method returns the index of the created local
1341 //! context. It should be kept and used to close the context.
1342 //! Opening a local context allows you to prepare an
1343 //! environment for temporary presentations and
1344 //! selections which will disappear once the local context is closed.
1345 //! You can open several local contexts, but only the last
1346 //! one will be active.
1347 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1348 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);
1350 //! Allows you to close local contexts. For greater
1351 //! security, you should close the context with the
1352 //! index Index given on opening.
1353 //! When you close a local context, the one before,
1354 //! which is still on the stack, reactivates. If none is
1355 //! left, you return to Neutral Point.
1356 //! If a local context is open and if updateviewer
1357 //! equals Standard_False, the presentation of the
1358 //! Interactive Object activates the selection mode; the
1359 //! object is displayed but no viewer will be updated.
1361 //! When the index isn't specified, the current context
1362 //! is closed. This option can be dangerous, as other
1363 //! Interactive Functions can open local contexts
1364 //! without necessarily warning the user.
1365 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1366 Standard_EXPORT void CloseLocalContext (const Standard_Integer theIndex = -1,
1367 const Standard_Boolean theToUpdateViewer = Standard_True);
1369 //! returns -1 if no opened local context.
1370 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1371 Standard_EXPORT Standard_Integer IndexOfCurrentLocal() const;
1374 //! Allows you to close all local contexts at one go and
1375 //! return to Neutral Point.
1376 //! If a local context is open and if updateviewer equals
1377 //! Standard_False, the presentation of the Interactive
1378 //! Object activates the selection mode; the object is
1379 //! displayed but no viewer will be updated.
1380 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1381 Standard_EXPORT void CloseAllContexts (const Standard_Boolean theToUpdateViewer);
1383 //! to be used only with no opened
1384 //! local context.. displays and activates objects in their
1385 //! original state before local contexts were opened...
1386 Standard_EXPORT void ResetOriginalState (const Standard_Boolean theToUpdateViewer);
1388 //! clears Objects/Filters/Activated Modes list in the current opened local context.
1389 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1390 Standard_EXPORT void ClearLocalContext (const AIS_ClearMode TheMode = AIS_CM_All);
1392 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1393 Standard_EXPORT void UseDisplayedObjects();
1395 //! when a local Context is opened, one is able to
1396 //! use/not use the displayed objects at neutral point
1398 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1399 Standard_EXPORT void NotUseDisplayedObjects();
1401 //! initializes the list of presentations to be displayed
1402 //! returns False if no local context is opened.
1403 Standard_EXPORT Standard_Boolean BeginImmediateDraw();
1405 //! returns True if <anIObj> has been stored in the list.
1406 Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0);
1408 //! returns True if the immediate display has been done.
1409 Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_View)& theView);
1411 //! Uses the First Active View of Main Viewer!
1412 //! returns True if the immediate display has been done.
1413 Standard_EXPORT Standard_Boolean EndImmediateDraw();
1415 Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
1418 //! Sets the highlighting status aStatus of detected and
1419 //! selected entities.
1420 //! Whether you are in Neutral Point or local context, this
1421 //! is automatically managed by the Interactive Context.
1422 //! This function allows you to disconnect the automatic mode.
1423 Standard_EXPORT void SetAutomaticHilight (const Standard_Boolean aStatus);
1426 //! Returns true if the automatic highlight mode is active
1427 //! in an open context.
1428 Standard_EXPORT Standard_Boolean AutomaticHilight() const;
1430 //! Activates the selection mode aMode whose index is
1431 //! given, for the given interactive entity anIobj.
1432 Standard_EXPORT void Activate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode = 0, const Standard_Boolean theIsForce = Standard_False);
1434 //! Activates the given selection mode for the all displayed objects.
1435 Standard_EXPORT void Activate (const Standard_Integer theMode,
1436 const Standard_Boolean theIsForce = Standard_False);
1438 //! Deactivates all the activated selection modes
1440 Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIObj);
1443 //! Deactivates all the activated selection modes of the
1444 //! interactive object anIobj with a given selection mode aMode.
1445 Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode);
1447 //! Deactivates the given selection mode for all displayed objects.
1448 Standard_EXPORT void Deactivate (const Standard_Integer theMode);
1450 //! Deactivates all the activated selection mode at all displayed objects.
1451 Standard_EXPORT void Deactivate();
1453 //! Returns the list of activated selection modes in an open context.
1454 Standard_EXPORT void ActivatedModes (const Handle(AIS_InteractiveObject)& anIobj, TColStd_ListOfInteger& theList) const;
1456 //! to be Used only with opened local context and
1457 //! if <anIobj> is of type shape...
1458 //! if <aStatus> = True <anIobj> will be sensitive to
1459 //! shape selection modes activation.
1460 //! = False, <anIobj> will not be senstive
1462 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1463 Standard_EXPORT void SetShapeDecomposition (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean aStatus);
1466 //! Sets the temporary graphic attributes of the entity
1467 //! anObj. These are provided by the attribute manager
1468 //! aDrawer and are valid for a particular local context only.
1469 //! If a local context is open and if updateviewer equals
1470 //! Standard_False, the presentation of the Interactive
1471 //! Object activates the selection mode; the object is
1472 //! displayed but no viewer will be updated.
1473 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1474 Standard_EXPORT void SetTemporaryAttributes (const Handle(AIS_InteractiveObject)& theIObj,
1475 const Handle(Prs3d_Drawer)& theDrawer,
1476 const Standard_Boolean theToUpdateViewer);
1479 //! Highlights, and removes highlights from, the displayed
1480 //! object aniobj which is displayed at Neutral Point with
1481 //! subintensity color; available only for active local
1482 //! context. There is no effect if there is no local context.
1483 //! If a local context is open and if updateviewer equals
1484 //! Standard_False, the presentation of the Interactive
1485 //! Object activates the selection mode; the object is
1486 //! displayed but no viewer will be updated.
1487 Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& theIObj,
1488 const Standard_Boolean theToUpdateViewer);
1491 //! Removes the subintensity option for the entity aniobj.
1492 //! If a local context is open and if updateviewer equals
1493 //! Standard_False, the presentation of the Interactive
1494 //! Object activates the selection mode; the object is
1495 //! displayed but no viewer will be updated.
1496 Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& theIObj,
1497 const Standard_Boolean theToUpdateViewer);
1499 //! hilights/unhilights displayed objects which are displayed at
1500 //! neutral state with subintensity color;
1501 //! available only for active local context.
1502 //! No effect if no local context.
1503 Standard_EXPORT void SubIntensityOn (const Standard_Boolean theToUpdateViewer);
1505 //! removes subintensity option for all objects.
1506 Standard_EXPORT void SubIntensityOff (const Standard_Boolean theToUpdateViewer);
1508 //! Allows you to add the filter aFilter to Neutral Point or
1509 //! to a local context if one or more selection modes have been activated.
1510 //! Only type filters may be active in Neutral Point.
1511 Standard_EXPORT void AddFilter (const Handle(SelectMgr_Filter)& aFilter);
1514 //! Removes a filter from Neutral Point or a local context
1515 //! if one or more selection modes have been activated.
1516 //! Only type filters are activated in Neutral Point.
1517 Standard_EXPORT void RemoveFilter (const Handle(SelectMgr_Filter)& aFilter);
1519 //! Remove a filter to Neutral Point or a local context if
1520 //! one or more selection modes have been activated.
1521 //! Only type filters are active in Neutral Point.
1522 Standard_EXPORT void RemoveFilters();
1524 //! Provides an alternative to the Display methods when
1525 //! activating specific selection modes. This has the
1526 //! effect of activating the corresponding selection mode
1527 //! aStandardActivation for all objects in Local Context
1528 //! which accept decomposition into sub-shapes.
1529 //! Every new Object which has been loaded into the
1530 //! interactive context and which answers these
1531 //! decomposition criteria is automatically activated
1532 //! according to these modes.
1534 //! If you have opened a local context by loading an
1535 //! object with the default options
1536 //! (<AllowShapeDecomposition >= Standard_True), all
1537 //! objects of the "Shape" type are also activated with
1538 //! the same modes. You can act on the state of these
1539 //! "Standard" objects by using SetShapeDecomposition(Status).
1540 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1541 Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1544 //! Provides an alternative to the Display methods when
1545 //! deactivating specific selection modes. This has the
1546 //! effect of deactivating the corresponding selection
1547 //! mode aStandardActivation for all objects in Local
1548 //! Context which accept decomposition into sub-shapes.
1549 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1550 Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1553 //! Returns the list of activated standard selection modes
1554 //! available in a local context.
1555 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1556 Standard_EXPORT const TColStd_ListOfInteger& ActivatedStandardModes() const;
1559 //! Returns the list of filters active in a local context.
1560 Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
1562 //! Returns the default attribute manager.
1563 //! This contains all the color and line attributes which
1564 //! can be used by interactive objects which do not have
1565 //! their own attributes.
1566 const Handle(Prs3d_Drawer)& DefaultDrawer() const { return myDefaultDrawer; }
1568 //! Returns the current viewer.
1569 const Handle(V3d_Viewer)& CurrentViewer() const { return myMainVwr; }
1571 //! Returns the list of displayed objects of a particular
1572 //! Type WhichKind and Signature WhichSignature. By
1573 //! Default, WhichSignature equals -1. This means that
1574 //! there is a check on type only.
1575 Standard_EXPORT void DisplayedObjects (AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1577 //! gives the list of displayed objects of a particular
1578 //! Type and signature.
1579 //! by Default, <WhichSignature> = -1 means
1580 //! control only on <WhichKind>.
1581 Standard_EXPORT void DisplayedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1584 //! Returns the list theListOfIO of erased objects (hidden objects)
1585 //! particular Type WhichKind and Signature WhichSignature.
1586 //! By Default, WhichSignature equals 1. This means
1587 //! that there is a check on type only.
1588 Standard_EXPORT void ErasedObjects (AIS_ListOfInteractive& theListOfIO) const;
1590 //! gives the list of erased objects (hidden objects)
1591 //! Type and signature
1592 //! by Default, <WhichSignature> = -1 means
1593 //! control only on <WhichKind>.
1594 Standard_EXPORT void ErasedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& theListOfIO) const;
1597 //! Returns the list theListOfIO of objects with indicated display status
1598 //! particular Type WhichKind and Signature WhichSignature.
1599 //! By Default, WhichSignature equals 1. This means
1600 //! that there is a check on type only.
1601 Standard_EXPORT void ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1603 //! gives the list of objects with indicated display status
1604 //! Type and signature
1605 //! by Default, <WhichSignature> = -1 means
1606 //! control only on <WhichKind>.
1607 Standard_EXPORT void ObjectsByDisplayStatus (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1609 //! fills <aListOfIO> with objects of a particular
1610 //! Type and Signature with no consideration of display status.
1611 //! by Default, <WhichSignature> = -1 means
1612 //! control only on <WhichKind>.
1613 //! if <WhichKind> = AIS_KOI_None and <WhichSignature> = -1,
1614 //! all the objects are put into the list.
1615 Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO, const AIS_KindOfInteractive WhichKind = AIS_KOI_None, const Standard_Integer WhichSignature = -1) const;
1617 //! Returns true if there is an open context.
1618 Standard_Boolean HasOpenedContext() const { return myCurLocalIndex != 0; }
1620 //! This method is only intended for advanced operation, particularly with
1621 //! the aim to improve performance when many objects have to be selected
1622 //! together. Otherwise, you should use other (non-internal) methods of
1623 //! class AIS_InteractiveContext without trying to obtain an instance of
1624 //! AIS_LocalContext.
1625 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1626 Handle(AIS_LocalContext) LocalContext() const { return myCurLocalIndex > 0 ? myLocalContexts (myCurLocalIndex) : Handle(AIS_LocalContext)(); }
1628 const Handle(SelectMgr_SelectionManager)& SelectionManager() const { return mgrSelector; }
1630 const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const { return myMainPM; }
1632 const Handle(StdSelect_ViewerSelector3d)& MainSelector() const { return myMainSel; }
1634 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1635 Standard_EXPORT Handle(StdSelect_ViewerSelector3d) LocalSelector() const;
1637 //! Clears all the structures which don't
1638 //! belong to objects displayed at neutral point
1639 //! only effective when no Local Context is opened...
1640 //! returns the number of removed structures from the viewers.
1641 Standard_EXPORT Standard_Integer PurgeDisplay();
1643 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1644 Standard_EXPORT Standard_Integer HighestIndex() const;
1646 Standard_EXPORT void DisplayActiveSensitive (const Handle(V3d_View)& aView);
1648 Standard_EXPORT void ClearActiveSensitive (const Handle(V3d_View)& aView);
1650 //! Fits the view correspondingly to the bounds of selected objects.
1651 //! Infinite objects are ignored if infinite state of AIS_InteractiveObject
1653 Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
1654 const Standard_Real theMargin,
1655 const Standard_Boolean theToUpdate);
1657 //! Fits the view correspondingly to the bounds of selected objects.
1658 //! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
1659 Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView);
1661 Standard_EXPORT void DisplayActiveSensitive (const Handle(AIS_InteractiveObject)& anObject, const Handle(V3d_View)& aView);
1663 //! returns if possible,
1664 //! the first local context where the object is seen
1665 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1666 Standard_EXPORT Standard_Boolean IsInLocal (const Handle(AIS_InteractiveObject)& anObject, Standard_Integer& TheIndex) const;
1668 //! Rebuilds 1st level of BVH selection forcibly
1669 Standard_EXPORT void RebuildSelectionStructs();
1671 //! setup object visibility in specified view,
1672 //! has no effect if object is not disaplyed in this context.
1673 Standard_EXPORT void SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisible);
1675 //! Disconnects theObjToDisconnect from theAssembly and removes dependent selection structures
1676 Standard_EXPORT void Disconnect (const Handle(AIS_InteractiveObject)& theAssembly, const Handle(AIS_InteractiveObject)& theObjToDisconnect = NULL);
1678 //! Query objects visible or hidden in specified view due to affinity mask.
1679 Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisibleInView, const AIS_DisplayStatus theStatus = AIS_DS_None) const;
1681 //! Redraws immediate structures in all views of the viewer given taking into account its visibility.
1682 Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
1686 Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
1688 Standard_EXPORT void EraseGlobal (const Handle(AIS_InteractiveObject)& theIObj,
1689 const Standard_Boolean theToUpdateViewer);
1691 Standard_EXPORT void ClearGlobal (const Handle(AIS_InteractiveObject)& theIObj,
1692 const Standard_Boolean theToUpdateViewer);
1694 Standard_EXPORT void ClearGlobalPrs (const Handle(AIS_InteractiveObject)& theObj,
1695 const Standard_Integer theMode,
1696 const Standard_Boolean theToUpdateViewer);
1698 Standard_EXPORT void InitAttributes();
1700 Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
1703 Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
1704 const Standard_Boolean theToUpdateViewer);
1707 Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
1708 const Standard_Boolean theToUpdateViewer);
1710 //! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
1711 Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
1713 //! Helper function that highlights the owner given with <theStyle> without
1714 //! performing AutoHighlight checks, e.g. is used for dynamic highlight.
1715 Standard_EXPORT void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
1716 const Handle(V3d_Viewer)& theViewer = NULL);
1718 //! Helper function that highlights the owner given with <theStyle> with check
1719 //! for AutoHighlight, e.g. is used for selection.
1720 Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
1722 //! Helper function that highlights global owner of the object given with <theStyle> with check
1723 //! for AutoHighlight, e.g. is used for selection.
1724 //! If global owner is null, it simply highlights the whole object
1725 Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
1726 const Handle(Prs3d_Drawer)& theStyle,
1727 const Standard_Integer theDispMode) const;
1729 //! Helper function that unhighlights all owners that are stored in current AIS_Selection.
1730 //! The function updates global status and selection state of owner and interactive object.
1731 //! If the parameter <theIsToHilightSubIntensity> is set to true, interactive objects with sub-intensity
1732 //! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
1733 Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
1735 //! Helper function that unhighlights global selection owner of given interactive.
1736 //! The function does not perform any updates of global or owner status
1737 Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const;
1739 //! Helper function that turns on sub-intensity in global status and highlights
1740 //! given objects with sub-intensity color
1741 //! @param theObject [in] the object. If NULL is given, than sub-intensity will be turned on for
1742 //! all inveractive objects of the context
1743 //! @param theDispMode [in] display mode. If -1 is given, sub-intensity will be turned on for
1744 //! all display modes in global status's list of modes
1745 //! @param theIsDisplayedOnly [in] is true if sub-intensity should be applied only to objects with
1746 //! status AIS_DS_Displayed
1747 Standard_EXPORT void turnOnSubintensity (const Handle(AIS_InteractiveObject)& theObject = NULL,
1748 const Standard_Integer theDispMode = -1,
1749 const Standard_Boolean theIsDisplayedOnly = Standard_True) const;
1751 //! Helper function that highlights the object with sub-intensity color without any checks
1752 //! @param theObject [in] the object that will be highlighted
1753 //! @param theMode [in] display mode
1754 Standard_EXPORT void highlightWithSubintensity (const Handle(AIS_InteractiveObject)& theObject,
1755 const Standard_Integer theMode) const;
1757 //! Helper function that highlights the owner with sub-intensity color without any checks
1758 //! @param theOwner [in] the owner that will be highlighted
1759 //! @param theMode [in] display mode
1760 Standard_EXPORT void highlightWithSubintensity (const Handle(SelectMgr_EntityOwner)& theOwner,
1761 const Standard_Integer theMode) const;
1763 //! Helper function that returns correct dynamic highlight style for the object:
1764 //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1765 //! dynamic highlight style of interactive context will be returned.
1766 //! @param theObj [in] the object to check
1767 const Handle(Prs3d_Drawer)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj,
1768 const Handle(SelectMgr_EntityOwner)& theOwner) const
1770 const Handle(Prs3d_Drawer)& aHiDrawer = theObj->DynamicHilightAttributes();
1771 if (!aHiDrawer.IsNull())
1776 return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
1779 //! Helper function that returns correct selection style for the object:
1780 //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1781 //! selection style of interactive context will be returned.
1782 //! @param theObj [in] the object to check
1783 const Handle(Prs3d_Drawer)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj,
1784 const Handle(SelectMgr_EntityOwner)& theOwner) const
1786 const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
1787 if (!aHiDrawer.IsNull())
1792 return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalSelected : Prs3d_TypeOfHighlight_Selected];
1795 //! Assign the context to the object or throw exception if object was already assigned to another context.
1796 void setContextToObject (const Handle(AIS_InteractiveObject)& theObj)
1798 if (theObj->HasInteractiveContext())
1800 if (theObj->myCTXPtr != this)
1802 throw Standard_ProgramError("AIS_InteractiveContext - object has been already displayed in another context!");
1807 theObj->SetContext (this);
1811 //! Return display mode for highlighting.
1812 Standard_Integer getHilightMode (const Handle(AIS_InteractiveObject)& theObj,
1813 const Handle(Prs3d_Drawer)& theStyle,
1814 const Standard_Integer theDispMode) const
1816 if (!theStyle.IsNull()
1817 && theStyle->DisplayMode() != -1
1818 && theObj->AcceptDisplayMode (theStyle->DisplayMode()))
1820 return theStyle->DisplayMode();
1822 else if (theDispMode != -1)
1826 else if (theObj->HasDisplayMode())
1828 return theObj->DisplayMode();
1830 return myDefaultDrawer->DisplayMode();
1833 //! Removes dynamic highlight draw
1834 void clearDynamicHighlight() const
1836 if (myLastinMain.IsNull())
1839 if (myLastinMain->IsAutoHilight())
1841 myMainPM->ClearImmediateDraw();
1845 myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
1851 AIS_DataMapOfIOStatus myObjects;
1852 Handle(SelectMgr_SelectionManager) mgrSelector;
1853 Handle(PrsMgr_PresentationManager3d) myMainPM;
1854 Handle(V3d_Viewer) myMainVwr;
1855 Handle(StdSelect_ViewerSelector3d) myMainSel;
1856 Handle(SelectMgr_EntityOwner) myLastPicked;
1857 Handle(SelectMgr_EntityOwner) myLastinMain;
1858 Standard_Boolean myWasLastMain;
1859 Standard_Boolean myToHilightSelected;
1860 Handle(AIS_Selection) mySelection;
1861 Handle(SelectMgr_OrFilter) myFilters;
1862 Handle(Prs3d_Drawer) myDefaultDrawer;
1863 Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
1864 AIS_DataMapOfILC myLocalContexts;
1865 Standard_Integer myCurLocalIndex;
1866 Handle(V3d_View) mylastmoveview;
1867 TColStd_SequenceOfInteger myDetectedSeq;
1868 Standard_Integer myCurDetected;
1869 Standard_Integer myCurHighlighted;
1870 SelectMgr_PickingStrategy myPickingStrategy; //!< picking strategy to be applied within MoveTo()
1871 Standard_Boolean myIsAutoActivateSelMode;
1875 DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
1877 #endif // _AIS_InteractiveContext_HeaderFile