0028162: Draw Harness - eliminate usage of deprecated Local Context
[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_DisplayStatus.hxx>
33 #include <AIS_KindOfInteractive.hxx>
34 #include <Standard_Real.hxx>
35 #include <Aspect_TypeOfFacingModel.hxx>
36 #include <Graphic3d_HighlightStyle.hxx>
37 #include <Graphic3d_NameOfMaterial.hxx>
38 #include <Standard_ShortReal.hxx>
39 #include <TColStd_ListOfInteger.hxx>
40 #include <AIS_DisplayMode.hxx>
41 #include <AIS_TypeOfIso.hxx>
42 #include <AIS_StatusOfDetection.hxx>
43 #include <AIS_StatusOfPick.hxx>
44 #include <TColgp_Array1OfPnt2d.hxx>
45 #include <SelectMgr_IndexedMapOfOwner.hxx>
46 #include <AIS_ClearMode.hxx>
47 #include <TopAbs_ShapeEnum.hxx>
48 #include <SelectMgr_ListOfFilter.hxx>
49 #include <AIS_ListOfInteractive.hxx>
50 #include <Standard_CString.hxx>
51 #include <AIS_Selection.hxx>
52 class SelectMgr_SelectionManager;
53 class V3d_Viewer;
54 class AIS_InteractiveObject;
55 class SelectMgr_OrFilter;
56 class V3d_View;
57 class AIS_LocalContext;
58 class TopLoc_Location;
59 class Quantity_Color;
60 class TCollection_ExtendedString;
61 class Prs3d_LineAspect;
62 class Prs3d_BasicAspect;
63 class SelectMgr_EntityOwner;
64 class Standard_Transient;
65 class SelectMgr_Filter;
66 class TCollection_AsciiString;
67
68 //! The Interactive Context allows you to manage
69 //! graphic behavior and selection of Interactive Objects
70 //! in one or more viewers. Class methods make this
71 //! highly transparent.
72 //! It is essential to remember that an Interactive Object
73 //! which is already known by the Interactive Context
74 //! must be modified using Context methods. You can
75 //! only directly call the methods available for an
76 //! Interactive Object if it has not been loaded into an
77 //! Interactive Context.
78 //! You must distinguish two states in the Interactive Context:
79 //! -   No Open Local Context, also known as the Neutral Point.
80 //! -   One or several open local contexts, each
81 //! representing a temporary state of selection and presentation.
82 //! Some methods can only be used in open Local
83 //! Context; others in closed Local Context; others do
84 //! not have the same behavior in one state as in the other.
85 //! The possiblities of use for local contexts are
86 //! numerous depending on the type of operation that
87 //! you want to perform, for example:
88 //! -   working on all visualized interactive objects,
89 //! -   working on only a few objects,
90 //! -   working on a single object.
91 //! 1. When you want ot work on one type of entity, you
92 //! may open a local context with the option
93 //! UseDisplayedObjects set to false. DisplayedObjects
94 //! allows you to recover the visualized Interactive
95 //! Objects which have a given Type and
96 //! Signature   from Neutral Point.
97 //! 2. You must keep in mind the fact that when you open
98 //! a Local Context with default options:
99 //! -   The Interactive Objects visualized at Neutral Point
100 //! are activated with their default selection mode. You
101 //! must deactivate those which you do not want ot use.
102 //! -   The Shape type Interactive Objects are
103 //! automatically decomposed into sub-shapes when
104 //! standard activation modes are launched.
105 //! -   The "temporary" Interactive Objects present in the
106 //! Local Contexts are not automatically taken into
107 //! account. You have to load them manually if you
108 //! want to use them.
109 //! -   The stages could be the following:
110 //! -   Open a Local Context with the right options;
111 //! -   Load/Visualize the required complementary
112 //! objects with the desired activation modes.
113 //! -   Activate Standard modes if necessary
114 //! - Create its filters and add them to the Local Context
115 //! -   Detect/Select/recover the desired entities
116 //! -   Close the Local Context with the adequate index.
117 //! -   It is useful to create an interactive editor, to which
118 //! you pass the Interactive Context. This will take care
119 //! of setting up the different contexts of
120 //! selection/presentation according to the operation
121 //! which you want to perform.
122
123 //! Selection of parts of the objects can also be done without opening a local context.
124 //! Interactive context itself supports decomposed object selection with selection filters
125 //! support. Note that each selectable object must specify the selection mode that is
126 //! responsible for selection of object as a whole (global selection mode). By default, global
127 //! selection mode is equal to 0, but it might be redefined if needed. Sub-part selection
128 //! of the objects without using local context provides a possibility to activate part
129 //! selection modes along with global selection mode.
130 class AIS_InteractiveContext : public Standard_Transient
131 {
132   friend class AIS_LocalContext;
133   DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext, Standard_Transient)
134 public:
135
136   //! Constructs the interactive context object defined by
137   //! the principal viewer MainViewer.
138   Standard_EXPORT AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer);
139
140   //! Destructor.
141   Standard_EXPORT virtual ~AIS_InteractiveContext();
142
143   Standard_EXPORT void SetAutoActivateSelection (const Standard_Boolean Auto);
144   
145   Standard_EXPORT Standard_Boolean GetAutoActivateSelection() const;
146   
147   //! Controls the choice between the using the display
148   //! and selection modes of open local context which you
149   //! have defined and activating those available by default.
150   //! If a local context is open and if updateviewer equals
151   //! Standard_False, the Interactive Object anIobj is
152   //! displayed in the default active mode. This will be the
153   //! object's default display mode, if there is one.
154   //! Otherwise, it will be the context mode. The Interactive
155   //! Object's default selection mode is activated. In
156   //! general, this is 0.
157   //! This syntax has the same behavior as local context,
158   //! open or closed. If you want to view the object in open
159   //! local context without selection, use the syntax below,
160   //! setting aSelectionMode to -1.
161   Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean updateviewer = Standard_True);
162   
163   //! Controls the choice between the using the display
164   //! and selection modes of open local context which you
165   //! have defined and activating those available by default.
166   //! If no Local Context is opened. and the Interactive
167   //! Object theIObj has no display mode of its own, the
168   //! default display mode, 0, is used. Likewise, if theIObj
169   //! has no selection mode of its own, the default one, 0, is used.
170   //! If a local context is open and if theToUpdateViewer equals
171   //! Standard_False, the presentation of the Interactive
172   //! Object activates the selection mode; the object is
173   //! displayed but no viewer will be updated.
174   //! If theSelectionMode equals -1, theIObj will not be
175   //! activated: it will be displayed but will not be selectable.
176   //! Use this if you want to view the object in open local
177   //! context without selection. Note: This option is only
178   //! available in Local Context.
179   //! If theToAllowDecomposition equals true, theIObj can have
180   //! subshapes detected by selection mechanisms. theIObj
181   //! must be able to give a shape selection modes which
182   //! fit the AIS_Shape selection modes:
183   //! -   vertices: 1
184   //! -   edges: 2
185   //! -   wires: 3.
186   Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theDispMode, const Standard_Integer theSelectionMode, const Standard_Boolean theToUpdateViewer = Standard_True, const Standard_Boolean theToAllowDecomposition = Standard_True, const AIS_DisplayStatus theDispStatus = AIS_DS_None);
187   
188   //! Allows you to load the Interactive Object aniobj
189   //! with a given selection mode SelectionMode, and/or
190   //! with the desired decomposition option, whether the
191   //! object is visualized or not. If AllowDecomp =
192   //! Standard_True and, if the interactive object is of
193   //! the "Shape" type, these "standard" selection
194   //! modes will be automatically activated as a function
195   //! of the modes present in the Local Context.
196   //! The loaded objects will be selectable but
197   //! displayable in highlighting only when detected by the Selector.
198   //! This method is available only when Local Contexts are open.
199   Standard_EXPORT void Load (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer SelectionMode = -1, const Standard_Boolean AllowDecomp = Standard_False);
200   
201   //! Hides the object. The object's presentations are simply
202   //! flagged as invisible and therefore excluded from redrawing.
203   //! To show hidden objects, use Display().
204   Standard_EXPORT void Erase (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
205   
206   //! Hides all objects. The object's presentations are simply
207   //! flagged as invisible and therefore excluded from redrawing.
208   //! To show all hidden objects, use DisplayAll().
209   Standard_EXPORT void EraseAll (const Standard_Boolean updateviewer = Standard_True);
210   
211   //! Displays all hidden objects.
212   Standard_EXPORT void DisplayAll (const Standard_Boolean updateviewer = Standard_True);
213   
214
215   //! Hides selected objects. The object's presentations are simply
216   //! flagged as invisible and therefore excluded from redrawing.
217   //! To show hidden objects, use Display().
218   Standard_EXPORT void EraseSelected (const Standard_Boolean updateviewer = Standard_True);
219   
220   //! Displays selected objects if a local context is open.
221   //! Displays current objects if there is no active local context.
222   //! Objects selected when there is no open local context
223   //! are called current objects; those selected in open
224   //! local context, selected objects.
225   //! If a local context is open and if updateviewer equals
226   //! Standard_False, the presentation   of the Interactive
227   //! Object activates   the   selection   mode; the   object is
228   //! displayed but no viewer will be updated.
229   Standard_EXPORT void DisplaySelected (const Standard_Boolean updateviewer = Standard_True);
230   
231   //! Changes the status of a temporary object. It will be
232   //! kept at the neutral point, i.e. put in the list of
233   //! displayed   objects along withwith   its temporary
234   //! attributes. These include display mode and
235   //! selection   mode, for example.
236   //! Returns true if done.
237   //! inWhichLocal gives the local context in which anIObj
238   //! is displayed. By default, the index -1 refers to the last
239   //! Local Context opened.
240   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
241   Standard_EXPORT Standard_Boolean KeepTemporary (const Handle(AIS_InteractiveObject)& anIObj, const Standard_Integer InWhichLocal = -1);
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   //! Setup the style of dynamic highlighting.
642   void SetHighlightStyle (const Handle(Graphic3d_HighlightStyle)& theStyle) { myHiStyle = theStyle; }
643
644   //! Returns current selection style settings.
645   //! By default:
646   //!   - the color of selection is Quantity_NOC_GRAY80;
647   //!   - the presentation for selection is completely opaque;
648   //!   - the type of highlight is Aspect_TOHM_COLOR.
649   const Handle(Graphic3d_HighlightStyle)& SelectionStyle() const
650   {
651     return mySelStyle;
652   }
653
654   //! Setup the style of selection highlighting.
655   void SetSelectionStyle (const Handle(Graphic3d_HighlightStyle)& theStyle) { mySelStyle = theStyle; }
656
657   //! Returns the name of the color used to show preselection.
658   //! By default, this is Quantity_NOC_GREEN.
659     Quantity_NameOfColor PreSelectionColor() const;
660   
661
662   //! Returns the name of the color used by default.
663   //! By default, this is Quantity_NOC_GOLDENROD.
664     Quantity_NameOfColor DefaultColor() const;
665   
666
667   //! Sub-intensity allows temporary highlighting of particular
668   //! objects with specified color in a manner of selection highlight,
669   //! but without actual selection (e.g., global status and owner's
670   //! selection state will not be updated).
671   //! The method returns the color of such highlighting.
672   //! By default, it is Quantity_NOC_GRAY40.
673   const Quantity_Color& SubIntensityColor() const
674   {
675     return mySubintStyle->Color();
676   }
677
678   //! Sub-intensity allows temporary highlighting of particular
679   //! objects with specified color in a manner of selection highlight,
680   //! but without actual selection (e.g., global status and owner's
681   //! selection state will not be updated).
682   //! The method sets up the color for such highlighting.
683   //! By default, this is Quantity_NOC_GRAY40.
684   void SetSubIntensityColor (const Quantity_Color& theColor)
685   {
686     mySubintStyle->SetColor (theColor);
687   }
688
689   //! Allows you to set the color used to show preselection.
690   //! By default, this is Quantity_NOC_GREEN.
691   //! A preselected entity is one which has been selected
692   //! as the domain of application of a function such as a fillet.
693     void SetPreselectionColor (const Quantity_NameOfColor aCol);
694
695   //! Sets the display mode of seen Interactive Objects.
696   //! aMode provides the display mode index of the entity aniobj.
697   //! If updateviewer equals Standard_True, the
698   //! predominant mode aMode will overule the context mode.
699   //! If a local context is open and if updateviewer equals
700   //! Standard_False, the presentation of the Interactive
701   //! Object returns to the default selection mode; the
702   //! object is displayed but no viewer will be updated.
703   //! Note that display mode 3 is only used if you have an
704   //! AIS_Textured Shape.
705   Standard_EXPORT void SetDisplayMode (const Standard_Integer AMode, const Standard_Boolean updateviewer = Standard_True);
706   
707
708   //! Sets the deviation coefficient aCoefficient.
709   //! Drawings of curves or patches are made with respect
710   //! to a maximal chordal deviation. A Deviation coefficient
711   //! is used in the shading display mode. The shape is
712   //! seen decomposed into triangles. These are used to
713   //! calculate reflection of light from the surface of the
714   //! object. The triangles are formed from chords of the
715   //! curves in the shape. The deviation coefficient
716   //! aCoefficient gives the highest value of the angle with
717   //! which a chord can deviate from a tangent to a   curve.
718   //! If this limit is reached, a new triangle is begun.
719   //! This deviation is absolute and is set through the
720   //! method: SetMaximalChordialDeviation. The default
721   //! value is 0.001.
722   //! In drawing shapes, however, you are allowed to ask
723   //! for a relative deviation. This deviation will be:
724   //! SizeOfObject * DeviationCoefficient.
725   //! default 0.001
726   Standard_EXPORT void SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aCoefficient, const Standard_Boolean updateviewer = Standard_True);
727   
728   Standard_EXPORT void SetDeviationAngle (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
729   
730   //! Calls the AIS_Shape SetAngleAndDeviation to set
731   //! both Angle and Deviation coefficients
732   Standard_EXPORT void SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
733   
734
735   //! Sets the deviation coefficient aCoefficient for
736   //! removal of hidden lines created by different
737   //! viewpoints in different presentations. The Default value is 0.02.
738   Standard_EXPORT void SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aCoefficient, const Standard_Boolean updateviewer = Standard_True);
739   
740   Standard_EXPORT void SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
741   
742   //! Computes a HLRAngle and a
743   //! HLRDeviationCoefficient by means of the angle
744   //! anAngle and sets the corresponding methods in the
745   //! default drawing tool with these values.
746   Standard_EXPORT void SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
747   
748   //! Sets the deviation coefficient aCoefficient.
749   //! Drawings of curves or patches are made with respect
750   //! to a maximal chordal deviation. A Deviation coefficient
751   //! is used in the shading display mode. The shape is
752   //! seen decomposed into triangles. These are used to
753   //! calculate reflection of light from the surface of the
754   //! object. The triangles are formed from chords of the
755   //! curves in the shape. The deviation coefficient
756   //! aCoefficient gives the highest value of the angle with
757   //! which a chord can deviate from a tangent to a   curve.
758   //! If this limit is reached, a new triangle is begun.
759   //! This deviation is absolute and is set through the
760   //! method: SetMaximalChordialDeviation. The default
761   //! value is 0.001.
762   //! In drawing shapes, however, you are allowed to ask
763   //! for a relative deviation. This deviation will be:
764   //! SizeOfObject * DeviationCoefficient.
765   //! default 0.001
766   Standard_EXPORT void SetDeviationCoefficient (const Standard_Real aCoefficient);
767   
768   //! Returns the deviation coefficient.
769   //! Drawings of curves or patches are made with respect
770   //! to a maximal chordal deviation. A Deviation coefficient
771   //! is used in the shading display mode. The shape is
772   //! seen decomposed into triangles. These are used to
773   //! calculate reflection of light from the surface of the
774   //! object. The triangles are formed from chords of the
775   //! curves in the shape. The deviation coefficient gives
776   //! the highest value of the angle with which a chord can
777   //! deviate from a tangent to a   curve. If this limit is
778   //! reached, a new triangle is begun.
779   //! This deviation is absolute and is set through
780   //! Prs3d_Drawer::SetMaximalChordialDeviation. The
781   //! default value is 0.001.
782   //! In drawing shapes, however, you are allowed to ask
783   //! for a relative deviation. This deviation will be:
784   //! SizeOfObject * DeviationCoefficient.
785   Standard_EXPORT Standard_Real DeviationCoefficient() const;
786   
787   //! default 12 degrees
788   Standard_EXPORT void SetDeviationAngle (const Standard_Real anAngle);
789   
790   Standard_EXPORT Standard_Real DeviationAngle() const;
791   
792   //! Sets the deviation coefficient aCoefficient for
793   //! removal of hidden lines created by different
794   //! viewpoints in different presentations. The Default value is 0.02.
795   Standard_EXPORT void SetHLRDeviationCoefficient (const Standard_Real aCoefficient);
796   
797
798   //! Returns the real number value of the hidden line
799   //! removal deviation coefficient.
800   //! A Deviation coefficient is used in the shading display
801   //! mode. The shape is seen decomposed into triangles.
802   //! These are used to calculate reflection of light from the
803   //! surface of the object.
804   //! The triangles are formed from chords of the curves in
805   //! the shape. The deviation coefficient give the highest
806   //! value of the angle with which a chord can deviate
807   //! from a tangent to a curve. If this limit is reached, a
808   //! new triangle is begun.
809   //! To find the hidden lines, hidden line display mode
810   //! entails recalculation of the view at each different
811   //! projector perspective.
812   //! Because hidden lines entail calculations of more than
813   //! usual complexity to decompose them into these
814   //! triangles, a deviation coefficient allowing greater
815   //! tolerance is used. This increases efficiency in calculation.
816   //! The Default value is 0.02.
817   Standard_EXPORT Standard_Real HLRDeviationCoefficient() const;
818   
819   //! Sets the HLR angle anAngle.
820   Standard_EXPORT void SetHLRAngle (const Standard_Real anAngle);
821   
822
823   //! Returns the real number value of the deviation angle
824   //! in hidden line removal views in this interactive context.
825   //! The default value is 20*PI/180.
826   Standard_EXPORT Standard_Real HLRAngle() const;
827   
828   //! compute with anangle a HLRAngle and a HLRDeviationCoefficient
829   //! and set them in myHLRAngle and in myHLRDeviationCoefficient
830   //! of myDefaultDrawer ;
831   //! anAngle is in radian ; ( 1 deg < angle in deg < 20 deg)
832   Standard_EXPORT void SetHLRAngleAndDeviation (const Standard_Real anAngle);
833   
834   //! Initializes hidden line aspect in the default drawing tool, or Drawer.
835   //! The default values are:
836   //! Color: Quantity_NOC_YELLOW
837   //! Type of line: Aspect_TOL_DASH
838   //! Width: 1.
839   Standard_EXPORT Handle(Prs3d_LineAspect) HiddenLineAspect() const;
840   
841
842   //! Sets the hidden line aspect anAspect.
843   //! anAspect defines display attributes for hidden lines in
844   //! HLR projections.
845   Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& anAspect) const;
846   
847   //! returns Standard_True if the hidden lines are to be drawn.
848   //! By default the hidden lines are not drawn.
849   Standard_EXPORT Standard_Boolean DrawHiddenLine() const;
850   
851   Standard_EXPORT void EnableDrawHiddenLine() const;
852   
853   Standard_EXPORT void DisableDrawHiddenLine() const;
854   
855   //! Sets the number of U and V isoparameters displayed.
856   Standard_EXPORT void SetIsoNumber (const Standard_Integer NbIsos, const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
857   
858   //! Returns the number of U and V isoparameters displayed.
859   Standard_EXPORT Standard_Integer IsoNumber (const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
860   
861   //! Returns True if drawing isoparameters on planes is enabled.
862   Standard_EXPORT void IsoOnPlane (const Standard_Boolean SwitchOn);
863   
864   //! Returns True if drawing isoparameters on planes is enabled.
865   //! if <forUIsos> = False,
866   Standard_EXPORT Standard_Boolean IsoOnPlane() const;
867
868   //! Enables or disables on-triangulation build for isolines for a particular object.
869   //! In case if on-triangulation builder is disabled, default on-plane
870   //! builder will compute isolines for the object given.
871   Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theIsEnabled,
872                                            const Handle(AIS_InteractiveObject)& theObject);
873
874   //! Enables or disables on-triangulation build for isolines for default drawer.
875   //! In case if on-triangulation builder is disabled, default on-plane
876   //! builder will compute isolines for the object given.
877   Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theToSwitchOn);
878
879   //! Returns true if drawing isolines on triangulation algorithm is enabled.
880   Standard_EXPORT Standard_Boolean IsoOnTriangulation() const;
881
882   //! Sets the graphic basic aspect to the current presentation of
883   //! ALL selected objects.
884   //! Flag globalChange has no effect (left to simplify porting).
885   //! Updates the viewer when <updateViewer> is TRUE
886   Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& anAspect, const Standard_Boolean globalChange = Standard_True, const Standard_Boolean updateViewer = Standard_True);
887   
888   //! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
889   //! This is done by the view theView passing this position to the main viewer and updating it.
890   //! Functions in both Neutral Point and local contexts.
891   //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
892   Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer theXPix, const Standard_Integer theYPix, const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawOnUpdate = Standard_True);
893   
894   //! returns True  if other entities  were detected  in the
895   //! last mouse detection
896   Standard_EXPORT Standard_Boolean HasNextDetected() const;
897   
898   //! if more than 1 object is detected by the selector,
899   //! only the "best" owner is hilighted at the mouse position.
900   //! This Method allows the user to hilight one after another
901   //! the other detected entities.
902   //! if The method select is called, the selected entity
903   //! will be the hilighted one!
904   //! returns the Rank of hilighted entity
905   //! WARNING : Loop Method. When all the detected entities
906   //! have been hilighted , the next call will hilight
907   //! the first one again
908   Standard_EXPORT Standard_Integer HilightNextDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
909   
910   //! Same as previous methods in reverse direction...
911   Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
912   
913   //! Adds object in the selection.
914   Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
915
916   //! Adds object in the selection.
917   AIS_StatusOfPick AddSelect (const Handle(AIS_InteractiveObject)& theObject)
918   {
919     return AddSelect (theObject->GlobalSelOwner());
920   }
921
922   //! Selects everything found in the bounding rectangle
923   //! defined by the pixel minima and maxima, XPMin,
924   //! YPMin, XPMax, and YPMax in the view, aView
925   //! The objects detected are passed to the main viewer,
926   //! which is then updated.
927   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);
928   
929   //! polyline selection; clears the previous picked list
930   Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
931   
932   //! Stores  and hilights the previous detected; Unhilights
933   //! the previous picked.
934   Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean updateviewer = Standard_True);
935   
936   //! adds the last detected to the list of previous picked.
937   //! if the last detected was already declared as picked,
938   //! removes it from the Picked List.
939   Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean updateviewer = Standard_True);
940   
941   //! adds the last detected to the list of previous picked.
942   //! if the last detected was already declared as picked,
943   //! removes it from the Picked List.
944   Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
945   
946   //! rectangle  of selection  ; adds new detected entities into the
947   //! picked list, removes the detected entities that were already stored...
948   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);
949   
950   //! Specify whether selected object must be hilighted when mouse cursor
951   //! is moved above it (in MoveTo method). By default this value is false and
952   //! selected object is not hilighted in this case.
953     void SetToHilightSelected (const Standard_Boolean toHilight);
954   
955   //! Return value specified whether selected object must be hilighted
956   //! when mouse cursor is moved above it
957     Standard_Boolean ToHilightSelected() const;
958
959
960   //! @name OBSOLETE METHODS THAT ARE VALID FOR LOCAL CONTEXT ONLY
961
962   //! Updates the view of the current object in open context.
963   //! Objects selected when there is no open local context
964   //! are called current objects; those selected in open
965   //! local context, selected objects.
966   //! If a local context is open and if updateviewer equals
967   //! Standard_False, the presentation of the Interactive
968   //! Object activates the selection mode; the object is
969   //! displayed but no viewer will be updated.
970   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
971   Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
972   
973
974   //! Allows to add or remove the object given to the list of current and highlight/unhighlight it
975   //! correspondingly. Is valid for global context only; for local context use method AddOrRemoveSelected.
976   //! Since this method makes sence only for neutral point selection of a whole object, if 0 selection
977   //! of the object is empty this method simply does nothing.
978   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
979   Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
980                                                  const Standard_Boolean theIsToUpdateViewer = Standard_True);
981   
982   //! Updates the list of current objects, i.e. hilights new
983   //! current objects, removes hilighting from former current objects.
984   //! Objects selected when there is no open local context
985   //! are called current objects; those selected in open
986   //! local context, selected objects.
987   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
988   Standard_EXPORT void UpdateCurrent();
989   
990
991   //! Returns the current selection touched by the cursor.
992   //! Objects selected when there is no open local context
993   //! are called current objects; those selected in open
994   //! local context, selected objects.
995   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
996   Standard_Boolean WasCurrentTouched() const;
997   
998   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
999   void SetOkCurrent();
1000   
1001
1002   //! Returns true if there is a non-null interactive object in Neutral Point.
1003   //! Objects selected when there is no open local context are called current objects;
1004   //! those selected in open local context, selected objects.
1005   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1006   Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const;
1007   
1008
1009   //! Initializes a scan of the current selected objects in
1010   //! Neutral Point.
1011   //! Objects selected when there is no open local context
1012   //! are called current objects; those selected in open
1013   //! local context, selected objects.
1014   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1015   Standard_EXPORT void InitCurrent();
1016   
1017
1018   //! Returns true if there is another object found by the
1019   //! scan of the list of current objects.
1020   //! Objects selected when there is no open local context
1021   //! are called current objects; those selected in open
1022   //! local context, selected objects.
1023   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1024   Standard_EXPORT Standard_Boolean MoreCurrent() const;
1025   
1026
1027   //! Continues the scan to the next object in the list of
1028   //! current objects.
1029   //! Objects selected when there is no open local context
1030   //! are called current objects; those selected in open
1031   //! local context, selected objects.
1032   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1033   Standard_EXPORT void NextCurrent();
1034   
1035
1036   //! Returns the current interactive object.
1037   //! Objects selected when there is no open local context
1038   //! are called current objects; those selected in open
1039   //! local context, selected objects.
1040   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1041   Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
1042
1043   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1044   Standard_EXPORT Standard_Integer NbCurrents();
1045
1046   //! Highlights current objects.
1047   //! Objects selected when there is no open local context
1048   //! are called current objects; those selected in open
1049   //! local context, selected objects.
1050   //! If a local context is open and if updateviewer equals
1051   //! Standard_False, the presentation of the Interactive
1052   //! Object activates the selection mode; the object is
1053   //! displayed but no viewer will be updated.
1054   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1055   Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
1056
1057   //! Removes highlighting from current objects.
1058   //! Objects selected when there is no open local context
1059   //! are called current objects; those selected in open
1060   //! local context, selected objects.
1061   //! If a local context is open and if updateviewer equals
1062   //! Standard_False, the presentation of the Interactive
1063   //! Object activates the selection mode; the object is
1064   //! displayed but no viewer will be updated.
1065   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1066   Standard_EXPORT void UnhilightCurrents (const Standard_Boolean updateviewer = Standard_True);
1067
1068   //! Empties previous current objects in order to get the
1069   //! current objects detected by the selector using
1070   //! UpdateCurrent.
1071   //! Objects selected when there is no open local context
1072   //! are called current objects; those selected in open
1073   //! local context, selected objects.
1074   //! If a local context is open and if updateviewer equals
1075   //! Standard_False, the presentation of the Interactive
1076   //! Object activates the selection mode; the object is
1077   //! displayed but no viewer will be updated.
1078   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
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_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1084   Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
1085   
1086   //! @return current mouse-detected interactive object or null object, if there is no currently detected interactives
1087   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1088   Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
1089
1090   //! @name COMMON SELECTION METHODS VALID FOR BOTH GLOBAL AND LOCAL CONTEXT
1091
1092   //! Unhighlights previously selected owners and marks them as not selected.
1093   //! Marks owner given as selected and highlights it.
1094   //! Performs selection filters check.
1095   Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
1096                                     const Standard_Boolean theToUpdateViewer = Standard_True);
1097
1098   //! Puts the interactive object aniObj in the list of
1099   //! selected objects.
1100   //! If a local context is open and if updateviewer equals
1101   //! Standard_False, the presentation of the Interactive
1102   //! Object activates the selection mode; the object is
1103   //! displayed but no viewer will be updated.
1104   //! Performs selection filters check.
1105   Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
1106                                     const Standard_Boolean theToUpdateViewer = Standard_True);
1107
1108   //! Updates the list of selected objects:
1109   //! i.e. highlights the newely selected ones and unhighlights previously selected objects.
1110   Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1111   
1112   //! Allows to highlight or unhighlight the owner given depending on its selection status
1113   Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
1114                                             const Standard_Boolean theToUpdateViewer = Standard_True);
1115
1116   //! Highlights selected objects.
1117   //! If a local context is open and if updateviewer equals
1118   //! Standard_False, the presentation of the Interactive
1119   //! Object activates the selection mode; the object is
1120   //! displayed but no viewer will be updated.
1121   Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1122
1123   //! Removes highlighting from selected objects.
1124   //! If a local context is open and if updateviewer equals
1125   //! Standard_False, the presentation of the Interactive
1126   //! Object activates the selection mode; the object is
1127   //! displayed but no viewer will be updated.
1128   Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1129
1130   //! Empties previous selected objects in order to get the
1131   //! selected objects detected by the selector using
1132   //! UpdateSelected.
1133   //! If a local context is open and if updateviewer equals
1134   //! Standard_False, the presentation of the Interactive
1135   //! Object activates the selection mode; the object is
1136   //! displayed but no viewer will be updated.
1137   Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
1138   
1139   //! No right to Add a selected Shape (Internal Management
1140   //! of shape Selection).
1141   //! A Previous selected shape may only be removed.
1142   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1143   Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& aShape, const Standard_Boolean updateviewer = Standard_True);
1144
1145   //! Allows to highlight or unhighlight the owner given depending on its selection status
1146   Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
1147                                             const Standard_Boolean theToUpdateViewer = Standard_True);
1148
1149   //! Returns true is the owner given is selected
1150   Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const;
1151
1152   //! Returns true is the object given is selected
1153   Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& theObj) const;
1154
1155   //! Returns the first selected object in the list of current selected.
1156   Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject();
1157
1158   //! Initializes a scan of the selected objects.
1159   Standard_EXPORT void InitSelected();
1160
1161   //! Returns true if there is another object found by the
1162   //! scan of the list of selected objects.
1163   Standard_EXPORT Standard_Boolean MoreSelected() const;
1164
1165   //! Continues the scan to the next object in the list of
1166   //! selected objects.
1167   Standard_EXPORT void NextSelected();
1168
1169   Standard_EXPORT Standard_Integer NbSelected();
1170
1171   //! Returns true if the interactive context has a shape
1172   //! selected in it which results from the decomposition of
1173   //! another entity.
1174   //! If HasSelectedShape returns true, SelectedShape
1175   //! returns the shape which has been shown to be
1176   //! selected. Interactive returns the Interactive Object
1177   //! from which the shape has been selected.
1178   //! If HasSelectedShape returns false, Interactive
1179   //! returns the interactive entity selected by the click of the mouse.
1180   Standard_EXPORT Standard_Boolean HasSelectedShape() const;
1181
1182   //! Returns the selected shape.
1183   Standard_EXPORT TopoDS_Shape SelectedShape() const;
1184
1185   //! Returns the owner of the selected entity resulting
1186   //! from the decomposition of another entity.
1187   Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const;
1188
1189   //! Returns a collection containing all entity owners
1190   //! created for the interactive object <theIObj> in
1191   //! the selection mode theMode (in all active modes
1192   //! if the Mode == -1)
1193   Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
1194                                      const Handle(AIS_InteractiveObject)& theIObj,
1195                                      const Standard_Integer theMode = -1) const;
1196
1197   Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const;
1198
1199   //! Returns true if the applicative object has an owner
1200   //! from Interactive attributed to it.
1201   Standard_EXPORT Standard_Boolean HasApplicative() const;
1202   
1203
1204   //! Returns the owner of the applicative entity detected
1205   //! in interactive context. The owner can be a shape for
1206   //! a set of sub-shapes or a sub-shape for sub-shapes
1207   //! which it is composed of.
1208   Standard_EXPORT Handle(Standard_Transient) Applicative() const;
1209   
1210
1211   //! Returns true if there is a mouse-detected entity in local context.
1212   //! If there is no open local context, the objects selected
1213   //! are called current objects; selected objects if there is
1214   //! one. Iterators allow entities to be recovered in either
1215   //! case. This method is one of a set which allows you to
1216   //! manipulate the objects which have been placed in these two lists.
1217   Standard_EXPORT Standard_Boolean HasDetected() const;
1218   
1219
1220   //! Returns true if there is a detected shape in local context.
1221   //! If there is no open local context, the objects selected
1222   //! are called current objects; selected objects if there is
1223   //! one. Iterators allow entities to be recovered in either
1224   //! case. This method is one of a set which allows you to
1225   //! manipulate the objects which have been placed in these two lists.
1226   Standard_EXPORT Standard_Boolean HasDetectedShape() const;
1227   
1228
1229   //! Returns the shape detected in local context.
1230   //! If there is no open local context, the objects selected
1231   //! are called current objects; selected objects if there is
1232   //! one. Iterators allow entities to be recovered in either
1233   //! case. This method is one of a set which allows you to
1234   //! manipulate the objects which have been placed in these two lists.
1235   Standard_EXPORT const TopoDS_Shape& DetectedShape() const;
1236   
1237
1238   //! Returns the interactive objects last detected in open context.
1239   //! If there is no open local context, the objects selected
1240   //! are called current objects; selected objects if there is
1241   //! one. Iterators allow entities to be recovered in either
1242   //! case. This method is one of a set which allows you to
1243   //! manipulate the objects which have been placed in these two lists.
1244   Standard_EXPORT Handle(AIS_InteractiveObject) DetectedInteractive() const;
1245   
1246   //! returns the owner of the detected sensitive primitive.
1247   Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedOwner() const;
1248   
1249
1250   //! Initialization for iteration through mouse-detected objects in
1251   //! interactive context or in local context if it is opened.
1252   Standard_EXPORT void InitDetected();
1253   
1254
1255   //! @return true if there is more mouse-detected objects after the current one
1256   //! during iteration through mouse-detected interactive objects.
1257   Standard_EXPORT Standard_Boolean MoreDetected() const;
1258   
1259
1260   //! Gets next current object during iteration through mouse-detected
1261   //! interactive objects.
1262   Standard_EXPORT void NextDetected();
1263
1264   //! Opens local contexts and specifies how this is to be
1265   //! done. The options listed above function in the following manner:
1266   //! -   UseDisplayedObjects -allows you to load or not
1267   //! load the interactive objects visualized at Neutral
1268   //! Point in the local context which you open. If false,
1269   //! the local context is empty after being opened. If
1270   //! true, the objects at Neutral Point are loaded by their
1271   //! default selection mode.
1272   //! -   AllowShapeDecomposition -AIS_Shape allows or
1273   //! prevents decomposition in standard shape location
1274   //! mode of objects at Neutral Point which are
1275   //! type-"privileged". This Flag is only taken into
1276   //! account when UseDisplayedObjects is true.
1277   //! -   AcceptEraseOfObjects -authorises other local
1278   //! contexts to erase the interactive objects present in
1279   //! this context. This option is rarely used.
1280   //! -   BothViewers - Has no use currently defined.
1281   //! This method returns the index of the created local
1282   //! context. It should be kept and used to close the context.
1283   //! Opening a local context allows you to prepare an
1284   //! environment for temporary presentations and
1285   //! selections which will disappear once the local context is closed.
1286   //! You can open several local contexts, but only the last
1287   //! one will be active.
1288   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1289   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);
1290   
1291   //! Allows you to close local contexts. For greater
1292   //! security, you should close the context with the
1293   //! index Index given on opening.
1294   //! When you close a local context, the one before,
1295   //! which is still on the stack,   reactivates. If none is
1296   //! left, you return to Neutral Point.
1297   //! If a local context is open and if updateviewer
1298   //! equals Standard_False, the presentation of the
1299   //! Interactive Object activates the selection mode; the
1300   //! object is displayed but no viewer will be updated.
1301   //! Warning
1302   //! When the index isn't specified, the current context
1303   //! is closed. This option can be dangerous, as other
1304   //! Interactive Functions can open local contexts
1305   //! without necessarily warning the user.
1306   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1307   Standard_EXPORT void CloseLocalContext (const Standard_Integer Index = -1, const Standard_Boolean updateviewer = Standard_True);
1308   
1309   //! returns -1 if no opened local context.
1310   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1311   Standard_EXPORT Standard_Integer IndexOfCurrentLocal() const;
1312   
1313
1314   //! Allows you to close all local contexts at one go and
1315   //! return to Neutral Point.
1316   //! If a local context is open and if updateviewer equals
1317   //! Standard_False, the presentation of the Interactive
1318   //! Object activates the selection mode; the object is
1319   //! displayed but no viewer will be updated.
1320   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1321   Standard_EXPORT void CloseAllContexts (const Standard_Boolean updateviewer = Standard_True);
1322   
1323   //! to   be  used only with no  opened
1324   //! local context..  displays and activates objects in their
1325   //! original state before local contexts were opened...
1326   Standard_EXPORT void ResetOriginalState (const Standard_Boolean updateviewer = Standard_True);
1327   
1328   //! clears Objects/Filters/Activated Modes list in the current opened local context.
1329   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1330   Standard_EXPORT void ClearLocalContext (const AIS_ClearMode TheMode = AIS_CM_All);
1331
1332   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1333   Standard_EXPORT void UseDisplayedObjects();
1334   
1335   //! when a local Context is opened, one is able to
1336   //! use/not use the displayed objects at neutral point
1337   //! at anytime.
1338   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1339   Standard_EXPORT void NotUseDisplayedObjects();
1340   
1341   //! initializes the list of presentations to be displayed
1342   //! returns False if no local context is opened.
1343   Standard_EXPORT Standard_Boolean BeginImmediateDraw();
1344   
1345   //! returns True if <anIObj> has been stored in the list.
1346   Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0);
1347   
1348   //! returns True if the immediate display has been done.
1349   Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_View)& theView);
1350   
1351   //! Uses the First Active View of Main Viewer!
1352   //! returns True if the immediate display has been done.
1353   Standard_EXPORT Standard_Boolean EndImmediateDraw();
1354   
1355   Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
1356   
1357
1358   //! Sets the highlighting status aStatus of detected and
1359   //! selected entities.
1360   //! Whether you are in Neutral Point or local context, this
1361   //! is automatically managed by the Interactive Context.
1362   //! This function allows you to disconnect the automatic mode.
1363   Standard_EXPORT void SetAutomaticHilight (const Standard_Boolean aStatus);
1364   
1365
1366   //! Returns true if the automatic highlight mode is active
1367   //! in an open context.
1368   Standard_EXPORT Standard_Boolean AutomaticHilight() const;
1369   
1370   //! Enables/Disables the Z detection.
1371   //! If TRUE the detection echo can be partially hidden by the
1372   //! detected object.
1373   Standard_EXPORT void SetZDetection (const Standard_Boolean aStatus = Standard_False);
1374   
1375   //! Retrieves the Z detection state.
1376   Standard_EXPORT Standard_Boolean ZDetection() const;
1377   
1378   //! Activates the selection mode aMode whose index is
1379   //! given, for the given interactive entity anIobj.
1380   Standard_EXPORT void Activate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode = 0, const Standard_Boolean theIsForce = Standard_False);
1381
1382   //! Activates the given selection mode for the all displayed objects.
1383   Standard_EXPORT void Activate (const Standard_Integer theMode,
1384                                  const Standard_Boolean theIsForce = Standard_False);
1385   
1386   //! Deactivates all the activated selection modes
1387   //! of an object.
1388   Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIObj);
1389   
1390
1391   //! Deactivates all the activated selection modes of the
1392   //! interactive object anIobj with a given selection mode aMode.
1393   Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode);
1394
1395   //! Deactivates the given selection mode for all displayed objects.
1396   Standard_EXPORT void Deactivate (const Standard_Integer theMode);
1397
1398   //! Deactivates all the activated selection mode at all displayed objects.
1399   Standard_EXPORT void Deactivate();
1400
1401   //! Returns the list of activated selection modes in an open context.
1402   Standard_EXPORT void ActivatedModes (const Handle(AIS_InteractiveObject)& anIobj, TColStd_ListOfInteger& theList) const;
1403   
1404   //! to be Used only with opened local context and
1405   //! if <anIobj> is of type shape...
1406   //! if <aStatus> = True <anIobj> will be sensitive to
1407   //! shape selection modes activation.
1408   //! = False, <anIobj> will not be senstive
1409   //! any more.
1410   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1411   Standard_EXPORT void SetShapeDecomposition (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean aStatus);
1412   
1413
1414   //! Sets the temporary graphic attributes of the entity
1415   //! anObj. These are provided by the attribute manager
1416   //! aDrawer and are valid for a particular local context only.
1417   //! If a local context is open and if updateviewer equals
1418   //! Standard_False, the presentation of the Interactive
1419   //! Object activates the selection mode; the object is
1420   //! displayed but no viewer will be updated.
1421   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1422   Standard_EXPORT void SetTemporaryAttributes (const Handle(AIS_InteractiveObject)& anObj, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Boolean updateviewer = Standard_True);
1423   
1424
1425   //! Highlights, and removes highlights from, the displayed
1426   //! object aniobj which is displayed at Neutral Point with
1427   //! subintensity color; available only for active local
1428   //! context. There is no effect if there is no local context.
1429   //! If a local context is open and if updateviewer equals
1430   //! Standard_False, the presentation of the Interactive
1431   //! Object activates the selection mode; the object is
1432   //! displayed but no viewer will be updated.
1433   Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
1434   
1435
1436   //! Removes the subintensity option for the entity aniobj.
1437   //! If a local context is open and if updateviewer equals
1438   //! Standard_False, the presentation of the Interactive
1439   //! Object activates the selection mode; the object is
1440   //! displayed but no viewer will be updated.
1441   Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
1442   
1443   //! hilights/unhilights displayed objects which are displayed at
1444   //! neutral state with subintensity color;
1445   //! available only for active local context.
1446   //! No effect if no local context.
1447   Standard_EXPORT void SubIntensityOn (const Standard_Boolean updateviewer = Standard_True);
1448   
1449   //! removes subintensity option for all objects.
1450   Standard_EXPORT void SubIntensityOff (const Standard_Boolean updateviewer = Standard_True);
1451   
1452   //! Allows you to add the filter aFilter to Neutral Point or
1453   //! to a local context if one or more selection modes have been activated.
1454   //! Only type filters may be active in Neutral Point.
1455   Standard_EXPORT void AddFilter (const Handle(SelectMgr_Filter)& aFilter);
1456   
1457
1458   //! Removes a filter from Neutral Point or a local context
1459   //! if one or more selection modes have been activated.
1460   //! Only type filters are activated in Neutral Point.
1461   Standard_EXPORT void RemoveFilter (const Handle(SelectMgr_Filter)& aFilter);
1462   
1463   //! Remove a filter to Neutral Point or a local context if
1464   //! one or more selection modes have been activated.
1465   //! Only type filters are active in Neutral Point.
1466   Standard_EXPORT void RemoveFilters();
1467   
1468   //! Provides an alternative to the Display methods when
1469   //! activating specific selection modes. This has the
1470   //! effect of activating the corresponding selection mode
1471   //! aStandardActivation for all objects in Local Context
1472   //! which accept decomposition into sub-shapes.
1473   //! Every new Object which has been loaded into the
1474   //! interactive context and which answers these
1475   //! decomposition criteria is automatically activated
1476   //! according to these modes.
1477   //! Warning
1478   //! If you have opened a local context by loading an
1479   //! object with the default options
1480   //! (<AllowShapeDecomposition >= Standard_True), all
1481   //! objects of the "Shape" type are also activated with
1482   //! the same modes. You can act on the state of these
1483   //! "Standard" objects by using SetShapeDecomposition(Status).
1484   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1485   Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1486   
1487
1488   //! Provides an alternative to the Display methods when
1489   //! deactivating specific selection modes. This has the
1490   //! effect of deactivating the corresponding selection
1491   //! mode aStandardActivation for all objects in Local
1492   //! Context which accept decomposition into sub-shapes.
1493   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1494   Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
1495   
1496
1497   //! Returns the list of activated standard selection modes
1498   //! available in a local context.
1499   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1500   Standard_EXPORT const TColStd_ListOfInteger& ActivatedStandardModes() const;
1501   
1502
1503   //! Returns the list of filters active in a local context.
1504   Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
1505   
1506
1507   //! Returns the default attribute manager.
1508   //! This contains all the color and line attributes which
1509   //! can be used by interactive objects which do not have
1510   //! their own attributes.
1511     const Handle(Prs3d_Drawer)& DefaultDrawer() const;
1512   
1513   //! Returns the current viewer.
1514     const Handle(V3d_Viewer)& CurrentViewer() const;
1515   
1516   //! Returns the list of displayed objects of a particular
1517   //! Type WhichKind and Signature WhichSignature. By
1518   //! Default, WhichSignature equals -1. This means that
1519   //! there is a check on type only.
1520   Standard_EXPORT void DisplayedObjects (AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1521   
1522   //! gives the list of displayed objects of a particular
1523   //! Type and signature.
1524   //! by Default, <WhichSignature> = -1 means
1525   //! control only on <WhichKind>.
1526   Standard_EXPORT void DisplayedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const;
1527   
1528
1529   //! Returns the list theListOfIO of erased objects (hidden objects)
1530   //! particular Type WhichKind and Signature WhichSignature.
1531   //! By Default, WhichSignature equals 1. This means
1532   //! that there is a check on type only.
1533   Standard_EXPORT void ErasedObjects (AIS_ListOfInteractive& theListOfIO) const;
1534   
1535   //! gives the list of erased objects (hidden objects)
1536   //! Type and signature
1537   //! by Default, <WhichSignature> = -1 means
1538   //! control only on <WhichKind>.
1539   Standard_EXPORT void ErasedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& theListOfIO) const;
1540   
1541
1542   //! Returns the list theListOfIO of objects with indicated display status
1543   //! particular Type WhichKind and Signature WhichSignature.
1544   //! By Default, WhichSignature equals 1. This means
1545   //! that there is a check on type only.
1546   Standard_EXPORT void ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1547   
1548   //! gives the list of objects with indicated display status
1549   //! Type and signature
1550   //! by Default, <WhichSignature> = -1 means
1551   //! control only on <WhichKind>.
1552   Standard_EXPORT void ObjectsByDisplayStatus (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
1553   
1554   //! fills <aListOfIO> with objects of a particular
1555   //! Type and Signature with no consideration of display status.
1556   //! by Default, <WhichSignature> = -1 means
1557   //! control only on <WhichKind>.
1558   //! if <WhichKind> = AIS_KOI_None and <WhichSignature> = -1,
1559   //! all the objects are put into the list.
1560   Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO, const AIS_KindOfInteractive WhichKind = AIS_KOI_None, const Standard_Integer WhichSignature = -1) const;
1561   
1562   //! Returns true if there is an open context.
1563     Standard_Boolean HasOpenedContext() const;
1564
1565   //! This method is only intended for advanced operation, particularly with
1566   //! the aim to improve performance when many objects have to be selected
1567   //! together. Otherwise, you should use other (non-internal) methods of
1568   //! class AIS_InteractiveContext without trying to obtain an instance of
1569   //! AIS_LocalContext.
1570   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1571   Handle(AIS_LocalContext) LocalContext() const;
1572   
1573     const Handle(SelectMgr_SelectionManager)& SelectionManager() const;
1574   
1575     const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const;
1576   
1577     const Handle(StdSelect_ViewerSelector3d)& MainSelector() const;
1578   
1579   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1580   Standard_EXPORT Handle(StdSelect_ViewerSelector3d) LocalSelector() const;
1581   
1582   //! Clears all the structures which don't
1583   //! belong to objects displayed at neutral point
1584   //! only effective when no Local Context is opened...
1585   //! returns the number of removed  structures from the viewers.
1586   Standard_EXPORT Standard_Integer PurgeDisplay();
1587   
1588   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1589   Standard_EXPORT Standard_Integer HighestIndex() const;
1590   
1591   Standard_EXPORT void DisplayActiveSensitive (const Handle(V3d_View)& aView);
1592   
1593   Standard_EXPORT void ClearActiveSensitive (const Handle(V3d_View)& aView);
1594   
1595   //! Fits the view correspondingly to the bounds of selected objects.
1596   //! Infinite objects are ignored if infinite state of AIS_InteractiveObject
1597   //! is set to true.
1598   Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView, const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
1599   
1600   Standard_EXPORT void DisplayActiveSensitive (const Handle(AIS_InteractiveObject)& anObject, const Handle(V3d_View)& aView);
1601   
1602   //! returns if possible,
1603   //! the first local context where the object is seen
1604   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1605   Standard_EXPORT Standard_Boolean IsInLocal (const Handle(AIS_InteractiveObject)& anObject, Standard_Integer& TheIndex) const;
1606   
1607   //! Rebuilds 1st level of BVH selection forcibly
1608   Standard_EXPORT void RebuildSelectionStructs();
1609   
1610   //! setup object visibility in specified view,
1611   //! has no effect if object is not disaplyed in this context.
1612   Standard_EXPORT void SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisible);
1613   
1614   //! Disconnects theObjToDisconnect from theAssembly and removes dependent selection structures
1615   Standard_EXPORT void Disconnect (const Handle(AIS_InteractiveObject)& theAssembly, const Handle(AIS_InteractiveObject)& theObjToDisconnect = NULL);
1616   
1617   //! Query objects visible or hidden in specified view due to affinity mask.
1618   Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisibleInView, const AIS_DisplayStatus theStatus = AIS_DS_None) const;
1619
1620   //! Redraws immediate structures in all views of the viewer given taking into account its visibility.
1621   Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
1622
1623 protected:
1624
1625   Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
1626   
1627   Standard_EXPORT void EraseGlobal (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
1628   
1629   Standard_EXPORT void ClearGlobal (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
1630   
1631   Standard_EXPORT void ClearGlobalPrs (const Handle(AIS_InteractiveObject)& anObj, const Standard_Integer aMode, const Standard_Boolean updateviewer = Standard_True);
1632   
1633   Standard_EXPORT void InitAttributes();
1634   
1635   Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
1636   
1637   //! UNKNOWN
1638   Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True);
1639   
1640   //! UNKNOWN
1641   Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True);
1642
1643   //! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
1644   Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
1645
1646   //! Helper function that highlights the owner given with <theStyle> without
1647   //! performing AutoHighlight checks, e.g. is used for dynamic highlight.
1648   Standard_EXPORT void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
1649                                            const Handle(V3d_Viewer)& theViewer = NULL);
1650
1651   //! Helper function that highlights the owner given with <theStyle> with check
1652   //! for AutoHighlight, e.g. is used for selection.
1653   Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
1654
1655   //! Helper function that highlights global owner of the object given with <theStyle> with check
1656   //! for AutoHighlight, e.g. is used for selection.
1657   //! If global owner is null, it simply highlights the whole object
1658   Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
1659                                         const Handle(Graphic3d_HighlightStyle)& theStyle,
1660                                         const Standard_Integer theMode) const;
1661
1662   //! Helper function that unhighlights all owners that are stored in current AIS_Selection.
1663   //! The function updates global status and selection state of owner and interactive object.
1664   //! If the parameter <theIsToHilightSubIntensity> is set to true, interactive objects with sub-intensity
1665   //! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
1666   Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
1667
1668   //! Helper function that unhighlights global selection owner of given interactive.
1669   //! The function does not perform any updates of global or owner status
1670   Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode) const;
1671
1672   //! Helper function that turns on sub-intensity in global status and highlights
1673   //! given objects with sub-intensity color
1674   //! @param theObject [in] the object. If NULL is given, than sub-intensity will be turned on for
1675   //! all inveractive objects of the context
1676   //! @param theDispMode [in] display mode. If -1 is given, sub-intensity will be turned on for
1677   //! all display modes in global status's list of modes
1678   //! @param theIsDisplayedOnly [in] is true if sub-intensity should be applied only to objects with
1679   //! status AIS_DS_Displayed
1680   Standard_EXPORT void turnOnSubintensity (const Handle(AIS_InteractiveObject)& theObject = NULL,
1681                                            const Standard_Integer theDispMode = -1,
1682                                            const Standard_Boolean theIsDisplayedOnly = Standard_True) const;
1683
1684   //! Helper function that highlights the object with sub-intensity color without any checks
1685   //! @param theObject [in] the object that will be highlighted
1686   //! @param theMode [in] display mode
1687   Standard_EXPORT void highlightWithSubintensity (const Handle(AIS_InteractiveObject)& theObject,
1688                                                   const Standard_Integer theMode) const;
1689
1690   //! Helper function that highlights the owner with sub-intensity color without any checks
1691   //! @param theOwner [in] the owner that will be highlighted
1692   //! @param theMode [in] display mode
1693   Standard_EXPORT void highlightWithSubintensity (const Handle(SelectMgr_EntityOwner)& theOwner,
1694                                                   const Standard_Integer theMode) const;
1695
1696   //! Helper function that returns correct dynamic highlight style for the object:
1697   //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1698   //! dynamic highlight style of interactive context will be returned.
1699   //! @param theObj [in] the object to check
1700   const Handle(Graphic3d_HighlightStyle)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj) const
1701   {
1702     const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
1703     return !aHiDrawer.IsNull() && aHiDrawer->HasOwnHighlightStyle()
1704       ? aHiDrawer->HighlightStyle() : myHiStyle;
1705   }
1706
1707   //! Helper function that returns correct selection style for the object:
1708   //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1709   //! selection style of interactive context will be returned.
1710   //! @param theObj [in] the object to check
1711   const Handle(Graphic3d_HighlightStyle)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj) const
1712   {
1713     const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
1714     return !aHiDrawer.IsNull() && aHiDrawer->HasOwnSelectionStyle()
1715       ? aHiDrawer->SelectionStyle() : mySelStyle;
1716   }
1717
1718   //! Assign the context to the object or throw exception if object was already assigned to another context.
1719   void setContextToObject (const Handle(AIS_InteractiveObject)& theObj)
1720   {
1721     if (theObj->HasInteractiveContext())
1722     {
1723       if (theObj->myCTXPtr != this)
1724       {
1725         Standard_ProgramError::Raise ("AIS_InteractiveContext - object has been already displayed in another context!");
1726       }
1727     }
1728     else
1729     {
1730       theObj->SetContext (this);
1731     }
1732   }
1733
1734 protected:
1735
1736   AIS_DataMapOfIOStatus myObjects;
1737   Handle(SelectMgr_SelectionManager) mgrSelector;
1738   Handle(PrsMgr_PresentationManager3d) myMainPM;
1739   Handle(V3d_Viewer) myMainVwr;
1740   Handle(StdSelect_ViewerSelector3d) myMainSel;
1741   Handle(SelectMgr_EntityOwner) myLastPicked;
1742   Handle(SelectMgr_EntityOwner) myLastinMain;
1743   Standard_Boolean myWasLastMain;
1744   Standard_Boolean myCurrentTouched;
1745   Standard_Boolean mySelectedTouched;
1746   Standard_Boolean myToHilightSelected;
1747   Handle(SelectMgr_OrFilter) myFilters;
1748   Handle(Prs3d_Drawer) myDefaultDrawer;
1749   Handle(AIS_Selection) mySelection;
1750   Quantity_NameOfColor myDefaultColor;
1751   Handle(Graphic3d_HighlightStyle) myHiStyle;
1752   Handle(Graphic3d_HighlightStyle) mySelStyle;
1753   Quantity_NameOfColor myPreselectionColor;
1754   Handle(Graphic3d_HighlightStyle) mySubintStyle;
1755   Standard_Integer myDisplayMode;
1756   AIS_DataMapOfILC myLocalContexts;
1757   Standard_Integer myCurLocalIndex;
1758   Handle(V3d_View) mylastmoveview;
1759   TColStd_SequenceOfInteger myDetectedSeq;
1760   Standard_Integer myCurDetected;
1761   Standard_Integer myCurHighlighted;
1762   Standard_Boolean myZDetectionFlag;
1763   Standard_Boolean myIsAutoActivateSelMode;
1764
1765 };
1766
1767 DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
1768
1769 #include <AIS_InteractiveContext.lxx>
1770
1771 #endif // _AIS_InteractiveContext_HeaderFile