Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:54

0001 // Created on: 1996-12-18
0002 // Created by: Robert COUBLANC
0003 // Copyright (c) 1996-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _AIS_InteractiveContext_HeaderFile
0018 #define _AIS_InteractiveContext_HeaderFile
0019 
0020 #include <AIS_DataMapOfIOStatus.hxx>
0021 #include <AIS_DisplayMode.hxx>
0022 #include <AIS_DisplayStatus.hxx>
0023 #include <AIS_KindOfInteractive.hxx>
0024 #include <AIS_ListOfInteractive.hxx>
0025 #include <AIS_Selection.hxx>
0026 #include <AIS_SelectionModesConcurrency.hxx>
0027 #include <AIS_SelectionScheme.hxx>
0028 #include <AIS_StatusOfDetection.hxx>
0029 #include <AIS_StatusOfPick.hxx>
0030 #include <AIS_TypeOfIso.hxx>
0031 #include <Aspect_TypeOfFacingModel.hxx>
0032 #include <Graphic3d_Vec2.hxx>
0033 #include <Prs3d_Drawer.hxx>
0034 #include <Prs3d_TypeOfHighlight.hxx>
0035 #include <PrsMgr_PresentationManager.hxx>
0036 #include <SelectMgr_AndOrFilter.hxx>
0037 #include <SelectMgr_IndexedMapOfOwner.hxx>
0038 #include <SelectMgr_ListOfFilter.hxx>
0039 #include <SelectMgr_PickingStrategy.hxx>
0040 #include <SelectMgr_SelectionManager.hxx>
0041 #include <StdSelect_ViewerSelector3d.hxx>
0042 #include <TCollection_AsciiString.hxx>
0043 #include <TColgp_Array1OfPnt2d.hxx>
0044 #include <TColStd_ListOfInteger.hxx>
0045 #include <TColStd_SequenceOfInteger.hxx>
0046 #include <Quantity_Color.hxx>
0047 
0048 class V3d_Viewer;
0049 class V3d_View;
0050 class TopLoc_Location;
0051 class TCollection_ExtendedString;
0052 class Prs3d_LineAspect;
0053 class Prs3d_BasicAspect;
0054 class TopoDS_Shape;
0055 class SelectMgr_Filter;
0056 
0057 //! The Interactive Context allows you to manage graphic behavior and selection of Interactive Objects in one or more viewers.
0058 //! Class methods make this highly transparent.
0059 //! It is essential to remember that an Interactive Object which is already known by the Interactive Context must be modified using Context methods.
0060 //! You can only directly call the methods available for an Interactive Object if it has not been loaded into an Interactive Context.
0061 //!
0062 //! Each selectable object must specify the selection mode that is
0063 //! responsible for selection of object as a whole (global selection mode).
0064 //! Interactive context itself supports decomposed object selection with selection filters support.
0065 //! By default, global selection mode is equal to 0, but it might be redefined if needed.
0066 class AIS_InteractiveContext : public Standard_Transient
0067 {
0068   DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext, Standard_Transient)
0069 public: //! @name object display management
0070 
0071   //! Constructs the interactive context object defined by the principal viewer MainViewer.
0072   Standard_EXPORT AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer);
0073 
0074   //! Destructor.
0075   Standard_EXPORT virtual ~AIS_InteractiveContext();
0076 
0077   //! Returns the display status of the entity anIobj.
0078   //! This will be one of the following:
0079   //! - AIS_DS_Displayed displayed in main viewer
0080   //! - AIS_DS_Erased    hidden in main viewer
0081   //! - AIS_DS_Temporary temporarily displayed
0082   //! - AIS_DS_None      nowhere displayed.
0083   Standard_EXPORT PrsMgr_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const;
0084 
0085   //! Returns the status of the Interactive Context for the view of the Interactive Object.
0086   Standard_EXPORT void Status (const Handle(AIS_InteractiveObject)& anObj, TCollection_ExtendedString& astatus) const;
0087 
0088   //! Returns true if Object is displayed in the interactive context.
0089   Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const;
0090 
0091   Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode) const;
0092 
0093   //! Enable or disable automatic activation of default selection mode while displaying the object.
0094   void SetAutoActivateSelection (const Standard_Boolean theIsAuto) { myIsAutoActivateSelMode = theIsAuto; }
0095 
0096   //! Manages displaying the new object should also automatically activate default selection mode; TRUE by default.
0097   Standard_Boolean GetAutoActivateSelection() const { return myIsAutoActivateSelMode; }
0098 
0099   //! Displays the object in this Context using default Display Mode.
0100   //! This will be the object's default display mode, if there is one. Otherwise, it will be the context mode.
0101   //! The Interactive Object's default selection mode is activated if GetAutoActivateSelection() is TRUE. In general, this is 0.
0102   Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj,
0103                                 const Standard_Boolean               theToUpdateViewer);
0104 
0105   //! Sets status, display mode and selection mode for specified Object
0106   //! If theSelectionMode equals -1, theIObj will not be activated: it will be displayed but will not be selectable.
0107   Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj,
0108                                 const Standard_Integer               theDispMode,
0109                                 const Standard_Integer               theSelectionMode,
0110                                 const Standard_Boolean               theToUpdateViewer,
0111                                 const PrsMgr_DisplayStatus           theDispStatus = PrsMgr_DisplayStatus_None);
0112 
0113   //! Allows you to load the Interactive Object with a given selection mode,
0114   //! and/or with the desired decomposition option, whether the object is visualized or not.
0115   //! The loaded objects will be selectable but displayable in highlighting only when detected by the Selector.
0116   Standard_EXPORT void Load (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theSelectionMode = -1);
0117 
0118   //! Hides the object. The object's presentations are simply flagged as invisible and therefore excluded from redrawing.
0119   //! To show hidden objects, use Display().
0120   Standard_EXPORT void Erase (const Handle(AIS_InteractiveObject)& theIObj,
0121                               const Standard_Boolean               theToUpdateViewer);
0122   
0123   //! Hides all objects. The object's presentations are simply flagged as invisible and therefore excluded from redrawing.
0124   //! To show all hidden objects, use DisplayAll().
0125   Standard_EXPORT void EraseAll (const Standard_Boolean theToUpdateViewer);
0126   
0127   //! Displays all hidden objects.
0128   Standard_EXPORT void DisplayAll (const Standard_Boolean theToUpdateViewer);
0129 
0130   //! Hides selected objects. The object's presentations are simply flagged as invisible and therefore excluded from redrawing.
0131   //! To show hidden objects, use Display().
0132   Standard_EXPORT void EraseSelected (const Standard_Boolean theToUpdateViewer);
0133 
0134   //! Displays current objects.
0135   Standard_EXPORT void DisplaySelected (const Standard_Boolean theToUpdateViewer);
0136   
0137   //! Empties the graphic presentation of the mode indexed by aMode.
0138   //! Warning! Removes theIObj. theIObj is still active if it was previously activated.
0139   void ClearPrs (const Handle(AIS_InteractiveObject)& theIObj,
0140                  const Standard_Integer               theMode,
0141                  const Standard_Boolean               theToUpdateViewer) { ClearGlobalPrs (theIObj, theMode, theToUpdateViewer); }
0142 
0143   //! Removes Object from every viewer.
0144   Standard_EXPORT void Remove (const Handle(AIS_InteractiveObject)& theIObj,
0145                                const Standard_Boolean               theToUpdateViewer);
0146 
0147   //! Removes all the objects from Context.
0148   Standard_EXPORT void RemoveAll (const Standard_Boolean theToUpdateViewer);
0149 
0150   //! Recomputes the seen parts presentation of the Object.
0151   //! If theAllModes equals true, all presentations are present in the object even if unseen.
0152   Standard_EXPORT void Redisplay (const Handle(AIS_InteractiveObject)& theIObj,
0153                                   const Standard_Boolean               theToUpdateViewer,
0154                                   const Standard_Boolean               theAllModes = Standard_False);
0155 
0156   //! Recomputes the Prs/Selection of displayed objects of a given type and a given signature.
0157   //! if signature = -1  doesn't take signature criterion.
0158   Standard_EXPORT void Redisplay (const AIS_KindOfInteractive theTypeOfObject,
0159                                   const Standard_Integer      theSignature,
0160                                   const Standard_Boolean      theToUpdateViewer);
0161 
0162   //! Recomputes the displayed presentations, flags the others.
0163   //! Doesn't update presentations.
0164   Standard_EXPORT void RecomputePrsOnly (const Handle(AIS_InteractiveObject)& theIObj,
0165                                          const Standard_Boolean               theToUpdateViewer,
0166                                          const Standard_Boolean               theAllModes = Standard_False);
0167 
0168   //! Recomputes the active selections, flags the others.
0169   //! Doesn't update presentations.
0170   Standard_EXPORT void RecomputeSelectionOnly (const Handle(AIS_InteractiveObject)& anIObj);
0171 
0172   //! Updates displayed interactive object by checking and recomputing its flagged as "to be recomputed" presentation and selection structures.
0173   //! This method does not force any recomputation on its own.
0174   //! The method recomputes selections even if they are loaded without activation in particular selector.
0175   Standard_EXPORT void Update (const Handle(AIS_InteractiveObject)& theIObj,
0176                                const Standard_Boolean               theUpdateViewer);
0177 
0178 public: //! @name highlighting management
0179 
0180   //! Returns default highlight style settings (could be overridden by PrsMgr_PresentableObject).
0181   //!
0182   //! Tip: although highlighting style is defined by Prs3d_Drawer,
0183   //! only a small set of properties derived from it's base class Graphic3d_PresentationAttributes will be actually used in most cases.
0184   //!
0185   //! Default highlight style for all types is Aspect_TOHM_COLOR. Other defaults:
0186   //!  - Prs3d_TypeOfHighlight_Dynamic
0187   //!    * Color: Quantity_NOC_CYAN1;
0188   //!    * Layer: Graphic3d_ZLayerId_Top,
0189   //!             object highlighting is drawn on top of main scene within Immediate Layers,
0190   //!             so that V3d_View::RedrawImmediate() will be enough to see update;
0191   //!  - Prs3d_TypeOfHighlight_LocalDynamic
0192   //!    * Color: Quantity_NOC_CYAN1;
0193   //!    * Layer: Graphic3d_ZLayerId_Topmost,
0194   //!             object parts highlighting is drawn on top of main scene within Immediate Layers
0195   //!             with depth cleared (even overlapped geometry will be revealed);
0196   //!  - Prs3d_TypeOfHighlight_Selected
0197   //!    * Color: Quantity_NOC_GRAY80;
0198   //!    * Layer: Graphic3d_ZLayerId_UNKNOWN,
0199   //!             object highlighting is drawn on top of main scene within the same layer
0200   //!             as object itself (e.g. Graphic3d_ZLayerId_Default by default) and increased priority.
0201   //!
0202   //! @param[in] theStyleType highlight style to modify
0203   //! @return drawer associated to specified highlight type
0204   //!
0205   //! @sa MoveTo() using Prs3d_TypeOfHighlight_Dynamic and Prs3d_TypeOfHighlight_LocalDynamic types
0206   //! @sa SelectDetected() using Prs3d_TypeOfHighlight_Selected and Prs3d_TypeOfHighlight_LocalSelected types
0207   //! @sa PrsMgr_PresentableObject::DynamicHilightAttributes() overriding Prs3d_TypeOfHighlight_Dynamic and Prs3d_TypeOfHighlight_LocalDynamic defaults on object level
0208   //! @sa PrsMgr_PresentableObject::HilightAttributes() overriding Prs3d_TypeOfHighlight_Selected and Prs3d_TypeOfHighlight_LocalSelected defaults on object level
0209   const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
0210 
0211   //! Setup highlight style settings.
0212   //! Tip: it is better modifying existing style returned by method HighlightStyle()
0213   //! instead of creating a new Prs3d_Drawer to avoid unexpected results due misconfiguration.
0214   //!
0215   //! If a new highlight style is created, its presentation Zlayer should be checked,
0216   //! otherwise highlighting might not work as expected.
0217   void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
0218                           const Handle(Prs3d_Drawer)& theStyle)
0219   {
0220     myStyles[theStyleType] = theStyle;
0221     if (theStyleType == Prs3d_TypeOfHighlight_None)
0222     {
0223       myDefaultDrawer = theStyle;
0224     }
0225   }
0226 
0227   //! Returns current dynamic highlight style settings corresponding to Prs3d_TypeOfHighlight_Dynamic.
0228   //! This is just a short-cut to HighlightStyle(Prs3d_TypeOfHighlight_Dynamic).
0229   const Handle(Prs3d_Drawer)& HighlightStyle() const
0230   {
0231     return myStyles[Prs3d_TypeOfHighlight_Dynamic];
0232   }
0233 
0234   //! Setup the style of dynamic highlighting corrsponding to Prs3d_TypeOfHighlight_Selected.
0235   //! This is just a short-cut to SetHighlightStyle(Prs3d_TypeOfHighlight_Dynamic,theStyle).
0236   void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
0237 
0238   //! Returns current selection style settings corrsponding to Prs3d_TypeOfHighlight_Selected.
0239   //! This is just a short-cut to HighlightStyle(Prs3d_TypeOfHighlight_Selected).
0240   const Handle(Prs3d_Drawer)& SelectionStyle() const
0241   {
0242     return myStyles[Prs3d_TypeOfHighlight_Selected];
0243   }
0244 
0245   //! Setup the style of selection highlighting.
0246   //! This is just a short-cut to SetHighlightStyle(Prs3d_TypeOfHighlight_Selected,theStyle).
0247   void SetSelectionStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Selected] = theStyle; }
0248 
0249   //! Returns highlight style of the object if it is marked as highlighted via global status
0250   //! @param theObj [in] the object to check
0251   Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
0252                                                    Handle(Prs3d_Drawer)& theStyle) const;
0253 
0254   //! Returns highlight style of the owner if it is selected
0255   //! @param theOwner [in] the owner to check
0256   Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
0257                                                    Handle(Prs3d_Drawer)& theStyle) const;
0258 
0259   //! Returns true if the object is marked as highlighted via its global status
0260   //! @param theObj [in] the object to check
0261   Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const;
0262 
0263   //! Returns true if the owner is marked as selected
0264   //! @param theOwner [in] the owner to check
0265   Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner) const;
0266 
0267   //! Changes the color of all the lines of the object in view.
0268   Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& theObj,
0269                                          const Handle(Prs3d_Drawer)&          theStyle,
0270                                          const Standard_Boolean               theToUpdateViewer);
0271 
0272   //! Removes hilighting from the Object.
0273   Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& theIObj,
0274                                   const Standard_Boolean               theToUpdateViewer);
0275 
0276 public: //! @name object presence management (View affinity, Layer, Priority)
0277 
0278   //! Returns the display priority of the Object.
0279   Standard_EXPORT Graphic3d_DisplayPriority DisplayPriority (const Handle(AIS_InteractiveObject)& theIObj) const;
0280 
0281   //! Sets the display priority of the seen parts presentation of the Object.
0282   Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj,
0283                                            const Graphic3d_DisplayPriority thePriority);
0284 
0285   Standard_DEPRECATED("Deprecated since OCCT7.7, Graphic3d_DisplayPriority should be passed instead of integer number to SetDisplayPriority()")
0286   void SetDisplayPriority (const Handle(AIS_InteractiveObject)& theIObj,
0287                            const Standard_Integer thePriority) { SetDisplayPriority (theIObj, (Graphic3d_DisplayPriority )thePriority); }
0288 
0289   //! Get Z layer id set for displayed interactive object.
0290   Standard_EXPORT Graphic3d_ZLayerId GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const;
0291 
0292   //! Set Z layer id for interactive object.
0293   //! The Z layers can be used to display temporarily presentations of some object in front of the other objects in the scene.
0294   //! The ids for Z layers are generated by V3d_Viewer.
0295   Standard_EXPORT void SetZLayer (const Handle(AIS_InteractiveObject)& theIObj, const Graphic3d_ZLayerId theLayerId);
0296 
0297   //! Setup object visibility in specified view.
0298   //! Has no effect if object is not displayed in this context.
0299   Standard_EXPORT void SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisible);
0300 
0301 public: //! @name Display Mode management
0302 
0303   //! Returns the Display Mode setting to be used by default.
0304   Standard_Integer DisplayMode() const { return myDefaultDrawer->DisplayMode(); }
0305 
0306   //! Sets the display mode of seen Interactive Objects (which have no overridden Display Mode).
0307   Standard_EXPORT void SetDisplayMode (const Standard_Integer theMode,
0308                                        const Standard_Boolean theToUpdateViewer);
0309 
0310   //! Sets the display mode of seen Interactive Objects.
0311   //! theMode provides the display mode index of the entity theIObj.
0312   Standard_EXPORT void SetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
0313                                        const Standard_Integer               theMode,
0314                                        const Standard_Boolean               theToUpdateViewer);
0315 
0316   //! Unsets the display mode of seen Interactive Objects.
0317   Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
0318                                          const Standard_Boolean               theToUpdateViewer);
0319 
0320 public: //! @name object local transformation management
0321 
0322   //! Puts the location on the initial graphic representation and the selection for the Object.
0323   Standard_EXPORT void SetLocation (const Handle(AIS_InteractiveObject)& theObject, const TopLoc_Location& theLocation);
0324 
0325   //! Puts the Object back into its initial position.
0326   Standard_EXPORT void ResetLocation (const Handle(AIS_InteractiveObject)& theObject);
0327 
0328   //! Returns true if the Object has a location.
0329   Standard_EXPORT Standard_Boolean HasLocation (const Handle(AIS_InteractiveObject)& theObject) const;
0330 
0331   //! Returns the location of the Object.
0332   Standard_EXPORT TopLoc_Location Location (const Handle(AIS_InteractiveObject)& theObject) const;
0333 
0334   //! Sets transform persistence.
0335   Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
0336                                                 const Handle(Graphic3d_TransformPers)& theTrsfPers);
0337 
0338 public: //! @name mouse picking logic (detection and dynamic highlighting of entities under cursor)
0339 
0340   //! Setup pixel tolerance for MoveTo() operation.
0341   //! @sa MoveTo().
0342   Standard_EXPORT void SetPixelTolerance (const Standard_Integer thePrecision = 2);
0343 
0344   //! Returns the pixel tolerance, default is 2.
0345   //! Pixel Tolerance extends sensitivity within MoveTo() operation (picking by point)
0346   //! and can be adjusted by application based on user input precision (e.g. screen pixel density, input device precision, etc.).
0347   Standard_EXPORT Standard_Integer PixelTolerance() const;
0348 
0349   //! Allows to manage sensitivity of a particular selection of interactive object theObject
0350   //! and changes previous sensitivity value of all sensitive entities in selection with theMode
0351   //! to the given theNewSensitivity.
0352   Standard_EXPORT void SetSelectionSensitivity (const Handle(AIS_InteractiveObject)& theObject,
0353                                                 const Standard_Integer theMode,
0354                                                 const Standard_Integer theNewSensitivity);
0355 
0356   //! Returns last active View (argument of MoveTo()/Select() methods).
0357   Standard_EXPORT Handle(V3d_View) LastActiveView() const;
0358 
0359   //! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
0360   //! This is done by the view theView passing this position to the main viewer and updating it.
0361   //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
0362   //! @sa PickingStrategy()
0363   //! @sa HighlightStyle() defining default dynamic highlight styles of detected owners
0364   //!                      (Prs3d_TypeOfHighlight_Dynamic and Prs3d_TypeOfHighlight_LocalDynamic)
0365   //! @sa PrsMgr_PresentableObject::DynamicHilightAttributes() defining per-object dynamic highlight style of detected owners (overrides defaults)
0366   Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer  theXPix,
0367                                                 const Standard_Integer  theYPix,
0368                                                 const Handle(V3d_View)& theView,
0369                                                 const Standard_Boolean  theToRedrawOnUpdate);
0370 
0371   //! Relays axis theAxis to the interactive context selectors.
0372   //! This is done by the view theView passing this axis to the main viewer and updating it.
0373   //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
0374   //! @sa PickingStrategy()
0375   Standard_EXPORT AIS_StatusOfDetection MoveTo (const gp_Ax1& theAxis,
0376                                                 const Handle(V3d_View)& theView,
0377                                                 const Standard_Boolean  theToRedrawOnUpdate);
0378 
0379   //! Clears the list of entities detected by MoveTo() and resets dynamic highlighting.
0380   //! @param theToRedrawImmediate if TRUE, the main Viewer will be redrawn on update
0381   //! @return TRUE if viewer needs to be updated (e.g. there were actually dynamically highlighted entities)
0382   Standard_EXPORT Standard_Boolean ClearDetected (Standard_Boolean theToRedrawImmediate = Standard_False);
0383 
0384   //! Returns true if there is a mouse-detected entity in context.
0385   //! @sa DetectedOwner(), HasNextDetected(), HilightPreviousDetected(), HilightNextDetected().
0386   Standard_Boolean HasDetected() const { return !myLastPicked.IsNull(); }
0387 
0388   //! Returns the owner of the detected sensitive primitive which is currently dynamically highlighted.
0389   //! WARNING! This method is irrelevant to InitDetected()/MoreDetected()/NextDetected().
0390   //! @sa HasDetected(), HasNextDetected(), HilightPreviousDetected(), HilightNextDetected().
0391   const Handle(SelectMgr_EntityOwner)& DetectedOwner() const { return myLastPicked; }
0392 
0393   //! Returns the interactive objects last detected in context.
0394   //! In general this is just a wrapper for Handle(AIS_InteractiveObject)::DownCast(DetectedOwner()->Selectable()).
0395   //! @sa DetectedOwner()
0396   Handle(AIS_InteractiveObject) DetectedInteractive() const { return Handle(AIS_InteractiveObject)::DownCast (myLastPicked->Selectable()); }
0397 
0398   //! Returns true if there is a detected shape in local context.
0399   //! @sa HasDetected(), DetectedShape()
0400   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
0401   Standard_EXPORT Standard_Boolean HasDetectedShape() const;
0402 
0403   //! Returns the shape detected in local context.
0404   //! @sa DetectedOwner()
0405   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
0406   Standard_EXPORT const TopoDS_Shape& DetectedShape() const;
0407   
0408   //! returns True if other entities were detected in the last mouse detection
0409   //! @sa HilightPreviousDetected(), HilightNextDetected().
0410   Standard_Boolean HasNextDetected() const { return !myDetectedSeq.IsEmpty() && myCurHighlighted <= myDetectedSeq.Upper(); }
0411 
0412   //! If more than 1 object is detected by the selector, only the "best" owner is hilighted at the mouse position.
0413   //! This Method allows the user to hilight one after another the other detected entities.
0414   //! If The method select is called, the selected entity will be the hilighted one!
0415   //! WARNING: Loop Method. When all the detected entities have been hilighted, the next call will hilight the first one again.
0416   //! @return the Rank of hilighted entity
0417   //! @sa HasNextDetected(), HilightPreviousDetected().
0418   Standard_EXPORT Standard_Integer HilightNextDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
0419 
0420   //! Same as previous methods in reverse direction.
0421   //! @sa HasNextDetected(), HilightNextDetected().
0422   Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
0423 
0424 public: //! @name iteration through detected entities
0425 
0426   //! Initialization for iteration through mouse-detected objects in
0427   //! interactive context or in local context if it is opened.
0428   //! @sa DetectedCurrentOwner(), MoreDetected(), NextDetected().
0429   void InitDetected()
0430   {
0431     if (!myDetectedSeq.IsEmpty())
0432     {
0433       myCurDetected = myDetectedSeq.Lower();
0434     }
0435   }
0436 
0437   //! Return TRUE if there is more mouse-detected objects after the current one
0438   //! during iteration through mouse-detected interactive objects.
0439   //! @sa DetectedCurrentOwner(), InitDetected(), NextDetected().
0440   Standard_Boolean MoreDetected() const { return myCurDetected >= myDetectedSeq.Lower() && myCurDetected <= myDetectedSeq.Upper(); }
0441 
0442   //! Gets next current object during iteration through mouse-detected interactive objects.
0443   //! @sa DetectedCurrentOwner(), InitDetected(), MoreDetected().
0444   void NextDetected() { ++myCurDetected; }
0445 
0446   //! Returns the owner from detected list pointed by current iterator position.
0447   //! WARNING! This method is irrelevant to DetectedOwner() which returns last picked Owner regardless of iterator position!
0448   //! @sa InitDetected(), MoreDetected(), NextDetected().
0449   Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedCurrentOwner() const;
0450 
0451 public: //! @name Selection management
0452 
0453   //! Adds object in the selection.
0454   Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
0455 
0456   //! Adds object in the selection.
0457   AIS_StatusOfPick AddSelect (const Handle(AIS_InteractiveObject)& theObject)
0458   {
0459     return AddSelect (theObject->GlobalSelOwner());
0460   }
0461 
0462   //! Selects objects within the bounding rectangle.
0463   //! Viewer should be explicitly redrawn after selection.
0464   //! @param thePntMin [in] rectangle lower point (in pixels)
0465   //! @param thePntMax [in] rectangle upper point (in pixels)
0466   //! @param theView   [in] active view where rectangle is defined
0467   //! @param theSelScheme [in] selection scheme
0468   //! @return picking status
0469   //! @sa StdSelect_ViewerSelector3d::AllowOverlapDetection()
0470   Standard_EXPORT AIS_StatusOfPick SelectRectangle (const Graphic3d_Vec2i&    thePntMin,
0471                                                     const Graphic3d_Vec2i&    thePntMax,
0472                                                     const Handle(V3d_View)&   theView,
0473                                                     const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace);
0474 
0475   //! Select everything found in the polygon defined by bounding polyline.
0476   //! Viewer should be explicitly redrawn after selection.
0477   //! @param thePolyline  [in] polyline defining polygon bounds (in pixels)
0478   //! @param theView      [in] active view where polyline is defined
0479   //! @param theSelScheme [in] selection scheme
0480   //! @return picking status
0481   Standard_EXPORT AIS_StatusOfPick SelectPolygon (const TColgp_Array1OfPnt2d& thePolyline,
0482                                                   const Handle(V3d_View)&     theView,
0483                                                   const AIS_SelectionScheme   theSelScheme = AIS_SelectionScheme_Replace);
0484 
0485   //! Selects the topmost object picked by the point in the view,
0486   //! Viewer should be explicitly redrawn after selection.
0487   //! @param thePnt  [in] point pixel coordinates within the view
0488   //! @param theView [in] active view where point is defined
0489   //! @param theSelScheme [in] selection scheme
0490   //! @return picking status
0491   Standard_EXPORT AIS_StatusOfPick SelectPoint (const Graphic3d_Vec2i&    thePnt,
0492                                                 const Handle(V3d_View)&   theView,
0493                                                 const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace);
0494 
0495   //! Select and hilights the previous detected via AIS_InteractiveContext::MoveTo() method;
0496   //! unhilights the previous picked.
0497   //! Viewer should be explicitly redrawn after selection.
0498   //! @param theSelScheme [in] selection scheme
0499   //! @return picking status
0500   //!
0501   //! @sa HighlightStyle() defining default highlight styles of selected owners (Prs3d_TypeOfHighlight_Selected and Prs3d_TypeOfHighlight_LocalSelected)
0502   //! @sa PrsMgr_PresentableObject::HilightAttributes() defining per-object highlight style of selected owners (overrides defaults)
0503   Standard_EXPORT AIS_StatusOfPick SelectDetected (const AIS_SelectionScheme theSelScheme = AIS_SelectionScheme_Replace);
0504 
0505   //! Returns bounding box of selected objects.
0506   Standard_EXPORT Bnd_Box BoundingBoxOfSelection (const Handle(V3d_View)& theView) const;
0507 
0508   Standard_DEPRECATED ("BoundingBoxOfSelection() should be called with View argument")
0509   Bnd_Box BoundingBoxOfSelection() const { return BoundingBoxOfSelection (Handle(V3d_View)()); }
0510 
0511   //! Sets list of owner selected/deselected using specified selection scheme.
0512   //! @param theOwners owners to change selection state
0513   //! @param theSelScheme selection scheme
0514   //! @return picking status
0515   Standard_EXPORT AIS_StatusOfPick Select (const AIS_NArray1OfEntityOwner& theOwners,
0516                                            const AIS_SelectionScheme theSelScheme);
0517 
0518   //! Fits the view correspondingly to the bounds of selected objects.
0519   //! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
0520   Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
0521                                     const Standard_Real     theMargin,
0522                                     const Standard_Boolean  theToUpdate);
0523 
0524   //! Fits the view correspondingly to the bounds of selected objects.
0525   //! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
0526   Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView);
0527 
0528   //! Return value specified whether selected object must be hilighted when mouse cursor is moved above it
0529   //! @sa MoveTo()
0530   Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
0531 
0532   //! Specify whether selected object must be hilighted when mouse cursor is moved above it (in MoveTo method).
0533   //! By default this value is false and selected object is not hilighted in this case.
0534   //! @sa MoveTo()
0535   void SetToHilightSelected (const Standard_Boolean toHilight) { myToHilightSelected = toHilight; }
0536 
0537   //! Returns true if the automatic highlight mode is active; TRUE by default.
0538   //! @sa MoveTo(), Select(), HilightWithColor(), Unhilight()
0539   Standard_Boolean AutomaticHilight() const { return myAutoHilight; }
0540 
0541   //! Sets the highlighting status of detected and selected entities.
0542   //! This function allows you to disconnect the automatic mode.
0543   //!
0544   //! MoveTo() will fill the list of detected entities
0545   //! and Select() will set selected state to detected objects regardless of this flag,
0546   //! but with disabled AutomaticHiligh() their highlighting state will be left unaffected,
0547   //! so that application will be able performing custom highlighting in a different way, if needed.
0548   //!
0549   //! This API should be distinguished from SelectMgr_SelectableObject::SetAutoHilight()
0550   //! that is used to implement custom highlighting logic for a specific interactive object class.
0551   //!
0552   //! @sa MoveTo(), Select(), HilightWithColor(), Unhilight()
0553   void SetAutomaticHilight (Standard_Boolean theStatus) { myAutoHilight = theStatus; }
0554 
0555   //! Unhighlights previously selected owners and marks them as not selected.
0556   //! Marks owner given as selected and highlights it.
0557   //! Performs selection filters check.
0558   Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
0559                                     const Standard_Boolean               theToUpdateViewer);
0560 
0561   //! Puts the interactive object aniObj in the list of selected objects.
0562   //! Performs selection filters check.
0563   Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
0564                                     const Standard_Boolean               theToUpdateViewer);
0565 
0566   //! Allows to highlight or unhighlight the owner given depending on its selection status
0567   Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
0568                                             const Standard_Boolean               theToUpdateViewer);
0569 
0570   //! Updates Selected state of specified owner without calling HilightSelected().
0571   //! Has no effect if Selected state is not changed, and redirects to AddOrRemoveSelected() otherwise.
0572   //! @param theOwner owner object to set selected state
0573   //! @param theIsSelected new selected state
0574   //! @return TRUE if Selected state has been changed
0575   Standard_EXPORT Standard_Boolean SetSelectedState (const Handle(SelectMgr_EntityOwner)& theOwner,
0576                                                      const Standard_Boolean               theIsSelected);
0577 
0578   //! Highlights selected objects.
0579   Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer);
0580 
0581   //! Removes highlighting from selected objects.
0582   Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer);
0583 
0584   //! Updates the list of selected objects:
0585   //! i.e. highlights the newly selected ones and unhighlights previously selected objects.
0586   //! @sa HilightSelected().
0587   void UpdateSelected (Standard_Boolean theToUpdateViewer) { HilightSelected (theToUpdateViewer); }
0588 
0589   //! Empties previous selected objects in order to get the selected objects detected by the selector using UpdateSelected.
0590   Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer);
0591 
0592   //! Allows to highlight or unhighlight the owner given depending on its selection status
0593   Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
0594                                             const Standard_Boolean               theToUpdateViewer);
0595 
0596   //! Returns true is the owner given is selected
0597   Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const { return !theOwner.IsNull() && theOwner->IsSelected(); }
0598 
0599   //! Returns true is the object given is selected
0600   Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& theObj) const;
0601 
0602   //! Returns the first selected object in the list of current selected.
0603   Standard_EXPORT Handle(AIS_InteractiveObject) FirstSelectedObject() const;
0604 
0605   //! Count a number of selected entities using InitSelected()+MoreSelected()+NextSelected() iterator.
0606   //! @sa SelectedOwner(), InitSelected(), MoreSelected(), NextSelected().
0607   Standard_Integer NbSelected() { return mySelection->Extent(); }
0608 
0609   //! Initializes a scan of the selected objects.
0610   //! @sa SelectedOwner(), MoreSelected(), NextSelected().
0611   void InitSelected() { mySelection->Init(); }
0612 
0613   //! Returns true if there is another object found by the scan of the list of selected objects.
0614   //! @sa SelectedOwner(), InitSelected(), NextSelected().
0615   Standard_Boolean MoreSelected() const { return mySelection->More(); }
0616 
0617   //! Continues the scan to the next object in the list of selected objects.
0618   //! @sa SelectedOwner(), InitSelected(), MoreSelected().
0619   void NextSelected() { mySelection->Next(); }
0620 
0621   //! Returns the owner of the selected entity.
0622   //! @sa InitSelected(), MoreSelected(), NextSelected().
0623   Handle(SelectMgr_EntityOwner) SelectedOwner() const
0624   {
0625     return !mySelection->More()
0626           ? Handle(SelectMgr_EntityOwner)()
0627           : mySelection->Value();
0628   }
0629 
0630   //! Return Handle(AIS_InteractiveObject)::DownCast (SelectedOwner()->Selectable()).
0631   //! @sa SelectedOwner().
0632   Handle(AIS_InteractiveObject) SelectedInteractive() const
0633   {
0634     return !mySelection->More()
0635          ? Handle(AIS_InteractiveObject)()
0636          : Handle(AIS_InteractiveObject)::DownCast (mySelection->Value()->Selectable());
0637   }
0638 
0639   //! Returns TRUE if the interactive context has a shape selected.
0640   //! @sa SelectedShape().
0641   Standard_EXPORT Standard_Boolean HasSelectedShape() const;
0642 
0643   //! Returns the selected shape.
0644   //! Basically it is just a shape returned stored by StdSelect_BRepOwner with graphic transformation being applied:
0645   //! @code
0646   //!   const Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast (SelectedOwner());
0647   //!   TopoDS_Shape aSelShape     = aBRepOwner->Shape();
0648   //!   TopoDS_Shape aLocatedShape = aSelShape.Located (aBRepOwner->Location() * aSelShape.Location());
0649   //! @endcode
0650   //! @sa SelectedOwner(), HasSelectedShape().
0651   Standard_EXPORT TopoDS_Shape SelectedShape() const;
0652 
0653   //! Returns SelectedInteractive()->HasOwner().
0654   //! @sa SelectedOwner().
0655   Standard_Boolean HasApplicative() const { return SelectedInteractive()->HasOwner(); }
0656 
0657   //! Returns SelectedInteractive()->GetOwner().
0658   //! @sa SelectedOwner().
0659   Handle(Standard_Transient) Applicative() const { return SelectedInteractive()->GetOwner(); }
0660 
0661 public: //! @name immediate mode rendering
0662 
0663   //! initializes the list of presentations to be displayed
0664   //! returns False if no local context is opened.
0665   Standard_EXPORT Standard_Boolean BeginImmediateDraw();
0666   
0667   //! returns True if <anIObj> has been stored in the list.
0668   Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0);
0669   
0670   //! returns True if the immediate display has been done.
0671   Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_View)& theView);
0672 
0673   //! Uses the First Active View of Main Viewer!
0674   //! returns True if the immediate display has been done.
0675   Standard_EXPORT Standard_Boolean EndImmediateDraw();
0676 
0677   Standard_EXPORT Standard_Boolean IsImmediateModeOn() const;
0678 
0679   //! Redraws immediate structures in all views of the viewer given taking into account its visibility.
0680   void RedrawImmediate (const Handle(V3d_Viewer)& theViewer) { myMainPM->RedrawImmediate (theViewer); }
0681 
0682 public: //! @name management of active Selection Modes
0683 
0684   //! Activates or deactivates the selection mode for specified object.
0685   //! Has no effect if selection mode was already active/deactivated.
0686   //! @param theObj         object to activate/deactivate selection mode
0687   //! @param theMode        selection mode to activate/deactivate;
0688   //!                       deactivation of -1 selection mode will effectively deactivate all selection modes;
0689   //!                       activation of -1 selection mode with AIS_SelectionModesConcurrency_Single
0690   //!                       will deactivate all selection modes, and will has no effect otherwise
0691   //! @param theToActivate  activation/deactivation flag
0692   //! @param theConcurrency specifies how to handle already activated selection modes;
0693   //!                       default value (AIS_SelectionModesConcurrency_Multiple) means active selection modes should be left as is,
0694   //!                       AIS_SelectionModesConcurrency_Single can be used if only one selection mode is expected to be active
0695   //!                       and AIS_SelectionModesConcurrency_GlobalOrLocal can be used if either AIS_InteractiveObject::GlobalSelectionMode()
0696   //!                       or any combination of Local selection modes is acceptable;
0697   //!                       this value is considered only if theToActivate set to TRUE
0698   //! @param theIsForce     when set to TRUE, the display status will be ignored while activating selection mode
0699   Standard_EXPORT void SetSelectionModeActive (const Handle(AIS_InteractiveObject)& theObj,
0700                                                const Standard_Integer theMode,
0701                                                const Standard_Boolean theToActivate,
0702                                                const AIS_SelectionModesConcurrency theConcurrency = AIS_SelectionModesConcurrency_Multiple,
0703                                                const Standard_Boolean theIsForce = Standard_False);
0704 
0705   //! Activates the selection mode aMode whose index is given, for the given interactive entity anIobj.
0706   void Activate (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0, const Standard_Boolean theIsForce = Standard_False)
0707   {
0708     SetSelectionModeActive (theObj, theMode, Standard_True, AIS_SelectionModesConcurrency_GlobalOrLocal, theIsForce);
0709   }
0710 
0711   //! Activates the given selection mode for the all displayed objects.
0712   Standard_EXPORT void Activate (const Standard_Integer theMode,
0713                                  const Standard_Boolean theIsForce = Standard_False);
0714   
0715   //! Deactivates all the activated selection modes of an object.
0716   void Deactivate (const Handle(AIS_InteractiveObject)& theObj)
0717   {
0718     SetSelectionModeActive (theObj, -1, Standard_False, AIS_SelectionModesConcurrency_Single);
0719   }
0720 
0721   //! Deactivates all the activated selection modes of the interactive object anIobj with a given selection mode aMode.
0722   void Deactivate (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode)
0723   {
0724     SetSelectionModeActive (theObj, theMode, Standard_False);
0725   }
0726 
0727   //! Deactivates the given selection mode for all displayed objects.
0728   Standard_EXPORT void Deactivate (const Standard_Integer theMode);
0729 
0730   //! Deactivates all the activated selection mode at all displayed objects.
0731   Standard_EXPORT void Deactivate();
0732 
0733   //! Returns the list of activated selection modes.
0734   Standard_EXPORT void ActivatedModes (const Handle(AIS_InteractiveObject)& anIobj, TColStd_ListOfInteger& theList) const;
0735 
0736   //! Returns a collection containing all entity owners created for the interactive object in specified selection mode (in all active modes if the Mode == -1)
0737   Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners,
0738                                      const Handle(AIS_InteractiveObject)& theIObj,
0739                                      const Standard_Integer theMode = -1) const;
0740 
0741 public: //! @name Selection Filters management
0742 
0743   //! @return the context selection filter type.
0744   SelectMgr_FilterType FilterType() const { return myFilters->FilterType(); }
0745 
0746   //! Sets the context selection filter type.
0747   //! SelectMgr_TypeFilter_OR selection filter is used by default.
0748   //! @param theFilterType the filter type.
0749   void SetFilterType (const SelectMgr_FilterType theFilterType)
0750   { myFilters->SetFilterType (theFilterType); }
0751 
0752   //! Returns the list of filters active in a local context.
0753   const SelectMgr_ListOfFilter& Filters() const { return myFilters->StoredFilters(); }
0754 
0755   //! @return the context selection global context filter.
0756   const Handle(SelectMgr_AndOrFilter)& GlobalFilter() const { return myFilters; }
0757 
0758   //! Allows you to add the filter.
0759   void AddFilter (const Handle(SelectMgr_Filter)& theFilter) { myFilters->Add (theFilter); }
0760 
0761   //! Removes a filter from context.
0762   void RemoveFilter (const Handle(SelectMgr_Filter)& theFilter) { myFilters->Remove (theFilter); }
0763 
0764   //! Remove all filters from context.
0765   void RemoveFilters() { myFilters->Clear(); }
0766 
0767   //! Return picking strategy; SelectMgr_PickingStrategy_FirstAcceptable by default.
0768   //! @sa MoveTo(), Filters()
0769   SelectMgr_PickingStrategy PickingStrategy() const { return myPickingStrategy; }
0770 
0771   //! Setup picking strategy - which entities detected by picking line will be accepted, considering Selection Filters.
0772   //! By default (SelectMgr_PickingStrategy_FirstAcceptable), Selection Filters reduce the list of entities
0773   //! so that the context accepts topmost in remaining.
0774   //!
0775   //! This means that entities behind non-selectable (by filters) parts can be picked by user.
0776   //! If this behavior is undesirable, and user wants that non-selectable (by filters) parts
0777   //! should remain an obstacle for picking, SelectMgr_PickingStrategy_OnlyTopmost can be set instead.
0778   //!
0779   //! Notice, that since Selection Manager operates only objects registered in it,
0780   //! SelectMgr_PickingStrategy_OnlyTopmost will NOT prevent picking entities behind
0781   //! visible by unregistered in Selection Manager presentations (e.g. deactivated).
0782   //! Hence, SelectMgr_PickingStrategy_OnlyTopmost changes behavior only with Selection Filters enabled.
0783   void SetPickingStrategy (const SelectMgr_PickingStrategy theStrategy)
0784   {
0785     myPickingStrategy = theStrategy;
0786   }
0787 
0788 public: //! @name common properties
0789 
0790   //! Returns the default attribute manager.
0791   //! This contains all the color and line attributes which can be used by interactive objects which do not have their own attributes.
0792   const Handle(Prs3d_Drawer)& DefaultDrawer() const { return myDefaultDrawer; }
0793 
0794   //! Sets the default attribute manager; should be set at context creation time.
0795   //! Warning - this setter doesn't update links to the default drawer of already displayed objects!
0796   void SetDefaultDrawer (const Handle(Prs3d_Drawer)& theDrawer)
0797   {
0798     myDefaultDrawer = theDrawer;
0799     myStyles[Prs3d_TypeOfHighlight_None] = myDefaultDrawer;
0800   }
0801 
0802   //! Returns the current viewer.
0803   const Handle(V3d_Viewer)& CurrentViewer() const { return myMainVwr; }
0804 
0805   const Handle(SelectMgr_SelectionManager)& SelectionManager() const { return mgrSelector; }
0806 
0807   const Handle(PrsMgr_PresentationManager)& MainPrsMgr() const { return myMainPM; }
0808 
0809   const Handle(StdSelect_ViewerSelector3d)& MainSelector() const { return mgrSelector->Selector(); }
0810 
0811   //! Updates the current viewer.
0812   Standard_EXPORT void UpdateCurrentViewer();
0813 
0814   //! Returns the list of displayed objects of a particular Type WhichKind and Signature WhichSignature.
0815   //! By Default, WhichSignature equals -1. This means that there is a check on type only.
0816   Standard_EXPORT void DisplayedObjects (AIS_ListOfInteractive& aListOfIO) const;
0817 
0818   //! gives the list of displayed objects of a particular Type and signature.
0819   //! by Default, <WhichSignature> = -1 means control only on <WhichKind>.
0820   Standard_EXPORT void DisplayedObjects (const AIS_KindOfInteractive theWhichKind, const Standard_Integer theWhichSignature, AIS_ListOfInteractive& theListOfIO) const;
0821 
0822   //! Returns the list theListOfIO of erased objects (hidden objects) particular Type WhichKind and Signature WhichSignature.
0823   //! By Default, WhichSignature equals 1. This means that there is a check on type only.
0824   Standard_EXPORT void ErasedObjects (AIS_ListOfInteractive& theListOfIO) const;
0825 
0826   //! gives the list of erased objects (hidden objects)
0827   //! Type and signature by Default, <WhichSignature> = -1 means control only on <WhichKind>.
0828   Standard_EXPORT void ErasedObjects (const AIS_KindOfInteractive theWhichKind, const Standard_Integer theWhichSignature, AIS_ListOfInteractive& theListOfIO) const;
0829 
0830   //! Returns the list theListOfIO of objects with indicated display status particular Type WhichKind and Signature WhichSignature.
0831   //! By Default, WhichSignature equals 1. This means that there is a check on type only.
0832   Standard_EXPORT void ObjectsByDisplayStatus (const PrsMgr_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const;
0833 
0834   //! gives the list of objects with indicated display status
0835   //! Type and signature by Default, <WhichSignature> = -1 means control only on <WhichKind>.
0836   Standard_EXPORT void ObjectsByDisplayStatus (const AIS_KindOfInteractive WhichKind,
0837                                                const Standard_Integer WhichSignature,
0838                                                const PrsMgr_DisplayStatus theStatus,
0839                                                AIS_ListOfInteractive& theListOfIO) const;
0840   
0841   //! fills <aListOfIO> with objects of a particular Type and Signature with no consideration of display status.
0842   //! by Default, <WhichSignature> = -1 means control only on <WhichKind>.
0843   //! if <WhichKind> = AIS_KindOfInteractive_None and <WhichSignature> = -1, all the objects are put into the list.
0844   Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO,
0845                                       const AIS_KindOfInteractive WhichKind = AIS_KindOfInteractive_None,
0846                                       const Standard_Integer WhichSignature = -1) const;
0847 
0848   //! Create iterator through all objects registered in context.
0849   AIS_DataMapIteratorOfDataMapOfIOStatus ObjectIterator() const
0850   {
0851     return AIS_DataMapIteratorOfDataMapOfIOStatus (myObjects);
0852   }
0853 
0854   //! Rebuilds 1st level of BVH selection forcibly
0855   Standard_EXPORT void RebuildSelectionStructs();
0856 
0857   //! Disconnects theObjToDisconnect from theAssembly and removes dependent selection structures
0858   Standard_EXPORT void Disconnect (const Handle(AIS_InteractiveObject)& theAssembly, const Handle(AIS_InteractiveObject)& theObjToDisconnect = NULL);
0859 
0860   //! Query objects visible or hidden in specified view due to affinity mask.
0861   Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO,
0862                                        const Handle(V3d_View)& theView,
0863                                        const Standard_Boolean theIsVisibleInView,
0864                                        const PrsMgr_DisplayStatus theStatus = PrsMgr_DisplayStatus_None) const;
0865 
0866   //! Return rotation gravity point.
0867   Standard_EXPORT virtual gp_Pnt GravityPoint (const Handle(V3d_View)& theView) const;
0868 
0869 public: //! @name debug visualization
0870 
0871   //! Visualization of sensitives - for debugging purposes!
0872   Standard_EXPORT void DisplayActiveSensitive (const Handle(V3d_View)& aView);
0873 
0874   //! Clear visualization of sensitives.
0875   Standard_EXPORT void ClearActiveSensitive (const Handle(V3d_View)& aView);
0876 
0877   //! Visualization of sensitives - for debugging purposes!
0878   Standard_EXPORT void DisplayActiveSensitive (const Handle(AIS_InteractiveObject)& anObject, const Handle(V3d_View)& aView);
0879 
0880 public: //! @name common object display attributes
0881 
0882   //! Sets the graphic attributes of the interactive object, such as visualization mode, color, and material.
0883   Standard_EXPORT void SetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
0884                                            const Handle(Prs3d_Drawer)&          theDrawer,
0885                                            const Standard_Boolean               theToUpdateViewer);
0886 
0887   //! Removes the settings for local attributes of the Object and returns to defaults.
0888   Standard_EXPORT void UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
0889                                              const Standard_Boolean               theToUpdateViewer);
0890 
0891   //! change the current facing model apply on polygons for SetColor(), SetTransparency(), SetMaterial() methods default facing model is Aspect_TOFM_TWO_SIDE.
0892   //! This mean that attributes is applying both on the front and back face.
0893   Standard_EXPORT void SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& aniobj, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE);
0894 
0895   //! Returns true if a view of the Interactive Object has color.
0896   Standard_EXPORT Standard_Boolean HasColor (const Handle(AIS_InteractiveObject)& aniobj) const;
0897 
0898   //! Returns the color of the Object in the interactive context.
0899   Standard_EXPORT void Color (const Handle(AIS_InteractiveObject)& aniobj, Quantity_Color& acolor) const;
0900 
0901   //! Sets the color of the selected entity.
0902   Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& theIObj,
0903                                  const Quantity_Color&                theColor,
0904                                  const Standard_Boolean               theToUpdateViewer);
0905 
0906   //! Removes the color selection for the selected entity.
0907   Standard_EXPORT void UnsetColor (const Handle(AIS_InteractiveObject)& theIObj,
0908                                    const Standard_Boolean               theToUpdateViewer);
0909 
0910   //! Returns the width of the Interactive Object in the interactive context.
0911   Standard_EXPORT virtual Standard_Real Width (const Handle(AIS_InteractiveObject)& aniobj) const;
0912 
0913   //! Sets the width of the Object.
0914   Standard_EXPORT virtual void SetWidth (const Handle(AIS_InteractiveObject)& theIObj,
0915                                          const Standard_Real                  theValue,
0916                                          const Standard_Boolean               theToUpdateViewer);
0917 
0918   //! Removes the width setting of the Object.
0919   Standard_EXPORT virtual void UnsetWidth (const Handle(AIS_InteractiveObject)& theIObj,
0920                                            const Standard_Boolean               theToUpdateViewer);
0921 
0922   //! Provides the type of material setting for the view of the Object.
0923   Standard_EXPORT void SetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
0924                                     const Graphic3d_MaterialAspect&      theMaterial,
0925                                     const Standard_Boolean               theToUpdateViewer);
0926 
0927   //! Removes the type of material setting for viewing the Object.
0928   Standard_EXPORT void UnsetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
0929                                       const Standard_Boolean               theToUpdateViewer);
0930   
0931   //! Provides the transparency settings for viewing the Object.
0932   //! The transparency value aValue may be between 0.0, opaque, and 1.0, fully transparent.
0933   Standard_EXPORT void SetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
0934                                         const Standard_Real                  theValue,
0935                                         const Standard_Boolean               theToUpdateViewer);
0936 
0937   //! Removes the transparency settings for viewing the Object.
0938   Standard_EXPORT void UnsetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
0939                                           const Standard_Boolean               theToUpdateViewer);
0940 
0941   //! Sets up polygon offsets for the given AIS_InteractiveObject.
0942   //! It simply calls AIS_InteractiveObject::SetPolygonOffsets().
0943   Standard_EXPORT void SetPolygonOffsets (const Handle(AIS_InteractiveObject)& theIObj,
0944                                           const Standard_Integer               theMode,
0945                                           const Standard_ShortReal             theFactor,
0946                                           const Standard_ShortReal             theUnits,
0947                                           const Standard_Boolean               theToUpdateViewer);
0948   
0949   //! Simply calls AIS_InteractiveObject::HasPolygonOffsets().
0950   Standard_EXPORT Standard_Boolean HasPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj) const;
0951 
0952   //! Retrieves current polygon offsets settings for Object.
0953   Standard_EXPORT void PolygonOffsets (const Handle(AIS_InteractiveObject)& anObj, Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const;
0954 
0955 public: //! @name trihedron display attributes
0956 
0957   //! Sets the size aSize of the trihedron.
0958   //! Is used to change the default value 100 mm for display of trihedra.
0959   //! Use of this function in one of your own interactive objects requires a call to the Compute function of the new class.
0960   //! This will recalculate the presentation for every trihedron displayed.
0961   Standard_EXPORT void SetTrihedronSize (const Standard_Real    theSize,
0962                                          const Standard_Boolean theToUpdateViewer);
0963 
0964   //! returns the current value of trihedron size.
0965   Standard_EXPORT Standard_Real TrihedronSize() const;
0966 
0967 public: //! @name plane display attributes
0968 
0969   //! Sets the plane size defined by the length in the X direction XSize and that in the Y direction YSize.
0970   Standard_EXPORT void SetPlaneSize (const Standard_Real    theSizeX,
0971                                      const Standard_Real    theSizeY,
0972                                      const Standard_Boolean theToUpdateViewer);
0973 
0974   //! Sets the plane size aSize.
0975   Standard_EXPORT void SetPlaneSize (const Standard_Real    theSize,
0976                                      const Standard_Boolean theToUpdateViewer);
0977 
0978   //! Returns true if the length in the X direction XSize is the same as that in the Y direction YSize.
0979   Standard_EXPORT Standard_Boolean PlaneSize (Standard_Real& XSize, Standard_Real& YSize) const;
0980 
0981 public: //! @name tessellation deviation properties for automatic triangulation
0982 
0983   //! Sets the deviation coefficient theCoefficient.
0984   //! Drawings of curves or patches are made with respect to a maximal chordal deviation.
0985   //! A Deviation coefficient is used in the shading display mode.
0986   //! The shape is seen decomposed into triangles.
0987   //! These are used to calculate reflection of light from the surface of the object.
0988   //! The triangles are formed from chords of the curves in the shape.
0989   //! The deviation coefficient theCoefficient gives the highest value of the angle with which a chord can deviate from a tangent to a curve.
0990   //! If this limit is reached, a new triangle is begun.
0991   //! This deviation is absolute and is set through the method: SetMaximalChordialDeviation.
0992   //! The default value is 0.001.
0993   //! In drawing shapes, however, you are allowed to ask for a relative deviation.
0994   //! This deviation will be: SizeOfObject * DeviationCoefficient.
0995   Standard_EXPORT void SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
0996                                                 const Standard_Real                  theCoefficient,
0997                                                 const Standard_Boolean               theToUpdateViewer);
0998 
0999   Standard_EXPORT void SetDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
1000                                           const Standard_Real                  theAngle,
1001                                           const Standard_Boolean               theToUpdateViewer);
1002   
1003   //! Calls the AIS_Shape SetAngleAndDeviation to set both Angle and Deviation coefficients
1004   Standard_EXPORT void SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
1005                                              const Standard_Real                  theAngle,
1006                                              const Standard_Boolean               theToUpdateViewer);
1007 
1008   //! Sets the deviation coefficient theCoefficient.
1009   //! Drawings of curves or patches are made with respect to a maximal chordal deviation.
1010   //! A Deviation coefficient is used in the shading display mode.
1011   //! The shape is seen decomposed into triangles.
1012   //! These are used to calculate reflection of light from the surface of the object.
1013   //! The triangles are formed from chords of the curves in the shape.
1014   //! The deviation coefficient theCoefficient gives the highest value of the angle with which a chord can deviate from a tangent to a curve.
1015   //! If this limit is reached, a new triangle is begun.
1016   //! This deviation is absolute and is set through the method: SetMaximalChordialDeviation.
1017   //! The default value is 0.001.
1018   //! In drawing shapes, however, you are allowed to ask for a relative deviation.
1019   //! This deviation will be: SizeOfObject * DeviationCoefficient.
1020   void SetDeviationCoefficient (const Standard_Real theCoefficient) { myDefaultDrawer->SetDeviationCoefficient (theCoefficient); }
1021   
1022   //! Returns the deviation coefficient.
1023   //! Drawings of curves or patches are made with respect to a maximal chordal deviation.
1024   //! A Deviation coefficient is used in the shading display mode.
1025   //! The shape is seen decomposed into triangles.
1026   //! These are used to calculate reflection of light from the surface of the object.
1027   //! The triangles are formed from chords of the curves in the shape.
1028   //! The deviation coefficient gives the highest value of the angle with which a chord can deviate from a tangent to a curve.
1029   //! If this limit is reached, a new triangle is begun.
1030   //! This deviation is absolute and is set through Prs3d_Drawer::SetMaximalChordialDeviation.
1031   //! The default value is 0.001.
1032   //! In drawing shapes, however, you are allowed to ask for a relative deviation.
1033   //! This deviation will be: SizeOfObject * DeviationCoefficient.
1034   Standard_Real DeviationCoefficient() const { return myDefaultDrawer->DeviationCoefficient(); }
1035 
1036   //! default 20 degrees
1037   void SetDeviationAngle (const Standard_Real theAngle) { myDefaultDrawer->SetDeviationAngle (theAngle); }
1038 
1039   Standard_Real DeviationAngle() const { return myDefaultDrawer->DeviationAngle(); }
1040 
1041 public: //! @name HLR (Hidden Line Removal) display attributes
1042 
1043   //! Initializes hidden line aspect in the default drawing tool, or Drawer.
1044   //! The default values are:
1045   //! Color: Quantity_NOC_YELLOW
1046   //! Type of line: Aspect_TOL_DASH
1047   //! Width: 1.
1048   const Handle(Prs3d_LineAspect)& HiddenLineAspect() const { return myDefaultDrawer->HiddenLineAspect(); }
1049 
1050   //! Sets the hidden line aspect anAspect.
1051   //! Aspect defines display attributes for hidden lines in HLR projections.
1052   void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& theAspect) const { myDefaultDrawer->SetHiddenLineAspect (theAspect); }
1053 
1054   //! returns Standard_True if the hidden lines are to be drawn.
1055   //! By default the hidden lines are not drawn.
1056   Standard_Boolean DrawHiddenLine() const { return myDefaultDrawer->DrawHiddenLine(); }
1057 
1058   void EnableDrawHiddenLine() const { myDefaultDrawer->EnableDrawHiddenLine(); }
1059 
1060   void DisableDrawHiddenLine() const { myDefaultDrawer->DisableDrawHiddenLine(); }
1061 
1062 public: //! @name iso-line display attributes
1063 
1064   //! Sets the number of U and V isoparameters displayed.
1065   Standard_EXPORT void SetIsoNumber (const Standard_Integer NbIsos, const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
1066   
1067   //! Returns the number of U and V isoparameters displayed.
1068   Standard_EXPORT Standard_Integer IsoNumber (const AIS_TypeOfIso WhichIsos = AIS_TOI_Both);
1069   
1070   //! Returns True if drawing isoparameters on planes is enabled.
1071   void IsoOnPlane (const Standard_Boolean theToSwitchOn) { myDefaultDrawer->SetIsoOnPlane (theToSwitchOn); }
1072   
1073   //! Returns True if drawing isoparameters on planes is enabled.
1074   //! if <forUIsos> = False,
1075   Standard_Boolean IsoOnPlane() const { return myDefaultDrawer->IsoOnPlane(); }
1076 
1077   //! Enables or disables on-triangulation build for isolines for a particular object.
1078   //! In case if on-triangulation builder is disabled, default on-plane builder will compute isolines for the object given.
1079   Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theIsEnabled,
1080                                            const Handle(AIS_InteractiveObject)& theObject);
1081 
1082   //! Enables or disables on-triangulation build for isolines for default drawer.
1083   //! In case if on-triangulation builder is disabled, default on-plane builder will compute isolines for the object given.
1084   void IsoOnTriangulation (const Standard_Boolean theToSwitchOn) { myDefaultDrawer->SetIsoOnTriangulation (theToSwitchOn); }
1085 
1086   //! Returns true if drawing isolines on triangulation algorithm is enabled.
1087   Standard_Boolean IsoOnTriangulation() const { return myDefaultDrawer->IsoOnTriangulation(); }
1088 
1089 //! @name obsolete methods
1090 public:
1091 
1092   Standard_DEPRECATED("Deprecated method Display() with obsolete argument theToAllowDecomposition")
1093   void Display (const Handle(AIS_InteractiveObject)& theIObj,
1094                 const Standard_Integer               theDispMode,
1095                 const Standard_Integer               theSelectionMode,
1096                 const Standard_Boolean               theToUpdateViewer,
1097                 const Standard_Boolean               theToAllowDecomposition,
1098                 const PrsMgr_DisplayStatus           theDispStatus = PrsMgr_DisplayStatus_None)
1099   {
1100     (void )theToAllowDecomposition;
1101     Display (theIObj, theDispMode, theSelectionMode, theToUpdateViewer, theDispStatus);
1102   }
1103 
1104   Standard_DEPRECATED("Deprecated method Load() with obsolete last argument theToAllowDecomposition")
1105   void Load (const Handle(AIS_InteractiveObject)& theObj, Standard_Integer theSelectionMode, Standard_Boolean ) { Load (theObj, theSelectionMode); }
1106 
1107   //! Updates the display in the viewer to take dynamic detection into account.
1108   //! On dynamic detection by the mouse cursor, sensitive primitives are highlighted.
1109   //! The highlight color of entities detected by mouse movement is white by default.
1110   Standard_DEPRECATED("Deprecated method Hilight()")
1111   void Hilight (const Handle(AIS_InteractiveObject)& theObj,
1112                 const Standard_Boolean               theIsToUpdateViewer)
1113   {
1114     return HilightWithColor (theObj, myStyles[Prs3d_TypeOfHighlight_Dynamic], theIsToUpdateViewer);
1115   }
1116 
1117   //! Sets the graphic basic aspect to the current presentation of ALL selected objects.
1118   Standard_DEPRECATED ("Deprecated method - presentation attributes should be assigned directly to object")
1119   Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
1120                                           const Standard_Boolean           theToUpdateViewer);
1121 
1122   //! Selects everything found in the bounding rectangle defined by the pixel minima and maxima, XPMin, YPMin, XPMax, and YPMax in the view.
1123   //! The objects detected are passed to the main viewer, which is then updated.
1124   Standard_DEPRECATED("This method is deprecated - SelectRectangle() taking AIS_SelectionScheme_Replace should be called instead")
1125   Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer  theXPMin,
1126                                            const Standard_Integer  theYPMin,
1127                                            const Standard_Integer  theXPMax,
1128                                            const Standard_Integer  theYPMax,
1129                                            const Handle(V3d_View)& theView,
1130                                            const Standard_Boolean  theToUpdateViewer);
1131 
1132   //! polyline selection; clears the previous picked list
1133   Standard_DEPRECATED("This method is deprecated - SelectPolygon() taking AIS_SelectionScheme_Replace should be called instead")
1134   Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& thePolyline,
1135                                            const Handle(V3d_View)&     theView,
1136                                            const Standard_Boolean      theToUpdateViewer);
1137 
1138   //! Stores and hilights the previous detected; Unhilights the previous picked.
1139   //! @sa MoveTo().
1140   Standard_DEPRECATED("This method is deprecated - SelectDetected() taking AIS_SelectionScheme_Replace should be called instead")
1141   Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean theToUpdateViewer);
1142 
1143   //! Adds the last detected to the list of previous picked.
1144   //! If the last detected was already declared as picked, removes it from the Picked List.
1145   //! @sa MoveTo().
1146   Standard_DEPRECATED("This method is deprecated - SelectDetected() taking AIS_SelectionScheme_XOR should be called instead")
1147   Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean theToUpdateViewer);
1148 
1149   //! Adds the last detected to the list of previous picked.
1150   //! If the last detected was already declared as picked, removes it from the Picked List.
1151   Standard_DEPRECATED("This method is deprecated - SelectPolygon() taking AIS_SelectionScheme_XOR should be called instead")
1152   Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
1153                                                 const Handle(V3d_View)&     theView,
1154                                                 const Standard_Boolean      theToUpdateViewer);
1155 
1156   //! Rectangle of selection; adds new detected entities into the picked list,
1157   //! removes the detected entities that were already stored.
1158   Standard_DEPRECATED("This method is deprecated - SelectRectangle() taking AIS_SelectionScheme_XOR should be called instead")
1159   Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Integer  theXPMin,
1160                                                 const Standard_Integer  theYPMin,
1161                                                 const Standard_Integer  theXPMax,
1162                                                 const Standard_Integer  theYPMax,
1163                                                 const Handle(V3d_View)& theView,
1164                                                 const Standard_Boolean  theToUpdateViewer);
1165 
1166 public:
1167 
1168   //! Updates the view of the current object in open context.
1169   //! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
1170   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1171   void SetCurrentObject (const Handle(AIS_InteractiveObject)& theIObj,
1172                          const Standard_Boolean               theToUpdateViewer) { SetSelected (theIObj, theToUpdateViewer); }
1173 
1174   //! Allows to add or remove the object given to the list of current and highlight/unhighlight it correspondingly.
1175   //! Is valid for global context only; for local context use method AddOrRemoveSelected.
1176   //! Since this method makes sense only for neutral point selection of a whole object,
1177   //! if 0 selection of the object is empty this method simply does nothing.
1178   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1179   void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
1180                                  const Standard_Boolean               theIsToUpdateViewer) { AddOrRemoveSelected (theObj, theIsToUpdateViewer); }
1181 
1182   //! Updates the list of current objects, i.e. hilights new current objects, removes hilighting from former current objects.
1183   //! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
1184   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1185   void UpdateCurrent() { UpdateSelected (Standard_True); }
1186 
1187   //! Returns true if there is a non-null interactive object in Neutral Point.
1188   //! Objects selected when there is no open local context are called current objects;
1189   //! those selected in open local context, selected objects.
1190   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1191   Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const { return IsSelected (theObject); }
1192 
1193   //! Initializes a scan of the current selected objects in Neutral Point.
1194   //! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
1195   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1196   void InitCurrent() { InitSelected(); }
1197 
1198   //! Returns true if there is another object found by the scan of the list of current objects.
1199   //! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
1200   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1201   Standard_Boolean MoreCurrent() const { return MoreSelected(); }
1202   
1203   //! Continues the scan to the next object in the list of current objects.
1204   //! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
1205   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1206   void NextCurrent() { NextSelected(); }
1207 
1208   //! Returns the current interactive object.
1209   //! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
1210   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1211   Handle(AIS_InteractiveObject) Current() const { return SelectedInteractive(); }
1212 
1213   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1214   Standard_Integer NbCurrents() { return NbSelected(); }
1215 
1216   //! Highlights current objects.
1217   //! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
1218   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1219   void HilightCurrents (const Standard_Boolean theToUpdateViewer) { HilightSelected (theToUpdateViewer); }
1220 
1221   //! Removes highlighting from current objects.
1222   //! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
1223   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1224   void UnhilightCurrents (const Standard_Boolean theToUpdateViewer) { UnhilightSelected (theToUpdateViewer); }
1225 
1226   //! Empties previous current objects in order to get the current objects detected by the selector using UpdateCurrent.
1227   //! Objects selected when there is no open local context are called current objects; those selected in open local context, selected objects.
1228   Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
1229   void ClearCurrents (const Standard_Boolean theToUpdateViewer) { ClearSelected (theToUpdateViewer); }
1230 
1231   //! @return current mouse-detected shape or empty (null) shape, if current interactive object
1232   //! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
1233   //! @sa DetectedCurrentOwner(), InitDetected(), MoreDetected(), NextDetected().
1234   Standard_DEPRECATED ("Local Context is deprecated - ::DetectedCurrentOwner() should be called instead")
1235   Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
1236   
1237   //! @return current mouse-detected interactive object or null object, if there is no currently detected interactives
1238   //! @sa DetectedCurrentOwner(), InitDetected(), MoreDetected(), NextDetected().
1239   Standard_DEPRECATED ("Local Context is deprecated - ::DetectedCurrentOwner() should be called instead")
1240   Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
1241 
1242 public: //! @name sub-intensity management (deprecated)
1243 
1244   //! Sub-intensity allows temporary highlighting of particular objects with specified color in a manner of selection highlight,
1245   //! but without actual selection (e.g., global status and owner's selection state will not be updated).
1246   //! The method returns the color of such highlighting.
1247   //! By default, it is Quantity_NOC_GRAY40.
1248   const Quantity_Color& SubIntensityColor() const
1249   {
1250     return myStyles[Prs3d_TypeOfHighlight_SubIntensity]->Color();
1251   }
1252 
1253   //! Sub-intensity allows temporary highlighting of particular objects with specified color in a manner of selection highlight,
1254   //! but without actual selection (e.g., global status and owner's selection state will not be updated).
1255   //! The method sets up the color for such highlighting.
1256   //! By default, this is Quantity_NOC_GRAY40.
1257   void SetSubIntensityColor (const Quantity_Color& theColor)
1258   {
1259     myStyles[Prs3d_TypeOfHighlight_SubIntensity]->SetColor (theColor);
1260   }
1261 
1262   //! Highlights, and removes highlights from, the displayed object which is displayed at Neutral Point with subintensity color.
1263   //! Available only for active local context.
1264   //! There is no effect if there is no local context.
1265   //! If a local context is open, the presentation of the Interactive Object activates the selection mode.
1266   Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& theIObj,
1267                                        const Standard_Boolean               theToUpdateViewer);
1268 
1269   //! Removes the subintensity option for the entity.
1270   //! If a local context is open, the presentation of the Interactive Object activates the selection mode.
1271   Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& theIObj,
1272                                         const Standard_Boolean               theToUpdateViewer);
1273 
1274   //! Returns selection instance
1275   const Handle(AIS_Selection)& Selection() const { return mySelection; }
1276 
1277   //! Sets selection instance to manipulate a container of selected owners
1278   //! @param theSelection an instance of the selection
1279   void SetSelection (const Handle(AIS_Selection)& theSelection) { mySelection = theSelection; }
1280 
1281   //! Dumps the content of me into the stream
1282   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
1283 
1284 protected: //! @name internal methods
1285 
1286   Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
1287   
1288   Standard_EXPORT void EraseGlobal (const Handle(AIS_InteractiveObject)& theIObj,
1289                                     const Standard_Boolean               theToUpdateViewer);
1290   
1291   Standard_EXPORT void ClearGlobal (const Handle(AIS_InteractiveObject)& theIObj,
1292                                     const Standard_Boolean               theToUpdateViewer);
1293   
1294   Standard_EXPORT void ClearGlobalPrs (const Handle(AIS_InteractiveObject)& theObj,
1295                                        const Standard_Integer               theMode,
1296                                        const Standard_Boolean               theToUpdateViewer);
1297   
1298   Standard_EXPORT void InitAttributes();
1299 
1300   //! Highlights detected objects.
1301   //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to update view.
1302   Standard_EXPORT AIS_StatusOfDetection moveTo (const Handle(V3d_View)& theView,
1303                                                 const Standard_Boolean  theToRedrawOnUpdate);
1304 
1305   //! Returns True if the object is detected.
1306   Standard_EXPORT Standard_Boolean isDetected (const Handle(AIS_InteractiveObject)& theObject);
1307 
1308   //! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
1309   Standard_EXPORT void unselectOwners (const Handle(AIS_InteractiveObject)& theObject);
1310 
1311   //! Helper function that highlights the owner given with <theStyle> without
1312   //! performing AutoHighlight checks, e.g. is used for dynamic highlight.
1313   Standard_EXPORT void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
1314                                            const Handle(V3d_Viewer)& theViewer = NULL);
1315 
1316   //! Helper function that highlights the owner given with <theStyle> with check
1317   //! for AutoHighlight, e.g. is used for selection.
1318   Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
1319 
1320   //! Helper function that highlights the owners with check for AutoHighlight, e.g. is used for selection.
1321   //! @param theOwners [in] list of owners to highlight
1322   //! @param theStyle  [in] highlight style to apply or NULL to apply selection style
1323   Standard_EXPORT void highlightOwners (const AIS_NListOfEntityOwner& theOwners,
1324                                         const Handle(Prs3d_Drawer)& theStyle);
1325 
1326   //! Helper function that highlights global owner of the object given with <theStyle> with check
1327   //! for AutoHighlight, e.g. is used for selection.
1328   //! If global owner is null, it simply highlights the whole object
1329   Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
1330                                         const Handle(Prs3d_Drawer)& theStyle,
1331                                         const Standard_Integer theDispMode);
1332 
1333   //! Helper function that unhighlights all owners that are stored in current AIS_Selection.
1334   //! The function updates global status and selection state of owner and interactive object.
1335   //! If the parameter <theIsToHilightSubIntensity> is set to true, interactive objects with sub-intensity
1336   //! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
1337   Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
1338 
1339   //! Helper function that unhighlights the owners with check
1340   //! for AutoHighlight, e.g. is used for selection.
1341   Standard_EXPORT void unhighlightOwners (const AIS_NListOfEntityOwner& theOwners,
1342                                           const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
1343 
1344   //! Helper function that unhighlights global selection owner of given interactive.
1345   //! The function does not perform any updates of global or owner status
1346   Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj);
1347 
1348   //! Helper function that turns on sub-intensity in global status and highlights
1349   //! given objects with sub-intensity color
1350   //! @param theObject [in] the object. If NULL is given, than sub-intensity will be turned on for
1351   //! all inveractive objects of the context
1352   //! @param theDispMode [in] display mode. If -1 is given, sub-intensity will be turned on for
1353   //! all display modes in global status's list of modes
1354   //! @param theIsDisplayedOnly [in] is true if sub-intensity should be applied only to objects with
1355   //! status AIS_DS_Displayed
1356   Standard_EXPORT void turnOnSubintensity (const Handle(AIS_InteractiveObject)& theObject = NULL,
1357                                            const Standard_Integer theDispMode = -1,
1358                                            const Standard_Boolean theIsDisplayedOnly = Standard_True) const;
1359 
1360   //! Helper function that highlights the object with sub-intensity color without any checks
1361   //! @param theObject [in] the object that will be highlighted
1362   //! @param theMode [in] display mode
1363   Standard_EXPORT void highlightWithSubintensity (const Handle(AIS_InteractiveObject)& theObject,
1364                                                   const Standard_Integer theMode) const;
1365 
1366   //! Helper function that highlights the owner with sub-intensity color without any checks
1367   //! @param theOwner [in] the owner that will be highlighted
1368   //! @param theMode [in] display mode
1369   Standard_EXPORT void highlightWithSubintensity (const Handle(SelectMgr_EntityOwner)& theOwner,
1370                                                   const Standard_Integer theMode) const;
1371 
1372   //! Helper function that returns correct dynamic highlight style for the object:
1373   //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1374   //! dynamic highlight style of interactive context will be returned.
1375   //! @param theObj [in] the object to check
1376   const Handle(Prs3d_Drawer)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj,
1377                                           const Handle(SelectMgr_EntityOwner)& theOwner) const
1378   {
1379     const Handle(Prs3d_Drawer)& aHiDrawer = theObj->DynamicHilightAttributes();
1380     if (!aHiDrawer.IsNull())
1381     {
1382       return aHiDrawer;
1383     }
1384 
1385     return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
1386   }
1387 
1388   //! Return TRUE if highlight style of owner requires full viewer redraw.
1389   Standard_EXPORT Standard_Boolean isSlowHiStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
1390                                                   const Handle(V3d_Viewer)& theViewer) const;
1391 
1392   //! Helper function that returns correct selection style for the object:
1393   //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
1394   //! selection style of interactive context will be returned.
1395   //! @param theObj [in] the object to check
1396   const Handle(Prs3d_Drawer)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj,
1397                                            const Handle(SelectMgr_EntityOwner)& theOwner) const
1398   {
1399     const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
1400     if (!aHiDrawer.IsNull())
1401     {
1402       return aHiDrawer;
1403     }
1404 
1405     return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalSelected : Prs3d_TypeOfHighlight_Selected];
1406   }
1407 
1408   //! Assign the context to the object or throw exception if object was already assigned to another context.
1409   Standard_EXPORT void setContextToObject (const Handle(AIS_InteractiveObject)& theObj);
1410 
1411   //! Return display mode for highlighting.
1412   Standard_Integer getHilightMode (const Handle(AIS_InteractiveObject)& theObj,
1413                                    const Handle(Prs3d_Drawer)& theStyle,
1414                                    const Standard_Integer theDispMode) const
1415   {
1416     if (!theStyle.IsNull()
1417      &&  theStyle->DisplayMode() != -1
1418      &&  theObj->AcceptDisplayMode (theStyle->DisplayMode()))
1419     {
1420       return theStyle->DisplayMode();
1421     }
1422     else if (theDispMode != -1)
1423     {
1424       return theDispMode;
1425     }
1426     else if (theObj->HasDisplayMode())
1427     {
1428       return theObj->DisplayMode();
1429     }
1430     return myDefaultDrawer->DisplayMode();
1431   }
1432 
1433   //! Removes dynamic highlight draw
1434   void clearDynamicHighlight() const
1435   {
1436     if (myLastPicked.IsNull())
1437       return;
1438 
1439     myLastPicked->Selectable()->ClearDynamicHighlight (myMainPM);
1440   }
1441 
1442   //! Bind/Unbind status to object and its children
1443   //! @param[in] theIObj the object to change status
1444   //! @param[in] theStatus status, if NULL, unbind object
1445   Standard_EXPORT void setObjectStatus (const Handle(AIS_InteractiveObject)& theIObj,
1446                                         const PrsMgr_DisplayStatus theStatus,
1447                                         const Standard_Integer theDispyMode,
1448                                         const Standard_Integer theSelectionMode);
1449 
1450 protected: //! @name internal fields
1451 
1452   AIS_DataMapOfIOStatus myObjects;
1453   Handle(SelectMgr_SelectionManager) mgrSelector;
1454   Handle(PrsMgr_PresentationManager) myMainPM;
1455   Handle(V3d_Viewer) myMainVwr;
1456   V3d_View* myLastActiveView;
1457   Handle(SelectMgr_EntityOwner) myLastPicked;
1458   Standard_Boolean myToHilightSelected;
1459   Handle(AIS_Selection) mySelection;
1460   Handle(SelectMgr_AndOrFilter) myFilters; //!< context filter (the content active filters
1461                                            //!  can be applied with AND or OR operation)
1462   Handle(Prs3d_Drawer) myDefaultDrawer;
1463   Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
1464   TColStd_SequenceOfInteger myDetectedSeq;
1465   Standard_Integer myCurDetected;
1466   Standard_Integer myCurHighlighted;
1467   SelectMgr_PickingStrategy myPickingStrategy; //!< picking strategy to be applied within MoveTo()
1468   Standard_Boolean myAutoHilight;
1469   Standard_Boolean myIsAutoActivateSelMode;
1470 
1471 };
1472 
1473 DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
1474 
1475 #endif // _AIS_InteractiveContext_HeaderFile