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_SequenceOfInteractive.hxx>
33 #include <MMgt_TShared.hxx>
34 #include <AIS_DisplayStatus.hxx>
35 #include <AIS_KindOfInteractive.hxx>
36 #include <Standard_Real.hxx>
37 #include <Aspect_TypeOfFacingModel.hxx>
38 #include <Graphic3d_HighlightStyle.hxx>
39 #include <Graphic3d_NameOfMaterial.hxx>
40 #include <Standard_ShortReal.hxx>
41 #include <TColStd_ListOfInteger.hxx>
42 #include <AIS_DisplayMode.hxx>
43 #include <AIS_TypeOfIso.hxx>
44 #include <AIS_StatusOfDetection.hxx>
45 #include <AIS_StatusOfPick.hxx>
46 #include <TColgp_Array1OfPnt2d.hxx>
47 #include <SelectMgr_IndexedMapOfOwner.hxx>
48 #include <AIS_ClearMode.hxx>
49 #include <TopAbs_ShapeEnum.hxx>
50 #include <SelectMgr_ListOfFilter.hxx>
51 #include <AIS_ListOfInteractive.hxx>
52 #include <Standard_CString.hxx>
53 #include <AIS_Selection.hxx>
54 class SelectMgr_SelectionManager;
56 class AIS_InteractiveObject;
57 class SelectMgr_OrFilter;
59 class AIS_LocalContext;
60 class TopLoc_Location;
62 class TCollection_ExtendedString;
63 class Prs3d_LineAspect;
64 class Prs3d_BasicAspect;
65 class SelectMgr_EntityOwner;
66 class Standard_Transient;
67 class SelectMgr_Filter;
68 class TCollection_AsciiString;
71 class AIS_InteractiveContext;
72 DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared)
74 //! The Interactive Context allows you to manage
75 //! graphic behavior and selection of Interactive Objects
76 //! in one or more viewers. Class methods make this
77 //! highly transparent.
78 //! It is essential to remember that an Interactive Object
79 //! which is already known by the Interactive Context
80 //! must be modified using Context methods. You can
81 //! only directly call the methods available for an
82 //! Interactive Object if it has not been loaded into an
83 //! Interactive Context.
84 //! You must distinguish two states in the Interactive Context:
85 //! - No Open Local Context, also known as the Neutral Point.
86 //! - One or several open local contexts, each
87 //! representing a temporary state of selection and presentation.
88 //! Some methods can only be used in open Local
89 //! Context; others in closed Local Context; others do
90 //! not have the same behavior in one state as in the other.
91 //! The possiblities of use for local contexts are
92 //! numerous depending on the type of operation that
93 //! you want to perform, for example:
94 //! - working on all visualized interactive objects,
95 //! - working on only a few objects,
96 //! - working on a single object.
97 //! 1. When you want ot work on one type of entity, you
98 //! may open a local context with the option
99 //! UseDisplayedObjects set to false. DisplayedObjects
100 //! allows you to recover the visualized Interactive
101 //! Objects which have a given Type and
102 //! Signature from Neutral Point.
103 //! 2. You must keep in mind the fact that when you open
104 //! a Local Context with default options:
105 //! - The Interactive Objects visualized at Neutral Point
106 //! are activated with their default selection mode. You
107 //! must deactivate those which you do not want ot use.
108 //! - The Shape type Interactive Objects are
109 //! automatically decomposed into sub-shapes when
110 //! standard activation modes are launched.
111 //! - The "temporary" Interactive Objects present in the
112 //! Local Contexts are not automatically taken into
113 //! account. You have to load them manually if you
114 //! want to use them.
115 //! - The stages could be the following:
116 //! - Open a Local Context with the right options;
117 //! - Load/Visualize the required complementary
118 //! objects with the desired activation modes.
119 //! - Activate Standard modes if necessary
120 //! - Create its filters and add them to the Local Context
121 //! - Detect/Select/recover the desired entities
122 //! - Close the Local Context with the adequate index.
123 //! - It is useful to create an interactive editor, to which
124 //! you pass the Interactive Context. This will take care
125 //! of setting up the different contexts of
126 //! selection/presentation according to the operation
127 //! which you want to perform.
129 //! Selection of parts of the objects can also be done without opening a local context.
130 //! Interactive context itself supports decomposed object selection with selection filters
131 //! support. Note that each selectable object must specify the selection mode that is
132 //! responsible for selection of object as a whole (global selection mode). By default, global
133 //! selection mode is equal to 0, but it might be redefined if needed. Sub-part selection
134 //! of the objects without using local context provides a possibility to activate part
135 //! selection modes along with global selection mode.
136 class AIS_InteractiveContext : public MMgt_TShared
143 //! Constructs the interactive context object defined by
144 //! the principal viewer MainViewer.
145 Standard_EXPORT AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer);
147 Standard_EXPORT virtual void Delete() const Standard_OVERRIDE;
149 Standard_EXPORT void SetAutoActivateSelection (const Standard_Boolean Auto);
151 Standard_EXPORT Standard_Boolean GetAutoActivateSelection() const;
153 //! Controls the choice between the using the display
154 //! and selection modes of open local context which you
155 //! have defined and activating those available by default.
156 //! If a local context is open and if updateviewer equals
157 //! Standard_False, the Interactive Object anIobj is
158 //! displayed in the default active mode. This will be the
159 //! object's default display mode, if there is one.
160 //! Otherwise, it will be the context mode. The Interactive
161 //! Object's default selection mode is activated. In
162 //! general, this is 0.
163 //! This syntax has the same behavior as local context,
164 //! open or closed. If you want to view the object in open
165 //! local context without selection, use the syntax below,
166 //! setting aSelectionMode to -1.
167 Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean updateviewer = Standard_True);
169 //! Controls the choice between the using the display
170 //! and selection modes of open local context which you
171 //! have defined and activating those available by default.
172 //! If no Local Context is opened. and the Interactive
173 //! Object theIObj has no display mode of its own, the
174 //! default display mode, 0, is used. Likewise, if theIObj
175 //! has no selection mode of its own, the default one, 0, is used.
176 //! If a local context is open and if theToUpdateViewer equals
177 //! Standard_False, the presentation of the Interactive
178 //! Object activates the selection mode; the object is
179 //! displayed but no viewer will be updated.
180 //! If theSelectionMode equals -1, theIObj will not be
181 //! activated: it will be displayed but will not be selectable.
182 //! Use this if you want to view the object in open local
183 //! context without selection. Note: This option is only
184 //! available in Local Context.
185 //! If theToAllowDecomposition equals true, theIObj can have
186 //! subshapes detected by selection mechanisms. theIObj
187 //! must be able to give a shape selection modes which
188 //! fit the AIS_Shape selection modes:
192 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);
194 //! Allows you to load the Interactive Object aniobj
195 //! with a given selection mode SelectionMode, and/or
196 //! with the desired decomposition option, whether the
197 //! object is visualized or not. If AllowDecomp =
198 //! Standard_True and, if the interactive object is of
199 //! the "Shape" type, these "standard" selection
200 //! modes will be automatically activated as a function
201 //! of the modes present in the Local Context.
202 //! The loaded objects will be selectable but
203 //! displayable in highlighting only when detected by the Selector.
204 //! This method is available only when Local Contexts are open.
205 Standard_EXPORT void Load (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer SelectionMode = -1, const Standard_Boolean AllowDecomp = Standard_False);
207 //! Hides the object. The object's presentations are simply
208 //! flagged as invisible and therefore excluded from redrawing.
209 //! To show hidden objects, use Display().
210 Standard_EXPORT void Erase (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
212 //! Hides all objects. The object's presentations are simply
213 //! flagged as invisible and therefore excluded from redrawing.
214 //! To show all hidden objects, use DisplayAll().
215 Standard_EXPORT void EraseAll (const Standard_Boolean updateviewer = Standard_True);
217 //! Displays all hidden objects.
218 Standard_EXPORT void DisplayAll (const Standard_Boolean updateviewer = Standard_True);
221 //! Hides selected objects. The object's presentations are simply
222 //! flagged as invisible and therefore excluded from redrawing.
223 //! To show hidden objects, use Display().
224 Standard_EXPORT void EraseSelected (const Standard_Boolean updateviewer = Standard_True);
226 //! Displays selected objects if a local context is open.
227 //! Displays current objects if there is no active local context.
228 //! Objects selected when there is no open local context
229 //! are called current objects; those selected in open
230 //! local context, selected objects.
231 //! If a local context is open and if updateviewer equals
232 //! Standard_False, the presentation of the Interactive
233 //! Object activates the selection mode; the object is
234 //! displayed but no viewer will be updated.
235 Standard_EXPORT void DisplaySelected (const Standard_Boolean updateviewer = Standard_True);
237 //! Changes the status of a temporary object. It will be
238 //! kept at the neutral point, i.e. put in the list of
239 //! displayed objects along withwith its temporary
240 //! attributes. These include display mode and
241 //! selection mode, for example.
242 //! Returns true if done.
243 //! inWhichLocal gives the local context in which anIObj
244 //! is displayed. By default, the index -1 refers to the last
245 //! Local Context opened.
246 Standard_EXPORT Standard_Boolean KeepTemporary (const Handle(AIS_InteractiveObject)& anIObj, const Standard_Integer InWhichLocal = -1);
248 //! Empties the graphic presentation of the mode
249 //! indexed by aMode.
250 //! If a local context is open and if updateviewer equals
251 //! Standard_False, the presentation of the Interactive
252 //! Object activates the selection mode; the object is
253 //! displayed but no viewer will be updated.
255 //! Removes anIobj. anIobj is still active if it was
256 //! previously activated.
257 Standard_EXPORT void ClearPrs (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode = 0, const Standard_Boolean updateviewer = Standard_True);
259 //! Removes aniobj from every viewer. aniobj is no
260 //! longer referenced in the Context.
261 //! If a local context is open and if updateviewer equals
262 //! Standard_False, the presentation of the Interactive
263 //! Object activates the selection mode; the object is
264 //! displayed but no viewer will be updated.
265 Standard_EXPORT void Remove (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
267 //! Removes all the objects from all opened Local Contexts
268 //! and from the Neutral Point
269 Standard_EXPORT void RemoveAll (const Standard_Boolean updateviewer = Standard_True);
272 //! Updates the display in the viewer to take dynamic
273 //! detection into account. On dynamic detection by the
274 //! mouse cursor, sensitive primitives are highlighted.
275 //! The highlight color of entities detected by mouse
276 //! movement is white by default.
277 //! If a local context is open and if updateviewer equals
278 //! Standard_False, the presentation of the Interactive
279 //! Object activates the selection mode; the object is
280 //! displayed but no viewer will be updated.
281 Standard_DEPRECATED("Deprecated method Hilight()")
282 void Hilight (const Handle(AIS_InteractiveObject)& theObj, const Standard_Boolean theIsToUpdateViewer = Standard_True)
284 return HilightWithColor (theObj, mySelStyle, theIsToUpdateViewer);
287 //! Changes the color of all the lines of the object in view,
288 //! aniobj. It paints these lines the color passed as the
290 //! If a local context is open and if updateviewer equals
291 //! Standard_False, the presentation of the Interactive
292 //! Object activates the selection mode; the object is
293 //! displayed but no viewer will be updated.
294 Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& theObj,
295 const Handle(Graphic3d_HighlightStyle)& theStyle,
296 const Standard_Boolean theIsToUpdate = Standard_True);
299 //! Removes hilighting from the entity aniobj. Updates the viewer.
300 //! If a local context is open and if updateviewer equals
301 //! Standard_False, the presentation of the Interactive
302 //! Object activates the selection mode; the object is
303 //! displayed but no viewer will be updated.
304 Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
306 //! Sets the display priority aPriority of the seen parts
307 //! presentation of the entity anIobj.
308 Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aPriority);
310 //! Set Z layer id for interactive object.
311 //! The Z layers can be used to display temporarily presentations of some object in front of the other objects in the scene.
312 //! The ids for Z layers are generated by V3d_Viewer.
313 Standard_EXPORT void SetZLayer (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theLayerId);
315 //! Get Z layer id set for displayed interactive object.
316 Standard_EXPORT Standard_Integer GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const;
318 //! Recomputes the seen parts presentation of the entity
319 //! aniobj. If allmodes equals true, all presentations are
320 //! present in the object even if unseen.
321 //! If a local context is open and if updateviewer equals
322 //! Standard_False, the presentation of the Interactive
323 //! Object activates the selection mode; the object is
324 //! displayed but no viewer will be updated.
325 Standard_EXPORT void Redisplay (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True, const Standard_Boolean allmodes = Standard_False);
327 //! Recomputes the Prs/Selection of displayed objects of
328 //! a given type and a given signature.
329 //! if signature = -1 doesnt take signature criterion.
330 Standard_EXPORT void Redisplay (const AIS_KindOfInteractive aTypeOfObject, const Standard_Integer Signature = -1, const Standard_Boolean updateviewer = Standard_True);
332 //! Recomputes the displayed presentations, flags the others
333 //! Doesn't update presentations
334 Standard_EXPORT void RecomputePrsOnly (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean updateviewer = Standard_True, const Standard_Boolean allmodes = Standard_False);
336 //! Recomputes the active selections, flags the others
337 //! Doesn't update presentations
338 Standard_EXPORT void RecomputeSelectionOnly (const Handle(AIS_InteractiveObject)& anIObj);
340 //! Updates displayed interactive object by checking and
341 //! recomputing its flagged as "to be recomputed" presentation
342 //! and selection structures. This method does not force any
343 //! recomputation on its own. The method recomputes selections
344 //! even if they are loaded without activation in particular selector.
345 Standard_EXPORT void Update (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theUpdateViewer = Standard_True);
348 //! Sets the display mode of seen Interactive Objects.
349 //! aMode provides the display mode index of the entity aniobj.
350 //! If updateviewer equals Standard_True, the
351 //! predominant mode aMode will overule the context mode.
352 //! If a local context is open and if updateviewer equals
353 //! Standard_False, the presentation of the Interactive
354 //! Object returns to the default selection mode; the
355 //! object is displayed but no viewer will be updated.
356 //! Note that display mode 3 is only used if you have an
357 //! AIS_Textured Shape.
358 Standard_EXPORT void SetDisplayMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode, const Standard_Boolean updateviewer = Standard_True);
361 //! Unsets the display mode of seen Interactive Objects.
362 //! aMode provides the display mode index of the entity aniobj.
363 //! If updateviewer equals Standard_True, the
364 //! predominant mode aMode will overule the context mode.
365 //! If a local context is open and if updateviewer equals
366 //! Standard_False, the presentation of the Interactive
367 //! Object returns to the default selection mode; the
368 //! object is displayed but no viewer will be updated.
369 Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
371 //! Disables the mechanism of adaptive tolerance calculation in SelectMgr_ViewerSelector and
372 //! sets the given tolerance for ALL sensitive entities activated. For more information, see
373 //! SelectMgr_ViewerSelector documentation
374 //! Warning: When a local context is open the sensitivity is apply on it
375 //! instead on the main context.
376 Standard_EXPORT void SetPixelTolerance (const Standard_Integer aPrecision = 2);
378 //! Returns the pixel tolerance.
379 Standard_EXPORT Standard_Integer PixelTolerance() const;
381 //! Allows to manage sensitivity of a particular selection of interactive object theObject
382 //! and changes previous sensitivity value of all sensitive entities in selection with theMode
383 //! to the given theNewSensitivity.
384 Standard_EXPORT void SetSelectionSensitivity (const Handle(AIS_InteractiveObject)& theObject,
385 const Standard_Integer theMode,
386 const Standard_Integer theNewSensitivity);
388 //! Puts the location aLocation on the initial graphic
389 //! representation and the selection for the entity aniobj.
390 //! In other words, aniobj is visible and selectable at a
391 //! position other than initial position.
392 //! Graphic and selection primitives are not recomputed.
393 //! To clean the view correctly, you must reset the previous location.
394 Standard_EXPORT void SetLocation (const Handle(AIS_InteractiveObject)& aniobj, const TopLoc_Location& aLocation);
396 //! Puts the entity aniobj back into its initial position.
397 Standard_EXPORT void ResetLocation (const Handle(AIS_InteractiveObject)& aniobj);
400 //! Returns true if the entity aniobj has a location.
401 Standard_EXPORT Standard_Boolean HasLocation (const Handle(AIS_InteractiveObject)& aniobj) const;
404 //! Returns the location of the entity aniobj.
405 Standard_EXPORT TopLoc_Location Location (const Handle(AIS_InteractiveObject)& aniobj) const;
407 //! change the current facing model apply on polygons for
408 //! SetColor(), SetTransparency(), SetMaterial() methods
409 //! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is
410 //! applying both on the front and back face.
411 Standard_EXPORT void SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& aniobj, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE);
413 Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_NameOfColor aColor, const Standard_Boolean updateviewer = Standard_True);
416 //! Sets the color of the selected entity.
417 //! If a local context is open and if updateviewer equals
418 //! Standard_False, the presentation of the Interactive
419 //! Object activates the selection mode; the object is
420 //! displayed but no viewer will be updated.
421 Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_Color& aColor, const Standard_Boolean updateviewer = Standard_True);
423 //! Removes the color selection for the selected entity.
424 //! If a local context is open and if updateviewer equals
425 //! Standard_False, the presentation of the Interactive
426 //! Object activates the selection mode; the object is
427 //! displayed but no viewer will be updated.
428 Standard_EXPORT void UnsetColor (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
431 //! Sets the width of the entity aniobj.
432 //! If a local context is open and if updateviewer equals
433 //! Standard_False, the presentation of the Interactive
434 //! Object activates the selection mode; the object is
435 //! displayed but no viewer will be updated.
436 Standard_EXPORT virtual void SetWidth (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aValue, const Standard_Boolean updateviewer = Standard_True);
439 //! Removes the width setting of the entity aniobj.
440 //! If a local context is open and if updateviewer equals
441 //! Standard_False, the presentation of the Interactive
442 //! Object activates the selection mode; the object is
443 //! displayed but no viewer will be updated.
444 Standard_EXPORT virtual void UnsetWidth (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
447 //! Provides the type of material setting for the view of
448 //! the entity aniobj.
449 //! The range of settings includes: BRASS, BRONZE,
450 //! GOLD, PEWTER, SILVER, STONE.
451 //! If a local context is open and if updateviewer equals
452 //! Standard_False, the presentation of the Interactive
453 //! Object activates the selection mode; the object is
454 //! displayed but no viewer will be updated.
455 Standard_EXPORT void SetMaterial (const Handle(AIS_InteractiveObject)& aniobj, const Graphic3d_NameOfMaterial aName, const Standard_Boolean updateviewer = Standard_True);
458 //! Removes the type of material setting for viewing the
460 //! If a local context is open and if updateviewer equals
461 //! Standard_False, the presentation of the Interactive
462 //! Object activates the selection mode; the object is
463 //! displayed but no viewer will be updated.
464 Standard_EXPORT void UnsetMaterial (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
466 //! Provides the transparency settings for viewing the
467 //! entity aniobj. The transparency value aValue may be
468 //! between 0.0, opaque, and 1.0, fully transparent.
469 //! If a local context is open and if updateviewer equals
470 //! Standard_False, the presentation of the Interactive
471 //! Object activates the selection mode; the object is
472 //! displayed but no viewer will be updated.
473 Standard_EXPORT void SetTransparency (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aValue = 0.6, const Standard_Boolean updateviewer = Standard_True);
476 //! Removes the transparency settings for viewing the
477 //! entity aniobj. The transparency value aValue may be
478 //! between 0.0, opaque, and 1.0, fully transparent.
479 //! If a local context is open and if updateviewer equals
480 //! Standard_False, the presentation of the Interactive
481 //! Object activates the selection mode; the object is
482 //! displayed but no viewer will be updated.
483 Standard_EXPORT void UnsetTransparency (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
486 //! Sets the attributes of the interactive object aniobj by
487 //! plugging the attribute manager aDrawer into the local
488 //! context. The graphic attributes of aDrawer such as
489 //! visualization mode, color, and material, are then used
490 //! to display aniobj.
491 //! If a local context is open and if updateviewer equals
492 //! Standard_False, the presentation of the Interactive
493 //! Object activates the selection mode; the object is
494 //! displayed but no viewer will be updated.
495 Standard_EXPORT void SetLocalAttributes (const Handle(AIS_InteractiveObject)& aniobj, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Boolean updateviewer = Standard_True);
498 //! Removes the settings for local attributes of the entity
499 //! anObj and returns to the Neutral Point attributes or
500 //! those of the previous local context.
501 //! If a local context is open and if updateviewer equals
502 //! Standard_False, the presentation of the Interactive
503 //! Object activates the selection mode; the object is
504 //! displayed but no viewer will be updated.
505 Standard_EXPORT void UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
507 //! Sets up polygon offsets for the given AIS_InteractiveObject.
508 //! It simply calls anObj->SetPolygonOffsets()
509 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);
511 //! simply calls anObj->HasPolygonOffsets()
512 Standard_EXPORT Standard_Boolean HasPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj) const;
514 //! Retrieves current polygon offsets settings for <anObj>.
515 Standard_EXPORT void PolygonOffsets (const Handle(AIS_InteractiveObject)& anObj, Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const;
517 //! Sets the size aSize of the trihedron.
518 //! Is used to change the default value 100 mm for
519 //! display of trihedra.
520 //! Use of this function in one of your own interactive
521 //! objects requires a call to the Compute function of the
522 //! new class. This will recalculate the presentation for
523 //! every trihedron displayed.
524 //! If a local context is open and if updateviewer equals
525 //! Standard_False, the presentation of the Interactive
526 //! Object activates the selection mode; the object is
527 //! displayed but no viewer will be updated.
528 Standard_EXPORT void SetTrihedronSize (const Standard_Real aSize, const Standard_Boolean updateviewer = Standard_True);
530 //! returns the current value of trihedron size.
531 Standard_EXPORT Standard_Real TrihedronSize() const;
534 //! Sets the plane size defined by the length in the X
535 //! direction XSize and that in the Y direction YSize.
536 //! If a local context is open and if updateviewer equals
537 //! Standard_False, the presentation of the Interactive
538 //! Object activates the selection mode; the object is
539 //! displayed but no viewer will be updated.
540 Standard_EXPORT void SetPlaneSize (const Standard_Real aSizeX, const Standard_Real aSizeY, const Standard_Boolean updateviewer = Standard_True);
543 //! Sets the plane size aSize.
544 //! If a local context is open and if updateviewer equals
545 //! Standard_False, the presentation of the Interactive
546 //! Object activates the selection mode; the object is
547 //! displayed but no viewer will be updated.
548 //! May be used if PlaneSize returns true.
549 Standard_EXPORT void SetPlaneSize (const Standard_Real aSize, const Standard_Boolean updateviewer = Standard_True);
551 //! Returns true if the length in the X direction XSize is
552 //! the same as that in the Y direction YSize.
553 Standard_EXPORT Standard_Boolean PlaneSize (Standard_Real& XSize, Standard_Real& YSize) const;
555 //! Returns the display status of the entity anIobj.
556 //! This will be one of the following:
557 //! - DS_Displayed displayed in main viewer
558 //! - DS_Erased hidden in main viewer
559 //! - DS_Temporary temporarily displayed
560 //! - DS_None nowhere displayed.
561 Standard_EXPORT AIS_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const;
564 //! Returns true if anIobj is displayed in the interactive context.
565 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const;
567 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode) const;
569 //! Returns true if the object is marked as highlighted via its global
571 //! @param theObj [in] the object to check
572 Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const;
574 //! Returns true if the owner is marked as selected
575 //! @param theOwner [in] the owner to check
576 Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner) const;
578 //! Returns highlight style of the object if it is marked as highlighted via global status
579 //! @param theObj [in] the object to check
580 Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
581 Handle(Graphic3d_HighlightStyle)& theStyle) const;
583 //! Returns highlight style of the owner if it is selected
584 //! @param theOwner [in] the owner to check
585 Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
586 Handle(Graphic3d_HighlightStyle)& theStyle) const;
588 //! Returns the display priority of the entity anIobj. This
589 //! will be display mode of anIobj if it is in the main
591 Standard_EXPORT Standard_Integer DisplayPriority (const Handle(AIS_InteractiveObject)& anIobj) const;
594 //! Returns true if a view of the Interactive Object aniobj has color.
595 Standard_EXPORT Standard_Boolean HasColor (const Handle(AIS_InteractiveObject)& aniobj) const;
597 Standard_EXPORT Quantity_NameOfColor Color (const Handle(AIS_InteractiveObject)& aniobj) const;
600 //! Returns the color Color of the entity aniobj in the interactive context.
601 Standard_EXPORT void Color (const Handle(AIS_InteractiveObject)& aniobj, Quantity_Color& acolor) const;
604 //! Returns the width of the Interactive Object aniobj in
605 //! the interactive context.
606 Standard_EXPORT virtual Standard_Real Width (const Handle(AIS_InteractiveObject)& aniobj) const;
609 //! Returns the status astatus of the Interactive Context
610 //! for the view of the Interactive Object anObj.
611 Standard_EXPORT void Status (const Handle(AIS_InteractiveObject)& anObj, TCollection_ExtendedString& astatus) const;
613 //! Sets transform persistence.
614 Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
615 const Handle(Graphic3d_TransformPers)& theTrsfPers);
617 Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
618 void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
619 const Graphic3d_TransModeFlags& theFlag,
620 const gp_Pnt& thePoint = gp_Pnt (0.0, 0.0, 0.0))
622 SetTransformPersistence (theObj, Graphic3d_TransformPers::FromDeprecatedParams (theFlag, thePoint));
625 //! Updates the current viewer, the viewer in Neutral Point.
626 //! Objects selected when there is no open local context
627 //! are called current objects; those selected in open
628 //! local context, selected objects.
629 Standard_EXPORT void UpdateCurrentViewer();
631 //! Returns the display mode setting.
632 //! Note that mode 3 is only used.
633 Standard_Integer DisplayMode() const;
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(Graphic3d_HighlightStyle)& HighlightStyle() const
646 //! Allows to manage the style of dynamic highlighting.
648 //! - the color of dynamic highlight is Quantity_NOC_CYAN1;
649 //! - the presentation for dynamic highlight is completely opaque;
650 //! - the type of highlight is Aspect_TOHM_COLOR.
651 Handle(Graphic3d_HighlightStyle)& ChangeHighlightStyle()
656 //! Returns current selection style settings.
658 //! - the color of selection is Quantity_NOC_GRAY80;
659 //! - the presentation for selection is completely opaque;
660 //! - the type of highlight is Aspect_TOHM_COLOR.
661 const Handle(Graphic3d_HighlightStyle)& SelectionStyle() const
666 //! Allows to manage the style of selection highlighting.
668 //! - the color of selection is Quantity_NOC_GRAY80;
669 //! - the presentation for selection is completely opaque;
670 //! - the type of highlight is Aspect_TOHM_COLOR.
671 Handle(Graphic3d_HighlightStyle)& ChangeSelectionStyle()
676 //! Returns the name of the color used to show preselection.
677 //! By default, this is Quantity_NOC_GREEN.
678 Quantity_NameOfColor PreSelectionColor() const;
681 //! Returns the name of the color used by default.
682 //! By default, this is Quantity_NOC_GOLDENROD.
683 Quantity_NameOfColor DefaultColor() const;
686 //! Sub-intensity allows temporary highlighting of particular
687 //! objects with specified color in a manner of selection highlight,
688 //! but without actual selection (e.g., global status and owner's
689 //! selection state will not be updated).
690 //! The method returns the color of such highlighting.
691 //! By default, it is Quantity_NOC_GRAY40.
692 const Quantity_Color& SubIntensityColor() const
694 return mySubintStyle->Color();
697 //! Sub-intensity allows temporary highlighting of particular
698 //! objects with specified color in a manner of selection highlight,
699 //! but without actual selection (e.g., global status and owner's
700 //! selection state will not be updated).
701 //! The method sets up the color for such highlighting.
702 //! By default, this is Quantity_NOC_GRAY40.
703 void SetSubIntensityColor (const Quantity_Color& theColor)
705 mySubintStyle->SetColor (theColor);
708 //! Allows you to set the color used to show preselection.
709 //! By default, this is Quantity_NOC_GREEN.
710 //! A preselected entity is one which has been selected
711 //! as the domain of application of a function such as a fillet.
712 void SetPreselectionColor (const Quantity_NameOfColor aCol);
714 //! Sets the display mode of seen Interactive Objects.
715 //! aMode provides the display mode index of the entity aniobj.
716 //! If updateviewer equals Standard_True, the
717 //! predominant mode aMode will overule the context mode.
718 //! If a local context is open and if updateviewer equals
719 //! Standard_False, the presentation of the Interactive
720 //! Object returns to the default selection mode; the
721 //! object is displayed but no viewer will be updated.
722 //! Note that display mode 3 is only used if you have an
723 //! AIS_Textured Shape.
724 Standard_EXPORT void SetDisplayMode (const Standard_Integer AMode, const Standard_Boolean updateviewer = Standard_True);
727 //! Sets the deviation coefficient aCoefficient.
728 //! Drawings of curves or patches are made with respect
729 //! to a maximal chordal deviation. A Deviation coefficient
730 //! is used in the shading display mode. The shape is
731 //! seen decomposed into triangles. These are used to
732 //! calculate reflection of light from the surface of the
733 //! object. The triangles are formed from chords of the
734 //! curves in the shape. The deviation coefficient
735 //! aCoefficient gives the highest value of the angle with
736 //! which a chord can deviate from a tangent to a curve.
737 //! If this limit is reached, a new triangle is begun.
738 //! This deviation is absolute and is set through the
739 //! method: SetMaximalChordialDeviation. The default
741 //! In drawing shapes, however, you are allowed to ask
742 //! for a relative deviation. This deviation will be:
743 //! SizeOfObject * DeviationCoefficient.
745 Standard_EXPORT void SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aCoefficient, const Standard_Boolean updateviewer = Standard_True);
747 Standard_EXPORT void SetDeviationAngle (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
749 //! Calls the AIS_Shape SetAngleAndDeviation to set
750 //! both Angle and Deviation coefficients
751 Standard_EXPORT void SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
754 //! Sets the deviation coefficient aCoefficient for
755 //! removal of hidden lines created by different
756 //! viewpoints in different presentations. The Default value is 0.02.
757 Standard_EXPORT void SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aCoefficient, const Standard_Boolean updateviewer = Standard_True);
759 Standard_EXPORT void SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
761 //! Computes a HLRAngle and a
762 //! HLRDeviationCoefficient by means of the angle
763 //! anAngle and sets the corresponding methods in the
764 //! default drawing tool with these values.
765 Standard_EXPORT void SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
767 //! Sets the deviation coefficient aCoefficient.
768 //! Drawings of curves or patches are made with respect
769 //! to a maximal chordal deviation. A Deviation coefficient
770 //! is used in the shading display mode. The shape is
771 //! seen decomposed into triangles. These are used to
772 //! calculate reflection of light from the surface of the
773 //! object. The triangles are formed from chords of the
774 //! curves in the shape. The deviation coefficient
775 //! aCoefficient gives the highest value of the angle with
776 //! which a chord can deviate from a tangent to a curve.
777 //! If this limit is reached, a new triangle is begun.
778 //! This deviation is absolute and is set through the
779 //! method: SetMaximalChordialDeviation. The default
781 //! In drawing shapes, however, you are allowed to ask
782 //! for a relative deviation. This deviation will be:
783 //! SizeOfObject * DeviationCoefficient.
785 Standard_EXPORT void SetDeviationCoefficient (const Standard_Real aCoefficient);
787 //! Returns the deviation coefficient.
788 //! Drawings of curves or patches are made with respect
789 //! to a maximal chordal deviation. A Deviation coefficient
790 //! is used in the shading display mode. The shape is
791 //! seen decomposed into triangles. These are used to
792 //! calculate reflection of light from the surface of the
793 //! object. The triangles are formed from chords of the
794 //! curves in the shape. The deviation coefficient gives
795 //! the highest value of the angle with which a chord can
796 //! deviate from a tangent to a curve. If this limit is
797 //! reached, a new triangle is begun.
798 //! This deviation is absolute and is set through
799 //! Prs3d_Drawer::SetMaximalChordialDeviation. The
800 //! default value is 0.001.
801 //! In drawing shapes, however, you are allowed to ask
802 //! for a relative deviation. This deviation will be:
803 //! SizeOfObject * DeviationCoefficient.
804 Standard_EXPORT Standard_Real DeviationCoefficient() const;
806 //! default 12 degrees
807 Standard_EXPORT void SetDeviationAngle (const Standard_Real anAngle);
809 Standard_EXPORT Standard_Real DeviationAngle() const;
811 //! Sets the deviation coefficient aCoefficient for
812 //! removal of hidden lines created by different
813 //! viewpoints in different presentations. The Default value is 0.02.
814 Standard_EXPORT void SetHLRDeviationCoefficient (const Standard_Real aCoefficient);
817 //! Returns the real number value of the hidden line
818 //! removal deviation coefficient.
819 //! A Deviation coefficient is used in the shading display
820 //! mode. The shape is seen decomposed into triangles.
821 //! These are used to calculate reflection of light from the
822 //! surface of the object.
823 //! The triangles are formed from chords of the curves in
824 //! the shape. The deviation coefficient give the highest
825 //! value of the angle with which a chord can deviate
826 //! from a tangent to a curve. If this limit is reached, a
827 //! new triangle is begun.
828 //! To find the hidden lines, hidden line display mode
829 //! entails recalculation of the view at each different
830 //! projector perspective.
831 //! Because hidden lines entail calculations of more than
832 //! usual complexity to decompose them into these
833 //! triangles, a deviation coefficient allowing greater
834 //! tolerance is used. This increases efficiency in calculation.
835 //! The Default value is 0.02.
836 Standard_EXPORT Standard_Real HLRDeviationCoefficient() const;
838 //! Sets the HLR angle anAngle.
839 Standard_EXPORT void SetHLRAngle (const Standard_Real anAngle);
842 //! Returns the real number value of the deviation angle
843 //! in hidden line removal views in this interactive context.
844 //! The default value is 20*PI/180.
845 Standard_EXPORT Standard_Real HLRAngle() const;
847 //! compute with anangle a HLRAngle and a HLRDeviationCoefficient
848 //! and set them in myHLRAngle and in myHLRDeviationCoefficient
849 //! of myDefaultDrawer ;
850 //! anAngle is in radian ; ( 1 deg < angle in deg < 20 deg)
851 Standard_EXPORT void SetHLRAngleAndDeviation (const Standard_Real anAngle);
853 //! Initializes hidden line aspect in the default drawing tool, or Drawer.
854 //! The default values are:
855 //! Color: Quantity_NOC_YELLOW
856 //! Type of line: Aspect_TOL_DASH
858 Standard_EXPORT Handle(Prs3d_LineAspect) HiddenLineAspect() const;
861 //! Sets the hidden line aspect anAspect.
862 //! anAspect defines display attributes for hidden lines in
864 Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& anAspect) const;
866 //! returns Standard_True if the hidden lines are to be drawn.
867 //! By default the hidden lines are not drawn.
868 Standard_EXPORT Standard_Boolean DrawHiddenLine() const;
870 Standard_EXPORT void EnableDrawHiddenLine() const;
872 Standard_EXPORT void DisableDrawHiddenLine() const;
874 //! Sets the number of U and V isoparameters displayed.
875 Standard_EXPORT void SetIsoNumber (const Standard_Integer NbIsos, const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
877 //! Returns the number of U and V isoparameters displayed.
878 Standard_EXPORT Standard_Integer IsoNumber (const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
880 //! Returns True if drawing isoparameters on planes is enabled.
881 Standard_EXPORT void IsoOnPlane (const Standard_Boolean SwitchOn);
883 //! Returns True if drawing isoparameters on planes is enabled.
884 //! if <forUIsos> = False,
885 Standard_EXPORT Standard_Boolean IsoOnPlane() const;
887 //! Enables or disables on-triangulation build for isolines for a particular object.
888 //! In case if on-triangulation builder is disabled, default on-plane
889 //! builder will compute isolines for the object given.
890 Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theIsEnabled,
891 const Handle(AIS_InteractiveObject)& theObject);
893 //! Enables or disables on-triangulation build for isolines for default drawer.
894 //! In case if on-triangulation builder is disabled, default on-plane
895 //! builder will compute isolines for the object given.
896 Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theToSwitchOn);
898 //! Returns true if drawing isolines on triangulation algorithm is enabled.
899 Standard_EXPORT Standard_Boolean IsoOnTriangulation() const;
901 //! Sets the graphic basic aspect to the current presentation of
902 //! ALL selected objects.
903 //! Flag globalChange has no effect (left to simplify porting).
904 //! Updates the viewer when <updateViewer> is TRUE
905 Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& anAspect, const Standard_Boolean globalChange = Standard_True, const Standard_Boolean updateViewer = Standard_True);
907 //! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
908 //! This is done by the view theView passing this position to the main viewer and updating it.
909 //! Functions in both Neutral Point and local contexts.
910 //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
911 Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer theXPix, const Standard_Integer theYPix, const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawOnUpdate = Standard_True);
913 //! returns True if other entities were detected in the
914 //! last mouse detection
915 Standard_EXPORT Standard_Boolean HasNextDetected() const;
917 //! if more than 1 object is detected by the selector,
918 //! only the "best" owner is hilighted at the mouse position.
919 //! This Method allows the user to hilight one after another
920 //! the other detected entities.
921 //! if The method select is called, the selected entity
922 //! will be the hilighted one!
923 //! returns the Rank of hilighted entity
924 //! WARNING : Loop Method. When all the detected entities
925 //! have been hilighted , the next call will hilight
926 //! the first one again
927 Standard_EXPORT Standard_Integer HilightNextDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
929 //! Same as previous methods in reverse direction...
930 Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
932 //! Adds object in the selection.
933 Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
935 //! Adds object in the selection.
936 AIS_StatusOfPick AddSelect (const Handle(AIS_InteractiveObject)& theObject)
938 return AddSelect (theObject->GlobalSelOwner());
941 //! Selects everything found in the bounding rectangle
942 //! defined by the pixel minima and maxima, XPMin,
943 //! YPMin, XPMax, and YPMax in the view, aView
944 //! The objects detected are passed to the main viewer,
945 //! which is then updated.
946 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);
948 //! polyline selection; clears the previous picked list
949 Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
951 //! Stores and hilights the previous detected; Unhilights
952 //! the previous picked.
953 Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean updateviewer = Standard_True);
955 //! adds the last detected to the list of previous picked.
956 //! if the last detected was already declared as picked,
957 //! removes it from the Picked List.
958 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean updateviewer = Standard_True);
960 //! adds the last detected to the list of previous picked.
961 //! if the last detected was already declared as picked,
962 //! removes it from the Picked List.
963 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
965 //! rectangle of selection ; adds new detected entities into the
966 //! picked list, removes the detected entities that were already stored...
967 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);
969 //! Specify whether selected object must be hilighted when mouse cursor
970 //! is moved above it (in MoveTo method). By default this value is false and
971 //! selected object is not hilighted in this case.
972 void SetToHilightSelected (const Standard_Boolean toHilight);
974 //! Return value specified whether selected object must be hilighted
975 //! when mouse cursor is moved above it
976 Standard_Boolean ToHilightSelected() const;
979 //! @name OBSOLETE METHODS THAT ARE VALID FOR LOCAL CONTEXT ONLY
981 //! Updates the view of the current object in open context.
982 //! Objects selected when there is no open local context
983 //! are called current objects; those selected in open
984 //! local context, selected objects.
985 //! If a local context is open and if updateviewer equals
986 //! Standard_False, the presentation of the Interactive
987 //! Object activates the selection mode; the object is
988 //! displayed but no viewer will be updated.
989 Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
992 //! Allows to add or remove the object given to the list of current and highlight/unhighlight it
993 //! correspondingly. Is valid for global context only; for local context use method AddOrRemoveSelected.
994 //! Since this method makes sence only for neutral point selection of a whole object, if 0 selection
995 //! of the object is empty this method simply does nothing.
996 Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
997 const Standard_Boolean theIsToUpdateViewer = Standard_True);
999 //! Updates the list of current objects, i.e. hilights new
1000 //! current objects, removes hilighting from former current objects.
1001 //! Objects selected when there is no open local context
1002 //! are called current objects; those selected in open
1003 //! local context, selected objects.
1004 Standard_EXPORT void UpdateCurrent();
1007 //! Returns the current selection touched by the cursor.
1008 //! Objects selected when there is no open local context
1009 //! are called current objects; those selected in open
1010 //! local context, selected objects.
1011 Standard_Boolean WasCurrentTouched() const;
1013 void SetOkCurrent();
1016 //! Returns true if there is a non-null interactive object in Neutral Point.
1017 //! Objects selected when there is no open local context are called current objects;
1018 //! those selected in open local context, selected objects.
1019 Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const;
1022 //! Initializes a scan of the current selected objects in
1024 //! Objects selected when there is no open local context
1025 //! are called current objects; those selected in open
1026 //! local context, selected objects.
1027 Standard_EXPORT void InitCurrent();
1030 //! Returns true if there is another object found by the
1031 //! scan of the list of current objects.
1032 //! Objects selected when there is no open local context
1033 //! are called current objects; those selected in open
1034 //! local context, selected objects.
1035 Standard_EXPORT Standard_Boolean MoreCurrent() const;
1038 //! Continues the scan to the next object in the list of
1039 //! current objects.
1040 //! Objects selected when there is no open local context
1041 //! are called current objects; those selected in open
1042 //! local context, selected objects.
1043 Standard_EXPORT void NextCurrent();
1046 //! Returns the current interactive object.
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 Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
1052 Standard_EXPORT Standard_Integer NbCurrents();
1054 //! Highlights current objects.
1055 //! Objects selected when there is no open local context
1056 //! are called current objects; those selected in open
1057 //! local context, selected objects.
1058 //! If a local context is open and if updateviewer equals
1059 //! Standard_False, the presentation of the Interactive
1060 //! Object activates the selection mode; the object is
1061 //! displayed but no viewer will be updated.
1062 Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
1064 //! Removes highlighting from current objects.
1065 //! Objects selected when there is no open local context
1066 //! are called current objects; those selected in open
1067 //! local context, selected objects.
1068 //! If a local context is open and if updateviewer equals
1069 //! Standard_False, the presentation of the Interactive
1070 //! Object activates the selection mode; the object is
1071 //! displayed but no viewer will be updated.
1072 Standard_EXPORT void UnhilightCurrents (const Standard_Boolean updateviewer = Standard_True);
1074 //! Empties previous current objects in order to get the
1075 //! current objects detected by the selector using
1077 //! Objects selected when there is no open local context
1078 //! are called current objects; those selected in open
1079 //! local context, selected objects.
1080 //! If a local context is open and if updateviewer equals
1081 //! Standard_False, the presentation of the Interactive
1082 //! Object activates the selection mode; the object is
1083 //! displayed but no viewer will be updated.
1084 Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
1086 //! @return current mouse-detected shape or empty (null) shape, if current interactive object
1087 //! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
1088 Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
1090 //! @return current mouse-detected interactive object or null object, if there is no
1091 //! currently detected interactives
1092 Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
1094 //! @name COMMON SELECTION METHODS VALID FOR BOTH GLOBAL AND LOCAL CONTEXT
1096 //! Unhighlights previously selected owners and marks them as not selected.
1097 //! Marks owner given as selected and highlights it.
1098 //! Performs selection filters check.
1099 Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
1100 const Standard_Boolean theToUpdateViewer = Standard_True);
1102 //! Puts the interactive object aniObj in the list of
1103 //! selected objects.
1104 //! If a local context is open and if updateviewer equals
1105 //! Standard_False, the presentation of the Interactive
1106 //! Object activates the selection mode; the object is
1107 //! displayed but no viewer will be updated.
1108 //! Performs selection filters check.
1109 Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
1110 const Standard_Boolean theToUpdateViewer = Standard_True);
1112 //! Updates the list of selected objects:
1113 //! i.e. highlights the newely selected ones and unhighlights previously selected objects.
1114 Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1116 //! Allows to highlight or unhighlight the owner given depending on its selection status
1117 Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
1118 const Standard_Boolean theToUpdateViewer = Standard_True);
1120 //! Highlights selected objects.
1121 //! If a local context is open and if updateviewer equals
1122 //! Standard_False, the presentation of the Interactive
1123 //! Object activates the selection mode; the object is
1124 //! displayed but no viewer will be updated.
1125 Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1127 //! Removes highlighting from selected objects.
1128 //! If a local context is open and if updateviewer equals
1129 //! Standard_False, the presentation of the Interactive
1130 //! Object activates the selection mode; the object is
1131 //! displayed but no viewer will be updated.
1132 Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1134 //! Empties previous selected objects in order to get the
1135 //! selected objects detected by the selector using
1137 //! If a local context is open and if updateviewer equals
1138 //! Standard_False, the presentation of the Interactive
1139 //! Object activates the selection mode; the object is
1140 //! displayed but no viewer will be updated.
1141 Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1143 //! No right to Add a selected Shape (Internal Management
1144 //! of shape Selection).
1145 //! A Previous selected shape may only be removed.
1146 Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& aShape, const Standard_Boolean updateviewer = Standard_True);
1148 //! Allows to highlight or unhighlight the owner given depending on its selection status
1149 Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
1150 const Standard_Boolean theToUpdateViewer = Standard_True);
1152 //! Returns true is the owner given is selected
1153 Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const;
1155 //! Returns true is the object given is selected
1156 Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& theObj) const;
1158 //! Returns the first selected object in the list of current selected.
1159 Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject();
1161 //! Initializes a scan of the selected objects.
1162 Standard_EXPORT void InitSelected();
1164 //! Returns true if there is another object found by the
1165 //! scan of the list of selected objects.
1166 Standard_EXPORT Standard_Boolean MoreSelected() const;
1168 //! Continues the scan to the next object in the list of
1169 //! selected objects.
1170 Standard_EXPORT void NextSelected();
1172 Standard_EXPORT Standard_Integer NbSelected();
1174 //! Returns true if the interactive context has a shape
1175 //! selected in it which results from the decomposition of
1177 //! If HasSelectedShape returns true, SelectedShape
1178 //! returns the shape which has been shown to be
1179 //! selected. Interactive returns the Interactive Object
1180 //! from which the shape has been selected.
1181 //! If HasSelectedShape returns false, Interactive
1182 //! returns the interactive entity selected by the click of the mouse.
1183 Standard_EXPORT Standard_Boolean HasSelectedShape() const;
1185 //! Returns the selected shape.
1186 Standard_EXPORT TopoDS_Shape SelectedShape() const;
1188 //! Returns the owner of the selected entity resulting
1189 //! from the decomposition of another entity.
1190 Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const;
1192 //! Returns a collection containing all entity owners
1193 //! created for the interactive object <theIObj> in
1194 //! the selection mode theMode (in all active modes
1195 //! if the Mode == -1)
1196 Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
1197 const Handle(AIS_InteractiveObject)& theIObj,
1198 const Standard_Integer theMode = -1) const;
1200 Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const;
1202 //! Returns true if the applicative object has an owner
1203 //! from Interactive attributed to it.
1204 Standard_EXPORT Standard_Boolean HasApplicative() const;
1207 //! Returns the owner of the applicative entity detected
1208 //! in interactive context. The owner can be a shape for
1209 //! a set of sub-shapes or a sub-shape for sub-shapes
1210 //! which it is composed of.
1211 Standard_EXPORT Handle(Standard_Transient) Applicative() const;
1214 //! Returns true if there is a mouse-detected entity in local 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 Standard_Boolean HasDetected() const;
1223 //! Returns true if there is a detected shape in local context.
1224 //! If there is no open local context, the objects selected
1225 //! are called current objects; selected objects if there is
1226 //! one. Iterators allow entities to be recovered in either
1227 //! case. This method is one of a set which allows you to
1228 //! manipulate the objects which have been placed in these two lists.
1229 Standard_EXPORT Standard_Boolean HasDetectedShape() const;
1232 //! Returns the shape detected in local context.
1233 //! If there is no open local context, the objects selected
1234 //! are called current objects; selected objects if there is
1235 //! one. Iterators allow entities to be recovered in either
1236 //! case. This method is one of a set which allows you to
1237 //! manipulate the objects which have been placed in these two lists.
1238 Standard_EXPORT const TopoDS_Shape& DetectedShape() const;
1241 //! Returns the interactive objects last detected in open context.
1242 //! If there is no open local context, the objects selected
1243 //! are called current objects; selected objects if there is
1244 //! one. Iterators allow entities to be recovered in either
1245 //! case. This method is one of a set which allows you to
1246 //! manipulate the objects which have been placed in these two lists.
1247 Standard_EXPORT Handle(AIS_InteractiveObject) DetectedInteractive() const;
1249 //! returns the owner of the detected sensitive primitive.
1250 Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedOwner() const;
1253 //! Initialization for iteration through mouse-detected objects in
1254 //! interactive context or in local context if it is opened.
1255 Standard_EXPORT void InitDetected();
1258 //! @return true if there is more mouse-detected objects after the current one
1259 //! during iteration through mouse-detected interactive objects.
1260 Standard_EXPORT Standard_Boolean MoreDetected() const;
1263 //! Gets next current object during iteration through mouse-detected
1264 //! interactive objects.
1265 Standard_EXPORT void NextDetected();
1267 //! Opens local contexts and specifies how this is to be
1268 //! done. The options listed above function in the following manner:
1269 //! - UseDisplayedObjects -allows you to load or not
1270 //! load the interactive objects visualized at Neutral
1271 //! Point in the local context which you open. If false,
1272 //! the local context is empty after being opened. If
1273 //! true, the objects at Neutral Point are loaded by their
1274 //! default selection mode.
1275 //! - AllowShapeDecomposition -AIS_Shape allows or
1276 //! prevents decomposition in standard shape location
1277 //! mode of objects at Neutral Point which are
1278 //! type-"privileged". This Flag is only taken into
1279 //! account when UseDisplayedObjects is true.
1280 //! - AcceptEraseOfObjects -authorises other local
1281 //! contexts to erase the interactive objects present in
1282 //! this context. This option is rarely used.
1283 //! - BothViewers - Has no use currently defined.
1284 //! This method returns the index of the created local
1285 //! context. It should be kept and used to close the context.
1286 //! Opening a local context allows you to prepare an
1287 //! environment for temporary presentations and
1288 //! selections which will disappear once the local context is closed.
1289 //! You can open several local contexts, but only the last
1290 //! one will be active.
1291 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);
1293 //! Allows you to close local contexts. For greater
1294 //! security, you should close the context with the
1295 //! index Index given on opening.
1296 //! When you close a local context, the one before,
1297 //! which is still on the stack, reactivates. If none is
1298 //! left, you return to Neutral Point.
1299 //! If a local context is open and if updateviewer
1300 //! equals Standard_False, the presentation of the
1301 //! Interactive Object activates the selection mode; the
1302 //! object is displayed but no viewer will be updated.
1304 //! When the index isn't specified, the current context
1305 //! is closed. This option can be dangerous, as other
1306 //! Interactive Functions can open local contexts
1307 //! without necessarily warning the user.
1308 Standard_EXPORT void CloseLocalContext (const Standard_Integer Index = -1, const Standard_Boolean updateviewer = Standard_True);
1310 //! returns -1 if no opened local context.
1311 Standard_EXPORT Standard_Integer IndexOfCurrentLocal() const;
1314 //! Allows you to close all local contexts at one go and
1315 //! return to Neutral Point.
1316 //! If a local context is open and if updateviewer equals
1317 //! Standard_False, the presentation of the Interactive
1318 //! Object activates the selection mode; the object is
1319 //! displayed but no viewer will be updated.
1320 Standard_EXPORT void CloseAllContexts (const Standard_Boolean updateviewer = Standard_True);
1322 //! to be used only with no opened
1323 //! local context.. displays and activates objects in their
1324 //! original state before local contexts were opened...
1325 Standard_EXPORT void ResetOriginalState (const Standard_Boolean updateviewer = Standard_True);
1327 //! clears Objects/Filters/Activated Modes list in the current opened
1329 Standard_EXPORT void ClearLocalContext (const AIS_ClearMode TheMode = AIS_CM_All);
1331 Standard_EXPORT void UseDisplayedObjects();
1333 //! when a local Context is opened, one is able to
1334 //! use/not use the displayed objects at neutral point
1336 Standard_EXPORT void NotUseDisplayedObjects();
1338 //! initializes the list of presentations to be displayed
1339 //! returns False if no local context is opened.
1340 Standard_EXPORT Standard_Boolean BeginImmediateDraw();
1342 //! returns True if <anIObj> has been stored in the list.
1343 Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0);
1345 //! returns True if the immediate display has been done.
1346 Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_View)& theView);
1348 //! Uses the First Active View of Main Viewer!
1349 //! returns True if the immediate display has been done.
1350 Standard_EXPORT Standard_Boolean EndImmediateDraw();
1352 Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
1355 //! Sets the highlighting status aStatus of detected and
1356 //! selected entities.
1357 //! Whether you are in Neutral Point or local context, this
1358 //! is automatically managed by the Interactive Context.
1359 //! This function allows you to disconnect the automatic mode.
1360 Standard_EXPORT void SetAutomaticHilight (const Standard_Boolean aStatus);
1363 //! Returns true if the automatic highlight mode is active
1364 //! in an open context.
1365 Standard_EXPORT Standard_Boolean AutomaticHilight() const;
1367 //! Enables/Disables the Z detection.
1368 //! If TRUE the detection echo can be partially hidden by the
1369 //! detected object.
1370 Standard_EXPORT void SetZDetection (const Standard_Boolean aStatus = Standard_False);
1372 //! Retrieves the Z detection state.
1373 Standard_EXPORT Standard_Boolean ZDetection() const;
1375 //! Activates the selection mode aMode whose index is
1376 //! given, for the given interactive entity anIobj.
1377 Standard_EXPORT void Activate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode = 0, const Standard_Boolean theIsForce = Standard_False);
1379 //! Deactivates all the activated selection modes
1381 Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIObj);
1384 //! Deactivates all the activated selection modes of the
1385 //! interactive object anIobj with a given selection mode aMode.
1386 Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode);
1389 //! Returns the list of activated selection modes in an open context.
1390 Standard_EXPORT void ActivatedModes (const Handle(AIS_InteractiveObject)& anIobj, TColStd_ListOfInteger& theList) const;
1392 //! to be Used only with opened local context and
1393 //! if <anIobj> is of type shape...
1394 //! if <aStatus> = True <anIobj> will be sensitive to
1395 //! shape selection modes activation.
1396 //! = False, <anIobj> will not be senstive
1398 Standard_EXPORT void SetShapeDecomposition (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean aStatus);
1401 //! Sets the temporary graphic attributes of the entity
1402 //! anObj. These are provided by the attribute manager
1403 //! aDrawer and are valid for a particular local context only.
1404 //! If a local context is open and if updateviewer equals
1405 //! Standard_False, the presentation of the Interactive
1406 //! Object activates the selection mode; the object is
1407 //! displayed but no viewer will be updated.
1408 Standard_EXPORT void SetTemporaryAttributes (const Handle(AIS_InteractiveObject)& anObj, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Boolean updateviewer = Standard_True);
1411 //! Highlights, and removes highlights from, the displayed
1412 //! object aniobj which is displayed at Neutral Point with
1413 //! subintensity color; available only for active local
1414 //! context. There is no effect if there is no local context.
1415 //! If a local context is open and if updateviewer equals
1416 //! Standard_False, the presentation of the Interactive
1417 //! Object activates the selection mode; the object is
1418 //! displayed but no viewer will be updated.
1419 Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
1422 //! Removes the subintensity option for the entity aniobj.
1423 //! If a local context is open and if updateviewer equals
1424 //! Standard_False, the presentation of the Interactive
1425 //! Object activates the selection mode; the object is
1426 //! displayed but no viewer will be updated.
1427 Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
1429 //! hilights/unhilights displayed objects which are displayed at
1430 //! neutral state with subintensity color;
1431 //! available only for active local context.
1432 //! No effect if no local context.
1433 Standard_EXPORT void SubIntensityOn (const Standard_Boolean updateviewer = Standard_True);
1435 //! removes subintensity option for all objects.
1436 Standard_EXPORT void SubIntensityOff (const Standard_Boolean updateviewer = Standard_True);
1438 //! Allows you to add the filter aFilter to Neutral Point or
1439 //! to a local context if one or more selection modes have been activated.
1440 //! Only type filters may be active in Neutral Point.
1441 Standard_EXPORT void AddFilter (const Handle(SelectMgr_Filter)& aFilter);
1444 //! Removes a filter from Neutral Point or a local context
1445 //! if one or more selection modes have been activated.
1446 //! Only type filters are activated in Neutral Point.
1447 Standard_EXPORT void RemoveFilter (const Handle(SelectMgr_Filter)& aFilter);
1449 //! Remove a filter to Neutral Point or a local context if
1450 //! one or more selection modes have been activated.
1451 //! Only type filters are active in Neutral Point.
1452 Standard_EXPORT void RemoveFilters();
1454 //! Provides an alternative to the Display methods when
1455 //! activating specific selection modes. This has the
1456 //! effect of activating the corresponding selection mode
1457 //! aStandardActivation for all objects in Local Context
1458 //! which accept decomposition into sub-shapes.
1459 //! Every new Object which has been loaded into the
1460 //! interactive context and which answers these
1461 //! decomposition criteria is automatically activated
1462 //! according to these modes.
1464 //! If you have opened a local context by loading an
1465 //! object with the default options
1466 //! (<AllowShapeDecomposition >= Standard_True), all
1467 //! objects of the "Shape" type are also activated with
1468 //! the same modes. You can act on the state of these
1469 //! "Standard" objects by using SetShapeDecomposition(Status).
1470 Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1473 //! Provides an alternative to the Display methods when
1474 //! deactivating specific selection modes. This has the
1475 //! effect of deactivating the corresponding selection
1476 //! mode aStandardActivation for all objects in Local
1477 //! Context which accept decomposition into sub-shapes.
1478 Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1481 //! Returns the list of activated standard selection modes
1482 //! available in a local context.
1483 Standard_EXPORT const TColStd_ListOfInteger& ActivatedStandardModes() const;
1486 //! Returns the list of filters active in a local context.
1487 Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
1490 //! Returns the default attribute manager.
1491 //! This contains all the color and line attributes which
1492 //! can be used by interactive objects which do not have
1493 //! their own attributes.
1494 const Handle(Prs3d_Drawer)& DefaultDrawer() const;
1496 //! Returns the current viewer.
1497 const Handle(V3d_Viewer)& CurrentViewer() const;
1499 //! Returns the list of displayed objects of a particular
1500 //! Type WhichKind and Signature WhichSignature. By
1501 //! Default, WhichSignature equals -1. This means that
1502 //! there is a check on type only.
1503 Standard_EXPORT void DisplayedObjects (AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1505 //! gives the list of displayed objects of a particular
1506 //! Type and signature.
1507 //! by Default, <WhichSignature> = -1 means
1508 //! control only on <WhichKind>.
1509 Standard_EXPORT void DisplayedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1512 //! Returns the list theListOfIO of erased objects (hidden objects)
1513 //! particular Type WhichKind and Signature WhichSignature.
1514 //! By Default, WhichSignature equals 1. This means
1515 //! that there is a check on type only.
1516 Standard_EXPORT void ErasedObjects (AIS_ListOfInteractive& theListOfIO) const;
1518 //! gives the list of erased objects (hidden objects)
1519 //! Type and signature
1520 //! by Default, <WhichSignature> = -1 means
1521 //! control only on <WhichKind>.
1522 Standard_EXPORT void ErasedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& theListOfIO) const;
1525 //! Returns the list theListOfIO of objects with indicated display status
1526 //! particular Type WhichKind and Signature WhichSignature.
1527 //! By Default, WhichSignature equals 1. This means
1528 //! that there is a check on type only.
1529 Standard_EXPORT void ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1531 //! gives the list of objects with indicated display status
1532 //! Type and signature
1533 //! by Default, <WhichSignature> = -1 means
1534 //! control only on <WhichKind>.
1535 Standard_EXPORT void ObjectsByDisplayStatus (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1537 //! fills <aListOfIO> with objects of a particular
1538 //! Type and Signature with no consideration of display status.
1539 //! by Default, <WhichSignature> = -1 means
1540 //! control only on <WhichKind>.
1541 //! if <WhichKind> = AIS_KOI_None and <WhichSignature> = -1,
1542 //! all the objects are put into the list.
1543 Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO, const AIS_KindOfInteractive WhichKind = AIS_KOI_None, const Standard_Integer WhichSignature = -1) const;
1545 //! Returns true if there is an open context.
1546 Standard_Boolean HasOpenedContext() const;
1548 //! This method is only intended for advanced operation, particularly with
1549 //! the aim to improve performance when many objects have to be selected
1550 //! together. Otherwise, you should use other (non-internal) methods of
1551 //! class AIS_InteractiveContext without trying to obtain an instance of
1552 //! AIS_LocalContext.
1553 Handle(AIS_LocalContext) LocalContext() const;
1555 const Handle(SelectMgr_SelectionManager)& SelectionManager() const;
1557 const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const;
1559 const Handle(StdSelect_ViewerSelector3d)& MainSelector() const;
1561 Standard_EXPORT Handle(StdSelect_ViewerSelector3d) LocalSelector() const;
1563 //! Clears all the structures which don't
1564 //! belong to objects displayed at neutral point
1565 //! only effective when no Local Context is opened...
1566 //! returns the number of removed structures from the viewers.
1567 Standard_EXPORT Standard_Integer PurgeDisplay();
1569 Standard_EXPORT Standard_Integer HighestIndex() const;
1571 Standard_EXPORT void DisplayActiveSensitive (const Handle(V3d_View)& aView);
1573 Standard_EXPORT void ClearActiveSensitive (const Handle(V3d_View)& aView);
1575 //! Fits the view correspondingly to the bounds of selected objects.
1576 //! Infinite objects are ignored if infinite state of AIS_InteractiveObject
1578 Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView, const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
1580 Standard_EXPORT void DisplayActiveSensitive (const Handle(AIS_InteractiveObject)& anObject, const Handle(V3d_View)& aView);
1582 //! returns if possible,
1583 //! the first local context where the object is seen
1584 Standard_EXPORT Standard_Boolean IsInLocal (const Handle(AIS_InteractiveObject)& anObject, Standard_Integer& TheIndex) const;
1586 //! Rebuilds 1st level of BVH selection forcibly
1587 Standard_EXPORT void RebuildSelectionStructs();
1589 //! setup object visibility in specified view,
1590 //! has no effect if object is not disaplyed in this context.
1591 Standard_EXPORT void SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisible);
1593 //! Disconnects theObjToDisconnect from theAssembly and removes dependent selection structures
1594 Standard_EXPORT void Disconnect (const Handle(AIS_InteractiveObject)& theAssembly, const Handle(AIS_InteractiveObject)& theObjToDisconnect = NULL);
1596 //! Query objects visible or hidden in specified view due to affinity mask.
1597 Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisibleInView, const AIS_DisplayStatus theStatus = AIS_DS_None) const;
1599 //! Redraws immediate structures in all views of the viewer given taking into account its visibility.
1600 Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
1603 friend class AIS_LocalContext;
1606 DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext,MMgt_TShared)
1610 Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
1612 Standard_EXPORT void EraseGlobal (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
1614 Standard_EXPORT void ClearGlobal (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
1616 Standard_EXPORT void ClearGlobalPrs (const Handle(AIS_InteractiveObject)& anObj, const Standard_Integer aMode, const Standard_Boolean updateviewer = Standard_True);
1618 Standard_EXPORT void InitAttributes();
1620 Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
1623 Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True);
1626 Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True);
1628 //! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
1629 Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
1631 //! Helper function that highlights the owner given with <theStyle> without
1632 //! performing AutoHighlight checks, e.g. is used for dynamic highlight.
1633 Standard_EXPORT void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
1634 const Handle(V3d_Viewer)& theViewer = NULL);
1636 //! Helper function that highlights the owner given with <theStyle> with check
1637 //! for AutoHighlight, e.g. is used for selection.
1638 Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
1640 //! Helper function that highlights global owner of the object given with <theStyle> with check
1641 //! for AutoHighlight, e.g. is used for selection.
1642 //! If global owner is null, it simply highlights the whole object
1643 Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
1644 const Handle(Graphic3d_HighlightStyle)& theStyle,
1645 const Standard_Integer theMode) const;
1647 //! Helper function that unhighlights all owners that are stored in current AIS_Selection.
1648 //! The function updates global status and selection state of owner and interactive object.
1649 //! If the parameter <theIsToHilightSubIntensity> is set to true, interactive objects with sub-intensity
1650 //! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
1651 Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
1653 //! Helper function that unhighlights global selection owner of given interactive.
1654 //! The function does not perform any updates of global or owner status
1655 Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode) const;
1657 //! Helper function that turns on sub-intensity in global status and highlights
1658 //! given objects with sub-intensity color
1659 //! @param theObject [in] the object. If NULL is given, than sub-intensity will be turned on for
1660 //! all inveractive objects of the context
1661 //! @param theDispMode [in] display mode. If -1 is given, sub-intensity will be turned on for
1662 //! all display modes in global status's list of modes
1663 //! @param theIsDisplayedOnly [in] is true if sub-intensity should be applied only to objects with
1664 //! status AIS_DS_Displayed
1665 Standard_EXPORT void turnOnSubintensity (const Handle(AIS_InteractiveObject)& theObject = NULL,
1666 const Standard_Integer theDispMode = -1,
1667 const Standard_Boolean theIsDisplayedOnly = Standard_True) const;
1669 //! Helper function that highlights the object with sub-intensity color without any checks
1670 //! @param theObject [in] the object that will be highlighted
1671 //! @param theMode [in] display mode
1672 Standard_EXPORT void highlightWithSubintensity (const Handle(AIS_InteractiveObject)& theObject,
1673 const Standard_Integer theMode) const;
1675 //! Helper function that highlights the owner with sub-intensity color without any checks
1676 //! @param theOwner [in] the owner that will be highlighted
1677 //! @param theMode [in] display mode
1678 Standard_EXPORT void highlightWithSubintensity (const Handle(SelectMgr_EntityOwner)& theOwner,
1679 const Standard_Integer theMode) const;
1681 //! Helper function that returns correct dynamic highlight style for the object:
1682 //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1683 //! dynamic highlight style of interactive context will be returned.
1684 //! @param theObj [in] the object to check
1685 const Handle(Graphic3d_HighlightStyle)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj) const
1687 const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
1688 return !aHiDrawer.IsNull() && aHiDrawer->HasOwnHighlightStyle()
1689 ? aHiDrawer->HighlightStyle() : myHiStyle;
1692 //! Helper function that returns correct selection style for the object:
1693 //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1694 //! selection style of interactive context will be returned.
1695 //! @param theObj [in] the object to check
1696 const Handle(Graphic3d_HighlightStyle)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj) const
1698 const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
1699 return !aHiDrawer.IsNull() && aHiDrawer->HasOwnSelectionStyle()
1700 ? aHiDrawer->SelectionStyle() : mySelStyle;
1705 AIS_DataMapOfIOStatus myObjects;
1706 Handle(SelectMgr_SelectionManager) mgrSelector;
1707 Handle(PrsMgr_PresentationManager3d) myMainPM;
1708 Handle(V3d_Viewer) myMainVwr;
1709 Handle(StdSelect_ViewerSelector3d) myMainSel;
1710 Handle(SelectMgr_EntityOwner) myLastPicked;
1711 Handle(SelectMgr_EntityOwner) myLastinMain;
1712 Standard_Boolean myWasLastMain;
1713 Standard_Boolean myCurrentTouched;
1714 Standard_Boolean mySelectedTouched;
1715 Standard_Boolean myToHilightSelected;
1716 Handle(SelectMgr_OrFilter) myFilters;
1717 Handle(Prs3d_Drawer) myDefaultDrawer;
1718 Handle(AIS_Selection) mySelection;
1719 Quantity_NameOfColor myDefaultColor;
1720 Handle(Graphic3d_HighlightStyle) myHiStyle;
1721 Handle(Graphic3d_HighlightStyle) mySelStyle;
1722 Quantity_NameOfColor myPreselectionColor;
1723 Handle(Graphic3d_HighlightStyle) mySubintStyle;
1724 Standard_Integer myDisplayMode;
1725 AIS_DataMapOfILC myLocalContexts;
1726 Standard_Integer myCurLocalIndex;
1727 Handle(V3d_View) mylastmoveview;
1728 AIS_SequenceOfInteractive myAISDetectedSeq;
1729 Standard_Integer myAISCurDetected;
1730 Standard_Boolean myZDetectionFlag;
1731 Standard_Boolean myIsAutoActivateSelMode;
1737 #include <AIS_InteractiveContext.lxx>
1743 #endif // _AIS_InteractiveContext_HeaderFile