0028888: Visualization - AIS_InteractiveContext should not hold V3d_View handle which...
[occt.git] / src / AIS / AIS_InteractiveContext.hxx
index ca775d8..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_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 <AIS_Selection.hxx>
-#include <Prs3d_TypeOfHighlight.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,12 +51,10 @@ 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 SelectMgr_EntityOwner;
-class Standard_Transient;
 class SelectMgr_Filter;
 class TCollection_AsciiString;
 
@@ -144,6 +137,26 @@ public:
   
   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.
@@ -425,11 +438,6 @@ 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)& theIObj,
-                                 const Quantity_NameOfColor           theColor,
-                                 const Standard_Boolean               theToUpdateViewer);
-  
 
   //! Sets the color of the selected entity.
   //! If a local context is open and if updateviewer equals
@@ -470,14 +478,12 @@ public:
 
   //! 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)& theIObj,
-                                    const Graphic3d_NameOfMaterial       theName,
+                                    const Graphic3d_MaterialAspect&      theMaterial,
                                     const Standard_Boolean               theToUpdateViewer);
   
 
@@ -634,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;
@@ -1860,10 +1863,10 @@ protected:
   Handle(Prs3d_Drawer) myStyles[Prs3d_TypeOfHighlight_NB];
   AIS_DataMapOfILC myLocalContexts;
   Standard_Integer myCurLocalIndex;
-  Handle(V3d_View) mylastmoveview;
   TColStd_SequenceOfInteger myDetectedSeq;
   Standard_Integer myCurDetected;
   Standard_Integer myCurHighlighted;
+  SelectMgr_PickingStrategy myPickingStrategy; //!< picking strategy to be applied within MoveTo()
   Standard_Boolean myIsAutoActivateSelMode;
 
 };