0028987: Visualization, SelectMgr_SelectableObject - move out iterator from object
[occt.git] / src / SelectMgr / SelectMgr_SelectionManager.hxx
index e3e4854..8c9ed22 100644 (file)
 #ifndef _SelectMgr_SelectionManager_HeaderFile
 #define _SelectMgr_SelectionManager_HeaderFile
 
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TColStd_MapOfTransient.hxx>
 #include <SelectMgr_DataMapOfObjectSelectors.hxx>
-#include <Standard_Transient.hxx>
 #include <SelectMgr_ViewerSelector.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Integer.hxx>
 #include <SelectMgr_TypeOfUpdate.hxx>
-class SelectMgr_SelectableObject;
-
+#include <TColStd_MapOfTransient.hxx>
 
-class SelectMgr_SelectionManager;
-DEFINE_STANDARD_HANDLE(SelectMgr_SelectionManager, Standard_Transient)
+class SelectMgr_SelectableObject;
 
-//! A framework to manage selection from the point of
-//! view of viewer selectors. These can be added and
-//! removed, and selection modes can be activated and
-//! deactivated. In addition, objects may be known to all
-//! selectors or only to some.
+//! A framework to manage selection from the point of view of viewer selectors.
+//! These can be added and removed, and selection modes can be activated and deactivated.
+//! In addition, objects may be known to all selectors or only to some.
 class SelectMgr_SelectionManager : public Standard_Transient
 {
-
+  DEFINE_STANDARD_RTTIEXT(SelectMgr_SelectionManager, Standard_Transient)
 public:
 
-  
   //! Constructs an empty selection manager object.
   Standard_EXPORT SelectMgr_SelectionManager();
   
@@ -65,7 +53,7 @@ public:
   Standard_EXPORT void Load (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode = -1);
   
   //! Loads and computes selection mode theMode (if it is not equal to -1) and adds selectable object to BVH tree.
-  //! Does not perform check of existance of theObject in global context before addition, but adds theSelector to local context.
+  //! Does not perform check of existence of theObject in global context before addition, but adds theSelector to local context.
   Standard_EXPORT void Load (const Handle(SelectMgr_SelectableObject)& theObject, const Handle(SelectMgr_ViewerSelector)& theSelector, const Standard_Integer theMode = -1);
   
   //! Removes selectable object theObject from all viewer selectors it was added to previously, removes it from all contexts
@@ -78,26 +66,36 @@ public:
   //! Activates the selection mode theMode in the selector theSelector for the selectable object anObject.
   //! By default, theMode is equal to 0. If theSelector is set to default (NULL), the selection with the mode theMode
   //! will be activated in all the viewers available.
-  Standard_EXPORT void Activate (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode = 0, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL);
+  Standard_EXPORT void Activate (const Handle(SelectMgr_SelectableObject)& theObject,
+                                 const Standard_Integer theMode = 0,
+                                 const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
   
   //! Deactivates mode theMode of theObject in theSelector. If theMode value is set to default (-1), all
-  //! avtive selection modes will be deactivated. Likewise, if theSelector value is set to default (NULL), theMode
+  //! active selection modes will be deactivated. Likewise, if theSelector value is set to default (NULL), theMode
   //! will be deactivated in all viewer selectors.
-  Standard_EXPORT void Deactivate (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode = -1, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL);
+  Standard_EXPORT void Deactivate (const Handle(SelectMgr_SelectableObject)& theObject,
+                                   const Standard_Integer theMode = -1,
+                                   const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
   
   //! Returns true if the selection with theMode is active for the selectable object theObject and selector theSelector.
   //! If all parameters are set to default values, it returns it there is any active selection in any known viewer selector for
   //! object theObject.
-  Standard_EXPORT Standard_Boolean IsActivated (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode = -1, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL) const;
+  Standard_EXPORT Standard_Boolean IsActivated (const Handle(SelectMgr_SelectableObject)& theObject,
+                                                const Standard_Integer theMode = -1,
+                                                const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)()) const;
   
   //! Removes sensitive entities from all viewer selectors
   //! after method Clear() was called to the selection they belonged to
   //! or it was recomputed somehow.
-  Standard_EXPORT void ClearSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj, const Standard_Integer theMode = -1, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL);
+  Standard_EXPORT void ClearSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj,
+                                                 const Standard_Integer theMode = -1,
+                                                 const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
   
-  //! Re-adds newely calculated sensitive  entities of recomputed selection
+  //! Re-adds newly calculated sensitive  entities of recomputed selection
   //! defined by mode theMode to all viewer selectors contained that selection.
-  Standard_EXPORT void RestoreSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj, const Standard_Integer theMode = -1, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL);
+  Standard_EXPORT void RestoreSelectionStructures (const Handle(SelectMgr_SelectableObject)& theObj,
+                                                   const Standard_Integer theMode = -1,
+                                                   const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
   
   //! Recomputes activated selections of theObject for all known viewer selectors according to theMode specified.
   //! If theMode is set to default (-1), then all activated selections will be recomputed. If theIsForce is set to true,
@@ -128,8 +126,6 @@ public:
   //! Re-adds selectable object in BVHs in all viewer selectors.
   Standard_EXPORT void UpdateSelection (const Handle(SelectMgr_SelectableObject)& theObj);
 
-  DEFINE_STANDARD_RTTIEXT(SelectMgr_SelectionManager,Standard_Transient)
-
 protected:
 
   //! Recomputes given selection mode and updates BVHs in all viewer selectors
@@ -137,30 +133,27 @@ protected:
                                                const Handle(SelectMgr_Selection)& theSelection,
                                                const Standard_Integer theMode);
 
-
 private:
 
-  
   //! Loads and creates selection structures for object theObject with mode theMode in specified
   //! viewer selector theSelector. If theSelector is set to default value (NULL), the selection mode
   //! created will be added to all known viewer selectors.
-  Standard_EXPORT void loadMode (const Handle(SelectMgr_SelectableObject)& theObject, const Standard_Integer theMode, const Handle(SelectMgr_ViewerSelector)& theSelector = NULL);
+  Standard_EXPORT void loadMode (const Handle(SelectMgr_SelectableObject)& theObject,
+                                 const Standard_Integer theMode,
+                                 const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
   
   //! Internal function that marks 1st level BVH of the object theObj as
   //! outdated.
-  Standard_EXPORT void rebuildSelectionStructures (const Handle(SelectMgr_ViewerSelector)& theSelector = NULL);
+  Standard_EXPORT void rebuildSelectionStructures (const Handle(SelectMgr_ViewerSelector)& theSelector = Handle(SelectMgr_ViewerSelector)());
 
-  TColStd_MapOfTransient mySelectors;
-  TColStd_MapOfTransient myGlobal;
-  SelectMgr_DataMapOfObjectSelectors myLocal;
+private:
 
+  NCollection_Map<Handle(SelectMgr_ViewerSelector)>   mySelectors;
+  NCollection_Map<Handle(SelectMgr_SelectableObject)> myGlobal;
+  SelectMgr_DataMapOfObjectSelectors                  myLocal;
 
 };
 
-
-
-
-
-
+DEFINE_STANDARD_HANDLE(SelectMgr_SelectionManager, Standard_Transient)
 
 #endif // _SelectMgr_SelectionManager_HeaderFile