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)& theIObj,
162 const Standard_Boolean theToUpdateViewer);
164 //! Controls the choice between the using the display
165 //! and selection modes of open local context which you
166 //! have defined and activating those available by default.
167 //! If no Local Context is opened. and the Interactive
168 //! Object theIObj has no display mode of its own, the
169 //! default display mode, 0, is used. Likewise, if theIObj
170 //! has no selection mode of its own, the default one, 0, is used.
171 //! If a local context is open and if theToUpdateViewer equals
172 //! Standard_False, the presentation of the Interactive
173 //! Object activates the selection mode; the object is
174 //! displayed but no viewer will be updated.
175 //! If theSelectionMode equals -1, theIObj will not be
176 //! activated: it will be displayed but will not be selectable.
177 //! Use this if you want to view the object in open local
178 //! context without selection. Note: This option is only
179 //! available in Local Context.
180 //! If theToAllowDecomposition equals true, theIObj can have
181 //! subshapes detected by selection mechanisms. theIObj
182 //! must be able to give a shape selection modes which
183 //! fit the AIS_Shape selection modes:
187 Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj,
188 const Standard_Integer theDispMode,
189 const Standard_Integer theSelectionMode,
190 const Standard_Boolean theToUpdateViewer,
191 const Standard_Boolean theToAllowDecomposition = Standard_True,
192 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)& theIObj,
211 const Standard_Boolean theToUpdateViewer);
213 //! Hides all objects. The object's presentations are simply
214 //! flagged as invisible and therefore excluded from redrawing.
215 //! To show all hidden objects, use DisplayAll().
216 Standard_EXPORT void EraseAll (const Standard_Boolean theToUpdateViewer);
218 //! Displays all hidden objects.
219 Standard_EXPORT void DisplayAll (const Standard_Boolean theToUpdateViewer);
222 //! Hides selected objects. The object's presentations are simply
223 //! flagged as invisible and therefore excluded from redrawing.
224 //! To show hidden objects, use Display().
225 Standard_EXPORT void EraseSelected (const Standard_Boolean theToUpdateViewer);
227 //! Displays selected objects if a local context is open.
228 //! Displays current objects if there is no active local context.
229 //! Objects selected when there is no open local context
230 //! are called current objects; those selected in open
231 //! local context, selected objects.
232 //! If a local context is open and if updateviewer equals
233 //! Standard_False, the presentation of the Interactive
234 //! Object activates the selection mode; the object is
235 //! displayed but no viewer will be updated.
236 Standard_EXPORT void DisplaySelected (const Standard_Boolean theToUpdateViewer);
238 //! Changes the status of a temporary object. It will be
239 //! kept at the neutral point, i.e. put in the list of
240 //! displayed objects along withwith its temporary
241 //! attributes. These include display mode and
242 //! selection mode, for example.
243 //! Returns true if done.
244 //! inWhichLocal gives the local context in which anIObj
245 //! is displayed. By default, the index -1 refers to the last
246 //! Local Context opened.
247 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
248 Standard_EXPORT Standard_Boolean KeepTemporary (const Handle(AIS_InteractiveObject)& anIObj, const Standard_Integer InWhichLocal = -1);
250 //! Empties the graphic presentation of the mode
251 //! indexed by aMode.
252 //! If a local context is open and if updateviewer equals
253 //! Standard_False, the presentation of the Interactive
254 //! Object activates the selection mode; the object is
255 //! displayed but no viewer will be updated.
257 //! Removes anIobj. anIobj is still active if it was
258 //! previously activated.
259 Standard_EXPORT void ClearPrs (const Handle(AIS_InteractiveObject)& theIObj,
260 const Standard_Integer theMode,
261 const Standard_Boolean theToUpdateViewer);
263 //! Removes aniobj from every viewer. aniobj is no
264 //! longer referenced in the Context.
265 //! If a local context is open and if updateviewer equals
266 //! Standard_False, the presentation of the Interactive
267 //! Object activates the selection mode; the object is
268 //! displayed but no viewer will be updated.
269 Standard_EXPORT void Remove (const Handle(AIS_InteractiveObject)& theIObj,
270 const Standard_Boolean theToUpdateViewer);
272 //! Removes all the objects from all opened Local Contexts
273 //! and from the Neutral Point
274 Standard_EXPORT void RemoveAll (const Standard_Boolean theToUpdateViewer);
276 //! Updates the display in the viewer to take dynamic
277 //! detection into account. On dynamic detection by the
278 //! mouse cursor, sensitive primitives are highlighted.
279 //! The highlight color of entities detected by mouse
280 //! movement is white by default.
281 //! If a local context is open and if updateviewer equals
282 //! Standard_False, the presentation of the Interactive
283 //! Object activates the selection mode; the object is
284 //! displayed but no viewer will be updated.
285 Standard_DEPRECATED("Deprecated method Hilight()")
286 void Hilight (const Handle(AIS_InteractiveObject)& theObj,
287 const Standard_Boolean theIsToUpdateViewer)
289 return HilightWithColor (theObj, myStyles[Prs3d_TypeOfHighlight_Dynamic], theIsToUpdateViewer);
292 //! Changes the color of all the lines of the object in view,
293 //! aniobj. It paints these lines the color passed as the
295 //! If a local context is open and if updateviewer equals
296 //! Standard_False, the presentation of the Interactive
297 //! Object activates the selection mode; the object is
298 //! displayed but no viewer will be updated.
299 Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& theObj,
300 const Handle(Prs3d_Drawer)& theStyle,
301 const Standard_Boolean theToUpdateViewer);
304 //! Removes hilighting from the entity aniobj. Updates the viewer.
305 //! If a local context is open and if updateviewer equals
306 //! Standard_False, the presentation of the Interactive
307 //! Object activates the selection mode; the object is
308 //! displayed but no viewer will be updated.
309 Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& theIObj,
310 const Standard_Boolean theToUpdateViewer);
312 //! Sets the display priority aPriority of the seen parts
313 //! presentation of the entity anIobj.
314 Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aPriority);
316 //! Set Z layer id for interactive object.
317 //! The Z layers can be used to display temporarily presentations of some object in front of the other objects in the scene.
318 //! The ids for Z layers are generated by V3d_Viewer.
319 Standard_EXPORT void SetZLayer (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theLayerId);
321 //! Get Z layer id set for displayed interactive object.
322 Standard_EXPORT Standard_Integer GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const;
324 //! Recomputes the seen parts presentation of the entity
325 //! aniobj. If allmodes equals true, all presentations are
326 //! present in the object even if unseen.
327 //! If a local context is open and if updateviewer equals
328 //! Standard_False, the presentation of the Interactive
329 //! Object activates the selection mode; the object is
330 //! displayed but no viewer will be updated.
331 Standard_EXPORT void Redisplay (const Handle(AIS_InteractiveObject)& theIObj,
332 const Standard_Boolean theToUpdateViewer,
333 const Standard_Boolean theAllModes = Standard_False);
335 //! Recomputes the Prs/Selection of displayed objects of
336 //! a given type and a given signature.
337 //! if signature = -1 doesnt take signature criterion.
338 Standard_EXPORT void Redisplay (const AIS_KindOfInteractive theTypeOfObject,
339 const Standard_Integer theSignature,
340 const Standard_Boolean theToUpdateViewer);
342 //! Recomputes the displayed presentations, flags the others
343 //! Doesn't update presentations
344 Standard_EXPORT void RecomputePrsOnly (const Handle(AIS_InteractiveObject)& theIObj,
345 const Standard_Boolean theToUpdateViewer,
346 const Standard_Boolean theAllModes = Standard_False);
348 //! Recomputes the active selections, flags the others
349 //! Doesn't update presentations
350 Standard_EXPORT void RecomputeSelectionOnly (const Handle(AIS_InteractiveObject)& anIObj);
352 //! Updates displayed interactive object by checking and
353 //! recomputing its flagged as "to be recomputed" presentation
354 //! and selection structures. This method does not force any
355 //! recomputation on its own. The method recomputes selections
356 //! even if they are loaded without activation in particular selector.
357 Standard_EXPORT void Update (const Handle(AIS_InteractiveObject)& theIObj,
358 const Standard_Boolean theUpdateViewer);
361 //! Sets 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 //! Note that display mode 3 is only used if you have an
370 //! AIS_Textured Shape.
371 Standard_EXPORT void SetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
372 const Standard_Integer theMode,
373 const Standard_Boolean theToUpdateViewer);
376 //! Unsets the display mode of seen Interactive Objects.
377 //! aMode provides the display mode index of the entity aniobj.
378 //! If updateviewer equals Standard_True, the
379 //! predominant mode aMode will overule the context mode.
380 //! If a local context is open and if updateviewer equals
381 //! Standard_False, the presentation of the Interactive
382 //! Object returns to the default selection mode; the
383 //! object is displayed but no viewer will be updated.
384 Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
385 const Standard_Boolean theToUpdateViewer);
387 //! Disables the mechanism of adaptive tolerance calculation in SelectMgr_ViewerSelector and
388 //! sets the given tolerance for ALL sensitive entities activated. For more information, see
389 //! SelectMgr_ViewerSelector documentation
390 //! Warning: When a local context is open the sensitivity is apply on it
391 //! instead on the main context.
392 Standard_EXPORT void SetPixelTolerance (const Standard_Integer aPrecision = 2);
394 //! Returns the pixel tolerance.
395 Standard_EXPORT Standard_Integer PixelTolerance() const;
397 //! Allows to manage sensitivity of a particular selection of interactive object theObject
398 //! and changes previous sensitivity value of all sensitive entities in selection with theMode
399 //! to the given theNewSensitivity.
400 Standard_EXPORT void SetSelectionSensitivity (const Handle(AIS_InteractiveObject)& theObject,
401 const Standard_Integer theMode,
402 const Standard_Integer theNewSensitivity);
404 //! Puts the location aLocation on the initial graphic
405 //! representation and the selection for the entity aniobj.
406 //! In other words, aniobj is visible and selectable at a
407 //! position other than initial position.
408 //! Graphic and selection primitives are not recomputed.
409 //! To clean the view correctly, you must reset the previous location.
410 Standard_EXPORT void SetLocation (const Handle(AIS_InteractiveObject)& aniobj, const TopLoc_Location& aLocation);
412 //! Puts the entity aniobj back into its initial position.
413 Standard_EXPORT void ResetLocation (const Handle(AIS_InteractiveObject)& aniobj);
416 //! Returns true if the entity aniobj has a location.
417 Standard_EXPORT Standard_Boolean HasLocation (const Handle(AIS_InteractiveObject)& aniobj) const;
420 //! Returns the location of the entity aniobj.
421 Standard_EXPORT TopLoc_Location Location (const Handle(AIS_InteractiveObject)& aniobj) const;
423 //! change the current facing model apply on polygons for
424 //! SetColor(), SetTransparency(), SetMaterial() methods
425 //! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is
426 //! applying both on the front and back face.
427 Standard_EXPORT void SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& aniobj, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE);
429 Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& theIObj,
430 const Quantity_NameOfColor theColor,
431 const Standard_Boolean theToUpdateViewer);
434 //! Sets the color of the selected entity.
435 //! If a local context is open and if updateviewer equals
436 //! Standard_False, the presentation of the Interactive
437 //! Object activates the selection mode; the object is
438 //! displayed but no viewer will be updated.
439 Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& theIObj,
440 const Quantity_Color& theColor,
441 const Standard_Boolean theToUpdateViewer);
443 //! Removes the color selection for the selected entity.
444 //! If a local context is open and if updateviewer equals
445 //! Standard_False, the presentation of the Interactive
446 //! Object activates the selection mode; the object is
447 //! displayed but no viewer will be updated.
448 Standard_EXPORT void UnsetColor (const Handle(AIS_InteractiveObject)& theIObj,
449 const Standard_Boolean theToUpdateViewer);
452 //! Sets the width of the entity aniobj.
453 //! If a local context is open and if updateviewer equals
454 //! Standard_False, the presentation of the Interactive
455 //! Object activates the selection mode; the object is
456 //! displayed but no viewer will be updated.
457 Standard_EXPORT virtual void SetWidth (const Handle(AIS_InteractiveObject)& theIObj,
458 const Standard_Real theValue,
459 const Standard_Boolean theToUpdateViewer);
462 //! Removes the width setting of the entity aniobj.
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 virtual void UnsetWidth (const Handle(AIS_InteractiveObject)& theIObj,
468 const Standard_Boolean theToUpdateViewer);
471 //! Provides the type of material setting for the view of
472 //! the entity aniobj.
473 //! The range of settings includes: BRASS, BRONZE,
474 //! GOLD, PEWTER, SILVER, STONE.
475 //! If a local context is open and if updateviewer equals
476 //! Standard_False, the presentation of the Interactive
477 //! Object activates the selection mode; the object is
478 //! displayed but no viewer will be updated.
479 Standard_EXPORT void SetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
480 const Graphic3d_NameOfMaterial theName,
481 const Standard_Boolean theToUpdateViewer);
484 //! Removes the type of material setting for viewing the
486 //! If a local context is open and if updateviewer equals
487 //! Standard_False, the presentation of the Interactive
488 //! Object activates the selection mode; the object is
489 //! displayed but no viewer will be updated.
490 Standard_EXPORT void UnsetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
491 const Standard_Boolean theToUpdateViewer);
493 //! Provides the transparency settings for viewing the
494 //! entity aniobj. The transparency value aValue may be
495 //! between 0.0, opaque, and 1.0, fully transparent.
496 //! If a local context is open and if updateviewer equals
497 //! Standard_False, the presentation of the Interactive
498 //! Object activates the selection mode; the object is
499 //! displayed but no viewer will be updated.
500 Standard_EXPORT void SetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
501 const Standard_Real theValue,
502 const Standard_Boolean theToUpdateViewer);
505 //! Removes the transparency settings for viewing the
506 //! entity aniobj. The transparency value aValue may be
507 //! between 0.0, opaque, and 1.0, fully transparent.
508 //! If a local context is open and if updateviewer equals
509 //! Standard_False, the presentation of the Interactive
510 //! Object activates the selection mode; the object is
511 //! displayed but no viewer will be updated.
512 Standard_EXPORT void UnsetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
513 const Standard_Boolean theToUpdateViewer);
516 //! Sets the attributes of the interactive object aniobj by
517 //! plugging the attribute manager aDrawer into the local
518 //! context. The graphic attributes of aDrawer such as
519 //! visualization mode, color, and material, are then used
520 //! to display aniobj.
521 //! If a local context is open and if updateviewer equals
522 //! Standard_False, the presentation of the Interactive
523 //! Object activates the selection mode; the object is
524 //! displayed but no viewer will be updated.
525 Standard_EXPORT void SetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
526 const Handle(Prs3d_Drawer)& theDrawer,
527 const Standard_Boolean theToUpdateViewer);
530 //! Removes the settings for local attributes of the entity
531 //! anObj and returns to the Neutral Point attributes or
532 //! those of the previous local context.
533 //! If a local context is open and if updateviewer equals
534 //! Standard_False, the presentation of the Interactive
535 //! Object activates the selection mode; the object is
536 //! displayed but no viewer will be updated.
537 Standard_EXPORT void UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
538 const Standard_Boolean theToUpdateViewer);
540 //! Sets up polygon offsets for the given AIS_InteractiveObject.
541 //! It simply calls anObj->SetPolygonOffsets()
542 Standard_EXPORT void SetPolygonOffsets (const Handle(AIS_InteractiveObject)& theIObj,
543 const Standard_Integer theMode,
544 const Standard_ShortReal theFactor,
545 const Standard_ShortReal theUnits,
546 const Standard_Boolean theToUpdateViewer);
548 //! simply calls anObj->HasPolygonOffsets()
549 Standard_EXPORT Standard_Boolean HasPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj) const;
551 //! Retrieves current polygon offsets settings for <anObj>.
552 Standard_EXPORT void PolygonOffsets (const Handle(AIS_InteractiveObject)& anObj, Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const;
554 //! Sets the size aSize of the trihedron.
555 //! Is used to change the default value 100 mm for
556 //! display of trihedra.
557 //! Use of this function in one of your own interactive
558 //! objects requires a call to the Compute function of the
559 //! new class. This will recalculate the presentation for
560 //! every trihedron displayed.
561 //! If a local context is open and if updateviewer equals
562 //! Standard_False, the presentation of the Interactive
563 //! Object activates the selection mode; the object is
564 //! displayed but no viewer will be updated.
565 Standard_EXPORT void SetTrihedronSize (const Standard_Real theSize,
566 const Standard_Boolean theToUpdateViewer);
568 //! returns the current value of trihedron size.
569 Standard_EXPORT Standard_Real TrihedronSize() const;
572 //! Sets the plane size defined by the length in the X
573 //! direction XSize and that in the Y direction YSize.
574 //! If a local context is open and if updateviewer equals
575 //! Standard_False, the presentation of the Interactive
576 //! Object activates the selection mode; the object is
577 //! displayed but no viewer will be updated.
578 Standard_EXPORT void SetPlaneSize (const Standard_Real theSizeX,
579 const Standard_Real theSizeY,
580 const Standard_Boolean theToUpdateViewer);
583 //! Sets the plane size aSize.
584 //! If a local context is open and if updateviewer equals
585 //! Standard_False, the presentation of the Interactive
586 //! Object activates the selection mode; the object is
587 //! displayed but no viewer will be updated.
588 //! May be used if PlaneSize returns true.
589 Standard_EXPORT void SetPlaneSize (const Standard_Real theSize,
590 const Standard_Boolean theToUpdateViewer);
592 //! Returns true if the length in the X direction XSize is
593 //! the same as that in the Y direction YSize.
594 Standard_EXPORT Standard_Boolean PlaneSize (Standard_Real& XSize, Standard_Real& YSize) const;
596 //! Returns the display status of the entity anIobj.
597 //! This will be one of the following:
598 //! - DS_Displayed displayed in main viewer
599 //! - DS_Erased hidden in main viewer
600 //! - DS_Temporary temporarily displayed
601 //! - DS_None nowhere displayed.
602 Standard_EXPORT AIS_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const;
605 //! Returns true if anIobj is displayed in the interactive context.
606 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const;
608 Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode) const;
610 //! Returns true if the object is marked as highlighted via its global
612 //! @param theObj [in] the object to check
613 Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const;
615 //! Returns true if the owner is marked as selected
616 //! @param theOwner [in] the owner to check
617 Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner) const;
619 //! Returns highlight style of the object if it is marked as highlighted via global status
620 //! @param theObj [in] the object to check
621 Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
622 Handle(Prs3d_Drawer)& theStyle) const;
624 //! Returns highlight style of the owner if it is selected
625 //! @param theOwner [in] the owner to check
626 Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
627 Handle(Prs3d_Drawer)& theStyle) const;
629 //! Returns the display priority of the entity anIobj. This
630 //! will be display mode of anIobj if it is in the main
632 Standard_EXPORT Standard_Integer DisplayPriority (const Handle(AIS_InteractiveObject)& anIobj) const;
635 //! Returns true if a view of the Interactive Object aniobj has color.
636 Standard_EXPORT Standard_Boolean HasColor (const Handle(AIS_InteractiveObject)& aniobj) const;
638 Standard_EXPORT Quantity_NameOfColor Color (const Handle(AIS_InteractiveObject)& aniobj) const;
641 //! Returns the color Color of the entity aniobj in the interactive context.
642 Standard_EXPORT void Color (const Handle(AIS_InteractiveObject)& aniobj, Quantity_Color& acolor) const;
645 //! Returns the width of the Interactive Object aniobj in
646 //! the interactive context.
647 Standard_EXPORT virtual Standard_Real Width (const Handle(AIS_InteractiveObject)& aniobj) const;
650 //! Returns the status astatus of the Interactive Context
651 //! for the view of the Interactive Object anObj.
652 Standard_EXPORT void Status (const Handle(AIS_InteractiveObject)& anObj, TCollection_ExtendedString& astatus) const;
654 //! Sets transform persistence.
655 Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
656 const Handle(Graphic3d_TransformPers)& theTrsfPers);
658 Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
659 void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
660 const Graphic3d_TransModeFlags& theFlag,
661 const gp_Pnt& thePoint = gp_Pnt (0.0, 0.0, 0.0))
663 SetTransformPersistence (theObj, Graphic3d_TransformPers::FromDeprecatedParams (theFlag, thePoint));
666 //! Updates the current viewer, the viewer in Neutral Point.
667 //! Objects selected when there is no open local context
668 //! are called current objects; those selected in open
669 //! local context, selected objects.
670 Standard_EXPORT void UpdateCurrentViewer();
672 //! Returns the display mode setting.
673 //! Note that mode 3 is only used.
674 Standard_Integer DisplayMode() const { return myDefaultDrawer->DisplayMode(); }
676 //! Returns highlight style settings.
677 const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
679 //! Setup highlight style settings.
680 void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
681 const Handle(Prs3d_Drawer)& theStyle) { myStyles[theStyleType] = theStyle; }
683 //! Returns current dynamic highlight style settings.
685 //! - the color of dynamic highlight is Quantity_NOC_CYAN1;
686 //! - the presentation for dynamic highlight is completely opaque;
687 //! - the type of highlight is Aspect_TOHM_COLOR.
688 const Handle(Prs3d_Drawer)& HighlightStyle() const
690 return myStyles[Prs3d_TypeOfHighlight_Dynamic];
693 //! Setup the style of dynamic highlighting.
694 void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
696 //! Returns current selection style settings.
698 //! - the color of selection is Quantity_NOC_GRAY80;
699 //! - the presentation for selection is completely opaque;
700 //! - the type of highlight is Aspect_TOHM_COLOR.
701 const Handle(Prs3d_Drawer)& SelectionStyle() const
703 return myStyles[Prs3d_TypeOfHighlight_Selected];
706 //! Setup the style of selection highlighting.
707 void SetSelectionStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Selected] = theStyle; }
709 //! Sub-intensity allows temporary highlighting of particular
710 //! objects with specified color in a manner of selection highlight,
711 //! but without actual selection (e.g., global status and owner's
712 //! selection state will not be updated).
713 //! The method returns the color of such highlighting.
714 //! By default, it is Quantity_NOC_GRAY40.
715 const Quantity_Color& SubIntensityColor() const
717 return myStyles[Prs3d_TypeOfHighlight_SubIntensity]->Color();
720 //! Sub-intensity allows temporary highlighting of particular
721 //! objects with specified color in a manner of selection highlight,
722 //! but without actual selection (e.g., global status and owner's
723 //! selection state will not be updated).
724 //! The method sets up the color for such highlighting.
725 //! By default, this is Quantity_NOC_GRAY40.
726 void SetSubIntensityColor (const Quantity_Color& theColor)
728 myStyles[Prs3d_TypeOfHighlight_SubIntensity]->SetColor (theColor);
731 //! Sets the display mode of seen Interactive Objects.
732 //! aMode provides the display mode index of the entity aniobj.
733 //! If updateviewer equals Standard_True, the
734 //! predominant mode aMode will overule the context mode.
735 //! If a local context is open and if updateviewer equals
736 //! Standard_False, the presentation of the Interactive
737 //! Object returns to the default selection mode; the
738 //! object is displayed but no viewer will be updated.
739 //! Note that display mode 3 is only used if you have an
740 //! AIS_Textured Shape.
741 Standard_EXPORT void SetDisplayMode (const Standard_Integer theMode,
742 const Standard_Boolean theToUpdateViewer);
745 //! Sets the deviation coefficient aCoefficient.
746 //! Drawings of curves or patches are made with respect
747 //! to a maximal chordal deviation. A Deviation coefficient
748 //! is used in the shading display mode. The shape is
749 //! seen decomposed into triangles. These are used to
750 //! calculate reflection of light from the surface of the
751 //! object. The triangles are formed from chords of the
752 //! curves in the shape. The deviation coefficient
753 //! aCoefficient gives the highest value of the angle with
754 //! which a chord can deviate from a tangent to a curve.
755 //! If this limit is reached, a new triangle is begun.
756 //! This deviation is absolute and is set through the
757 //! method: SetMaximalChordialDeviation. The default
759 //! In drawing shapes, however, you are allowed to ask
760 //! for a relative deviation. This deviation will be:
761 //! SizeOfObject * DeviationCoefficient.
763 Standard_EXPORT void SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
764 const Standard_Real theCoefficient,
765 const Standard_Boolean theToUpdateViewer);
767 Standard_EXPORT void SetDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
768 const Standard_Real theAngle,
769 const Standard_Boolean theToUpdateViewer);
771 //! Calls the AIS_Shape SetAngleAndDeviation to set
772 //! both Angle and Deviation coefficients
773 Standard_EXPORT void SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
774 const Standard_Real theAngle,
775 const Standard_Boolean theToUpdateViewer);
778 //! Sets the deviation coefficient aCoefficient for
779 //! removal of hidden lines created by different
780 //! viewpoints in different presentations. The Default value is 0.02.
781 Standard_EXPORT void SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
782 const Standard_Real theCoefficient,
783 const Standard_Boolean theToUpdateViewer);
785 Standard_EXPORT void SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
786 const Standard_Real theAngle,
787 const Standard_Boolean theToUpdateViewer);
789 //! Computes a HLRAngle and a
790 //! HLRDeviationCoefficient by means of the angle
791 //! anAngle and sets the corresponding methods in the
792 //! default drawing tool with these values.
793 Standard_EXPORT void SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
794 const Standard_Real theAngle,
795 const Standard_Boolean theToUpdateViewer);
797 //! Sets the deviation coefficient aCoefficient.
798 //! Drawings of curves or patches are made with respect
799 //! to a maximal chordal deviation. A Deviation coefficient
800 //! is used in the shading display mode. The shape is
801 //! seen decomposed into triangles. These are used to
802 //! calculate reflection of light from the surface of the
803 //! object. The triangles are formed from chords of the
804 //! curves in the shape. The deviation coefficient
805 //! aCoefficient gives the highest value of the angle with
806 //! which a chord can deviate from a tangent to a curve.
807 //! If this limit is reached, a new triangle is begun.
808 //! This deviation is absolute and is set through the
809 //! method: SetMaximalChordialDeviation. The default
811 //! In drawing shapes, however, you are allowed to ask
812 //! for a relative deviation. This deviation will be:
813 //! SizeOfObject * DeviationCoefficient.
815 Standard_EXPORT void SetDeviationCoefficient (const Standard_Real aCoefficient);
817 //! Returns the deviation coefficient.
818 //! Drawings of curves or patches are made with respect
819 //! to a maximal chordal deviation. A Deviation coefficient
820 //! is used in the shading display mode. The shape is
821 //! seen decomposed into triangles. These are used to
822 //! calculate reflection of light from the surface of the
823 //! object. The triangles are formed from chords of the
824 //! curves in the shape. The deviation coefficient gives
825 //! the highest value of the angle with which a chord can
826 //! deviate from a tangent to a curve. If this limit is
827 //! reached, a new triangle is begun.
828 //! This deviation is absolute and is set through
829 //! Prs3d_Drawer::SetMaximalChordialDeviation. The
830 //! default value is 0.001.
831 //! In drawing shapes, however, you are allowed to ask
832 //! for a relative deviation. This deviation will be:
833 //! SizeOfObject * DeviationCoefficient.
834 Standard_EXPORT Standard_Real DeviationCoefficient() const;
836 //! default 12 degrees
837 Standard_EXPORT void SetDeviationAngle (const Standard_Real anAngle);
839 Standard_EXPORT Standard_Real DeviationAngle() const;
841 //! Sets the deviation coefficient aCoefficient for
842 //! removal of hidden lines created by different
843 //! viewpoints in different presentations. The Default value is 0.02.
844 Standard_EXPORT void SetHLRDeviationCoefficient (const Standard_Real aCoefficient);
847 //! Returns the real number value of the hidden line
848 //! removal deviation coefficient.
849 //! A Deviation coefficient is used in the shading display
850 //! mode. The shape is seen decomposed into triangles.
851 //! These are used to calculate reflection of light from the
852 //! surface of the object.
853 //! The triangles are formed from chords of the curves in
854 //! the shape. The deviation coefficient give the highest
855 //! value of the angle with which a chord can deviate
856 //! from a tangent to a curve. If this limit is reached, a
857 //! new triangle is begun.
858 //! To find the hidden lines, hidden line display mode
859 //! entails recalculation of the view at each different
860 //! projector perspective.
861 //! Because hidden lines entail calculations of more than
862 //! usual complexity to decompose them into these
863 //! triangles, a deviation coefficient allowing greater
864 //! tolerance is used. This increases efficiency in calculation.
865 //! The Default value is 0.02.
866 Standard_EXPORT Standard_Real HLRDeviationCoefficient() const;
868 //! Sets the HLR angle anAngle.
869 Standard_EXPORT void SetHLRAngle (const Standard_Real anAngle);
872 //! Returns the real number value of the deviation angle
873 //! in hidden line removal views in this interactive context.
874 //! The default value is 20*PI/180.
875 Standard_EXPORT Standard_Real HLRAngle() const;
877 //! compute with anangle a HLRAngle and a HLRDeviationCoefficient
878 //! and set them in myHLRAngle and in myHLRDeviationCoefficient
879 //! of myDefaultDrawer ;
880 //! anAngle is in radian ; ( 1 deg < angle in deg < 20 deg)
881 Standard_EXPORT void SetHLRAngleAndDeviation (const Standard_Real anAngle);
883 //! Initializes hidden line aspect in the default drawing tool, or Drawer.
884 //! The default values are:
885 //! Color: Quantity_NOC_YELLOW
886 //! Type of line: Aspect_TOL_DASH
888 Standard_EXPORT Handle(Prs3d_LineAspect) HiddenLineAspect() const;
891 //! Sets the hidden line aspect anAspect.
892 //! anAspect defines display attributes for hidden lines in
894 Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& anAspect) const;
896 //! returns Standard_True if the hidden lines are to be drawn.
897 //! By default the hidden lines are not drawn.
898 Standard_EXPORT Standard_Boolean DrawHiddenLine() const;
900 Standard_EXPORT void EnableDrawHiddenLine() const;
902 Standard_EXPORT void DisableDrawHiddenLine() const;
904 //! Sets the number of U and V isoparameters displayed.
905 Standard_EXPORT void SetIsoNumber (const Standard_Integer NbIsos, const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
907 //! Returns the number of U and V isoparameters displayed.
908 Standard_EXPORT Standard_Integer IsoNumber (const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
910 //! Returns True if drawing isoparameters on planes is enabled.
911 Standard_EXPORT void IsoOnPlane (const Standard_Boolean SwitchOn);
913 //! Returns True if drawing isoparameters on planes is enabled.
914 //! if <forUIsos> = False,
915 Standard_EXPORT Standard_Boolean IsoOnPlane() const;
917 //! Enables or disables on-triangulation build for isolines for a particular object.
918 //! In case if on-triangulation builder is disabled, default on-plane
919 //! builder will compute isolines for the object given.
920 Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theIsEnabled,
921 const Handle(AIS_InteractiveObject)& theObject);
923 //! Enables or disables on-triangulation build for isolines for default drawer.
924 //! In case if on-triangulation builder is disabled, default on-plane
925 //! builder will compute isolines for the object given.
926 Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theToSwitchOn);
928 //! Returns true if drawing isolines on triangulation algorithm is enabled.
929 Standard_EXPORT Standard_Boolean IsoOnTriangulation() const;
931 //! Sets the graphic basic aspect to the current presentation of
932 //! ALL selected objects.
933 //! Flag globalChange has no effect (left to simplify porting).
934 //! Updates the viewer when <updateViewer> is TRUE
935 Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
936 const Standard_Boolean theToUpdateViewer);
938 //! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
939 //! This is done by the view theView passing this position to the main viewer and updating it.
940 //! Functions in both Neutral Point and local contexts.
941 //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
942 Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer theXPix,
943 const Standard_Integer theYPix,
944 const Handle(V3d_View)& theView,
945 const Standard_Boolean theToRedrawOnUpdate);
947 //! returns True if other entities were detected in the
948 //! last mouse detection
949 Standard_EXPORT Standard_Boolean HasNextDetected() const;
951 //! if more than 1 object is detected by the selector,
952 //! only the "best" owner is hilighted at the mouse position.
953 //! This Method allows the user to hilight one after another
954 //! the other detected entities.
955 //! if The method select is called, the selected entity
956 //! will be the hilighted one!
957 //! returns the Rank of hilighted entity
958 //! WARNING : Loop Method. When all the detected entities
959 //! have been hilighted , the next call will hilight
960 //! the first one again
961 Standard_EXPORT Standard_Integer HilightNextDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
963 //! Same as previous methods in reverse direction...
964 Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
966 //! Adds object in the selection.
967 Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
969 //! Adds object in the selection.
970 AIS_StatusOfPick AddSelect (const Handle(AIS_InteractiveObject)& theObject)
972 return AddSelect (theObject->GlobalSelOwner());
975 //! Selects everything found in the bounding rectangle
976 //! defined by the pixel minima and maxima, XPMin,
977 //! YPMin, XPMax, and YPMax in the view, aView
978 //! The objects detected are passed to the main viewer,
979 //! which is then updated.
980 Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer theXPMin,
981 const Standard_Integer theYPMin,
982 const Standard_Integer theXPMax,
983 const Standard_Integer theYPMax,
984 const Handle(V3d_View)& theView,
985 const Standard_Boolean theToUpdateViewer);
987 //! polyline selection; clears the previous picked list
988 Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& thePolyline,
989 const Handle(V3d_View)& theView,
990 const Standard_Boolean theToUpdateViewer);
992 //! Stores and hilights the previous detected; Unhilights
993 //! the previous picked.
994 Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean theToUpdateViewer);
996 //! adds the last detected to the list of previous picked.
997 //! if the last detected was already declared as picked,
998 //! removes it from the Picked List.
999 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean theToUpdateViewer);
1001 //! adds the last detected to the list of previous picked.
1002 //! if the last detected was already declared as picked,
1003 //! removes it from the Picked List.
1004 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
1005 const Handle(V3d_View)& theView,
1006 const Standard_Boolean theToUpdateViewer);
1008 //! rectangle of selection ; adds new detected entities into the
1009 //! picked list, removes the detected entities that were already stored...
1010 Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Integer theXPMin,
1011 const Standard_Integer theYPMin,
1012 const Standard_Integer theXPMax,
1013 const Standard_Integer theYPMax,
1014 const Handle(V3d_View)& theView,
1015 const Standard_Boolean theToUpdateViewer);
1017 //! Specify whether selected object must be hilighted when mouse cursor
1018 //! is moved above it (in MoveTo method). By default this value is false and
1019 //! selected object is not hilighted in this case.
1020 void SetToHilightSelected (const Standard_Boolean toHilight) { myToHilightSelected = toHilight; }
1022 //! Return value specified whether selected object must be hilighted
1023 //! when mouse cursor is moved above it
1024 Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
1026 //! @name OBSOLETE METHODS THAT ARE VALID FOR LOCAL CONTEXT ONLY
1028 //! Updates the view of the current object in open context.
1029 //! Objects selected when there is no open local context
1030 //! are called current objects; those selected in open
1031 //! local context, selected objects.
1032 //! If a local context is open and if updateviewer equals
1033 //! Standard_False, the presentation of the Interactive
1034 //! Object activates the selection mode; the object is
1035 //! displayed but no viewer will be updated.
1036 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1037 Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& theIObj,
1038 const Standard_Boolean theToUpdateViewer);
1041 //! Allows to add or remove the object given to the list of current and highlight/unhighlight it
1042 //! correspondingly. Is valid for global context only; for local context use method AddOrRemoveSelected.
1043 //! Since this method makes sence only for neutral point selection of a whole object, if 0 selection
1044 //! of the object is empty this method simply does nothing.
1045 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1046 Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
1047 const Standard_Boolean theIsToUpdateViewer);
1049 //! Updates the list of current objects, i.e. hilights new
1050 //! current objects, removes hilighting from former current objects.
1051 //! Objects selected when there is no open local context
1052 //! are called current objects; those selected in open
1053 //! local context, selected objects.
1054 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1055 Standard_EXPORT void UpdateCurrent();
1057 //! Returns true if there is a non-null interactive object in Neutral Point.
1058 //! Objects selected when there is no open local context are called current objects;
1059 //! those selected in open local context, selected objects.
1060 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1061 Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const;
1064 //! Initializes a scan of the current selected objects in
1066 //! Objects selected when there is no open local context
1067 //! are called current objects; those selected in open
1068 //! local context, selected objects.
1069 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1070 Standard_EXPORT void InitCurrent();
1073 //! Returns true if there is another object found by the
1074 //! scan of the list of current objects.
1075 //! Objects selected when there is no open local context
1076 //! are called current objects; those selected in open
1077 //! local context, selected objects.
1078 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1079 Standard_EXPORT Standard_Boolean MoreCurrent() const;
1082 //! Continues the scan to the next object in the list of
1083 //! current objects.
1084 //! Objects selected when there is no open local context
1085 //! are called current objects; those selected in open
1086 //! local context, selected objects.
1087 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1088 Standard_EXPORT void NextCurrent();
1091 //! Returns the current interactive object.
1092 //! Objects selected when there is no open local context
1093 //! are called current objects; those selected in open
1094 //! local context, selected objects.
1095 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1096 Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
1098 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1099 Standard_EXPORT Standard_Integer NbCurrents();
1101 //! Highlights current objects.
1102 //! Objects selected when there is no open local context
1103 //! are called current objects; those selected in open
1104 //! local context, selected objects.
1105 //! If a local context is open and if updateviewer equals
1106 //! Standard_False, the presentation of the Interactive
1107 //! Object activates the selection mode; the object is
1108 //! displayed but no viewer will be updated.
1109 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1110 Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer);
1112 //! Removes highlighting from current objects.
1113 //! Objects selected when there is no open local context
1114 //! are called current objects; those selected in open
1115 //! local context, selected objects.
1116 //! If a local context is open and if updateviewer equals
1117 //! Standard_False, the presentation of the Interactive
1118 //! Object activates the selection mode; the object is
1119 //! displayed but no viewer will be updated.
1120 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1121 Standard_EXPORT void UnhilightCurrents (const Standard_Boolean theToUpdateViewer);
1123 //! Empties previous current objects in order to get the
1124 //! current objects detected by the selector using
1126 //! Objects selected when there is no open local context
1127 //! are called current objects; those selected in open
1128 //! local context, selected objects.
1129 //! If a local context is open and if updateviewer equals
1130 //! Standard_False, the presentation of the Interactive
1131 //! Object activates the selection mode; the object is
1132 //! displayed but no viewer will be updated.
1133 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1134 Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer);
1136 //! @return current mouse-detected shape or empty (null) shape, if current interactive object
1137 //! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
1138 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1139 Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
1141 //! @return current mouse-detected interactive object or null object, if there is no currently detected interactives
1142 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1143 Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
1145 //! @name COMMON SELECTION METHODS VALID FOR BOTH GLOBAL AND LOCAL CONTEXT
1147 //! Unhighlights previously selected owners and marks them as not selected.
1148 //! Marks owner given as selected and highlights it.
1149 //! Performs selection filters check.
1150 Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
1151 const Standard_Boolean theToUpdateViewer);
1153 //! Puts the interactive object aniObj in the list of
1154 //! selected objects.
1155 //! If a local context is open and if updateviewer equals
1156 //! Standard_False, the presentation of the Interactive
1157 //! Object activates the selection mode; the object is
1158 //! displayed but no viewer will be updated.
1159 //! Performs selection filters check.
1160 Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
1161 const Standard_Boolean theToUpdateViewer);
1163 //! Updates the list of selected objects:
1164 //! i.e. highlights the newely selected ones and unhighlights previously selected objects.
1165 Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer);
1167 //! Allows to highlight or unhighlight the owner given depending on its selection status
1168 Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
1169 const Standard_Boolean theToUpdateViewer);
1171 //! Highlights selected objects.
1172 //! If a local context is open and if updateviewer equals
1173 //! Standard_False, the presentation of the Interactive
1174 //! Object activates the selection mode; the object is
1175 //! displayed but no viewer will be updated.
1176 Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer);
1178 //! Removes highlighting from selected objects.
1179 //! If a local context is open and if updateviewer equals
1180 //! Standard_False, the presentation of the Interactive
1181 //! Object activates the selection mode; the object is
1182 //! displayed but no viewer will be updated.
1183 Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer);
1185 //! Empties previous selected objects in order to get the
1186 //! selected objects detected by the selector using
1188 //! If a local context is open and if updateviewer equals
1189 //! Standard_False, the presentation of the Interactive
1190 //! Object activates the selection mode; the object is
1191 //! displayed but no viewer will be updated.
1192 Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer);
1194 //! No right to Add a selected Shape (Internal Management
1195 //! of shape Selection).
1196 //! A Previous selected shape may only be removed.
1197 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1198 Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& theShape,
1199 const Standard_Boolean theToUpdateViewer);
1201 //! Allows to highlight or unhighlight the owner given depending on its selection status
1202 Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
1203 const Standard_Boolean theToUpdateViewer);
1205 //! Returns true is the owner given is selected
1206 Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const;
1208 //! Returns true is the object given is selected
1209 Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& theObj) const;
1211 //! Returns the first selected object in the list of current selected.
1212 Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject();
1214 //! Initializes a scan of the selected objects.
1215 Standard_EXPORT void InitSelected();
1217 //! Returns true if there is another object found by the
1218 //! scan of the list of selected objects.
1219 Standard_EXPORT Standard_Boolean MoreSelected() const;
1221 //! Continues the scan to the next object in the list of
1222 //! selected objects.
1223 Standard_EXPORT void NextSelected();
1225 Standard_EXPORT Standard_Integer NbSelected();
1227 //! Returns true if the interactive context has a shape
1228 //! selected in it which results from the decomposition of
1230 //! If HasSelectedShape returns true, SelectedShape
1231 //! returns the shape which has been shown to be
1232 //! selected. Interactive returns the Interactive Object
1233 //! from which the shape has been selected.
1234 //! If HasSelectedShape returns false, Interactive
1235 //! returns the interactive entity selected by the click of the mouse.
1236 Standard_EXPORT Standard_Boolean HasSelectedShape() const;
1238 //! Returns the selected shape.
1239 Standard_EXPORT TopoDS_Shape SelectedShape() const;
1241 //! Returns the owner of the selected entity resulting
1242 //! from the decomposition of another entity.
1243 Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const;
1245 //! Returns a collection containing all entity owners
1246 //! created for the interactive object <theIObj> in
1247 //! the selection mode theMode (in all active modes
1248 //! if the Mode == -1)
1249 Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
1250 const Handle(AIS_InteractiveObject)& theIObj,
1251 const Standard_Integer theMode = -1) const;
1253 Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const;
1255 //! Returns true if the applicative object has an owner
1256 //! from Interactive attributed to it.
1257 Standard_EXPORT Standard_Boolean HasApplicative() const;
1260 //! Returns the owner of the applicative entity detected
1261 //! in interactive context. The owner can be a shape for
1262 //! a set of sub-shapes or a sub-shape for sub-shapes
1263 //! which it is composed of.
1264 Standard_EXPORT Handle(Standard_Transient) Applicative() const;
1267 //! Returns true if there is a mouse-detected entity in local context.
1268 //! If there is no open local context, the objects selected
1269 //! are called current objects; selected objects if there is
1270 //! one. Iterators allow entities to be recovered in either
1271 //! case. This method is one of a set which allows you to
1272 //! manipulate the objects which have been placed in these two lists.
1273 Standard_EXPORT Standard_Boolean HasDetected() const;
1276 //! Returns true if there is a detected shape in local context.
1277 //! If there is no open local context, the objects selected
1278 //! are called current objects; selected objects if there is
1279 //! one. Iterators allow entities to be recovered in either
1280 //! case. This method is one of a set which allows you to
1281 //! manipulate the objects which have been placed in these two lists.
1282 Standard_EXPORT Standard_Boolean HasDetectedShape() const;
1285 //! Returns the shape detected in local context.
1286 //! If there is no open local context, the objects selected
1287 //! are called current objects; selected objects if there is
1288 //! one. Iterators allow entities to be recovered in either
1289 //! case. This method is one of a set which allows you to
1290 //! manipulate the objects which have been placed in these two lists.
1291 Standard_EXPORT const TopoDS_Shape& DetectedShape() const;
1294 //! Returns the interactive objects last detected in open context.
1295 //! If there is no open local context, the objects selected
1296 //! are called current objects; selected objects if there is
1297 //! one. Iterators allow entities to be recovered in either
1298 //! case. This method is one of a set which allows you to
1299 //! manipulate the objects which have been placed in these two lists.
1300 Standard_EXPORT Handle(AIS_InteractiveObject) DetectedInteractive() const;
1302 //! returns the owner of the detected sensitive primitive.
1303 Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedOwner() const;
1306 //! Initialization for iteration through mouse-detected objects in
1307 //! interactive context or in local context if it is opened.
1308 Standard_EXPORT void InitDetected();
1311 //! @return true if there is more mouse-detected objects after the current one
1312 //! during iteration through mouse-detected interactive objects.
1313 Standard_EXPORT Standard_Boolean MoreDetected() const;
1316 //! Gets next current object during iteration through mouse-detected
1317 //! interactive objects.
1318 Standard_EXPORT void NextDetected();
1320 //! Opens local contexts and specifies how this is to be
1321 //! done. The options listed above function in the following manner:
1322 //! - UseDisplayedObjects -allows you to load or not
1323 //! load the interactive objects visualized at Neutral
1324 //! Point in the local context which you open. If false,
1325 //! the local context is empty after being opened. If
1326 //! true, the objects at Neutral Point are loaded by their
1327 //! default selection mode.
1328 //! - AllowShapeDecomposition -AIS_Shape allows or
1329 //! prevents decomposition in standard shape location
1330 //! mode of objects at Neutral Point which are
1331 //! type-"privileged". This Flag is only taken into
1332 //! account when UseDisplayedObjects is true.
1333 //! - AcceptEraseOfObjects -authorises other local
1334 //! contexts to erase the interactive objects present in
1335 //! this context. This option is rarely used.
1336 //! - BothViewers - Has no use currently defined.
1337 //! This method returns the index of the created local
1338 //! context. It should be kept and used to close the context.
1339 //! Opening a local context allows you to prepare an
1340 //! environment for temporary presentations and
1341 //! selections which will disappear once the local context is closed.
1342 //! You can open several local contexts, but only the last
1343 //! one will be active.
1344 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1345 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);
1347 //! Allows you to close local contexts. For greater
1348 //! security, you should close the context with the
1349 //! index Index given on opening.
1350 //! When you close a local context, the one before,
1351 //! which is still on the stack, reactivates. If none is
1352 //! left, you return to Neutral Point.
1353 //! If a local context is open and if updateviewer
1354 //! equals Standard_False, the presentation of the
1355 //! Interactive Object activates the selection mode; the
1356 //! object is displayed but no viewer will be updated.
1358 //! When the index isn't specified, the current context
1359 //! is closed. This option can be dangerous, as other
1360 //! Interactive Functions can open local contexts
1361 //! without necessarily warning the user.
1362 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1363 Standard_EXPORT void CloseLocalContext (const Standard_Integer theIndex = -1,
1364 const Standard_Boolean theToUpdateViewer = Standard_True);
1366 //! returns -1 if no opened local context.
1367 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1368 Standard_EXPORT Standard_Integer IndexOfCurrentLocal() const;
1371 //! Allows you to close all local contexts at one go and
1372 //! return to Neutral Point.
1373 //! If a local context is open and if updateviewer equals
1374 //! Standard_False, the presentation of the Interactive
1375 //! Object activates the selection mode; the object is
1376 //! displayed but no viewer will be updated.
1377 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1378 Standard_EXPORT void CloseAllContexts (const Standard_Boolean theToUpdateViewer);
1380 //! to be used only with no opened
1381 //! local context.. displays and activates objects in their
1382 //! original state before local contexts were opened...
1383 Standard_EXPORT void ResetOriginalState (const Standard_Boolean theToUpdateViewer);
1385 //! clears Objects/Filters/Activated Modes list in the current opened local context.
1386 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1387 Standard_EXPORT void ClearLocalContext (const AIS_ClearMode TheMode = AIS_CM_All);
1389 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1390 Standard_EXPORT void UseDisplayedObjects();
1392 //! when a local Context is opened, one is able to
1393 //! use/not use the displayed objects at neutral point
1395 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1396 Standard_EXPORT void NotUseDisplayedObjects();
1398 //! initializes the list of presentations to be displayed
1399 //! returns False if no local context is opened.
1400 Standard_EXPORT Standard_Boolean BeginImmediateDraw();
1402 //! returns True if <anIObj> has been stored in the list.
1403 Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0);
1405 //! returns True if the immediate display has been done.
1406 Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_View)& theView);
1408 //! Uses the First Active View of Main Viewer!
1409 //! returns True if the immediate display has been done.
1410 Standard_EXPORT Standard_Boolean EndImmediateDraw();
1412 Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
1415 //! Sets the highlighting status aStatus of detected and
1416 //! selected entities.
1417 //! Whether you are in Neutral Point or local context, this
1418 //! is automatically managed by the Interactive Context.
1419 //! This function allows you to disconnect the automatic mode.
1420 Standard_EXPORT void SetAutomaticHilight (const Standard_Boolean aStatus);
1423 //! Returns true if the automatic highlight mode is active
1424 //! in an open context.
1425 Standard_EXPORT Standard_Boolean AutomaticHilight() const;
1427 //! Activates the selection mode aMode whose index is
1428 //! given, for the given interactive entity anIobj.
1429 Standard_EXPORT void Activate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode = 0, const Standard_Boolean theIsForce = Standard_False);
1431 //! Activates the given selection mode for the all displayed objects.
1432 Standard_EXPORT void Activate (const Standard_Integer theMode,
1433 const Standard_Boolean theIsForce = Standard_False);
1435 //! Deactivates all the activated selection modes
1437 Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIObj);
1440 //! Deactivates all the activated selection modes of the
1441 //! interactive object anIobj with a given selection mode aMode.
1442 Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode);
1444 //! Deactivates the given selection mode for all displayed objects.
1445 Standard_EXPORT void Deactivate (const Standard_Integer theMode);
1447 //! Deactivates all the activated selection mode at all displayed objects.
1448 Standard_EXPORT void Deactivate();
1450 //! Returns the list of activated selection modes in an open context.
1451 Standard_EXPORT void ActivatedModes (const Handle(AIS_InteractiveObject)& anIobj, TColStd_ListOfInteger& theList) const;
1453 //! to be Used only with opened local context and
1454 //! if <anIobj> is of type shape...
1455 //! if <aStatus> = True <anIobj> will be sensitive to
1456 //! shape selection modes activation.
1457 //! = False, <anIobj> will not be senstive
1459 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1460 Standard_EXPORT void SetShapeDecomposition (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean aStatus);
1463 //! Sets the temporary graphic attributes of the entity
1464 //! anObj. These are provided by the attribute manager
1465 //! aDrawer and are valid for a particular local context only.
1466 //! If a local context is open and if updateviewer equals
1467 //! Standard_False, the presentation of the Interactive
1468 //! Object activates the selection mode; the object is
1469 //! displayed but no viewer will be updated.
1470 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1471 Standard_EXPORT void SetTemporaryAttributes (const Handle(AIS_InteractiveObject)& theIObj,
1472 const Handle(Prs3d_Drawer)& theDrawer,
1473 const Standard_Boolean theToUpdateViewer);
1476 //! Highlights, and removes highlights from, the displayed
1477 //! object aniobj which is displayed at Neutral Point with
1478 //! subintensity color; available only for active local
1479 //! context. There is no effect if there is no local context.
1480 //! If a local context is open and if updateviewer equals
1481 //! Standard_False, the presentation of the Interactive
1482 //! Object activates the selection mode; the object is
1483 //! displayed but no viewer will be updated.
1484 Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& theIObj,
1485 const Standard_Boolean theToUpdateViewer);
1488 //! Removes the subintensity option for the entity aniobj.
1489 //! If a local context is open and if updateviewer equals
1490 //! Standard_False, the presentation of the Interactive
1491 //! Object activates the selection mode; the object is
1492 //! displayed but no viewer will be updated.
1493 Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& theIObj,
1494 const Standard_Boolean theToUpdateViewer);
1496 //! hilights/unhilights displayed objects which are displayed at
1497 //! neutral state with subintensity color;
1498 //! available only for active local context.
1499 //! No effect if no local context.
1500 Standard_EXPORT void SubIntensityOn (const Standard_Boolean theToUpdateViewer);
1502 //! removes subintensity option for all objects.
1503 Standard_EXPORT void SubIntensityOff (const Standard_Boolean theToUpdateViewer);
1505 //! Allows you to add the filter aFilter to Neutral Point or
1506 //! to a local context if one or more selection modes have been activated.
1507 //! Only type filters may be active in Neutral Point.
1508 Standard_EXPORT void AddFilter (const Handle(SelectMgr_Filter)& aFilter);
1511 //! Removes a filter from Neutral Point or a local context
1512 //! if one or more selection modes have been activated.
1513 //! Only type filters are activated in Neutral Point.
1514 Standard_EXPORT void RemoveFilter (const Handle(SelectMgr_Filter)& aFilter);
1516 //! Remove a filter to Neutral Point or a local context if
1517 //! one or more selection modes have been activated.
1518 //! Only type filters are active in Neutral Point.
1519 Standard_EXPORT void RemoveFilters();
1521 //! Provides an alternative to the Display methods when
1522 //! activating specific selection modes. This has the
1523 //! effect of activating the corresponding selection mode
1524 //! aStandardActivation for all objects in Local Context
1525 //! which accept decomposition into sub-shapes.
1526 //! Every new Object which has been loaded into the
1527 //! interactive context and which answers these
1528 //! decomposition criteria is automatically activated
1529 //! according to these modes.
1531 //! If you have opened a local context by loading an
1532 //! object with the default options
1533 //! (<AllowShapeDecomposition >= Standard_True), all
1534 //! objects of the "Shape" type are also activated with
1535 //! the same modes. You can act on the state of these
1536 //! "Standard" objects by using SetShapeDecomposition(Status).
1537 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1538 Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1541 //! Provides an alternative to the Display methods when
1542 //! deactivating specific selection modes. This has the
1543 //! effect of deactivating the corresponding selection
1544 //! mode aStandardActivation for all objects in Local
1545 //! Context which accept decomposition into sub-shapes.
1546 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1547 Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1550 //! Returns the list of activated standard selection modes
1551 //! available in a local context.
1552 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1553 Standard_EXPORT const TColStd_ListOfInteger& ActivatedStandardModes() const;
1556 //! Returns the list of filters active in a local context.
1557 Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
1559 //! Returns the default attribute manager.
1560 //! This contains all the color and line attributes which
1561 //! can be used by interactive objects which do not have
1562 //! their own attributes.
1563 const Handle(Prs3d_Drawer)& DefaultDrawer() const { return myDefaultDrawer; }
1565 //! Returns the current viewer.
1566 const Handle(V3d_Viewer)& CurrentViewer() const { return myMainVwr; }
1568 //! Returns the list of displayed objects of a particular
1569 //! Type WhichKind and Signature WhichSignature. By
1570 //! Default, WhichSignature equals -1. This means that
1571 //! there is a check on type only.
1572 Standard_EXPORT void DisplayedObjects (AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1574 //! gives the list of displayed objects of a particular
1575 //! Type and signature.
1576 //! by Default, <WhichSignature> = -1 means
1577 //! control only on <WhichKind>.
1578 Standard_EXPORT void DisplayedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1581 //! Returns the list theListOfIO of erased objects (hidden objects)
1582 //! particular Type WhichKind and Signature WhichSignature.
1583 //! By Default, WhichSignature equals 1. This means
1584 //! that there is a check on type only.
1585 Standard_EXPORT void ErasedObjects (AIS_ListOfInteractive& theListOfIO) const;
1587 //! gives the list of erased objects (hidden objects)
1588 //! Type and signature
1589 //! by Default, <WhichSignature> = -1 means
1590 //! control only on <WhichKind>.
1591 Standard_EXPORT void ErasedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& theListOfIO) const;
1594 //! Returns the list theListOfIO of objects with indicated display status
1595 //! particular Type WhichKind and Signature WhichSignature.
1596 //! By Default, WhichSignature equals 1. This means
1597 //! that there is a check on type only.
1598 Standard_EXPORT void ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1600 //! gives the list of objects with indicated display status
1601 //! Type and signature
1602 //! by Default, <WhichSignature> = -1 means
1603 //! control only on <WhichKind>.
1604 Standard_EXPORT void ObjectsByDisplayStatus (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1606 //! fills <aListOfIO> with objects of a particular
1607 //! Type and Signature with no consideration of display status.
1608 //! by Default, <WhichSignature> = -1 means
1609 //! control only on <WhichKind>.
1610 //! if <WhichKind> = AIS_KOI_None and <WhichSignature> = -1,
1611 //! all the objects are put into the list.
1612 Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO, const AIS_KindOfInteractive WhichKind = AIS_KOI_None, const Standard_Integer WhichSignature = -1) const;
1614 //! Returns true if there is an open context.
1615 Standard_Boolean HasOpenedContext() const { return myCurLocalIndex != 0; }
1617 //! This method is only intended for advanced operation, particularly with
1618 //! the aim to improve performance when many objects have to be selected
1619 //! together. Otherwise, you should use other (non-internal) methods of
1620 //! class AIS_InteractiveContext without trying to obtain an instance of
1621 //! AIS_LocalContext.
1622 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1623 Handle(AIS_LocalContext) LocalContext() const { return myCurLocalIndex > 0 ? myLocalContexts (myCurLocalIndex) : Handle(AIS_LocalContext)(); }
1625 const Handle(SelectMgr_SelectionManager)& SelectionManager() const { return mgrSelector; }
1627 const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const { return myMainPM; }
1629 const Handle(StdSelect_ViewerSelector3d)& MainSelector() const { return myMainSel; }
1631 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1632 Standard_EXPORT Handle(StdSelect_ViewerSelector3d) LocalSelector() const;
1634 //! Clears all the structures which don't
1635 //! belong to objects displayed at neutral point
1636 //! only effective when no Local Context is opened...
1637 //! returns the number of removed structures from the viewers.
1638 Standard_EXPORT Standard_Integer PurgeDisplay();
1640 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1641 Standard_EXPORT Standard_Integer HighestIndex() const;
1643 Standard_EXPORT void DisplayActiveSensitive (const Handle(V3d_View)& aView);
1645 Standard_EXPORT void ClearActiveSensitive (const Handle(V3d_View)& aView);
1647 //! Fits the view correspondingly to the bounds of selected objects.
1648 //! Infinite objects are ignored if infinite state of AIS_InteractiveObject
1650 Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
1651 const Standard_Real theMargin,
1652 const Standard_Boolean theToUpdate);
1654 //! Fits the view correspondingly to the bounds of selected objects.
1655 //! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
1656 Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView);
1658 Standard_EXPORT void DisplayActiveSensitive (const Handle(AIS_InteractiveObject)& anObject, const Handle(V3d_View)& aView);
1660 //! returns if possible,
1661 //! the first local context where the object is seen
1662 Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1663 Standard_EXPORT Standard_Boolean IsInLocal (const Handle(AIS_InteractiveObject)& anObject, Standard_Integer& TheIndex) const;
1665 //! Rebuilds 1st level of BVH selection forcibly
1666 Standard_EXPORT void RebuildSelectionStructs();
1668 //! setup object visibility in specified view,
1669 //! has no effect if object is not disaplyed in this context.
1670 Standard_EXPORT void SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisible);
1672 //! Disconnects theObjToDisconnect from theAssembly and removes dependent selection structures
1673 Standard_EXPORT void Disconnect (const Handle(AIS_InteractiveObject)& theAssembly, const Handle(AIS_InteractiveObject)& theObjToDisconnect = NULL);
1675 //! Query objects visible or hidden in specified view due to affinity mask.
1676 Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisibleInView, const AIS_DisplayStatus theStatus = AIS_DS_None) const;
1678 //! Redraws immediate structures in all views of the viewer given taking into account its visibility.
1679 Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
1683 Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
1685 Standard_EXPORT void EraseGlobal (const Handle(AIS_InteractiveObject)& theIObj,
1686 const Standard_Boolean theToUpdateViewer);
1688 Standard_EXPORT void ClearGlobal (const Handle(AIS_InteractiveObject)& theIObj,
1689 const Standard_Boolean theToUpdateViewer);
1691 Standard_EXPORT void ClearGlobalPrs (const Handle(AIS_InteractiveObject)& theObj,
1692 const Standard_Integer theMode,
1693 const Standard_Boolean theToUpdateViewer);
1695 Standard_EXPORT void InitAttributes();
1697 Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
1700 Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
1701 const Standard_Boolean theToUpdateViewer);
1704 Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
1705 const Standard_Boolean theToUpdateViewer);
1707 //! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
1708 Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
1710 //! Helper function that highlights the owner given with <theStyle> without
1711 //! performing AutoHighlight checks, e.g. is used for dynamic highlight.
1712 Standard_EXPORT void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
1713 const Handle(V3d_Viewer)& theViewer = NULL);
1715 //! Helper function that highlights the owner given with <theStyle> with check
1716 //! for AutoHighlight, e.g. is used for selection.
1717 Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
1719 //! Helper function that highlights global owner of the object given with <theStyle> with check
1720 //! for AutoHighlight, e.g. is used for selection.
1721 //! If global owner is null, it simply highlights the whole object
1722 Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
1723 const Handle(Prs3d_Drawer)& theStyle,
1724 const Standard_Integer theDispMode) const;
1726 //! Helper function that unhighlights all owners that are stored in current AIS_Selection.
1727 //! The function updates global status and selection state of owner and interactive object.
1728 //! If the parameter <theIsToHilightSubIntensity> is set to true, interactive objects with sub-intensity
1729 //! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
1730 Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
1732 //! Helper function that unhighlights global selection owner of given interactive.
1733 //! The function does not perform any updates of global or owner status
1734 Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const;
1736 //! Helper function that turns on sub-intensity in global status and highlights
1737 //! given objects with sub-intensity color
1738 //! @param theObject [in] the object. If NULL is given, than sub-intensity will be turned on for
1739 //! all inveractive objects of the context
1740 //! @param theDispMode [in] display mode. If -1 is given, sub-intensity will be turned on for
1741 //! all display modes in global status's list of modes
1742 //! @param theIsDisplayedOnly [in] is true if sub-intensity should be applied only to objects with
1743 //! status AIS_DS_Displayed
1744 Standard_EXPORT void turnOnSubintensity (const Handle(AIS_InteractiveObject)& theObject = NULL,
1745 const Standard_Integer theDispMode = -1,
1746 const Standard_Boolean theIsDisplayedOnly = Standard_True) const;
1748 //! Helper function that highlights the object with sub-intensity color without any checks
1749 //! @param theObject [in] the object that will be highlighted
1750 //! @param theMode [in] display mode
1751 Standard_EXPORT void highlightWithSubintensity (const Handle(AIS_InteractiveObject)& theObject,
1752 const Standard_Integer theMode) const;
1754 //! Helper function that highlights the owner with sub-intensity color without any checks
1755 //! @param theOwner [in] the owner that will be highlighted
1756 //! @param theMode [in] display mode
1757 Standard_EXPORT void highlightWithSubintensity (const Handle(SelectMgr_EntityOwner)& theOwner,
1758 const Standard_Integer theMode) const;
1760 //! Helper function that returns correct dynamic highlight style for the object:
1761 //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1762 //! dynamic highlight style of interactive context will be returned.
1763 //! @param theObj [in] the object to check
1764 const Handle(Prs3d_Drawer)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj,
1765 const Handle(SelectMgr_EntityOwner)& theOwner) const
1767 const Handle(Prs3d_Drawer)& aHiDrawer = theObj->DynamicHilightAttributes();
1768 if (!aHiDrawer.IsNull())
1773 return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
1776 //! Helper function that returns correct selection style for the object:
1777 //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1778 //! selection style of interactive context will be returned.
1779 //! @param theObj [in] the object to check
1780 const Handle(Prs3d_Drawer)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj,
1781 const Handle(SelectMgr_EntityOwner)& theOwner) const
1783 const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
1784 if (!aHiDrawer.IsNull())
1789 return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalSelected : Prs3d_TypeOfHighlight_Selected];
1792 //! Assign the context to the object or throw exception if object was already assigned to another context.
1793 void setContextToObject (const Handle(AIS_InteractiveObject)& theObj)
1795 if (theObj->HasInteractiveContext())
1797 if (theObj->myCTXPtr != this)
1799 Standard_ProgramError::Raise ("AIS_InteractiveContext - object has been already displayed in another context!");
1804 theObj->SetContext (this);
1808 //! Return display mode for highlighting.
1809 Standard_Integer getHilightMode (const Handle(AIS_InteractiveObject)& theObj,
1810 const Handle(Prs3d_Drawer)& theStyle,
1811 const Standard_Integer theDispMode) const
1813 if (!theStyle.IsNull()
1814 && theStyle->DisplayMode() != -1
1815 && theObj->AcceptDisplayMode (theStyle->DisplayMode()))
1817 return theStyle->DisplayMode();
1819 else if (theDispMode != -1)
1823 else if (theObj->HasDisplayMode())
1825 return theObj->DisplayMode();
1827 return myDefaultDrawer->DisplayMode();
1830 //! Removes dynamic highlight draw
1831 void clearDynamicHighlight() const
1833 if (myLastinMain.IsNull())
1836 if (myLastinMain->IsAutoHilight())
1838 myMainPM->ClearImmediateDraw();
1842 myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
1848 AIS_DataMapOfIOStatus myObjects;
1849 Handle(SelectMgr_SelectionManager) mgrSelector;
1850 Handle(PrsMgr_PresentationManager3d) myMainPM;
1851 Handle(V3d_Viewer) myMainVwr;
1852 Handle(StdSelect_ViewerSelector3d) myMainSel;
1853 Handle(SelectMgr_EntityOwner) myLastPicked;
1854 Handle(SelectMgr_EntityOwner) myLastinMain;
1855 Standard_Boolean myWasLastMain;
1856 Standard_Boolean myToHilightSelected;
1857 Handle(AIS_Selection) mySelection;
1858 Handle(SelectMgr_OrFilter) myFilters;
1859 Handle(Prs3d_Drawer) myDefaultDrawer;
1860 Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
1861 AIS_DataMapOfILC myLocalContexts;
1862 Standard_Integer myCurLocalIndex;
1863 Handle(V3d_View) mylastmoveview;
1864 TColStd_SequenceOfInteger myDetectedSeq;
1865 Standard_Integer myCurDetected;
1866 Standard_Integer myCurHighlighted;
1867 Standard_Boolean myIsAutoActivateSelMode;
1871 DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
1873 #endif // _AIS_InteractiveContext_HeaderFile