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