Salome HOME
Renaming Fill in Split : Help (General index)
[modules/shaper.git] / src / PartSet / PartSet_Module.h
old mode 100755 (executable)
new mode 100644 (file)
index cc9bd9e..1f23bc7
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef PartSet_Module_H
@@ -24,6 +23,7 @@
 #include "PartSet.h"
 #include "PartSet_Tools.h"
 #include "PartSet_OverconstraintListener.h"
+#include "XGUI_SelectionFilterType.h"
 #include "PartSet_SketcherMgr.h"
 
 #include <ModuleBase_IModule.h>
 //#include <StdSelect_FaceFilter.hxx>
 #include <TopoDS_Shape.hxx>
 #include <SelectMgr_ListOfFilter.hxx>
+#include <SelectMgr_Filter.hxx>
 
 #include <QMap>
 #include <QMenu>
 #include <QObject>
 #include <QModelIndex>
 
-#include <string>
-
+#include <map>
 #include <memory>
+#include <string>
 
 class ModuleBase_Operation;
 class ModuleBase_IViewWindow;
@@ -56,6 +57,7 @@ class PartSet_MenuMgr;
 class PartSet_CustomPrs;
 class PartSet_SketcherMgr;
 class PartSet_SketcherReentrantMgr;
+class PartSet_RootNode;
 class ModelAPI_Result;
 
 class QAction;
@@ -84,11 +86,6 @@ public:
   PartSet_Module(ModuleBase_IWorkshop* theWshop);
   virtual ~PartSet_Module();
 
-  // Add default selection filters of the module to the current viewer
-  virtual void activateSelectionFilters();
-  // Remove default selection filters of the module from the current viewer
-  virtual void deactivateSelectionFilters();
-
   // Stores the current selection
   virtual void storeSelection();
 
@@ -223,8 +220,30 @@ public:
   virtual void activeSelectionModes(QIntList& theModes);
 
   /// Appends specific selection modes for the module to the list of types
-  /// \param theTypes a selection modes to be extended
-  virtual void customSubShapesSelectionModes(QIntList& theTypes);
+  /// \param theModesType combination of available selection filters
+  /// \param theModes a selection modes to be extended
+  virtual void moduleSelectionModes(int theModesType, QIntList& theModes);
+
+  /// Appends into container of filters module filters corresponded to the modes type
+  /// \param theFilterTypes container of available selection filters
+  /// \param theSelectionFilters [out] container to be extend by elements
+  virtual void moduleSelectionFilters(const QIntList& theFilterTypes,
+                                      SelectMgr_ListOfFilter& theSelectionFilters);
+
+  /// Returns types of registered module selection filters
+  /// \param theSelectionFilters [out] container of type value
+  virtual QIntList selectionFilters();
+
+  /// Append selection filter into the module and type of the filter in internal container
+  /// \param theFilterType selection filter type
+  /// \param theFilter added filter
+  void registerSelectionFilter(const XGUI_SelectionFilterType theFilterType,
+                               const Handle(SelectMgr_Filter)& theFilter);
+
+  /// Returns selection filter
+  /// \param theType selection filter type
+  /// \param theFilter instance of filter
+  virtual Handle(SelectMgr_Filter) selectionFilter(const int theType);
 
   /// Returns whether the mouse enter the viewer's window
   /// \return true if items are added and there is no necessity to provide standard menu
@@ -331,9 +350,6 @@ public:
   /// \param theStdActions - a map of standard actions
   virtual void updateViewerMenu(const QMap<QString, QAction*>& theStdActions);
 
-  /// Updates the current operation state after undo/redo actions calling
-  virtual void updateOperationByUndoRedo();
-
   /// Returns true if the action should be always enabled
   /// \param theActionId an action index: Accept or Accept All
   /// \return boolean value
@@ -377,9 +393,15 @@ public:
   /// \param theMessage a message of reentrant operation
   virtual void setReentrantPreSelection(const std::shared_ptr<Events_Message>& theMessage);
 
+  /// Returns root tree node which represents a data model
+  virtual ModuleBase_ITreeNode* rootNode() const;
+
   /// Returns the workshop
   XGUI_Workshop* getWorkshop() const;
 
+  /// Reads description of features from XML file
+  virtual void createFeatures();
+
 public slots:
   /// Slolt called on object display
   /// \param theObject a data object
@@ -414,6 +436,10 @@ protected slots:
   void onChoiceChanged(ModuleBase_ModelWidget* theWidget, int theIndex);
 
 protected:
+  /// Appends specific selection modes for the module to the list of types
+  /// \param theModes a selection modes to be extended
+  virtual void customSubShapesSelectionModes(QIntList& theModes);
+
   /// Sets the constraints states in internal map. If the feature kind is a dimensional constraint
   /// other dimensions are shown.
   /// \param theFeatureKindId a feature kind
@@ -453,7 +479,7 @@ protected:
 
 private:
   bool myIsOperationIsLaunched; /// state of application between launch and stop operation
-  SelectMgr_ListOfFilter mySelectionFilters;
+  std::map<XGUI_SelectionFilterType, Handle(SelectMgr_Filter)> mySelectionFilters;
 
   PartSet_SketcherMgr* mySketchMgr;
   PartSet_SketcherReentrantMgr* mySketchReentrantMgr;
@@ -470,6 +496,8 @@ private:
   /// redisplay and restore it after
   PartSet_SketcherMgr::FeatureToSelectionMap myCurrentSelection;
   QModelIndex myActivePartIndex;
+
+  PartSet_RootNode* myRoot;
 };
 
 #endif