0028888: Visualization - AIS_InteractiveContext should not hold V3d_View handle which...
[occt.git] / src / AIS / AIS_InteractiveContext.hxx
index f8ba7b3..59b0524 100644 (file)
 #ifndef _AIS_InteractiveContext_HeaderFile
 #define _AIS_InteractiveContext_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <AIS_DataMapOfIOStatus.hxx>
-#include <PrsMgr_PresentationManager3d.hxx>
-#include <StdSelect_ViewerSelector3d.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <Standard_Boolean.hxx>
-#include <Prs3d_Drawer.hxx>
-#include <Quantity_NameOfColor.hxx>
-#include <Standard_Integer.hxx>
 #include <AIS_DataMapOfILC.hxx>
-#include <AIS_SequenceOfInteractive.hxx>
-#include <MMgt_TShared.hxx>
+#include <AIS_DataMapOfIOStatus.hxx>
+#include <AIS_DisplayMode.hxx>
 #include <AIS_DisplayStatus.hxx>
+#include <AIS_ClearMode.hxx>
 #include <AIS_KindOfInteractive.hxx>
-#include <Standard_Real.hxx>
-#include <Aspect_TypeOfFacingModel.hxx>
-#include <Graphic3d_NameOfMaterial.hxx>
-#include <Standard_ShortReal.hxx>
-#include <TColStd_ListOfInteger.hxx>
-#include <AIS_DisplayMode.hxx>
-#include <AIS_TypeOfIso.hxx>
+#include <AIS_ListOfInteractive.hxx>
+#include <AIS_Selection.hxx>
 #include <AIS_StatusOfDetection.hxx>
 #include <AIS_StatusOfPick.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
+#include <AIS_TypeOfIso.hxx>
+#include <Aspect_TypeOfFacingModel.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_TypeOfHighlight.hxx>
+#include <PrsMgr_PresentationManager3d.hxx>
 #include <SelectMgr_IndexedMapOfOwner.hxx>
-#include <AIS_ClearMode.hxx>
-#include <TopAbs_ShapeEnum.hxx>
 #include <SelectMgr_ListOfFilter.hxx>
-#include <AIS_ListOfInteractive.hxx>
-#include <Standard_CString.hxx>
+#include <SelectMgr_PickingStrategy.hxx>
+#include <Standard.hxx>
+#include <Standard_Type.hxx>
+#include <StdSelect_ViewerSelector3d.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+#include <Quantity_Color.hxx>
+
 class SelectMgr_SelectionManager;
 class V3d_Viewer;
 class AIS_InteractiveObject;
@@ -56,20 +51,13 @@ class SelectMgr_OrFilter;
 class V3d_View;
 class AIS_LocalContext;
 class TopLoc_Location;
-class Quantity_Color;
 class TCollection_ExtendedString;
 class Prs3d_LineAspect;
 class Prs3d_BasicAspect;
-class TopoDS_Shape;
 class SelectMgr_EntityOwner;
-class Standard_Transient;
 class SelectMgr_Filter;
 class TCollection_AsciiString;
 
-
-class AIS_InteractiveContext;
-DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared)
-
 //! The Interactive Context allows you to manage
 //! graphic behavior and selection of Interactive Objects
 //! in one or more viewers. Class methods make this
@@ -132,23 +120,43 @@ DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared)
 //! selection mode is equal to 0, but it might be redefined if needed. Sub-part selection
 //! of the objects without using local context provides a possibility to activate part
 //! selection modes along with global selection mode.
-class AIS_InteractiveContext : public MMgt_TShared
+class AIS_InteractiveContext : public Standard_Transient
 {
-
+  friend class AIS_LocalContext;
+  DEFINE_STANDARD_RTTIEXT(AIS_InteractiveContext, Standard_Transient)
 public:
 
-  
-
   //! Constructs the interactive context object defined by
   //! the principal viewer MainViewer.
   Standard_EXPORT AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer);
-  
-  Standard_EXPORT virtual void Delete() const Standard_OVERRIDE;
-  
+
+  //! Destructor.
+  Standard_EXPORT virtual ~AIS_InteractiveContext();
+
   Standard_EXPORT void SetAutoActivateSelection (const Standard_Boolean Auto);
   
   Standard_EXPORT Standard_Boolean GetAutoActivateSelection() const;
   
+  //! Setup picking strategy - which entities detected by picking line will be accepted, considering Selection Filters.
+  //! By default (SelectMgr_PickingStrategy_FirstAcceptable), Selection Filters reduce the list of entities
+  //! so that the context accepts topmost in remaining.
+  //!
+  //! This means that entities behind non-selectable (by filters) parts can be picked by user.
+  //! If this behavior is undesirable, and user wants that non-selectable (by filters) parts
+  //! should remain an obstacle for picking, SelectMgr_PickingStrategy_OnlyTopmost can be set instead.
+  //!
+  //! Notice, that since Selection Manager operates only objects registered in it,
+  //! SelectMgr_PickingStrategy_OnlyTopmost will NOT prevent picking entities behind
+  //! visible by unregistered in Selection Manager presentations (e.g. deactivated).
+  //! Hence, SelectMgr_PickingStrategy_OnlyTopmost changes behavior only with Selection Filters enabled.
+  void SetPickingStrategy (const SelectMgr_PickingStrategy theStrategy)
+  {
+    myPickingStrategy = theStrategy;
+  }
+
+  //! Return picking strategy; SelectMgr_PickingStrategy_FirstAcceptable by default.
+  SelectMgr_PickingStrategy PickingStrategy() const { return myPickingStrategy; }
+
   //! Controls the choice between the using the display
   //! and selection modes of open local context which you
   //! have defined and activating those available by default.
@@ -163,7 +171,8 @@ public:
   //! open or closed. If you want to view the object in open
   //! local context without selection, use the syntax below,
   //! setting aSelectionMode to -1.
-  Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj,
+                                const Standard_Boolean               theToUpdateViewer);
   
   //! Controls the choice between the using the display
   //! and selection modes of open local context which you
@@ -188,7 +197,12 @@ public:
   //! -   vertices: 1
   //! -   edges: 2
   //! -   wires: 3.
-  Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theDispMode, const Standard_Integer theSelectionMode, const Standard_Boolean theToUpdateViewer = Standard_True, const Standard_Boolean theToAllowDecomposition = Standard_True, const AIS_DisplayStatus theDispStatus = AIS_DS_None);
+  Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj,
+                                const Standard_Integer               theDispMode,
+                                const Standard_Integer               theSelectionMode,
+                                const Standard_Boolean               theToUpdateViewer,
+                                const Standard_Boolean               theToAllowDecomposition = Standard_True,
+                                const AIS_DisplayStatus              theDispStatus = AIS_DS_None);
   
   //! Allows you to load the Interactive Object aniobj
   //! with a given selection mode SelectionMode, and/or
@@ -206,21 +220,22 @@ public:
   //! Hides the object. The object's presentations are simply
   //! flagged as invisible and therefore excluded from redrawing.
   //! To show hidden objects, use Display().
-  Standard_EXPORT void Erase (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void Erase (const Handle(AIS_InteractiveObject)& theIObj,
+                              const Standard_Boolean               theToUpdateViewer);
   
   //! Hides all objects. The object's presentations are simply
   //! flagged as invisible and therefore excluded from redrawing.
   //! To show all hidden objects, use DisplayAll().
-  Standard_EXPORT void EraseAll (const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void EraseAll (const Standard_Boolean theToUpdateViewer);
   
   //! Displays all hidden objects.
-  Standard_EXPORT void DisplayAll (const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void DisplayAll (const Standard_Boolean theToUpdateViewer);
   
 
   //! Hides selected objects. The object's presentations are simply
   //! flagged as invisible and therefore excluded from redrawing.
   //! To show hidden objects, use Display().
-  Standard_EXPORT void EraseSelected (const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void EraseSelected (const Standard_Boolean theToUpdateViewer);
   
   //! Displays selected objects if a local context is open.
   //! Displays current objects if there is no active local context.
@@ -231,7 +246,7 @@ public:
   //! Standard_False, the presentation   of the Interactive
   //! Object activates   the   selection   mode; the   object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void DisplaySelected (const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void DisplaySelected (const Standard_Boolean theToUpdateViewer);
   
   //! Changes the status of a temporary object. It will be
   //! kept at the neutral point, i.e. put in the list of
@@ -242,6 +257,7 @@ public:
   //! inWhichLocal gives the local context in which anIObj
   //! is displayed. By default, the index -1 refers to the last
   //! Local Context opened.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Standard_Boolean KeepTemporary (const Handle(AIS_InteractiveObject)& anIObj, const Standard_Integer InWhichLocal = -1);
   
   //! Empties the graphic presentation of the mode
@@ -253,7 +269,9 @@ public:
   //! Warning
   //! Removes anIobj. anIobj is still active if it was
   //! previously activated.
-  Standard_EXPORT void ClearPrs (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode = 0, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void ClearPrs (const Handle(AIS_InteractiveObject)& theIObj,
+                                 const Standard_Integer               theMode,
+                                 const Standard_Boolean               theToUpdateViewer);
   
   //! Removes aniobj from every viewer. aniobj is no
   //! longer referenced in the Context.
@@ -261,12 +279,12 @@ public:
   //! Standard_False, the presentation   of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void Remove (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void Remove (const Handle(AIS_InteractiveObject)& theIObj,
+                               const Standard_Boolean               theToUpdateViewer);
   
   //! Removes all the objects from all opened Local Contexts
   //! and from the Neutral Point
-  Standard_EXPORT void RemoveAll (const Standard_Boolean updateviewer = Standard_True);
-  
+  Standard_EXPORT void RemoveAll (const Standard_Boolean theToUpdateViewer);
 
   //! Updates the display in the viewer to take dynamic
   //! detection into account. On dynamic detection by the
@@ -277,8 +295,12 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
-  
+  Standard_DEPRECATED("Deprecated method Hilight()")
+  void Hilight (const Handle(AIS_InteractiveObject)& theObj,
+                const Standard_Boolean               theIsToUpdateViewer)
+  {
+    return HilightWithColor (theObj, myStyles[Prs3d_TypeOfHighlight_Dynamic], theIsToUpdateViewer);
+  }
 
   //! Changes the color of all the lines of the object in view,
   //! aniobj. It paints these lines the color passed as the
@@ -287,7 +309,9 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_NameOfColor aCol, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& theObj,
+                                         const Handle(Prs3d_Drawer)&          theStyle,
+                                         const Standard_Boolean               theToUpdateViewer);
   
 
   //! Removes hilighting from the entity aniobj. Updates the viewer.
@@ -295,7 +319,8 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& theIObj,
+                                  const Standard_Boolean               theToUpdateViewer);
   
   //! Sets the display priority aPriority of the seen parts
   //! presentation of the entity anIobj.
@@ -316,16 +341,22 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void Redisplay (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True, const Standard_Boolean allmodes = Standard_False);
+  Standard_EXPORT void Redisplay (const Handle(AIS_InteractiveObject)& theIObj,
+                                  const Standard_Boolean               theToUpdateViewer,
+                                  const Standard_Boolean               theAllModes = Standard_False);
   
   //! Recomputes the Prs/Selection of displayed objects of
   //! a given type and a given signature.
   //! if signature = -1  doesnt take signature criterion.
-  Standard_EXPORT void Redisplay (const AIS_KindOfInteractive aTypeOfObject, const Standard_Integer Signature = -1, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void Redisplay (const AIS_KindOfInteractive theTypeOfObject,
+                                  const Standard_Integer      theSignature,
+                                  const Standard_Boolean      theToUpdateViewer);
   
   //! Recomputes the displayed presentations, flags the others
   //! Doesn't update presentations
-  Standard_EXPORT void RecomputePrsOnly (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean updateviewer = Standard_True, const Standard_Boolean allmodes = Standard_False);
+  Standard_EXPORT void RecomputePrsOnly (const Handle(AIS_InteractiveObject)& theIObj,
+                                         const Standard_Boolean               theToUpdateViewer,
+                                         const Standard_Boolean               theAllModes = Standard_False);
   
   //! Recomputes the active selections, flags the others
   //! Doesn't update presentations
@@ -336,7 +367,8 @@ public:
   //! and selection structures. This method does not force any
   //! recomputation on its own. The method recomputes selections
   //! even if they are loaded without activation in particular selector.
-  Standard_EXPORT void Update (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theUpdateViewer = Standard_True);
+  Standard_EXPORT void Update (const Handle(AIS_InteractiveObject)& theIObj,
+                               const Standard_Boolean               theUpdateViewer);
   
 
   //! Sets the display mode of seen Interactive Objects.
@@ -349,7 +381,9 @@ public:
   //! object is displayed but no viewer will be updated.
   //! Note that display mode 3 is only used if you have an
   //! AIS_Textured Shape.
-  Standard_EXPORT void SetDisplayMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
+                                       const Standard_Integer               theMode,
+                                       const Standard_Boolean               theToUpdateViewer);
   
 
   //! Unsets the display mode of seen Interactive Objects.
@@ -360,17 +394,25 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object returns to the default selection mode; the
   //! object is displayed but no viewer will be updated.
-  Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& theIObj,
+                                         const Standard_Boolean               theToUpdateViewer);
 
   //! Disables the mechanism of adaptive tolerance calculation in SelectMgr_ViewerSelector and
   //! sets the given tolerance for ALL sensitive entities activated. For more information, see
   //! SelectMgr_ViewerSelector documentation
   //! Warning: When a local context is open the sensitivity is apply on it
   //! instead on the main context.
-  Standard_EXPORT void SetPixelTolerance (const Standard_Real aPrecision = 2.0);
+  Standard_EXPORT void SetPixelTolerance (const Standard_Integer aPrecision = 2);
   
   //! Returns the pixel tolerance.
-  Standard_EXPORT Standard_Real PixelTolerance() const;
+  Standard_EXPORT Standard_Integer PixelTolerance() const;
+
+  //! Allows to manage sensitivity of a particular selection of interactive object theObject
+  //! and changes previous sensitivity value of all sensitive entities in selection with theMode
+  //! to the given theNewSensitivity.
+  Standard_EXPORT void SetSelectionSensitivity (const Handle(AIS_InteractiveObject)& theObject,
+                                                const Standard_Integer theMode,
+                                                const Standard_Integer theNewSensitivity);
   
   //! Puts the location aLocation on the initial graphic
   //! representation and the selection for the entity aniobj.
@@ -396,23 +438,23 @@ public:
   //! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is
   //! applying both on the front and back face.
   Standard_EXPORT void SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& aniobj, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE);
-  
-  Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_NameOfColor aColor, const Standard_Boolean updateviewer = Standard_True);
-  
 
   //! Sets the color of the selected entity.
   //! If a local context is open and if updateviewer equals
   //! Standard_False, the presentation   of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_Color& aColor, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& theIObj,
+                                 const Quantity_Color&                theColor,
+                                 const Standard_Boolean               theToUpdateViewer);
   
   //! Removes the color selection for the selected entity.
   //! If a local context is open and if updateviewer equals
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void UnsetColor (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void UnsetColor (const Handle(AIS_InteractiveObject)& theIObj,
+                                   const Standard_Boolean               theToUpdateViewer);
   
 
   //! Sets the width of the entity aniobj.
@@ -420,7 +462,9 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT virtual void SetWidth (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aValue, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT virtual void SetWidth (const Handle(AIS_InteractiveObject)& theIObj,
+                                         const Standard_Real                  theValue,
+                                         const Standard_Boolean               theToUpdateViewer);
   
 
   //! Removes the width setting of the entity aniobj.
@@ -428,18 +472,19 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT virtual void UnsetWidth (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT virtual void UnsetWidth (const Handle(AIS_InteractiveObject)& theIObj,
+                                           const Standard_Boolean               theToUpdateViewer);
   
 
   //! Provides the type of material setting for the view of
   //! the entity aniobj.
-  //! The range of settings includes: BRASS, BRONZE,
-  //! GOLD, PEWTER, SILVER, STONE.
   //! If a local context is open and if updateviewer equals
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void SetMaterial (const Handle(AIS_InteractiveObject)& aniobj, const Graphic3d_NameOfMaterial aName, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
+                                    const Graphic3d_MaterialAspect&      theMaterial,
+                                    const Standard_Boolean               theToUpdateViewer);
   
 
   //! Removes the type of material setting for viewing the
@@ -448,7 +493,8 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void UnsetMaterial (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void UnsetMaterial (const Handle(AIS_InteractiveObject)& theIObj,
+                                      const Standard_Boolean               theToUpdateViewer);
   
   //! Provides the transparency settings for viewing the
   //! entity aniobj. The transparency value aValue may be
@@ -457,7 +503,9 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void SetTransparency (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aValue = 0.6, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
+                                        const Standard_Real                  theValue,
+                                        const Standard_Boolean               theToUpdateViewer);
   
 
   //! Removes   the transparency settings for viewing the
@@ -467,7 +515,8 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void UnsetTransparency (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void UnsetTransparency (const Handle(AIS_InteractiveObject)& theIObj,
+                                          const Standard_Boolean               theToUpdateViewer);
   
 
   //! Sets the attributes of the interactive object aniobj by
@@ -479,7 +528,9 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void SetLocalAttributes (const Handle(AIS_InteractiveObject)& aniobj, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
+                                           const Handle(Prs3d_Drawer)&          theDrawer,
+                                           const Standard_Boolean               theToUpdateViewer);
   
 
   //! Removes the settings for local attributes of the entity
@@ -489,11 +540,16 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& theIObj,
+                                             const Standard_Boolean               theToUpdateViewer);
   
   //! Sets up polygon offsets for the given AIS_InteractiveObject.
   //! It simply calls anObj->SetPolygonOffsets()
-  Standard_EXPORT void SetPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj, const Standard_Integer aMode, const Standard_ShortReal aFactor = 1.0, const Standard_ShortReal aUnits = 0.0, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetPolygonOffsets (const Handle(AIS_InteractiveObject)& theIObj,
+                                          const Standard_Integer               theMode,
+                                          const Standard_ShortReal             theFactor,
+                                          const Standard_ShortReal             theUnits,
+                                          const Standard_Boolean               theToUpdateViewer);
   
   //! simply calls anObj->HasPolygonOffsets()
   Standard_EXPORT Standard_Boolean HasPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj) const;
@@ -512,7 +568,8 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void SetTrihedronSize (const Standard_Real aSize, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetTrihedronSize (const Standard_Real    theSize,
+                                         const Standard_Boolean theToUpdateViewer);
   
   //! returns the current value of trihedron size.
   Standard_EXPORT Standard_Real TrihedronSize() const;
@@ -524,7 +581,9 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void SetPlaneSize (const Standard_Real aSizeX, const Standard_Real aSizeY, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetPlaneSize (const Standard_Real    theSizeX,
+                                     const Standard_Real    theSizeY,
+                                     const Standard_Boolean theToUpdateViewer);
   
 
   //! Sets the plane size aSize.
@@ -533,7 +592,8 @@ public:
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
   //! May be used if PlaneSize returns true.
-  Standard_EXPORT void SetPlaneSize (const Standard_Real aSize, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetPlaneSize (const Standard_Real    theSize,
+                                     const Standard_Boolean theToUpdateViewer);
   
   //! Returns true if the length in the X direction XSize is
   //! the same as that in the Y direction YSize.
@@ -548,26 +608,29 @@ public:
   Standard_EXPORT AIS_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const;
   
 
-  //! Returns the list of active display modes for the entity aniobj.
-  Standard_EXPORT const TColStd_ListOfInteger& DisplayedModes (const Handle(AIS_InteractiveObject)& aniobj) const;
-  
   //! Returns true if anIobj is displayed in the interactive context.
   Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const;
   
   Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode) const;
-  
-  Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& aniobj) const;
-  
-  //! if <anIObj> is hilighted with a specific color
-  //! <WithColor> will be returned TRUE
-  //! <theHiCol> gives the name of the hilightcolor
-  Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& anIobj, Standard_Boolean& WithColor, Quantity_NameOfColor& theHiCol) const;
 
-  //! if <theOwner> is hilighted with a specific color, than <theIsCustomColor> will be set
-  //! to true and <theCustomColorName> will have the name of the color stored
-  Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner,
-                                                Standard_Boolean& theIsCustomColor,
-                                                Quantity_NameOfColor& theCustomColorName) const;
+  //! Returns true if the object is marked as highlighted via its global
+  //! status
+  //! @param theObj [in] the object to check
+  Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& theObj) const;
+
+  //! Returns true if the owner is marked as selected
+  //! @param theOwner [in] the owner to check
+  Standard_EXPORT Standard_Boolean IsHilighted (const Handle(SelectMgr_EntityOwner)& theOwner) const;
+
+  //! Returns highlight style of the object if it is marked as highlighted via global status
+  //! @param theObj [in] the object to check
+  Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(AIS_InteractiveObject)& theObj,
+                                                   Handle(Prs3d_Drawer)& theStyle) const;
+
+  //! Returns highlight style of the owner if it is selected
+  //! @param theOwner [in] the owner to check
+  Standard_EXPORT Standard_Boolean HighlightStyle (const Handle(SelectMgr_EntityOwner)& theOwner,
+                                                   Handle(Prs3d_Drawer)& theStyle) const;
 
   //! Returns the display priority of the entity anIobj. This
   //! will be display   mode of anIobj if it is in the main
@@ -577,9 +640,6 @@ public:
 
   //! Returns true if a view of the Interactive Object aniobj has color.
   Standard_EXPORT Standard_Boolean HasColor (const Handle(AIS_InteractiveObject)& aniobj) const;
-  
-  Standard_EXPORT Quantity_NameOfColor Color (const Handle(AIS_InteractiveObject)& aniobj) const;
-  
 
   //! Returns the color Color of the entity aniobj in the interactive context.
   Standard_EXPORT void Color (const Handle(AIS_InteractiveObject)& aniobj, Quantity_Color& acolor) const;
@@ -594,6 +654,17 @@ public:
   //! for the view of the Interactive Object anObj.
   Standard_EXPORT void Status (const Handle(AIS_InteractiveObject)& anObj, TCollection_ExtendedString& astatus) const;
   
+  //! Sets transform persistence.
+  Standard_EXPORT void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObject,
+                                                const Handle(Graphic3d_TransformPers)& theTrsfPers);
+
+  Standard_DEPRECATED("This method is deprecated - SetTransformPersistence() taking Graphic3d_TransformPers should be called instead")
+  void SetTransformPersistence (const Handle(AIS_InteractiveObject)& theObj,
+                                const Graphic3d_TransModeFlags&      theFlag,
+                                const gp_Pnt&                        thePoint = gp_Pnt (0.0, 0.0, 0.0))
+  {
+    SetTransformPersistence (theObj, Graphic3d_TransformPers::FromDeprecatedParams (theFlag, thePoint));
+  }
 
   //! Updates the current viewer, the viewer in Neutral Point.
   //! Objects selected when there is no open local context
@@ -603,56 +674,62 @@ public:
   
   //! Returns the display mode setting.
   //! Note that mode 3 is only used.
-    Standard_Integer DisplayMode() const;
-  
-
-  //! Returns the name of the color used to show
-  //! highlighted entities, that is, entities picked out by the mouse.
-    Quantity_NameOfColor HilightColor() const;
-  
-
-  //! Returns the name of the color used to show selected entities.
-  //! By default, this is Quantity_NOC_GRAY80.
-    Quantity_NameOfColor SelectionColor() const;
-  
-  //! Returns the name of the color used to show preselection.
-  //! By default, this is Quantity_NOC_GREEN.
-    Quantity_NameOfColor PreSelectionColor() const;
-  
-
-  //! Returns the name of the color used by default.
-  //! By default, this is Quantity_NOC_GOLDENROD.
-    Quantity_NameOfColor DefaultColor() const;
-  
-
-  //! Returns the name of the color used to show that an
-  //! object is not currently selected.
-  //! By default, this is Quantity_NOC_GRAY40.
-    Quantity_NameOfColor SubIntensityColor() const;
-  
-
-  //! Sets the color used to show highlighted entities, that
-  //! is, entities picked by the mouse.
-  //! By default, this is Quantity_NOC_CYAN1.
-    void SetHilightColor (const Quantity_NameOfColor aHiCol);
-  
-
-  //! Sets the color used to show selected entities.
-  //! By default, this is Quantity_NOC_GRAY80.
-    void SelectionColor (const Quantity_NameOfColor aCol);
-  
-
-  //! Allows you to set the color used to show preselection.
-  //! By default, this is Quantity_NOC_GREEN.
-  //! A preselected entity is one which has been selected
-  //! as the domain of application of a function such as a fillet.
-    void SetPreselectionColor (const Quantity_NameOfColor aCol);
-  
-
-  //! Sets the color used to show that an object is not currently selected.
+  Standard_Integer DisplayMode() const { return myDefaultDrawer->DisplayMode(); }
+
+  //! Returns highlight style settings.
+  const Handle(Prs3d_Drawer)& HighlightStyle (const Prs3d_TypeOfHighlight theStyleType) const { return myStyles[theStyleType]; }
+
+  //! Setup highlight style settings.
+  void SetHighlightStyle (const Prs3d_TypeOfHighlight theStyleType,
+                          const Handle(Prs3d_Drawer)& theStyle) { myStyles[theStyleType] = theStyle; }
+
+  //! Returns current dynamic highlight style settings.
+  //! By default:
+  //!   - the color of dynamic highlight is Quantity_NOC_CYAN1;
+  //!   - the presentation for dynamic highlight is completely opaque;
+  //!   - the type of highlight is Aspect_TOHM_COLOR.
+  const Handle(Prs3d_Drawer)& HighlightStyle() const
+  {
+    return myStyles[Prs3d_TypeOfHighlight_Dynamic];
+  }
+
+  //! Setup the style of dynamic highlighting.
+  void SetHighlightStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Dynamic] = theStyle; }
+
+  //! Returns current selection style settings.
+  //! By default:
+  //!   - the color of selection is Quantity_NOC_GRAY80;
+  //!   - the presentation for selection is completely opaque;
+  //!   - the type of highlight is Aspect_TOHM_COLOR.
+  const Handle(Prs3d_Drawer)& SelectionStyle() const
+  {
+    return myStyles[Prs3d_TypeOfHighlight_Selected];
+  }
+
+  //! Setup the style of selection highlighting.
+  void SetSelectionStyle (const Handle(Prs3d_Drawer)& theStyle) { myStyles[Prs3d_TypeOfHighlight_Selected] = theStyle; }
+
+  //! Sub-intensity allows temporary highlighting of particular
+  //! objects with specified color in a manner of selection highlight,
+  //! but without actual selection (e.g., global status and owner's
+  //! selection state will not be updated).
+  //! The method returns the color of such highlighting.
+  //! By default, it is Quantity_NOC_GRAY40.
+  const Quantity_Color& SubIntensityColor() const
+  {
+    return myStyles[Prs3d_TypeOfHighlight_SubIntensity]->Color();
+  }
+
+  //! Sub-intensity allows temporary highlighting of particular
+  //! objects with specified color in a manner of selection highlight,
+  //! but without actual selection (e.g., global status and owner's
+  //! selection state will not be updated).
+  //! The method sets up the color for such highlighting.
   //! By default, this is Quantity_NOC_GRAY40.
-    void SetSubIntensityColor (const Quantity_NameOfColor aCol);
-  
+  void SetSubIntensityColor (const Quantity_Color& theColor)
+  {
+    myStyles[Prs3d_TypeOfHighlight_SubIntensity]->SetColor (theColor);
+  }
 
   //! Sets the display mode of seen Interactive Objects.
   //! aMode provides the display mode index of the entity aniobj.
@@ -664,7 +741,8 @@ public:
   //! object is displayed but no viewer will be updated.
   //! Note that display mode 3 is only used if you have an
   //! AIS_Textured Shape.
-  Standard_EXPORT void SetDisplayMode (const AIS_DisplayMode AMode, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetDisplayMode (const Standard_Integer theMode,
+                                       const Standard_Boolean theToUpdateViewer);
   
 
   //! Sets the deviation coefficient aCoefficient.
@@ -685,27 +763,39 @@ public:
   //! for a relative deviation. This deviation will be:
   //! SizeOfObject * DeviationCoefficient.
   //! default 0.001
-  Standard_EXPORT void SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aCoefficient, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
+                                                const Standard_Real                  theCoefficient,
+                                                const Standard_Boolean               theToUpdateViewer);
   
-  Standard_EXPORT void SetDeviationAngle (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
+                                          const Standard_Real                  theAngle,
+                                          const Standard_Boolean               theToUpdateViewer);
   
   //! Calls the AIS_Shape SetAngleAndDeviation to set
   //! both Angle and Deviation coefficients
-  Standard_EXPORT void SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
+                                             const Standard_Real                  theAngle,
+                                             const Standard_Boolean               theToUpdateViewer);
   
 
   //! Sets the deviation coefficient aCoefficient for
   //! removal of hidden lines created by different
   //! viewpoints in different presentations. The Default value is 0.02.
-  Standard_EXPORT void SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aCoefficient, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& theIObj,
+                                                   const Standard_Real                  theCoefficient,
+                                                   const Standard_Boolean               theToUpdateViewer);
   
-  Standard_EXPORT void SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& theIObj,
+                                             const Standard_Real                  theAngle,
+                                             const Standard_Boolean               theToUpdateViewer);
   
   //! Computes a HLRAngle and a
   //! HLRDeviationCoefficient by means of the angle
   //! anAngle and sets the corresponding methods in the
   //! default drawing tool with these values.
-  Standard_EXPORT void SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& theIObj,
+                                                const Standard_Real                  theAngle,
+                                                const Standard_Boolean               theToUpdateViewer);
   
   //! Sets the deviation coefficient aCoefficient.
   //! Drawings of curves or patches are made with respect
@@ -746,7 +836,7 @@ public:
   //! SizeOfObject * DeviationCoefficient.
   Standard_EXPORT Standard_Real DeviationCoefficient() const;
   
-  //! default 6degrees
+  //! default 12 degrees
   Standard_EXPORT void SetDeviationAngle (const Standard_Real anAngle);
   
   Standard_EXPORT Standard_Real DeviationAngle() const;
@@ -826,21 +916,36 @@ public:
   //! Returns True if drawing isoparameters on planes is enabled.
   //! if <forUIsos> = False,
   Standard_EXPORT Standard_Boolean IsoOnPlane() const;
-  
+
+  //! Enables or disables on-triangulation build for isolines for a particular object.
+  //! In case if on-triangulation builder is disabled, default on-plane
+  //! builder will compute isolines for the object given.
+  Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theIsEnabled,
+                                           const Handle(AIS_InteractiveObject)& theObject);
+
+  //! Enables or disables on-triangulation build for isolines for default drawer.
+  //! In case if on-triangulation builder is disabled, default on-plane
+  //! builder will compute isolines for the object given.
+  Standard_EXPORT void IsoOnTriangulation (const Standard_Boolean theToSwitchOn);
+
+  //! Returns true if drawing isolines on triangulation algorithm is enabled.
+  Standard_EXPORT Standard_Boolean IsoOnTriangulation() const;
+
   //! Sets the graphic basic aspect to the current presentation of
   //! ALL selected objects.
-  //! When <globalChange> is TRUE , the full object presentation
-  //! is changed.
-  //! When <globalChange> is FALSE , only the current group
-  //! of the object presentation is changed.
+  //! Flag globalChange has no effect (left to simplify porting).
   //! Updates the viewer when <updateViewer> is TRUE
-  Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& anAspect, const Standard_Boolean globalChange = Standard_True, const Standard_Boolean updateViewer = Standard_True);
+  Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& theAspect,
+                                          const Standard_Boolean           theToUpdateViewer);
   
   //! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors.
   //! This is done by the view theView passing this position to the main viewer and updating it.
   //! Functions in both Neutral Point and local contexts.
   //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object.
-  Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer theXPix, const Standard_Integer theYPix, const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawOnUpdate = Standard_True);
+  Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer  theXPix,
+                                                const Standard_Integer  theYPix,
+                                                const Handle(V3d_View)& theView,
+                                                const Standard_Boolean  theToRedrawOnUpdate);
   
   //! returns True  if other entities  were detected  in the
   //! last mouse detection
@@ -861,43 +966,65 @@ public:
   //! Same as previous methods in reverse direction...
   Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True);
   
+  //! Adds object in the selection.
+  Standard_EXPORT AIS_StatusOfPick AddSelect (const Handle(SelectMgr_EntityOwner)& theObject);
+
+  //! Adds object in the selection.
+  AIS_StatusOfPick AddSelect (const Handle(AIS_InteractiveObject)& theObject)
+  {
+    return AddSelect (theObject->GlobalSelOwner());
+  }
+
   //! Selects everything found in the bounding rectangle
   //! defined by the pixel minima and maxima, XPMin,
   //! YPMin, XPMax, and YPMax in the view, aView
   //! The objects detected are passed to the main viewer,
   //! which is then updated.
-  Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer XPMin, const Standard_Integer YPMin, const Standard_Integer XPMax, const Standard_Integer YPMax, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer  theXPMin,
+                                           const Standard_Integer  theYPMin,
+                                           const Standard_Integer  theXPMax,
+                                           const Standard_Integer  theYPMax,
+                                           const Handle(V3d_View)& theView,
+                                           const Standard_Boolean  theToUpdateViewer);
   
   //! polyline selection; clears the previous picked list
-  Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& thePolyline,
+                                           const Handle(V3d_View)&     theView,
+                                           const Standard_Boolean      theToUpdateViewer);
   
   //! Stores  and hilights the previous detected; Unhilights
   //! the previous picked.
-  Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean theToUpdateViewer);
   
   //! adds the last detected to the list of previous picked.
   //! if the last detected was already declared as picked,
   //! removes it from the Picked List.
-  Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean theToUpdateViewer);
   
   //! adds the last detected to the list of previous picked.
   //! if the last detected was already declared as picked,
   //! removes it from the Picked List.
-  Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& thePolyline,
+                                                const Handle(V3d_View)&     theView,
+                                                const Standard_Boolean      theToUpdateViewer);
   
   //! rectangle  of selection  ; adds new detected entities into the
   //! picked list, removes the detected entities that were already stored...
-  Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Integer XPMin, const Standard_Integer YPMin, const Standard_Integer XPMax, const Standard_Integer YPMax, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Integer  theXPMin,
+                                                const Standard_Integer  theYPMin,
+                                                const Standard_Integer  theXPMax,
+                                                const Standard_Integer  theYPMax,
+                                                const Handle(V3d_View)& theView,
+                                                const Standard_Boolean  theToUpdateViewer);
   
   //! Specify whether selected object must be hilighted when mouse cursor
   //! is moved above it (in MoveTo method). By default this value is false and
   //! selected object is not hilighted in this case.
-    void SetToHilightSelected (const Standard_Boolean toHilight);
-  
+  void SetToHilightSelected (const Standard_Boolean toHilight) { myToHilightSelected = toHilight; }
+
   //! Return value specified whether selected object must be hilighted
   //! when mouse cursor is moved above it
-    Standard_Boolean ToHilightSelected() const;
-
+  Standard_Boolean ToHilightSelected() const { return myToHilightSelected; }
 
   //! @name OBSOLETE METHODS THAT ARE VALID FOR LOCAL CONTEXT ONLY
 
@@ -909,36 +1036,31 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
+  Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& theIObj,
+                                         const Standard_Boolean               theToUpdateViewer);
   
 
   //! Allows to add or remove the object given to the list of current and highlight/unhighlight it
   //! correspondingly. Is valid for global context only; for local context use method AddOrRemoveSelected.
   //! Since this method makes sence only for neutral point selection of a whole object, if 0 selection
   //! of the object is empty this method simply does nothing.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& theObj,
-                                                 const Standard_Boolean theIsToUpdateViewer = Standard_True);
+                                                 const Standard_Boolean               theIsToUpdateViewer);
   
   //! Updates the list of current objects, i.e. hilights new
   //! current objects, removes hilighting from former current objects.
   //! Objects selected when there is no open local context
   //! are called current objects; those selected in open
   //! local context, selected objects.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT void UpdateCurrent();
-  
-
-  //! Returns the current selection touched by the cursor.
-  //! Objects selected when there is no open local context
-  //! are called current objects; those selected in open
-  //! local context, selected objects.
-    Standard_Boolean WasCurrentTouched() const;
-  
-    void SetOkCurrent();
-  
 
   //! Returns true if there is a non-null interactive object in Neutral Point.
   //! Objects selected when there is no open local context are called current objects;
   //! those selected in open local context, selected objects.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& theObject) const;
   
 
@@ -947,6 +1069,7 @@ public:
   //! Objects selected when there is no open local context
   //! are called current objects; those selected in open
   //! local context, selected objects.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT void InitCurrent();
   
 
@@ -955,6 +1078,7 @@ public:
   //! Objects selected when there is no open local context
   //! are called current objects; those selected in open
   //! local context, selected objects.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Standard_Boolean MoreCurrent() const;
   
 
@@ -963,6 +1087,7 @@ public:
   //! Objects selected when there is no open local context
   //! are called current objects; those selected in open
   //! local context, selected objects.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT void NextCurrent();
   
 
@@ -970,8 +1095,10 @@ public:
   //! Objects selected when there is no open local context
   //! are called current objects; those selected in open
   //! local context, selected objects.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Handle(AIS_InteractiveObject) Current() const;
-  
+
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Standard_Integer NbCurrents();
 
   //! Highlights current objects.
@@ -982,7 +1109,8 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
+  Standard_EXPORT void HilightCurrents (const Standard_Boolean theToUpdateViewer);
 
   //! Removes highlighting from current objects.
   //! Objects selected when there is no open local context
@@ -992,7 +1120,8 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void UnhilightCurrents (const Standard_Boolean updateviewer = Standard_True);
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
+  Standard_EXPORT void UnhilightCurrents (const Standard_Boolean theToUpdateViewer);
 
   //! Empties previous current objects in order to get the
   //! current objects detected by the selector using
@@ -1004,22 +1133,25 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer = Standard_True);
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
+  Standard_EXPORT void ClearCurrents (const Standard_Boolean theToUpdateViewer);
 
   //! @return current mouse-detected shape or empty (null) shape, if current interactive object
   //! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const;
   
-  //! @return current mouse-detected interactive object or null object, if there is no
-  //! currently detected interactives
+  //! @return current mouse-detected interactive object or null object, if there is no currently detected interactives
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const;
 
   //! @name COMMON SELECTION METHODS VALID FOR BOTH GLOBAL AND LOCAL CONTEXT
 
   //! Unhighlights previously selected owners and marks them as not selected.
   //! Marks owner given as selected and highlights it.
+  //! Performs selection filters check.
   Standard_EXPORT void SetSelected (const Handle(SelectMgr_EntityOwner)& theOwners,
-                                    const Standard_Boolean theToUpdateViewer = Standard_True);
+                                    const Standard_Boolean               theToUpdateViewer);
 
   //! Puts the interactive object aniObj in the list of
   //! selected objects.
@@ -1027,30 +1159,31 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
+  //! Performs selection filters check.
   Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& theObject,
-                                    const Standard_Boolean theToUpdateViewer = Standard_True);
+                                    const Standard_Boolean               theToUpdateViewer);
 
   //! Updates the list of selected objects:
   //! i.e. highlights the newely selected ones and unhighlights previously selected objects.
-  Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
+  Standard_EXPORT void UpdateSelected (const Standard_Boolean theToUpdateViewer);
   
   //! Allows to highlight or unhighlight the owner given depending on its selection status
   Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& theObject,
-                                            const Standard_Boolean theToUpdateViewer = Standard_True);
+                                            const Standard_Boolean               theToUpdateViewer);
 
   //! Highlights selected objects.
   //! If a local context is open and if updateviewer equals
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
+  Standard_EXPORT void HilightSelected (const Standard_Boolean theToUpdateViewer);
 
   //! Removes highlighting from selected objects.
   //! If a local context is open and if updateviewer equals
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
+  Standard_EXPORT void UnhilightSelected (const Standard_Boolean theToUpdateViewer);
 
   //! Empties previous selected objects in order to get the
   //! selected objects detected by the selector using
@@ -1059,16 +1192,18 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer = Standard_True);
+  Standard_EXPORT void ClearSelected (const Standard_Boolean theToUpdateViewer);
   
   //! No right to Add a selected Shape (Internal Management
   //! of shape Selection).
   //! A Previous selected shape may only be removed.
-  Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& aShape, const Standard_Boolean updateviewer = Standard_True);
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
+  Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape&    theShape,
+                                            const Standard_Boolean theToUpdateViewer);
 
   //! Allows to highlight or unhighlight the owner given depending on its selection status
   Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
-                                            const Standard_Boolean theToUpdateViewer = Standard_True);
+                                            const Standard_Boolean               theToUpdateViewer);
 
   //! Returns true is the owner given is selected
   Standard_EXPORT Standard_Boolean IsSelected (const Handle(SelectMgr_EntityOwner)& theOwner) const;
@@ -1209,6 +1344,7 @@ public:
   //! selections which will disappear once the local context is closed.
   //! You can open several local contexts, but only the last
   //! one will be active.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Standard_Integer OpenLocalContext (const Standard_Boolean UseDisplayedObjects = Standard_True, const Standard_Boolean AllowShapeDecomposition = Standard_True, const Standard_Boolean AcceptEraseOfObjects = Standard_False, const Standard_Boolean BothViewers = Standard_False);
   
   //! Allows you to close local contexts. For greater
@@ -1226,9 +1362,12 @@ public:
   //! is closed. This option can be dangerous, as other
   //! Interactive Functions can open local contexts
   //! without necessarily warning the user.
-  Standard_EXPORT void CloseLocalContext (const Standard_Integer Index = -1, const Standard_Boolean updateviewer = Standard_True);
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
+  Standard_EXPORT void CloseLocalContext (const Standard_Integer theIndex = -1,
+                                          const Standard_Boolean theToUpdateViewer = Standard_True);
   
   //! returns -1 if no opened local context.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Standard_Integer IndexOfCurrentLocal() const;
   
 
@@ -1238,22 +1377,25 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void CloseAllContexts (const Standard_Boolean updateviewer = Standard_True);
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
+  Standard_EXPORT void CloseAllContexts (const Standard_Boolean theToUpdateViewer);
   
   //! to   be  used only with no  opened
   //! local context..  displays and activates objects in their
   //! original state before local contexts were opened...
-  Standard_EXPORT void ResetOriginalState (const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void ResetOriginalState (const Standard_Boolean theToUpdateViewer);
   
-  //! clears Objects/Filters/Activated Modes list in the current opened
-  //! local context.
+  //! clears Objects/Filters/Activated Modes list in the current opened local context.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT void ClearLocalContext (const AIS_ClearMode TheMode = AIS_CM_All);
-  
+
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT void UseDisplayedObjects();
   
   //! when a local Context is opened, one is able to
   //! use/not use the displayed objects at neutral point
   //! at anytime.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT void NotUseDisplayedObjects();
   
   //! initializes the list of presentations to be displayed
@@ -1284,18 +1426,14 @@ public:
   //! Returns true if the automatic highlight mode is active
   //! in an open context.
   Standard_EXPORT Standard_Boolean AutomaticHilight() const;
-  
-  //! Enables/Disables the Z detection.
-  //! If TRUE the detection echo can be partially hidden by the
-  //! detected object.
-  Standard_EXPORT void SetZDetection (const Standard_Boolean aStatus = Standard_False);
-  
-  //! Retrieves the Z detection state.
-  Standard_EXPORT Standard_Boolean ZDetection() const;
-  
+
   //! Activates the selection mode aMode whose index is
   //! given, for the given interactive entity anIobj.
   Standard_EXPORT void Activate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode = 0, const Standard_Boolean theIsForce = Standard_False);
+
+  //! Activates the given selection mode for the all displayed objects.
+  Standard_EXPORT void Activate (const Standard_Integer theMode,
+                                 const Standard_Boolean theIsForce = Standard_False);
   
   //! Deactivates all the activated selection modes
   //! of an object.
@@ -1305,7 +1443,12 @@ public:
   //! Deactivates all the activated selection modes of the
   //! interactive object anIobj with a given selection mode aMode.
   Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode);
-  
+
+  //! Deactivates the given selection mode for all displayed objects.
+  Standard_EXPORT void Deactivate (const Standard_Integer theMode);
+
+  //! Deactivates all the activated selection mode at all displayed objects.
+  Standard_EXPORT void Deactivate();
 
   //! Returns the list of activated selection modes in an open context.
   Standard_EXPORT void ActivatedModes (const Handle(AIS_InteractiveObject)& anIobj, TColStd_ListOfInteger& theList) const;
@@ -1316,6 +1459,7 @@ public:
   //! shape selection modes activation.
   //! = False, <anIobj> will not be senstive
   //! any more.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT void SetShapeDecomposition (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean aStatus);
   
 
@@ -1326,7 +1470,10 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void SetTemporaryAttributes (const Handle(AIS_InteractiveObject)& anObj, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Boolean updateviewer = Standard_True);
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
+  Standard_EXPORT void SetTemporaryAttributes (const Handle(AIS_InteractiveObject)& theIObj,
+                                               const Handle(Prs3d_Drawer)&          theDrawer,
+                                               const Standard_Boolean               theToUpdateViewer);
   
 
   //! Highlights, and removes highlights from, the displayed
@@ -1337,7 +1484,8 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& theIObj,
+                                       const Standard_Boolean               theToUpdateViewer);
   
 
   //! Removes the subintensity option for the entity aniobj.
@@ -1345,16 +1493,17 @@ public:
   //! Standard_False, the presentation of the Interactive
   //! Object activates the selection mode; the object is
   //! displayed but no viewer will be updated.
-  Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& theIObj,
+                                        const Standard_Boolean               theToUpdateViewer);
   
   //! hilights/unhilights displayed objects which are displayed at
   //! neutral state with subintensity color;
   //! available only for active local context.
   //! No effect if no local context.
-  Standard_EXPORT void SubIntensityOn (const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SubIntensityOn (const Standard_Boolean theToUpdateViewer);
   
   //! removes subintensity option for all objects.
-  Standard_EXPORT void SubIntensityOff (const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void SubIntensityOff (const Standard_Boolean theToUpdateViewer);
   
   //! Allows you to add the filter aFilter to Neutral Point or
   //! to a local context if one or more selection modes have been activated.
@@ -1388,6 +1537,7 @@ public:
   //! objects of the "Shape" type are also activated with
   //! the same modes. You can act on the state of these
   //! "Standard" objects by using SetShapeDecomposition(Status).
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
   
 
@@ -1396,27 +1546,28 @@ public:
   //! effect of deactivating the corresponding selection
   //! mode aStandardActivation for all objects in Local
   //! Context which accept decomposition into sub-shapes.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aStandardActivation);
   
 
   //! Returns the list of activated standard selection modes
   //! available in a local context.
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT const TColStd_ListOfInteger& ActivatedStandardModes() const;
   
 
   //! Returns the list of filters active in a local context.
   Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const;
-  
 
   //! Returns the default attribute manager.
   //! This contains all the color and line attributes which
   //! can be used by interactive objects which do not have
   //! their own attributes.
-    const Handle(Prs3d_Drawer)& DefaultDrawer() const;
-  
+  const Handle(Prs3d_Drawer)& DefaultDrawer() const { return myDefaultDrawer; }
+
   //! Returns the current viewer.
-    const Handle(V3d_Viewer)& CurrentViewer() const;
-  
+  const Handle(V3d_Viewer)& CurrentViewer() const { return myMainVwr; }
+
   //! Returns the list of displayed objects of a particular
   //! Type WhichKind and Signature WhichSignature. By
   //! Default, WhichSignature equals -1. This means that
@@ -1464,40 +1615,23 @@ public:
   Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO, const AIS_KindOfInteractive WhichKind = AIS_KOI_None, const Standard_Integer WhichSignature = -1) const;
   
   //! Returns true if there is an open context.
-    Standard_Boolean HasOpenedContext() const;
-  
-
-  //! Returns the name of the current selected entity in Neutral Point.
-  //! Objects selected when there is no open local context
-  //! are called current objects; those selected in open
-  //! local context, selected objects.
-    const TCollection_AsciiString& CurrentName() const;
-  
-
-  //! Returns the name of the current selected entity in
-  //! open local context.
-  //! Objects selected when there is no open local context
-  //! are called current objects; those selected in open
-  //! local context, selected objects.
-  Standard_EXPORT const TCollection_AsciiString& SelectionName() const;
-  
-  //! Returns the domain name of the main viewer.
-  Standard_EXPORT Standard_CString DomainOfMainViewer() const;
-  
+  Standard_Boolean HasOpenedContext() const { return myCurLocalIndex != 0; }
 
   //! This method is only intended for advanced operation, particularly with
   //! the aim to improve performance when many objects have to be selected
   //! together. Otherwise, you should use other (non-internal) methods of
   //! class AIS_InteractiveContext without trying to obtain an instance of
   //! AIS_LocalContext.
-    Handle(AIS_LocalContext) LocalContext() const;
-  
-    const Handle(SelectMgr_SelectionManager)& SelectionManager() const;
-  
-    const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const;
-  
-    const Handle(StdSelect_ViewerSelector3d)& MainSelector() const;
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
+  Handle(AIS_LocalContext) LocalContext() const { return myCurLocalIndex > 0 ? myLocalContexts (myCurLocalIndex) : Handle(AIS_LocalContext)(); }
+
+  const Handle(SelectMgr_SelectionManager)& SelectionManager() const { return mgrSelector; }
   
+  const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const { return myMainPM; }
+
+  const Handle(StdSelect_ViewerSelector3d)& MainSelector() const { return myMainSel; }
+
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Handle(StdSelect_ViewerSelector3d) LocalSelector() const;
   
   //! Clears all the structures which don't
@@ -1506,6 +1640,7 @@ public:
   //! returns the number of removed  structures from the viewers.
   Standard_EXPORT Standard_Integer PurgeDisplay();
   
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Standard_Integer HighestIndex() const;
   
   Standard_EXPORT void DisplayActiveSensitive (const Handle(V3d_View)& aView);
@@ -1515,12 +1650,19 @@ public:
   //! Fits the view correspondingly to the bounds of selected objects.
   //! Infinite objects are ignored if infinite state of AIS_InteractiveObject
   //! is set to true.
-  Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView, const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True);
+  Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView,
+                                    const Standard_Real     theMargin,
+                                    const Standard_Boolean  theToUpdate);
+
+  //! Fits the view correspondingly to the bounds of selected objects.
+  //! Infinite objects are ignored if infinite state of AIS_InteractiveObject is set to true.
+  Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView);
   
   Standard_EXPORT void DisplayActiveSensitive (const Handle(AIS_InteractiveObject)& anObject, const Handle(V3d_View)& aView);
   
   //! returns if possible,
   //! the first local context where the object is seen
+  Standard_DEPRECATED ("Local Context is deprecated - local selection should be used without Local Context")
   Standard_EXPORT Standard_Boolean IsInLocal (const Handle(AIS_InteractiveObject)& anObject, Standard_Integer& TheIndex) const;
   
   //! Rebuilds 1st level of BVH selection forcibly
@@ -1539,93 +1681,196 @@ public:
   //! Redraws immediate structures in all views of the viewer given taking into account its visibility.
   Standard_EXPORT void RedrawImmediate (const Handle(V3d_Viewer)& theViewer);
 
-
-friend class AIS_LocalContext;
-
-
-  DEFINE_STANDARD_RTTI(AIS_InteractiveContext,MMgt_TShared)
-
 protected:
 
-
-
-
-private:
-
-  
   Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const;
   
-  Standard_EXPORT void EraseGlobal (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void EraseGlobal (const Handle(AIS_InteractiveObject)& theIObj,
+                                    const Standard_Boolean               theToUpdateViewer);
   
-  Standard_EXPORT void ClearGlobal (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void ClearGlobal (const Handle(AIS_InteractiveObject)& theIObj,
+                                    const Standard_Boolean               theToUpdateViewer);
   
-  Standard_EXPORT void ClearGlobalPrs (const Handle(AIS_InteractiveObject)& anObj, const Standard_Integer aMode, const Standard_Boolean updateviewer = Standard_True);
+  Standard_EXPORT void ClearGlobalPrs (const Handle(AIS_InteractiveObject)& theObj,
+                                       const Standard_Integer               theMode,
+                                       const Standard_Boolean               theToUpdateViewer);
   
   Standard_EXPORT void InitAttributes();
   
   Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr);
   
   //! UNKNOWN
-  Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True);
+  Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj,
+                                          const Standard_Boolean               theToUpdateViewer);
   
   //! UNKNOWN
-  Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True);
+  Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj,
+                                             const Standard_Boolean               theToUpdateViewer);
 
   //! Helper function to unhighlight all entity owners currently highlighted with seleciton color.
-  void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
+  Standard_EXPORT void unhighlightOwners (const Handle(AIS_InteractiveObject)& theObject);
 
-  //! Helper function that highlights the owner given with <theColor> without
+  //! Helper function that highlights the owner given with <theStyle> without
   //! performing AutoHighlight checks, e.g. is used for dynamic highlight.
-  //! If the parameter <theViewer> is set and <theIsImmediate> is true, highlight will be synchronized
-  //! automatically in all views of the viewer.
-  void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
-                           const Quantity_NameOfColor theColor,
-                           const Handle(V3d_Viewer)& theViewer = NULL);
+  Standard_EXPORT void highlightWithColor (const Handle(SelectMgr_EntityOwner)& theOwner,
+                                           const Handle(V3d_Viewer)& theViewer = NULL);
+
+  //! Helper function that highlights the owner given with <theStyle> with check
+  //! for AutoHighlight, e.g. is used for selection.
+  Standard_EXPORT void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner);
 
-  //! Helper function that highlights the owner given with <theColor> with check
+  //! Helper function that highlights global owner of the object given with <theStyle> with check
   //! for AutoHighlight, e.g. is used for selection.
-  //! If the parameter <theViewer> is set and <theIsImmediate> is true, selection color will be synchronized
-  //! automatically in all views of the viewer.
-  void highlightSelected (const Handle(SelectMgr_EntityOwner)& theOwner,
-                          const Quantity_NameOfColor theSelColor);
+  //! If global owner is null, it simply highlights the whole object
+  Standard_EXPORT void highlightGlobal (const Handle(AIS_InteractiveObject)& theObj,
+                                        const Handle(Prs3d_Drawer)& theStyle,
+                                        const Standard_Integer theDispMode) const;
+
+  //! Helper function that unhighlights all owners that are stored in current AIS_Selection.
+  //! The function updates global status and selection state of owner and interactive object.
+  //! If the parameter <theIsToHilightSubIntensity> is set to true, interactive objects with sub-intensity
+  //! switched on in AIS_GlobalStatus will be highlighted with context's sub-intensity color.
+  Standard_EXPORT void unhighlightSelected (const Standard_Boolean theIsToHilightSubIntensity = Standard_False);
+
+  //! Helper function that unhighlights global selection owner of given interactive.
+  //! The function does not perform any updates of global or owner status
+  Standard_EXPORT void unhighlightGlobal (const Handle(AIS_InteractiveObject)& theObj) const;
+
+  //! Helper function that turns on sub-intensity in global status and highlights
+  //! given objects with sub-intensity color
+  //! @param theObject [in] the object. If NULL is given, than sub-intensity will be turned on for
+  //! all inveractive objects of the context
+  //! @param theDispMode [in] display mode. If -1 is given, sub-intensity will be turned on for
+  //! all display modes in global status's list of modes
+  //! @param theIsDisplayedOnly [in] is true if sub-intensity should be applied only to objects with
+  //! status AIS_DS_Displayed
+  Standard_EXPORT void turnOnSubintensity (const Handle(AIS_InteractiveObject)& theObject = NULL,
+                                           const Standard_Integer theDispMode = -1,
+                                           const Standard_Boolean theIsDisplayedOnly = Standard_True) const;
+
+  //! Helper function that highlights the object with sub-intensity color without any checks
+  //! @param theObject [in] the object that will be highlighted
+  //! @param theMode [in] display mode
+  Standard_EXPORT void highlightWithSubintensity (const Handle(AIS_InteractiveObject)& theObject,
+                                                  const Standard_Integer theMode) const;
+
+  //! Helper function that highlights the owner with sub-intensity color without any checks
+  //! @param theOwner [in] the owner that will be highlighted
+  //! @param theMode [in] display mode
+  Standard_EXPORT void highlightWithSubintensity (const Handle(SelectMgr_EntityOwner)& theOwner,
+                                                  const Standard_Integer theMode) const;
+
+  //! Helper function that returns correct dynamic highlight style for the object:
+  //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
+  //! dynamic highlight style of interactive context will be returned.
+  //! @param theObj [in] the object to check
+  const Handle(Prs3d_Drawer)& getHiStyle (const Handle(AIS_InteractiveObject)& theObj,
+                                          const Handle(SelectMgr_EntityOwner)& theOwner) const
+  {
+    const Handle(Prs3d_Drawer)& aHiDrawer = theObj->DynamicHilightAttributes();
+    if (!aHiDrawer.IsNull())
+    {
+      return aHiDrawer;
+    }
+
+    return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalDynamic : Prs3d_TypeOfHighlight_Dynamic];
+  }
+
+  //! Helper function that returns correct selection style for the object:
+  //! if custom style is defined via object's highlight drawer, it will be used. Otherwise,
+  //! selection style of interactive context will be returned.
+  //! @param theObj [in] the object to check
+  const Handle(Prs3d_Drawer)& getSelStyle (const Handle(AIS_InteractiveObject)& theObj,
+                                           const Handle(SelectMgr_EntityOwner)& theOwner) const
+  {
+    const Handle(Prs3d_Drawer)& aHiDrawer = theObj->HilightAttributes();
+    if (!aHiDrawer.IsNull())
+    {
+      return aHiDrawer;
+    }
+
+    return myStyles[!theOwner.IsNull() && theOwner->ComesFromDecomposition() ? Prs3d_TypeOfHighlight_LocalSelected : Prs3d_TypeOfHighlight_Selected];
+  }
+
+  //! Assign the context to the object or throw exception if object was already assigned to another context.
+  void setContextToObject (const Handle(AIS_InteractiveObject)& theObj)
+  {
+    if (theObj->HasInteractiveContext())
+    {
+      if (theObj->myCTXPtr != this)
+      {
+        throw Standard_ProgramError("AIS_InteractiveContext - object has been already displayed in another context!");
+      }
+    }
+    else
+    {
+      theObj->SetContext (this);
+    }
+  }
+
+  //! Return display mode for highlighting.
+  Standard_Integer getHilightMode (const Handle(AIS_InteractiveObject)& theObj,
+                                   const Handle(Prs3d_Drawer)& theStyle,
+                                   const Standard_Integer theDispMode) const
+  {
+    if (!theStyle.IsNull()
+     &&  theStyle->DisplayMode() != -1
+     &&  theObj->AcceptDisplayMode (theStyle->DisplayMode()))
+    {
+      return theStyle->DisplayMode();
+    }
+    else if (theDispMode != -1)
+    {
+      return theDispMode;
+    }
+    else if (theObj->HasDisplayMode())
+    {
+      return theObj->DisplayMode();
+    }
+    return myDefaultDrawer->DisplayMode();
+  }
+
+  //! Removes dynamic highlight draw
+  void clearDynamicHighlight() const
+  {
+    if (myLastinMain.IsNull())
+      return;
+
+    if (myLastinMain->IsAutoHilight())
+    {
+      myMainPM->ClearImmediateDraw();
+    }
+    else
+    {
+      myLastinMain->Selectable()->ClearDynamicHighlight (myMainPM);
+    }
+  }
+
+protected:
 
   AIS_DataMapOfIOStatus myObjects;
   Handle(SelectMgr_SelectionManager) mgrSelector;
   Handle(PrsMgr_PresentationManager3d) myMainPM;
   Handle(V3d_Viewer) myMainVwr;
   Handle(StdSelect_ViewerSelector3d) myMainSel;
-  TCollection_AsciiString mySelectionName;
-  TCollection_AsciiString myCurrentName;
   Handle(SelectMgr_EntityOwner) myLastPicked;
   Handle(SelectMgr_EntityOwner) myLastinMain;
   Standard_Boolean myWasLastMain;
-  Standard_Boolean myCurrentTouched;
-  Standard_Boolean mySelectedTouched;
   Standard_Boolean myToHilightSelected;
+  Handle(AIS_Selection) mySelection;
   Handle(SelectMgr_OrFilter) myFilters;
   Handle(Prs3d_Drawer) myDefaultDrawer;
-  Quantity_NameOfColor myDefaultColor;
-  Quantity_NameOfColor myHilightColor;
-  Quantity_NameOfColor mySelectionColor;
-  Quantity_NameOfColor myPreselectionColor;
-  Quantity_NameOfColor mySubIntensity;
-  Standard_Integer myDisplayMode;
+  Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
   AIS_DataMapOfILC myLocalContexts;
   Standard_Integer myCurLocalIndex;
-  Handle(V3d_View) mylastmoveview;
-  AIS_SequenceOfInteractive myAISDetectedSeq;
-  Standard_Integer myAISCurDetected;
-  Standard_Boolean myZDetectionFlag;
+  TColStd_SequenceOfInteger myDetectedSeq;
+  Standard_Integer myCurDetected;
+  Standard_Integer myCurHighlighted;
+  SelectMgr_PickingStrategy myPickingStrategy; //!< picking strategy to be applied within MoveTo()
   Standard_Boolean myIsAutoActivateSelMode;
 
-
 };
 
-
-#include <AIS_InteractiveContext.lxx>
-
-
-
-
+DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, Standard_Transient)
 
 #endif // _AIS_InteractiveContext_HeaderFile