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 <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <AIS_DataMapOfIOStatus.hxx>
24 #include <PrsMgr_PresentationManager3d.hxx>
25 #include <StdSelect_ViewerSelector3d.hxx>
26 #include <TCollection_AsciiString.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Prs3d_Drawer.hxx>
29 #include <Quantity_NameOfColor.hxx>
30 #include <Standard_Integer.hxx>
31 #include <AIS_DataMapOfILC.hxx>
32 #include <AIS_DisplayStatus.hxx>
33 #include <AIS_KindOfInteractive.hxx>
34 #include <Standard_Real.hxx>
35 #include <Aspect_TypeOfFacingModel.hxx>
36 #include <Graphic3d_NameOfMaterial.hxx>
37 #include <Standard_ShortReal.hxx>
38 #include <TColStd_ListOfInteger.hxx>
39 #include <AIS_DisplayMode.hxx>
40 #include <AIS_TypeOfIso.hxx>
41 #include <AIS_StatusOfDetection.hxx>
42 #include <AIS_StatusOfPick.hxx>
43 #include <TColgp_Array1OfPnt2d.hxx>
44 #include <SelectMgr_IndexedMapOfOwner.hxx>
45 #include <AIS_ClearMode.hxx>
46 #include <TopAbs_ShapeEnum.hxx>
47 #include <SelectMgr_ListOfFilter.hxx>
48 #include <AIS_ListOfInteractive.hxx>
49 #include <Standard_CString.hxx>
50 #include <AIS_Selection.hxx>
51 #include <Prs3d_TypeOfHighlight.hxx>
52 class SelectMgr_SelectionManager;
54 class AIS_InteractiveObject;
55 class SelectMgr_OrFilter;
57 class AIS_LocalContext;
58 class TopLoc_Location;
60 class TCollection_ExtendedString;
61 class Prs3d_LineAspect;
62 class Prs3d_BasicAspect;
63 class SelectMgr_EntityOwner;
64 class Standard_Transient;
65 class SelectMgr_Filter;
66 class TCollection_AsciiString;
68 //! The Interactive Context allows you to manage
69 //! graphic behavior and selection of Interactive Objects
70 //! in one or more viewers. Class methods make this
71 //! highly transparent.
72 //! It is essential to remember that an Interactive Object
73 //! which is already known by the Interactive Context
74 //! must be modified using Context methods. You can
75 //! only directly call the methods available for an
76 //! Interactive Object if it has not been loaded into an
77 //! Interactive Context.
78 //! You must distinguish two states in the Interactive Context:
79 //! - No Open Local Context, also known as the Neutral Point.
80 //! - One or several open local contexts, each
81 //! representing a temporary state of selection and presentation.
82 //! Some methods can only be used in open Local
83 //! Context; others in closed Local Context; others do
84 //! not have the same behavior in one state as in the other.
85 //! The possiblities of use for local contexts are
86 //! numerous depending on the type of operation that
87 //! you want to perform, for example:
88 //! - working on all visualized interactive objects,
89 //! - working on only a few objects,
90 //! - working on a single object.
91 //! 1. When you want ot work on one type of entity, you
92 //! may open a local context with the option
93 //! UseDisplayedObjects set to false. DisplayedObjects
94 //! allows you to recover the visualized Interactive
95 //! Objects which have a given Type and
96 //! Signature from Neutral Point.
97 //! 2. You must keep in mind the fact that when you open
98 //! a Local Context with default options:
99 //! - The Interactive Objects visualized at Neutral Point
100 //! are activated with their default selection mode. You
101 //! must deactivate those which you do not want ot use.
102 //! - The Shape type Interactive Objects are
103 //! automatically decomposed into sub-shapes when
104 //! standard activation modes are launched.
105 //! - The "temporary" Interactive Objects present in the
106 //! Local Contexts are not automatically taken into
107 //! account. You have to load them manually if you
108 //! want to use them.
109 //! - The stages could be the following:
110 //! - Open a Local Context with the right options;
111 //! - Load/Visualize the required complementary
112 //! objects with the desired activation modes.
113 //! - Activate Standard modes if necessary
114 //! - Create its filters and add them to the Local Context
115 //! - Detect/Select/recover the desired entities
116 //! - Close the Local Context with the adequate index.
117 //! - It is useful to create an interactive editor, to which
118 //! you pass the Interactive Context. This will take care
119 //! of setting up the different contexts of
120 //! selection/presentation according to the operation
121 //! which you want to perform.
123 //! Selection of parts of the objects can also be done without opening a local context.
124 //! Interactive context itself supports decomposed object selection with selection filters
125 //! support. Note that each selectable object must specify the selection mode that is
126 //! responsible for selection of object as a whole (global selection mode). By default, global
127 //! selection mode is equal to 0, but it might be redefined if needed. Sub-part selection
128 //! of the objects without using local context provides a possibility to activate part
129 //! selection modes along with global selection mode.
130 class AIS_InteractiveContext : public Standard_Transient
132 friend class AIS_LocalContext;
133 DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext, Standard_Transient)
136 //! Constructs the interactive context object defined by
137 //! the principal viewer MainViewer.
138 Standard_EXPORT AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer);
141 Standard_EXPORT virtual ~AIS_InteractiveContext();
143 Standard_EXPORT void SetAutoActivateSelection (const Standard_Boolean Auto);
145 Standard_EXPORT Standard_Boolean GetAutoActivateSelection() const;
147 //! Controls the choice between the using the display
148 //! and selection modes of open local context which you
149 //! have defined and activating those available by default.
150 //! If a local context is open and if updateviewer equals
151 //! Standard_False, the Interactive Object anIobj is
152 //! displayed in the default active mode. This will be the
153 //! object's default display mode, if there is one.
154 //! Otherwise, it will be the context mode. The Interactive
155 //! Object's default selection mode is activated. In
156 //! general, this is 0.
157 //! This syntax has the same behavior as local context,
158 //! open or closed. If you want to view the object in open
159 //! local context without selection, use the syntax below,
160 //! setting aSelectionMode to -1.
161 Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean updateviewer = Standard_True);
163 //! Controls the choice between the using the display
164 //! and selection modes of open local context which you
165 //! have defined and activating those available by default.
166 //! If no Local Context is opened. and the Interactive
167 //! Object theIObj has no display mode of its own, the
168 //! default display mode, 0, is used. Likewise, if theIObj
169 //! has no selection mode of its own, the default one, 0, is used.
170 //! If a local context is open and if theToUpdateViewer equals
171 //! Standard_False, the presentation of the Interactive
172 //! Object activates the selection mode; the object is
173 //! displayed but no viewer will be updated.
174 //! If theSelectionMode equals -1, theIObj will not be
175 //! activated: it will be displayed but will not be selectable.
176 //! Use this if you want to view the object in open local
177 //! context without selection. Note: This option is only
178 //! available in Local Context.
179 //! If theToAllowDecomposition equals true, theIObj can have
180 //! subshapes detected by selection mechanisms. theIObj
181 //! must be able to give a shape selection modes which
182 //! fit the AIS_Shape selection modes:
186 Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theDispMode, const Standard_Integer theSelectionMode, const Standard_Boolean theToUpdateViewer = Standard_True, const Standard_Boolean theToAllowDecomposition = Standard_True, const AIS_DisplayStatus theDispStatus = AIS_DS_None);
188 //! Allows you to load the Interactive Object aniobj
189 //! with a given selection mode SelectionMode, and/or
190 //! with the desired decomposition option, whether the
191 //! object is visualized or not. If AllowDecomp =
192 //! Standard_True and, if the interactive object is of
193 //! the "Shape" type, these "standard" selection
194 //! modes will be automatically activated as a function
195 //! of the modes present in the Local Context.
196 //! The loaded objects will be selectable but
197 //! displayable in highlighting only when detected by the Selector.
198 //! This method is available only when Local Contexts are open.
199 Standard_EXPORT void Load (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer SelectionMode = -1, const Standard_Boolean AllowDecomp = Standard_False);
201 //! Hides the object. The object's presentations are simply
202 //! flagged as invisible and therefore excluded from redrawing.
203 //! To show hidden objects, use Display().
204 Standard_EXPORT void Erase (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
206 //! Hides all objects. The object's presentations are simply
207 //! flagged as invisible and therefore excluded from redrawing.
208 //! To show all hidden objects, use DisplayAll().
209 Standard_EXPORT void EraseAll (const Standard_Boolean updateviewer = Standard_True);
211 //! Displays all hidden objects.
212 Standard_EXPORT void DisplayAll (const Standard_Boolean updateviewer = Standard_True);
215 //! Hides selected objects. The object's presentations are simply
216 //! flagged as invisible and therefore excluded from redrawing.
217 //! To show hidden objects, use Display().
218 Standard_EXPORT void EraseSelected (const Standard_Boolean updateviewer = Standard_True);
220 //! Displays selected objects if a local context is open.
221 //! Displays current objects if there is no active local context.
222 //! Objects selected when there is no open local context
223 //! are called current objects; those selected in open
224 //! local context, selected objects.
225 //! If a local context is open and if updateviewer equals
226 //! Standard_False, the presentation of the Interactive
227 //! Object activates the selection mode; the object is
228 //! displayed but no viewer will be updated.
229 Standard_EXPORT void DisplaySelected (const Standard_Boolean updateviewer = Standard_True);
231 //! Changes the status of a temporary object. It will be
232 //! kept at the neutral point, i.e. put in the list of
233 //! displayed objects along withwith its temporary
234 //! attributes. These include display mode and
235 //! selection mode, for example.
236 //! Returns true if done.
237 //! inWhichLocal gives the local context in which anIObj
238 //! is displayed. By default, the index -1 refers to the last
239 //! Local Context opened.
240 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
241 Standard_EXPORT Standard_Boolean KeepTemporary (const Handle(AIS_InteractiveObject)& anIObj, const Standard_Integer InWhichLocal = -1);
243 //! Empties the graphic presentation of the mode
244 //! indexed by aMode.
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.
250 //! Removes anIobj. anIobj is still active if it was
251 //! previously activated.
252 Standard_EXPORT void ClearPrs (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode = 0, const Standard_Boolean updateviewer = Standard_True);
254 //! Removes aniobj from every viewer. aniobj is no
255 //! longer referenced in the Context.
256 //! If a local context is open and if updateviewer equals
257 //! Standard_False, the presentation of the Interactive
258 //! Object activates the selection mode; the object is
259 //! displayed but no viewer will be updated.
260 Standard_EXPORT void Remove (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
262 //! Removes all the objects from all opened Local Contexts
263 //! and from the Neutral Point
264 Standard_EXPORT void RemoveAll (const Standard_Boolean updateviewer = Standard_True);
266 //! Updates the display in the viewer to take dynamic
267 //! detection into account. On dynamic detection by the
268 //! mouse cursor, sensitive primitives are highlighted.
269 //! The highlight color of entities detected by mouse
270 //! movement is white by default.
271 //! If a local context is open and if updateviewer equals
272 //! Standard_False, the presentation of the Interactive
273 //! Object activates the selection mode; the object is
274 //! displayed but no viewer will be updated.
275 Standard_DEPRECATED("Deprecated method Hilight()")
276 void Hilight (const Handle(AIS_InteractiveObject)& theObj, const Standard_Boolean theIsToUpdateViewer = Standard_True)
278 return HilightWithColor (theObj, myStyles[Prs3d_TypeOfHighlight_Dynamic], theIsToUpdateViewer);
281 //! Changes the color of all the lines of the object in view,
282 //! aniobj. It paints these lines the color passed as the
284 //! If a local context is open and if updateviewer equals
285 //! Standard_False, the presentation of the Interactive
286 //! Object activates the selection mode; the object is
287 //! displayed but no viewer will be updated.
288 Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& theObj,
289 const Handle(Prs3d_Drawer)& theStyle,
290 const Standard_Boolean theIsToUpdate = Standard_True);
293 //! Removes hilighting from the entity aniobj. Updates the viewer.
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_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
300 //! Sets the display priority aPriority of the seen parts
301 //! presentation of the entity anIobj.
302 Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aPriority);
304 //! Set Z layer id for interactive object.
305 //! The Z layers can be used to display temporarily presentations of some object in front of the other objects in the scene.
306 //! The ids for Z layers are generated by V3d_Viewer.
307 Standard_EXPORT void SetZLayer (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theLayerId);
309 //! Get Z layer id set for displayed interactive object.
310 Standard_EXPORT Standard_Integer GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const;
312 //! Recomputes the seen parts presentation of the entity
313 //! aniobj. If allmodes equals true, all presentations are
314 //! present in the object even if unseen.
315 //! If a local context is open and if updateviewer equals
316 //! Standard_False, the presentation of the Interactive
317 //! Object activates the selection mode; the object is
318 //! displayed but no viewer will be updated.
319 Standard_EXPORT void Redisplay (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True, const Standard_Boolean allmodes = Standard_False);
321 //! Recomputes the Prs/Selection of displayed objects of
322 //! a given type and a given signature.
323 //! if signature = -1 doesnt take signature criterion.
324 Standard_EXPORT void Redisplay (const AIS_KindOfInteractive aTypeOfObject, const Standard_Integer Signature = -1, const Standard_Boolean updateviewer = Standard_True);
326 //! Recomputes the displayed presentations, flags the others
327 //! Doesn't update presentations
328 Standard_EXPORT void RecomputePrsOnly (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean updateviewer = Standard_True, const Standard_Boolean allmodes = Standard_False);
330 //! Recomputes the active selections, flags the others
331 //! Doesn't update presentations
332 Standard_EXPORT void RecomputeSelectionOnly (const Handle(AIS_InteractiveObject)& anIObj);
334 //! Updates displayed interactive object by checking and
335 //! recomputing its flagged as "to be recomputed" presentation
336 //! and selection structures. This method does not force any
337 //! recomputation on its own. The method recomputes selections
338 //! even if they are loaded without activation in particular selector.
339 Standard_EXPORT void Update (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theUpdateViewer = Standard_True);
342 //! Sets the display mode of seen Interactive Objects.
343 //! aMode provides the display mode index of the entity aniobj.
344 //! If updateviewer equals Standard_True, the
345 //! predominant mode aMode will overule the context mode.
346 //! If a local context is open and if updateviewer equals
347 //! Standard_False, the presentation of the Interactive
348 //! Object returns to the default selection mode; the
349 //! object is displayed but no viewer will be updated.
350 //! Note that display mode 3 is only used if you have an
351 //! AIS_Textured Shape.
352 Standard_EXPORT void SetDisplayMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode, const Standard_Boolean updateviewer = Standard_True);
355 //! Unsets the display mode of seen Interactive Objects.
356 //! aMode provides the display mode index of the entity aniobj.
357 //! If updateviewer equals Standard_True, the
358 //! predominant mode aMode will overule the context mode.
359 //! If a local context is open and if updateviewer equals
360 //! Standard_False, the presentation of the Interactive
361 //! Object returns to the default selection mode; the
362 //! object is displayed but no viewer will be updated.
363 Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
365 //! Disables the mechanism of adaptive tolerance calculation in SelectMgr_ViewerSelector and
366 //! sets the given tolerance for ALL sensitive entities activated. For more information, see
367 //! SelectMgr_ViewerSelector documentation
368 //! Warning: When a local context is open the sensitivity is apply on it
369 //! instead on the main context.
370 Standard_EXPORT void SetPixelTolerance (const Standard_Integer aPrecision = 2);
372 //! Returns the pixel tolerance.
373 Standard_EXPORT Standard_Integer PixelTolerance() const;
375 //! Allows to manage sensitivity of a particular selection of interactive object theObject
376 //! and changes previous sensitivity value of all sensitive entities in selection with theMode
377 //! to the given theNewSensitivity.
378 Standard_EXPORT void SetSelectionSensitivity (const Handle(AIS_InteractiveObject)& theObject,
379 const Standard_Integer theMode,
380 const Standard_Integer theNewSensitivity);
382 //! Puts the location aLocation on the initial graphic
383 //! representation and the selection for the entity aniobj.
384 //! In other words, aniobj is visible and selectable at a
385 //! position other than initial position.
386 //! Graphic and selection primitives are not recomputed.
387 //! To clean the view correctly, you must reset the previous location.
388 Standard_EXPORT void SetLocation (const Handle(AIS_InteractiveObject)& aniobj, const TopLoc_Location& aLocation);
390 //! Puts the entity aniobj back into its initial position.
391 Standard_EXPORT void ResetLocation (const Handle(AIS_InteractiveObject)& aniobj);
394 //! Returns true if the entity aniobj has a location.
395 Standard_EXPORT Standard_Boolean HasLocation (const Handle(AIS_InteractiveObject)& aniobj) const;
398 //! Returns the location of the entity aniobj.
399 Standard_EXPORT TopLoc_Location Location (const Handle(AIS_InteractiveObject)& aniobj) const;
401 //! change the current facing model apply on polygons for
402 //! SetColor(), SetTransparency(), SetMaterial() methods
403 //! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is
404 //! applying both on the front and back face.
405 Standard_EXPORT void SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& aniobj, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE);
407 Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_NameOfColor aColor, const Standard_Boolean updateviewer = Standard_True);
410 //! Sets the color of the selected entity.
411 //! If a local context is open and if updateviewer equals
412 //! Standard_False, the presentation of the Interactive
413 //! Object activates the selection mode; the object is
414 //! displayed but no viewer will be updated.
415 Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_Color& aColor, const Standard_Boolean updateviewer = Standard_True);
417 //! Removes the color selection for the selected entity.
418 //! If a local context is open and if updateviewer equals
419 //! Standard_False, the presentation of the Interactive
420 //! Object activates the selection mode; the object is
421 //! displayed but no viewer will be updated.
422 Standard_EXPORT void UnsetColor (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
425 //! Sets the width of the entity aniobj.
426 //! If a local context is open and if updateviewer equals
427 //! Standard_False, the presentation of the Interactive
428 //! Object activates the selection mode; the object is
429 //! displayed but no viewer will be updated.
430 Standard_EXPORT virtual void SetWidth (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aValue, const Standard_Boolean updateviewer = Standard_True);
433 //! Removes the width setting of the entity aniobj.
434 //! If a local context is open and if updateviewer equals
435 //! Standard_False, the presentation of the Interactive
436 //! Object activates the selection mode; the object is
437 //! displayed but no viewer will be updated.
438 Standard_EXPORT virtual void UnsetWidth (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
441 //! Provides the type of material setting for the view of
442 //! the entity aniobj.
443 //! The range of settings includes: BRASS, BRONZE,
444 //! GOLD, PEWTER, SILVER, STONE.
445 //! If a local context is open and if updateviewer equals
446 //! Standard_False, the presentation of the Interactive
447 //! Object activates the selection mode; the object is
448 //! displayed but no viewer will be updated.
449 Standard_EXPORT void SetMaterial (const Handle(AIS_InteractiveObject)& aniobj, const Graphic3d_NameOfMaterial aName, const Standard_Boolean updateviewer = Standard_True);
452 //! Removes the type of material setting for viewing the
454 //! If a local context is open and if updateviewer equals
455 //! Standard_False, the presentation of the Interactive
456 //! Object activates the selection mode; the object is
457 //! displayed but no viewer will be updated.
458 Standard_EXPORT void UnsetMaterial (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
460 //! Provides the transparency settings for viewing the
461 //! entity aniobj. The transparency value aValue may be
462 //! between 0.0, opaque, and 1.0, fully transparent.
463 //! If a local context is open and if updateviewer equals
464 //! Standard_False, the presentation of the Interactive
465 //! Object activates the selection mode; the object is
466 //! displayed but no viewer will be updated.
467 Standard_EXPORT void SetTransparency (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aValue = 0.6, const Standard_Boolean updateviewer = Standard_True);
470 //! Removes the transparency settings for viewing the
471 //! entity aniobj. The transparency value aValue may be
472 //! between 0.0, opaque, and 1.0, fully transparent.
473 //! If a local context is open and if updateviewer equals
474 //! Standard_False, the presentation of the Interactive
475 //! Object activates the selection mode; the object is
476 //! displayed but no viewer will be updated.
477 Standard_EXPORT void UnsetTransparency (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
480 //! Sets the attributes of the interactive object aniobj by
481 //! plugging the attribute manager aDrawer into the local
482 //! context. The graphic attributes of aDrawer such as
483 //! visualization mode, color, and material, are then used
484 //! to display aniobj.
485 //! If a local context is open and if updateviewer equals
486 //! Standard_False, the presentation of the Interactive
487 //! Object activates the selection mode; the object is
488 //! displayed but no viewer will be updated.
489 Standard_EXPORT void SetLocalAttributes (const Handle(AIS_InteractiveObject)& aniobj, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Boolean updateviewer = Standard_True);
492 //! Removes the settings for local attributes of the entity
493 //! anObj and returns to the Neutral Point attributes or
494 //! those of the previous local context.
495 //! If a local context is open and if updateviewer equals
496 //! Standard_False, the presentation of the Interactive
497 //! Object activates the selection mode; the object is
498 //! displayed but no viewer will be updated.
499 Standard_EXPORT void UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
501 //! Sets up polygon offsets for the given AIS_InteractiveObject.
502 //! It simply calls anObj->SetPolygonOffsets()
503 Standard_EXPORT void SetPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj, const Standard_Integer aMode, const Standard_ShortReal aFactor = 1.0, const Standard_ShortReal aUnits = 0.0, const Standard_Boolean updateviewer = Standard_True);
505 //! simply calls anObj->HasPolygonOffsets()
506 Standard_EXPORT Standard_Boolean HasPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj) const;
508 //! Retrieves current polygon offsets settings for <anObj>.
509 Standard_EXPORT void PolygonOffsets (const Handle(AIS_InteractiveObject)& anObj, Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const;
511 //! Sets the size aSize of the trihedron.
512 //! Is used to change the default value 100 mm for
513 //! display of trihedra.
514 //! Use of this function in one of your own interactive
515 //! objects requires a call to the Compute function of the
516 //! new class. This will recalculate the presentation for
517 //! every trihedron displayed.
518 //! If a local context is open and if updateviewer equals
519 //! Standard_False, the presentation of the Interactive
520 //! Object activates the selection mode; the object is
521 //! displayed but no viewer will be updated.
522 Standard_EXPORT void SetTrihedronSize (const Standard_Real aSize, const Standard_Boolean updateviewer = Standard_True);
524 //! returns the current value of trihedron size.
525 Standard_EXPORT Standard_Real TrihedronSize() const;
528 //! Sets the plane size defined by the length in the X
529 //! direction XSize and that in the Y direction YSize.
530 //! If a local context is open and if updateviewer equals
531 //! Standard_False, the presentation of the Interactive
532 //! Object activates the selection mode; the object is
533 //! displayed but no viewer will be updated.
534 Standard_EXPORT void SetPlaneSize (const Standard_Real aSizeX, const Standard_Real aSizeY, const Standard_Boolean updateviewer = Standard_True);
537 //! Sets the plane size aSize.
538 //! If a local context is open and if updateviewer equals
539 //! Standard_False, the presentation of the Interactive
540 //! Object activates the selection mode; the object is
541 //! displayed but no viewer will be updated.
542 //! May be used if PlaneSize returns true.
543 Standard_EXPORT void SetPlaneSize (const Standard_Real aSize, const Standard_Boolean updateviewer = Standard_True);
545 //! Returns true if the length in the X direction XSize is
546 //! the same as that in the Y direction YSize.
547 Standard_EXPORT Standard_Boolean PlaneSize (Standard_Real& XSize, Standard_Real& YSize) const;
549 //! Returns the display status of the entity anIobj.
550 //! This will be one of the following:
551 //! - DS_Displayed displayed in main viewer
552 //! - DS_Erased hidden in main viewer
553 //! - DS_Temporary temporarily displayed
554 //! - DS_None nowhere displayed.
555 Standard_EXPORT AIS_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const;
558 //! Returns true if anIobj is displayed in the interactive context.
559 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const;
561 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode) const;
563 //! Returns true if the object is marked as highlighted via its global
565 //! @param theObj [in] the object to check
566 Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const;
568 //! Returns true if the owner is marked as selected
569 //! @param theOwner [in] the owner to check
570 Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner) const;
572 //! Returns highlight style of the object if it is marked as highlighted via global status
573 //! @param theObj [in] the object to check
574 Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
575 Handle(Prs3d_Drawer)& theStyle) const;
577 //! Returns highlight style of the owner if it is selected
578 //! @param theOwner [in] the owner to check
579 Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
580 Handle(Prs3d_Drawer)& theStyle) const;
582 //! Returns the display priority of the entity anIobj. This
583 //! will be display mode of anIobj if it is in the main
585 Standard_EXPORT Standard_Integer DisplayPriority (const Handle(AIS_InteractiveObject)& anIobj) const;
588 //! Returns true if a view of the Interactive Object aniobj has color.
589 Standard_EXPORT Standard_Boolean HasColor (const Handle(AIS_InteractiveObject)& aniobj) const;
591 Standard_EXPORT Quantity_NameOfColor Color (const Handle(AIS_InteractiveObject)& aniobj) const;
594 //! Returns the color Color of the entity aniobj in the interactive context.
595 Standard_EXPORT void Color (const Handle(AIS_InteractiveObject)& aniobj, Quantity_Color& acolor) const;
598 //! Returns the width of the Interactive Object aniobj in
599 //! the interactive context.
600 Standard_EXPORT virtual Standard_Real Width (const Handle(AIS_InteractiveObject)& aniobj) const;
603 //! Returns the status astatus of the Interactive Context
604 //! for the view of the Interactive Object anObj.
605 Standard_EXPORT void Status (const Handle(AIS_InteractiveObject)& anObj, TCollection_ExtendedString& astatus) const;
607 //! Sets transform persistence.
608 Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
609 const Handle(Graphic3d_TransformPers)& theTrsfPers);
611 Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
612 void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
613 const Graphic3d_TransModeFlags& theFlag,
614 const gp_Pnt& thePoint = gp_Pnt (0.0, 0.0, 0.0))
616 SetTransformPersistence (theObj, Graphic3d_TransformPers::FromDeprecatedParams (theFlag, thePoint));
619 //! Updates the current viewer, the viewer in Neutral Point.
620 //! Objects selected when there is no open local context
621 //! are called current objects; those selected in open
622 //! local context, selected objects.
623 Standard_EXPORT void UpdateCurrentViewer();
625 //! Returns the display mode setting.
626 //! Note that mode 3 is only used.
627 Standard_Integer DisplayMode() const { return myDefaultDrawer->DisplayMode(); }
629 //! Returns highlight style settings.
630 const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
632 //! Setup highlight style settings.
633 void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
634 const Handle(Prs3d_Drawer)& theStyle) { myStyles[theStyleType] = theStyle; }
636 //! Returns current dynamic highlight style settings.
638 //! - the color of dynamic highlight is Quantity_NOC_CYAN1;
639 //! - the presentation for dynamic highlight is completely opaque;
640 //! - the type of highlight is Aspect_TOHM_COLOR.
641 const Handle(Prs3d_Drawer)& HighlightStyle() const
643 return myStyles[Prs3d_TypeOfHighlight_Dynamic];
646 //! Setup the style of dynamic highlighting.
647 void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
649 //! Returns current selection style settings.
651 //! - the color of selection is Quantity_NOC_GRAY80;
652 //! - the presentation for selection is completely opaque;
653 //! - the type of highlight is Aspect_TOHM_COLOR.
654 const Handle(Prs3d_Drawer)& SelectionStyle() const
656 return myStyles[Prs3d_TypeOfHighlight_Selected];
659 //! Setup the style of selection highlighting.
660 void SetSelectionStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Selected] = theStyle; }
662 //! Sub-intensity allows temporary highlighting of particular
663 //! objects with specified color in a manner of selection highlight,
664 //! but without actual selection (e.g., global status and owner's
665 //! selection state will not be updated).
666 //! The method returns the color of such highlighting.
667 //! By default, it is Quantity_NOC_GRAY40.
668 const Quantity_Color& SubIntensityColor() const
670 return myStyles[Prs3d_TypeOfHighlight_SubIntensity]->Color();
673 //! Sub-intensity allows temporary highlighting of particular
674 //! objects with specified color in a manner of selection highlight,
675 //! but without actual selection (e.g., global status and owner's
676 //! selection state will not be updated).
677 //! The method sets up the color for such highlighting.
678 //! By default, this is Quantity_NOC_GRAY40.
679 void SetSubIntensityColor (const Quantity_Color& theColor)
681 myStyles[Prs3d_TypeOfHighlight_SubIntensity]->SetColor (theColor);
684 //! Sets the display mode of seen Interactive Objects.
685 //! aMode provides the display mode index of the entity aniobj.
686 //! If updateviewer equals Standard_True, the
687 //! predominant mode aMode will overule the context mode.
688 //! If a local context is open and if updateviewer equals
689 //! Standard_False, the presentation of the Interactive
690 //! Object returns to the default selection mode; the
691 //! object is displayed but no viewer will be updated.
692 //! Note that display mode 3 is only used if you have an
693 //! AIS_Textured Shape.
694 Standard_EXPORT void SetDisplayMode (const Standard_Integer AMode, const Standard_Boolean updateviewer = Standard_True);
697 //! Sets the deviation coefficient aCoefficient.
698 //! Drawings of curves or patches are made with respect
699 //! to a maximal chordal deviation. A Deviation coefficient
700 //! is used in the shading display mode. The shape is
701 //! seen decomposed into triangles. These are used to
702 //! calculate reflection of light from the surface of the
703 //! object. The triangles are formed from chords of the
704 //! curves in the shape. The deviation coefficient
705 //! aCoefficient gives the highest value of the angle with
706 //! which a chord can deviate from a tangent to a curve.
707 //! If this limit is reached, a new triangle is begun.
708 //! This deviation is absolute and is set through the
709 //! method: SetMaximalChordialDeviation. The default
711 //! In drawing shapes, however, you are allowed to ask
712 //! for a relative deviation. This deviation will be:
713 //! SizeOfObject * DeviationCoefficient.
715 Standard_EXPORT void SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aCoefficient, const Standard_Boolean updateviewer = Standard_True);
717 Standard_EXPORT void SetDeviationAngle (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
719 //! Calls the AIS_Shape SetAngleAndDeviation to set
720 //! both Angle and Deviation coefficients
721 Standard_EXPORT void SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
724 //! Sets the deviation coefficient aCoefficient for
725 //! removal of hidden lines created by different
726 //! viewpoints in different presentations. The Default value is 0.02.
727 Standard_EXPORT void SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aCoefficient, const Standard_Boolean updateviewer = Standard_True);
729 Standard_EXPORT void SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
731 //! Computes a HLRAngle and a
732 //! HLRDeviationCoefficient by means of the angle
733 //! anAngle and sets the corresponding methods in the
734 //! default drawing tool with these values.
735 Standard_EXPORT void SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
737 //! Sets the deviation coefficient aCoefficient.
738 //! Drawings of curves or patches are made with respect
739 //! to a maximal chordal deviation. A Deviation coefficient
740 //! is used in the shading display mode. The shape is
741 //! seen decomposed into triangles. These are used to
742 //! calculate reflection of light from the surface of the
743 //! object. The triangles are formed from chords of the
744 //! curves in the shape. The deviation coefficient
745 //! aCoefficient gives the highest value of the angle with
746 //! which a chord can deviate from a tangent to a curve.
747 //! If this limit is reached, a new triangle is begun.
748 //! This deviation is absolute and is set through the
749 //! method: SetMaximalChordialDeviation. The default
751 //! In drawing shapes, however, you are allowed to ask
752 //! for a relative deviation. This deviation will be:
753 //! SizeOfObject * DeviationCoefficient.
755 Standard_EXPORT void SetDeviationCoefficient (const Standard_Real aCoefficient);
757 //! Returns the deviation coefficient.
758 //! Drawings of curves or patches are made with respect
759 //! to a maximal chordal deviation. A Deviation coefficient
760 //! is used in the shading display mode. The shape is
761 //! seen decomposed into triangles. These are used to
762 //! calculate reflection of light from the surface of the
763 //! object. The triangles are formed from chords of the
764 //! curves in the shape. The deviation coefficient gives
765 //! the highest value of the angle with which a chord can
766 //! deviate from a tangent to a curve. If this limit is
767 //! reached, a new triangle is begun.
768 //! This deviation is absolute and is set through
769 //! Prs3d_Drawer::SetMaximalChordialDeviation. The
770 //! default value is 0.001.
771 //! In drawing shapes, however, you are allowed to ask
772 //! for a relative deviation. This deviation will be:
773 //! SizeOfObject * DeviationCoefficient.
774 Standard_EXPORT Standard_Real DeviationCoefficient() const;
776 //! default 12 degrees
777 Standard_EXPORT void SetDeviationAngle (const Standard_Real anAngle);
779 Standard_EXPORT Standard_Real DeviationAngle() const;
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 Standard_Real aCoefficient);
787 //! Returns the real number value of the hidden line
788 //! removal deviation coefficient.
789 //! A Deviation coefficient is used in the shading display
790 //! mode. The shape is seen decomposed into triangles.
791 //! These are used to calculate reflection of light from the
792 //! surface of the object.
793 //! The triangles are formed from chords of the curves in
794 //! the shape. The deviation coefficient give the highest
795 //! value of the angle with which a chord can deviate
796 //! from a tangent to a curve. If this limit is reached, a
797 //! new triangle is begun.
798 //! To find the hidden lines, hidden line display mode
799 //! entails recalculation of the view at each different
800 //! projector perspective.
801 //! Because hidden lines entail calculations of more than
802 //! usual complexity to decompose them into these
803 //! triangles, a deviation coefficient allowing greater
804 //! tolerance is used. This increases efficiency in calculation.
805 //! The Default value is 0.02.
806 Standard_EXPORT Standard_Real HLRDeviationCoefficient() const;
808 //! Sets the HLR angle anAngle.
809 Standard_EXPORT void SetHLRAngle (const Standard_Real anAngle);
812 //! Returns the real number value of the deviation angle
813 //! in hidden line removal views in this interactive context.
814 //! The default value is 20*PI/180.
815 Standard_EXPORT Standard_Real HLRAngle() const;
817 //! compute with anangle a HLRAngle and a HLRDeviationCoefficient
818 //! and set them in myHLRAngle and in myHLRDeviationCoefficient
819 //! of myDefaultDrawer ;
820 //! anAngle is in radian ; ( 1 deg < angle in deg < 20 deg)
821 Standard_EXPORT void SetHLRAngleAndDeviation (const Standard_Real anAngle);
823 //! Initializes hidden line aspect in the default drawing tool, or Drawer.
824 //! The default values are:
825 //! Color: Quantity_NOC_YELLOW
826 //! Type of line: Aspect_TOL_DASH
828 Standard_EXPORT Handle(Prs3d_LineAspect) HiddenLineAspect() const;
831 //! Sets the hidden line aspect anAspect.
832 //! anAspect defines display attributes for hidden lines in
834 Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& anAspect) const;
836 //! returns Standard_True if the hidden lines are to be drawn.
837 //! By default the hidden lines are not drawn.
838 Standard_EXPORT Standard_Boolean DrawHiddenLine() const;
840 Standard_EXPORT void EnableDrawHiddenLine() const;
842 Standard_EXPORT void DisableDrawHiddenLine() const;
844 //! Sets the number of U and V isoparameters displayed.
845 Standard_EXPORT void SetIsoNumber (const Standard_Integer NbIsos, const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
847 //! Returns the number of U and V isoparameters displayed.
848 Standard_EXPORT Standard_Integer IsoNumber (const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
850 //! Returns True if drawing isoparameters on planes is enabled.
851 Standard_EXPORT void IsoOnPlane (const Standard_Boolean SwitchOn);
853 //! Returns True if drawing isoparameters on planes is enabled.
854 //! if <forUIsos> = False,
855 Standard_EXPORT Standard_Boolean IsoOnPlane() const;
857 //! Enables or disables on-triangulation build for isolines for a particular object.
858 //! In case if on-triangulation builder is disabled, default on-plane
859 //! builder will compute isolines for the object given.
860 Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theIsEnabled,
861 const Handle(AIS_InteractiveObject)& theObject);
863 //! Enables or disables on-triangulation build for isolines for default drawer.
864 //! In case if on-triangulation builder is disabled, default on-plane
865 //! builder will compute isolines for the object given.
866 Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theToSwitchOn);
868 //! Returns true if drawing isolines on triangulation algorithm is enabled.
869 Standard_EXPORT Standard_Boolean IsoOnTriangulation() const;
871 //! Sets the graphic basic aspect to the current presentation of
872 //! ALL selected objects.
873 //! Flag globalChange has no effect (left to simplify porting).
874 //! Updates the viewer when <updateViewer> is TRUE
875 Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& anAspect, const Standard_Boolean globalChange = Standard_True, const Standard_Boolean updateViewer = Standard_True);
877 //! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
878 //! This is done by the view theView passing this position to the main viewer and updating it.
879 //! Functions in both Neutral Point and local contexts.
880 //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
881 Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer theXPix, const Standard_Integer theYPix, const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawOnUpdate = Standard_True);
883 //! returns True if other entities were detected in the
884 //! last mouse detection
885 Standard_EXPORT Standard_Boolean HasNextDetected() const;
887 //! if more than 1 object is detected by the selector,
888 //! only the "best" owner is hilighted at the mouse position.
889 //! This Method allows the user to hilight one after another
890 //! the other detected entities.
891 //! if The method select is called, the selected entity
892 //! will be the hilighted one!
893 //! returns the Rank of hilighted entity
894 //! WARNING : Loop Method. When all the detected entities
895 //! have been hilighted , the next call will hilight
896 //! the first one again
897 Standard_EXPORT Standard_Integer HilightNextDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
899 //! Same as previous methods in reverse direction...
900 Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
902 //! Adds object in the selection.
903 Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
905 //! Adds object in the selection.
906 AIS_StatusOfPick AddSelect (const Handle(AIS_InteractiveObject)& theObject)
908 return AddSelect (theObject->GlobalSelOwner());
911 //! Selects everything found in the bounding rectangle
912 //! defined by the pixel minima and maxima, XPMin,
913 //! YPMin, XPMax, and YPMax in the view, aView
914 //! The objects detected are passed to the main viewer,
915 //! which is then updated.
916 Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer XPMin, const Standard_Integer YPMin, const Standard_Integer XPMax, const Standard_Integer YPMax, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
918 //! polyline selection; clears the previous picked list
919 Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
921 //! Stores and hilights the previous detected; Unhilights
922 //! the previous picked.
923 Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean updateviewer = Standard_True);
925 //! adds the last detected to the list of previous picked.
926 //! if the last detected was already declared as picked,
927 //! removes it from the Picked List.
928 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean updateviewer = Standard_True);
930 //! adds the last detected to the list of previous picked.
931 //! if the last detected was already declared as picked,
932 //! removes it from the Picked List.
933 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
935 //! rectangle of selection ; adds new detected entities into the
936 //! picked list, removes the detected entities that were already stored...
937 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Integer XPMin, const Standard_Integer YPMin, const Standard_Integer XPMax, const Standard_Integer YPMax, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
939 //! Specify whether selected object must be hilighted when mouse cursor
940 //! is moved above it (in MoveTo method). By default this value is false and
941 //! selected object is not hilighted in this case.
942 void SetToHilightSelected (const Standard_Boolean toHilight) { myToHilightSelected = toHilight; }
944 //! Return value specified whether selected object must be hilighted
945 //! when mouse cursor is moved above it
946 Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
948 //! @name OBSOLETE METHODS THAT ARE VALID FOR LOCAL CONTEXT ONLY
950 //! Updates the view of the current object in open context.
951 //! Objects selected when there is no open local context
952 //! are called current objects; those selected in open
953 //! local context, selected objects.
954 //! If a local context is open and if updateviewer equals
955 //! Standard_False, the presentation of the Interactive
956 //! Object activates the selection mode; the object is
957 //! displayed but no viewer will be updated.
958 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
959 Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
962 //! Allows to add or remove the object given to the list of current and highlight/unhighlight it
963 //! correspondingly. Is valid for global context only; for local context use method AddOrRemoveSelected.
964 //! Since this method makes sence only for neutral point selection of a whole object, if 0 selection
965 //! of the object is empty this method simply does nothing.
966 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
967 Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
968 const Standard_Boolean theIsToUpdateViewer = Standard_True);
970 //! Updates the list of current objects, i.e. hilights new
971 //! current objects, removes hilighting from former current objects.
972 //! Objects selected when there is no open local context
973 //! are called current objects; those selected in open
974 //! local context, selected objects.
975 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
976 Standard_EXPORT void UpdateCurrent();
978 //! Returns true if there is a non-null interactive object in Neutral Point.
979 //! Objects selected when there is no open local context are called current objects;
980 //! those selected in open local context, selected objects.
981 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
982 Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const;
985 //! Initializes a scan of the current selected objects in
987 //! Objects selected when there is no open local context
988 //! are called current objects; those selected in open
989 //! local context, selected objects.
990 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
991 Standard_EXPORT void InitCurrent();
994 //! Returns true if there is another object found by the
995 //! scan of the list of current objects.
996 //! Objects selected when there is no open local context
997 //! are called current objects; those selected in open
998 //! local context, selected objects.
999 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1000 Standard_EXPORT Standard_Boolean MoreCurrent() const;
1003 //! Continues the scan to the next object in the list of
1004 //! current objects.
1005 //! Objects selected when there is no open local context
1006 //! are called current objects; those selected in open
1007 //! local context, selected objects.
1008 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1009 Standard_EXPORT void NextCurrent();
1012 //! Returns the current interactive object.
1013 //! Objects selected when there is no open local context
1014 //! are called current objects; those selected in open
1015 //! local context, selected objects.
1016 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1017 Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
1019 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1020 Standard_EXPORT Standard_Integer NbCurrents();
1022 //! Highlights current objects.
1023 //! Objects selected when there is no open local context
1024 //! are called current objects; those selected in open
1025 //! local context, selected objects.
1026 //! If a local context is open and if updateviewer equals
1027 //! Standard_False, the presentation of the Interactive
1028 //! Object activates the selection mode; the object is
1029 //! displayed but no viewer will be updated.
1030 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1031 Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
1033 //! Removes highlighting from current objects.
1034 //! Objects selected when there is no open local context
1035 //! are called current objects; those selected in open
1036 //! local context, selected objects.
1037 //! If a local context is open and if updateviewer equals
1038 //! Standard_False, the presentation of the Interactive
1039 //! Object activates the selection mode; the object is
1040 //! displayed but no viewer will be updated.
1041 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1042 Standard_EXPORT void UnhilightCurrents (const Standard_Boolean updateviewer = Standard_True);
1044 //! Empties previous current objects in order to get the
1045 //! current objects detected by the selector using
1047 //! Objects selected when there is no open local context
1048 //! are called current objects; those selected in open
1049 //! local context, selected objects.
1050 //! If a local context is open and if updateviewer equals
1051 //! Standard_False, the presentation of the Interactive
1052 //! Object activates the selection mode; the object is
1053 //! displayed but no viewer will be updated.
1054 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1055 Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
1057 //! @return current mouse-detected shape or empty (null) shape, if current interactive object
1058 //! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
1059 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1060 Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
1062 //! @return current mouse-detected interactive object or null object, if there is no currently detected interactives
1063 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1064 Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
1066 //! @name COMMON SELECTION METHODS VALID FOR BOTH GLOBAL AND LOCAL CONTEXT
1068 //! Unhighlights previously selected owners and marks them as not selected.
1069 //! Marks owner given as selected and highlights it.
1070 //! Performs selection filters check.
1071 Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
1072 const Standard_Boolean theToUpdateViewer = Standard_True);
1074 //! Puts the interactive object aniObj in the list of
1075 //! selected objects.
1076 //! If a local context is open and if updateviewer equals
1077 //! Standard_False, the presentation of the Interactive
1078 //! Object activates the selection mode; the object is
1079 //! displayed but no viewer will be updated.
1080 //! Performs selection filters check.
1081 Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
1082 const Standard_Boolean theToUpdateViewer = Standard_True);
1084 //! Updates the list of selected objects:
1085 //! i.e. highlights the newely selected ones and unhighlights previously selected objects.
1086 Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1088 //! Allows to highlight or unhighlight the owner given depending on its selection status
1089 Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
1090 const Standard_Boolean theToUpdateViewer = Standard_True);
1092 //! Highlights selected objects.
1093 //! If a local context is open and if updateviewer equals
1094 //! Standard_False, the presentation of the Interactive
1095 //! Object activates the selection mode; the object is
1096 //! displayed but no viewer will be updated.
1097 Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1099 //! Removes highlighting from selected objects.
1100 //! If a local context is open and if updateviewer equals
1101 //! Standard_False, the presentation of the Interactive
1102 //! Object activates the selection mode; the object is
1103 //! displayed but no viewer will be updated.
1104 Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1106 //! Empties previous selected objects in order to get the
1107 //! selected objects detected by the selector using
1109 //! If a local context is open and if updateviewer equals
1110 //! Standard_False, the presentation of the Interactive
1111 //! Object activates the selection mode; the object is
1112 //! displayed but no viewer will be updated.
1113 Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1115 //! No right to Add a selected Shape (Internal Management
1116 //! of shape Selection).
1117 //! A Previous selected shape may only be removed.
1118 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1119 Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& aShape, const Standard_Boolean updateviewer = Standard_True);
1121 //! Allows to highlight or unhighlight the owner given depending on its selection status
1122 Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
1123 const Standard_Boolean theToUpdateViewer = Standard_True);
1125 //! Returns true is the owner given is selected
1126 Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const;
1128 //! Returns true is the object given is selected
1129 Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& theObj) const;
1131 //! Returns the first selected object in the list of current selected.
1132 Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject();
1134 //! Initializes a scan of the selected objects.
1135 Standard_EXPORT void InitSelected();
1137 //! Returns true if there is another object found by the
1138 //! scan of the list of selected objects.
1139 Standard_EXPORT Standard_Boolean MoreSelected() const;
1141 //! Continues the scan to the next object in the list of
1142 //! selected objects.
1143 Standard_EXPORT void NextSelected();
1145 Standard_EXPORT Standard_Integer NbSelected();
1147 //! Returns true if the interactive context has a shape
1148 //! selected in it which results from the decomposition of
1150 //! If HasSelectedShape returns true, SelectedShape
1151 //! returns the shape which has been shown to be
1152 //! selected. Interactive returns the Interactive Object
1153 //! from which the shape has been selected.
1154 //! If HasSelectedShape returns false, Interactive
1155 //! returns the interactive entity selected by the click of the mouse.
1156 Standard_EXPORT Standard_Boolean HasSelectedShape() const;
1158 //! Returns the selected shape.
1159 Standard_EXPORT TopoDS_Shape SelectedShape() const;
1161 //! Returns the owner of the selected entity resulting
1162 //! from the decomposition of another entity.
1163 Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const;
1165 //! Returns a collection containing all entity owners
1166 //! created for the interactive object <theIObj> in
1167 //! the selection mode theMode (in all active modes
1168 //! if the Mode == -1)
1169 Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
1170 const Handle(AIS_InteractiveObject)& theIObj,
1171 const Standard_Integer theMode = -1) const;
1173 Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const;
1175 //! Returns true if the applicative object has an owner
1176 //! from Interactive attributed to it.
1177 Standard_EXPORT Standard_Boolean HasApplicative() const;
1180 //! Returns the owner of the applicative entity detected
1181 //! in interactive context. The owner can be a shape for
1182 //! a set of sub-shapes or a sub-shape for sub-shapes
1183 //! which it is composed of.
1184 Standard_EXPORT Handle(Standard_Transient) Applicative() const;
1187 //! Returns true if there is a mouse-detected entity in local context.
1188 //! If there is no open local context, the objects selected
1189 //! are called current objects; selected objects if there is
1190 //! one. Iterators allow entities to be recovered in either
1191 //! case. This method is one of a set which allows you to
1192 //! manipulate the objects which have been placed in these two lists.
1193 Standard_EXPORT Standard_Boolean HasDetected() const;
1196 //! Returns true if there is a detected shape in local context.
1197 //! If there is no open local context, the objects selected
1198 //! are called current objects; selected objects if there is
1199 //! one. Iterators allow entities to be recovered in either
1200 //! case. This method is one of a set which allows you to
1201 //! manipulate the objects which have been placed in these two lists.
1202 Standard_EXPORT Standard_Boolean HasDetectedShape() const;
1205 //! Returns the shape detected in local context.
1206 //! If there is no open local context, the objects selected
1207 //! are called current objects; selected objects if there is
1208 //! one. Iterators allow entities to be recovered in either
1209 //! case. This method is one of a set which allows you to
1210 //! manipulate the objects which have been placed in these two lists.
1211 Standard_EXPORT const TopoDS_Shape& DetectedShape() const;
1214 //! Returns the interactive objects last detected in open context.
1215 //! If there is no open local context, the objects selected
1216 //! are called current objects; selected objects if there is
1217 //! one. Iterators allow entities to be recovered in either
1218 //! case. This method is one of a set which allows you to
1219 //! manipulate the objects which have been placed in these two lists.
1220 Standard_EXPORT Handle(AIS_InteractiveObject) DetectedInteractive() const;
1222 //! returns the owner of the detected sensitive primitive.
1223 Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedOwner() const;
1226 //! Initialization for iteration through mouse-detected objects in
1227 //! interactive context or in local context if it is opened.
1228 Standard_EXPORT void InitDetected();
1231 //! @return true if there is more mouse-detected objects after the current one
1232 //! during iteration through mouse-detected interactive objects.
1233 Standard_EXPORT Standard_Boolean MoreDetected() const;
1236 //! Gets next current object during iteration through mouse-detected
1237 //! interactive objects.
1238 Standard_EXPORT void NextDetected();
1240 //! Opens local contexts and specifies how this is to be
1241 //! done. The options listed above function in the following manner:
1242 //! - UseDisplayedObjects -allows you to load or not
1243 //! load the interactive objects visualized at Neutral
1244 //! Point in the local context which you open. If false,
1245 //! the local context is empty after being opened. If
1246 //! true, the objects at Neutral Point are loaded by their
1247 //! default selection mode.
1248 //! - AllowShapeDecomposition -AIS_Shape allows or
1249 //! prevents decomposition in standard shape location
1250 //! mode of objects at Neutral Point which are
1251 //! type-"privileged". This Flag is only taken into
1252 //! account when UseDisplayedObjects is true.
1253 //! - AcceptEraseOfObjects -authorises other local
1254 //! contexts to erase the interactive objects present in
1255 //! this context. This option is rarely used.
1256 //! - BothViewers - Has no use currently defined.
1257 //! This method returns the index of the created local
1258 //! context. It should be kept and used to close the context.
1259 //! Opening a local context allows you to prepare an
1260 //! environment for temporary presentations and
1261 //! selections which will disappear once the local context is closed.
1262 //! You can open several local contexts, but only the last
1263 //! one will be active.
1264 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1265 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);
1267 //! Allows you to close local contexts. For greater
1268 //! security, you should close the context with the
1269 //! index Index given on opening.
1270 //! When you close a local context, the one before,
1271 //! which is still on the stack, reactivates. If none is
1272 //! left, you return to Neutral Point.
1273 //! If a local context is open and if updateviewer
1274 //! equals Standard_False, the presentation of the
1275 //! Interactive Object activates the selection mode; the
1276 //! object is displayed but no viewer will be updated.
1278 //! When the index isn't specified, the current context
1279 //! is closed. This option can be dangerous, as other
1280 //! Interactive Functions can open local contexts
1281 //! without necessarily warning the user.
1282 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1283 Standard_EXPORT void CloseLocalContext (const Standard_Integer Index = -1, const Standard_Boolean updateviewer = Standard_True);
1285 //! returns -1 if no opened local context.
1286 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1287 Standard_EXPORT Standard_Integer IndexOfCurrentLocal() const;
1290 //! Allows you to close all local contexts at one go and
1291 //! return to Neutral Point.
1292 //! If a local context is open and if updateviewer equals
1293 //! Standard_False, the presentation of the Interactive
1294 //! Object activates the selection mode; the object is
1295 //! displayed but no viewer will be updated.
1296 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1297 Standard_EXPORT void CloseAllContexts (const Standard_Boolean updateviewer = Standard_True);
1299 //! to be used only with no opened
1300 //! local context.. displays and activates objects in their
1301 //! original state before local contexts were opened...
1302 Standard_EXPORT void ResetOriginalState (const Standard_Boolean updateviewer = Standard_True);
1304 //! clears Objects/Filters/Activated Modes list in the current opened local context.
1305 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1306 Standard_EXPORT void ClearLocalContext (const AIS_ClearMode TheMode = AIS_CM_All);
1308 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1309 Standard_EXPORT void UseDisplayedObjects();
1311 //! when a local Context is opened, one is able to
1312 //! use/not use the displayed objects at neutral point
1314 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1315 Standard_EXPORT void NotUseDisplayedObjects();
1317 //! initializes the list of presentations to be displayed
1318 //! returns False if no local context is opened.
1319 Standard_EXPORT Standard_Boolean BeginImmediateDraw();
1321 //! returns True if <anIObj> has been stored in the list.
1322 Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0);
1324 //! returns True if the immediate display has been done.
1325 Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_View)& theView);
1327 //! Uses the First Active View of Main Viewer!
1328 //! returns True if the immediate display has been done.
1329 Standard_EXPORT Standard_Boolean EndImmediateDraw();
1331 Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
1334 //! Sets the highlighting status aStatus of detected and
1335 //! selected entities.
1336 //! Whether you are in Neutral Point or local context, this
1337 //! is automatically managed by the Interactive Context.
1338 //! This function allows you to disconnect the automatic mode.
1339 Standard_EXPORT void SetAutomaticHilight (const Standard_Boolean aStatus);
1342 //! Returns true if the automatic highlight mode is active
1343 //! in an open context.
1344 Standard_EXPORT Standard_Boolean AutomaticHilight() const;
1346 //! Activates the selection mode aMode whose index is
1347 //! given, for the given interactive entity anIobj.
1348 Standard_EXPORT void Activate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode = 0, const Standard_Boolean theIsForce = Standard_False);
1350 //! Activates the given selection mode for the all displayed objects.
1351 Standard_EXPORT void Activate (const Standard_Integer theMode,
1352 const Standard_Boolean theIsForce = Standard_False);
1354 //! Deactivates all the activated selection modes
1356 Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIObj);
1359 //! Deactivates all the activated selection modes of the
1360 //! interactive object anIobj with a given selection mode aMode.
1361 Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode);
1363 //! Deactivates the given selection mode for all displayed objects.
1364 Standard_EXPORT void Deactivate (const Standard_Integer theMode);
1366 //! Deactivates all the activated selection mode at all displayed objects.
1367 Standard_EXPORT void Deactivate();
1369 //! Returns the list of activated selection modes in an open context.
1370 Standard_EXPORT void ActivatedModes (const Handle(AIS_InteractiveObject)& anIobj, TColStd_ListOfInteger& theList) const;
1372 //! to be Used only with opened local context and
1373 //! if <anIobj> is of type shape...
1374 //! if <aStatus> = True <anIobj> will be sensitive to
1375 //! shape selection modes activation.
1376 //! = False, <anIobj> will not be senstive
1378 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1379 Standard_EXPORT void SetShapeDecomposition (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean aStatus);
1382 //! Sets the temporary graphic attributes of the entity
1383 //! anObj. These are provided by the attribute manager
1384 //! aDrawer and are valid for a particular local context only.
1385 //! If a local context is open and if updateviewer equals
1386 //! Standard_False, the presentation of the Interactive
1387 //! Object activates the selection mode; the object is
1388 //! displayed but no viewer will be updated.
1389 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1390 Standard_EXPORT void SetTemporaryAttributes (const Handle(AIS_InteractiveObject)& anObj, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Boolean updateviewer = Standard_True);
1393 //! Highlights, and removes highlights from, the displayed
1394 //! object aniobj which is displayed at Neutral Point with
1395 //! subintensity color; available only for active local
1396 //! context. There is no effect if there is no local context.
1397 //! If a local context is open and if updateviewer equals
1398 //! Standard_False, the presentation of the Interactive
1399 //! Object activates the selection mode; the object is
1400 //! displayed but no viewer will be updated.
1401 Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
1404 //! Removes the subintensity option for the entity aniobj.
1405 //! If a local context is open and if updateviewer equals
1406 //! Standard_False, the presentation of the Interactive
1407 //! Object activates the selection mode; the object is
1408 //! displayed but no viewer will be updated.
1409 Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
1411 //! hilights/unhilights displayed objects which are displayed at
1412 //! neutral state with subintensity color;
1413 //! available only for active local context.
1414 //! No effect if no local context.
1415 Standard_EXPORT void SubIntensityOn (const Standard_Boolean updateviewer = Standard_True);
1417 //! removes subintensity option for all objects.
1418 Standard_EXPORT void SubIntensityOff (const Standard_Boolean updateviewer = Standard_True);
1420 //! Allows you to add the filter aFilter to Neutral Point or
1421 //! to a local context if one or more selection modes have been activated.
1422 //! Only type filters may be active in Neutral Point.
1423 Standard_EXPORT void AddFilter (const Handle(SelectMgr_Filter)& aFilter);
1426 //! Removes a filter from Neutral Point or a local context
1427 //! if one or more selection modes have been activated.
1428 //! Only type filters are activated in Neutral Point.
1429 Standard_EXPORT void RemoveFilter (const Handle(SelectMgr_Filter)& aFilter);
1431 //! Remove a filter to Neutral Point or a local context if
1432 //! one or more selection modes have been activated.
1433 //! Only type filters are active in Neutral Point.
1434 Standard_EXPORT void RemoveFilters();
1436 //! Provides an alternative to the Display methods when
1437 //! activating specific selection modes. This has the
1438 //! effect of activating the corresponding selection mode
1439 //! aStandardActivation for all objects in Local Context
1440 //! which accept decomposition into sub-shapes.
1441 //! Every new Object which has been loaded into the
1442 //! interactive context and which answers these
1443 //! decomposition criteria is automatically activated
1444 //! according to these modes.
1446 //! If you have opened a local context by loading an
1447 //! object with the default options
1448 //! (<AllowShapeDecomposition >= Standard_True), all
1449 //! objects of the "Shape" type are also activated with
1450 //! the same modes. You can act on the state of these
1451 //! "Standard" objects by using SetShapeDecomposition(Status).
1452 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1453 Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1456 //! Provides an alternative to the Display methods when
1457 //! deactivating specific selection modes. This has the
1458 //! effect of deactivating the corresponding selection
1459 //! mode aStandardActivation for all objects in Local
1460 //! Context which accept decomposition into sub-shapes.
1461 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1462 Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1465 //! Returns the list of activated standard selection modes
1466 //! available in a local context.
1467 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1468 Standard_EXPORT const TColStd_ListOfInteger& ActivatedStandardModes() const;
1471 //! Returns the list of filters active in a local context.
1472 Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
1474 //! Returns the default attribute manager.
1475 //! This contains all the color and line attributes which
1476 //! can be used by interactive objects which do not have
1477 //! their own attributes.
1478 const Handle(Prs3d_Drawer)& DefaultDrawer() const { return myDefaultDrawer; }
1480 //! Returns the current viewer.
1481 const Handle(V3d_Viewer)& CurrentViewer() const { return myMainVwr; }
1483 //! Returns the list of displayed objects of a particular
1484 //! Type WhichKind and Signature WhichSignature. By
1485 //! Default, WhichSignature equals -1. This means that
1486 //! there is a check on type only.
1487 Standard_EXPORT void DisplayedObjects (AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1489 //! gives the list of displayed objects of a particular
1490 //! Type and signature.
1491 //! by Default, <WhichSignature> = -1 means
1492 //! control only on <WhichKind>.
1493 Standard_EXPORT void DisplayedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1496 //! Returns the list theListOfIO of erased objects (hidden objects)
1497 //! particular Type WhichKind and Signature WhichSignature.
1498 //! By Default, WhichSignature equals 1. This means
1499 //! that there is a check on type only.
1500 Standard_EXPORT void ErasedObjects (AIS_ListOfInteractive& theListOfIO) const;
1502 //! gives the list of erased objects (hidden objects)
1503 //! Type and signature
1504 //! by Default, <WhichSignature> = -1 means
1505 //! control only on <WhichKind>.
1506 Standard_EXPORT void ErasedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& theListOfIO) const;
1509 //! Returns the list theListOfIO of objects with indicated display status
1510 //! particular Type WhichKind and Signature WhichSignature.
1511 //! By Default, WhichSignature equals 1. This means
1512 //! that there is a check on type only.
1513 Standard_EXPORT void ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1515 //! gives the list of objects with indicated display status
1516 //! Type and signature
1517 //! by Default, <WhichSignature> = -1 means
1518 //! control only on <WhichKind>.
1519 Standard_EXPORT void ObjectsByDisplayStatus (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1521 //! fills <aListOfIO> with objects of a particular
1522 //! Type and Signature with no consideration of display status.
1523 //! by Default, <WhichSignature> = -1 means
1524 //! control only on <WhichKind>.
1525 //! if <WhichKind> = AIS_KOI_None and <WhichSignature> = -1,
1526 //! all the objects are put into the list.
1527 Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO, const AIS_KindOfInteractive WhichKind = AIS_KOI_None, const Standard_Integer WhichSignature = -1) const;
1529 //! Returns true if there is an open context.
1530 Standard_Boolean HasOpenedContext() const { return myCurLocalIndex != 0; }
1532 //! This method is only intended for advanced operation, particularly with
1533 //! the aim to improve performance when many objects have to be selected
1534 //! together. Otherwise, you should use other (non-internal) methods of
1535 //! class AIS_InteractiveContext without trying to obtain an instance of
1536 //! AIS_LocalContext.
1537 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1538 Handle(AIS_LocalContext) LocalContext() const { return myCurLocalIndex > 0 ? myLocalContexts (myCurLocalIndex) : Handle(AIS_LocalContext)(); }
1540 const Handle(SelectMgr_SelectionManager)& SelectionManager() const { return mgrSelector; }
1542 const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const { return myMainPM; }
1544 const Handle(StdSelect_ViewerSelector3d)& MainSelector() const { return myMainSel; }
1546 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1547 Standard_EXPORT Handle(StdSelect_ViewerSelector3d) LocalSelector() const;
1549 //! Clears all the structures which don't
1550 //! belong to objects displayed at neutral point
1551 //! only effective when no Local Context is opened...
1552 //! returns the number of removed structures from the viewers.
1553 Standard_EXPORT Standard_Integer PurgeDisplay();
1555 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1556 Standard_EXPORT Standard_Integer HighestIndex() const;
1558 Standard_EXPORT void DisplayActiveSensitive (const Handle(V3d_View)& aView);
1560 Standard_EXPORT void ClearActiveSensitive (const Handle(V3d_View)& aView);
1562 //! Fits the view correspondingly to the bounds of selected objects.
1563 //! Infinite objects are ignored if infinite state of AIS_InteractiveObject
1565 Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView, const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
1567 Standard_EXPORT void DisplayActiveSensitive (const Handle(AIS_InteractiveObject)& anObject, const Handle(V3d_View)& aView);
1569 //! returns if possible,
1570 //! the first local context where the object is seen
1571 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1572 Standard_EXPORT Standard_Boolean IsInLocal (const Handle(AIS_InteractiveObject)& anObject, Standard_Integer& TheIndex) const;
1574 //! Rebuilds 1st level of BVH selection forcibly
1575 Standard_EXPORT void RebuildSelectionStructs();
1577 //! setup object visibility in specified view,
1578 //! has no effect if object is not disaplyed in this context.
1579 Standard_EXPORT void SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisible);
1581 //! Disconnects theObjToDisconnect from theAssembly and removes dependent selection structures
1582 Standard_EXPORT void Disconnect (const Handle(AIS_InteractiveObject)& theAssembly, const Handle(AIS_InteractiveObject)& theObjToDisconnect = NULL);
1584 //! Query objects visible or hidden in specified view due to affinity mask.
1585 Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisibleInView, const AIS_DisplayStatus theStatus = AIS_DS_None) const;
1587 //! Redraws immediate structures in all views of the viewer given taking into account its visibility.
1588 Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
1592 Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
1594 Standard_EXPORT void EraseGlobal (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
1596 Standard_EXPORT void ClearGlobal (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
1598 Standard_EXPORT void ClearGlobalPrs (const Handle(AIS_InteractiveObject)& anObj, const Standard_Integer aMode, const Standard_Boolean updateviewer = Standard_True);
1600 Standard_EXPORT void InitAttributes();
1602 Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
1605 Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True);
1608 Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True);
1610 //! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
1611 Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
1613 //! Helper function that highlights the owner given with <theStyle> without
1614 //! performing AutoHighlight checks, e.g. is used for dynamic highlight.
1615 Standard_EXPORT void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
1616 const Handle(V3d_Viewer)& theViewer = NULL);
1618 //! Helper function that highlights the owner given with <theStyle> with check
1619 //! for AutoHighlight, e.g. is used for selection.
1620 Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
1622 //! Helper function that highlights global owner of the object given with <theStyle> with check
1623 //! for AutoHighlight, e.g. is used for selection.
1624 //! If global owner is null, it simply highlights the whole object
1625 Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
1626 const Handle(Prs3d_Drawer)& theStyle,
1627 const Standard_Integer theDispMode) const;
1629 //! Helper function that unhighlights all owners that are stored in current AIS_Selection.
1630 //! The function updates global status and selection state of owner and interactive object.
1631 //! If the parameter <theIsToHilightSubIntensity> is set to true, interactive objects with sub-intensity
1632 //! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
1633 Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
1635 //! Helper function that unhighlights global selection owner of given interactive.
1636 //! The function does not perform any updates of global or owner status
1637 Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const;
1639 //! Helper function that turns on sub-intensity in global status and highlights
1640 //! given objects with sub-intensity color
1641 //! @param theObject [in] the object. If NULL is given, than sub-intensity will be turned on for
1642 //! all inveractive objects of the context
1643 //! @param theDispMode [in] display mode. If -1 is given, sub-intensity will be turned on for
1644 //! all display modes in global status's list of modes
1645 //! @param theIsDisplayedOnly [in] is true if sub-intensity should be applied only to objects with
1646 //! status AIS_DS_Displayed
1647 Standard_EXPORT void turnOnSubintensity (const Handle(AIS_InteractiveObject)& theObject = NULL,
1648 const Standard_Integer theDispMode = -1,
1649 const Standard_Boolean theIsDisplayedOnly = Standard_True) const;
1651 //! Helper function that highlights the object with sub-intensity color without any checks
1652 //! @param theObject [in] the object that will be highlighted
1653 //! @param theMode [in] display mode
1654 Standard_EXPORT void highlightWithSubintensity (const Handle(AIS_InteractiveObject)& theObject,
1655 const Standard_Integer theMode) const;
1657 //! Helper function that highlights the owner with sub-intensity color without any checks
1658 //! @param theOwner [in] the owner that will be highlighted
1659 //! @param theMode [in] display mode
1660 Standard_EXPORT void highlightWithSubintensity (const Handle(SelectMgr_EntityOwner)& theOwner,
1661 const Standard_Integer theMode) const;
1663 //! Helper function that returns correct dynamic highlight style for the object:
1664 //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1665 //! dynamic highlight style of interactive context will be returned.
1666 //! @param theObj [in] the object to check
1667 const Handle(Prs3d_Drawer)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj,
1668 const Handle(SelectMgr_EntityOwner)& theOwner) const
1670 const Handle(Prs3d_Drawer)& aHiDrawer = theObj->DynamicHilightAttributes();
1671 if (!aHiDrawer.IsNull())
1676 return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
1679 //! Helper function that returns correct selection style for the object:
1680 //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1681 //! selection style of interactive context will be returned.
1682 //! @param theObj [in] the object to check
1683 const Handle(Prs3d_Drawer)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj,
1684 const Handle(SelectMgr_EntityOwner)& theOwner) const
1686 const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
1687 if (!aHiDrawer.IsNull())
1692 return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalSelected : Prs3d_TypeOfHighlight_Selected];
1695 //! Assign the context to the object or throw exception if object was already assigned to another context.
1696 void setContextToObject (const Handle(AIS_InteractiveObject)& theObj)
1698 if (theObj->HasInteractiveContext())
1700 if (theObj->myCTXPtr != this)
1702 Standard_ProgramError::Raise ("AIS_InteractiveContext - object has been already displayed in another context!");
1707 theObj->SetContext (this);
1711 //! Return display mode for highlighting.
1712 Standard_Integer getHilightMode (const Handle(AIS_InteractiveObject)& theObj,
1713 const Handle(Prs3d_Drawer)& theStyle,
1714 const Standard_Integer theDispMode) const
1716 if (!theStyle.IsNull()
1717 && theStyle->DisplayMode() != -1
1718 && theObj->AcceptDisplayMode (theStyle->DisplayMode()))
1720 return theStyle->DisplayMode();
1722 else if (theDispMode != -1)
1726 else if (theObj->HasDisplayMode())
1728 return theObj->DisplayMode();
1730 return myDefaultDrawer->DisplayMode();
1735 AIS_DataMapOfIOStatus myObjects;
1736 Handle(SelectMgr_SelectionManager) mgrSelector;
1737 Handle(PrsMgr_PresentationManager3d) myMainPM;
1738 Handle(V3d_Viewer) myMainVwr;
1739 Handle(StdSelect_ViewerSelector3d) myMainSel;
1740 Handle(SelectMgr_EntityOwner) myLastPicked;
1741 Handle(SelectMgr_EntityOwner) myLastinMain;
1742 Standard_Boolean myWasLastMain;
1743 Standard_Boolean myToHilightSelected;
1744 Handle(AIS_Selection) mySelection;
1745 Handle(SelectMgr_OrFilter) myFilters;
1746 Handle(Prs3d_Drawer) myDefaultDrawer;
1747 Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
1748 AIS_DataMapOfILC myLocalContexts;
1749 Standard_Integer myCurLocalIndex;
1750 Handle(V3d_View) mylastmoveview;
1751 TColStd_SequenceOfInteger myDetectedSeq;
1752 Standard_Integer myCurDetected;
1753 Standard_Integer myCurHighlighted;
1754 Standard_Boolean myIsAutoActivateSelMode;
1758 DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
1760 #endif // _AIS_InteractiveContext_HeaderFile