Salome HOME
Sketch shape in plane selection filter should not be activated while PartSet_WidgetSh...
authornds <nds@opencascade.com>
Thu, 14 Dec 2017 05:58:09 +0000 (08:58 +0300)
committernds <nds@opencascade.com>
Thu, 14 Dec 2017 05:58:09 +0000 (08:58 +0300)
31 files changed:
src/CollectionPlugin/CollectionPlugin_WidgetField.cpp
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_ModelWidget.cpp
src/ModuleBase/ModuleBase_ModelWidget.h
src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp
src/ModuleBase/ModuleBase_WidgetFeatureSelector.h
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/ModuleBase/ModuleBase_WidgetSelector.h
src/ModuleBase/ModuleBase_WidgetValidated.cpp
src/ModuleBase/ModuleBase_WidgetValidated.h
src/ModuleBase/ModuleBase_WidgetValidator.cpp
src/ModuleBase/ModuleBase_WidgetValidator.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h
src/PartSet/PartSet_SketcherReentrantMgr.cpp
src/PartSet/PartSet_WidgetFeaturePointSelector.cpp
src/PartSet/PartSet_WidgetFeaturePointSelector.h
src/PartSet/PartSet_WidgetPoint2d.cpp
src/PartSet/PartSet_WidgetPoint2d.h
src/PartSet/PartSet_WidgetShapeSelector.cpp
src/PartSet/PartSet_WidgetShapeSelector.h
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/PartSet/PartSet_WidgetSketchLabel.h
src/XGUI/XGUI_SelectionActivate.cpp
src/XGUI/XGUI_SelectionActivate.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

index e7e400d37c13971ad91b57aa62f35f78fc2ea9d5..94989abb5fceed86e54c720da0056f891834f7c6 100644 (file)
@@ -968,7 +968,7 @@ void CollectionPlugin_WidgetField::onTableEdited(int theRow, int theCol)
 //**********************************************************************************
 void CollectionPlugin_WidgetField::onShapeTypeChanged(int theType)
 {
-  activateSelectionAndFilters(theType == 5? false:true);
+  updateSelectionModesAndFilters(theType == 5? false:true);
 
   AttributeSelectionListPtr aSelList =
     myFeature->data()->selectionList(CollectionPlugin_Field::SELECTED_ID());
index 0a2b14991f580d6746f38df6a770ab01cdab56f1..66711b4c5707c0a73603986540cf930f9435cd4c 100755 (executable)
@@ -79,14 +79,6 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
 
   virtual ~ModuleBase_IModule() {}
 
-  /// Appends into container of workshop selection filters
-  /// \param [out] selection filters
-  virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters) const {}
-
-  /// Returns current selection modes that should be used in 3D viewer
-  /// \param theModes container of modes
-  virtual void selectionModes(QIntList& theModes) const {}
-
   /// Stores the current selection
   virtual void storeSelection() {}
 
@@ -239,8 +231,15 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   virtual void activeSelectionModes(QIntList& theModes) {}
 
   /// Appends specific selection modes for the module to the list of types
+  /// \param theModesType combination of available selection filters
   /// \param theModes a selection modes to be extended
-  virtual void customSubShapesSelectionModes(QIntList& theModes) {}
+  virtual void moduleSelectionModes(int theModesType, QIntList& theModes) = 0;
+
+  /// Appends into container of filters module filters corresponded to the modes type
+  /// \param theModesType combination of available selection filters
+  /// \param theSelectionFilters [out] container to be extend by elements
+  virtual void moduleSelectionFilters(int theModesType,
+                                      SelectMgr_ListOfFilter& theSelectionFilters) = 0;
 
   /// Return true if the custom presentation is activated
   /// \param theFlag a flag of level of customization, which means that only part of sub-elements
index 904d28ab1b932b96dfa51165f41d7d10e25c65e7..097f5175d31c949ea1e2ff15f800066dd53179be 100644 (file)
@@ -111,18 +111,20 @@ bool ModuleBase_ModelWidget::isInitialized(ObjectPtr theObject) const
 }
 
 //**************************************************************
-void ModuleBase_ModelWidget::selectionModes(QIntList& theModes, bool& isAdditional)
+void ModuleBase_ModelWidget::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
 {
-  isAdditional = true;
+  theModuleSelectionModes = -1;
   if (myWidgetValidator)
-    myWidgetValidator->selectionModes(theModes, isAdditional);
+    myWidgetValidator->selectionModes(theModuleSelectionModes, theModes);
 }
 
 //**************************************************************
-void ModuleBase_ModelWidget::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
+void ModuleBase_ModelWidget::selectionFilters(int& theModuleSelectionFilters,
+                                              SelectMgr_ListOfFilter& theSelectionFilters)
 {
+  theModuleSelectionFilters = -1;
   if (myWidgetValidator)
-    myWidgetValidator->selectionFilters(theSelectionFilters);
+    myWidgetValidator->selectionFilters(theModuleSelectionFilters, theSelectionFilters);
 }
 
 //**************************************************************
index 306f8eb12e8faf1da02c04ee630c469d9416152c..d4ecf3f89986a5b336e37672eb53d6510023ad02 100644 (file)
@@ -87,13 +87,15 @@ Q_OBJECT
   bool isInitialized(ObjectPtr theObject) const;
 
   /// Fills given container with selection modes if the widget has it
-  /// \param theModes [out] a container of modes
-  /// \param isAdditional if true, the modes are combinated with the module ones
-  virtual void selectionModes(QIntList& theModes, bool& isAdditional);
+  /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
+  /// \param [out] theModes a container of modes
+  virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
 
   /// Appends into container of workshop selection filters
-  /// \param [out] selection filters
-  virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
+  /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
+  /// \param [out] theSelectionFilters selection filters
+  virtual void selectionFilters(int& theModuleSelectionFilters,
+                                SelectMgr_ListOfFilter& theSelectionFilters);
 
   /// Returns true, if default value of the widget should be computed
   /// on operation's execute, like radius for circle's constraint (can not be zero)
index 7872179a302e1e27775b721d1c303d1a93ac9dc6..77538f6084c2754b204e656bc7195778cee32571 100644 (file)
@@ -110,10 +110,10 @@ bool ModuleBase_WidgetFeatureSelector::setSelectionCustom(const ModuleBase_Viewe
 }
 
 //********************************************************************
-void ModuleBase_WidgetFeatureSelector::selectionModes(QIntList& theModes, bool& isAdditional)
+void ModuleBase_WidgetFeatureSelector::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
 {
+  theModuleSelectionModes = -1;
   theModes.push_back(ModuleBase_ResultPrs::Sel_Result);
-  isAdditional = true;
 }
 
 //********************************************************************
index 5261f53f7285dc0dddc8eab24fe456bf6ecc43f3..f4166d35b66277c75e66d779677c04a31482f160 100644 (file)
@@ -69,9 +69,9 @@ Q_OBJECT
                             const bool theToValidate);
 
   /// Fills given container with selection modes if the widget has it
+  /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
   /// \param theModes [out] a container of modes
-  /// \param isAdditional if true, the modes are combinated with the module ones
-  virtual void selectionModes(QIntList& theModes, bool& isAdditional);
+  virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
 
   /// Returns list of widget controls
   /// \return a control list
index c7b42d7ee41069bb5b6c04d1b849337306507ee2..b3884b4966c655063793b2451e9e1f2c364ecd72 100755 (executable)
@@ -332,10 +332,10 @@ bool ModuleBase_WidgetMultiSelector::processAction(ModuleBase_ActionType theActi
 }
 
 //********************************************************************
-void ModuleBase_WidgetMultiSelector::activateSelectionAndFilters(bool toActivate)
+void ModuleBase_WidgetMultiSelector::updateSelectionModesAndFilters(bool toActivate)
 {
   myWorkshop->updateCommandStatus(); // update enable state of Undo/Redo application actions
-  ModuleBase_WidgetSelector::activateSelectionAndFilters(toActivate);
+  ModuleBase_WidgetSelector::updateSelectionModesAndFilters(toActivate);
 }
 
 //********************************************************************
@@ -430,7 +430,7 @@ QList<QWidget*> ModuleBase_WidgetMultiSelector::getControls() const
 //********************************************************************
 void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
 {
-  activateSelectionAndFilters(true);
+  updateSelectionModesAndFilters(true);
   myWorkshop->selectionActivate()->updateSelectionModes();
 
   if (!myFeature)
@@ -592,11 +592,11 @@ void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const int theShapeType)
     aShapeTypeName = myTypeCombo->itemText(idx);
     int aRefType = ModuleBase_Tools::shapeType(aShapeTypeName);
     if(aRefType == theShapeType && idx != myTypeCombo->currentIndex()) {
-      activateSelectionAndFilters(false);
+      updateSelectionModesAndFilters(false);
       bool isBlocked = myTypeCombo->blockSignals(true);
       myTypeCombo->setCurrentIndex(idx);
       myTypeCombo->blockSignals(isBlocked);
-      activateSelectionAndFilters(true);
+      updateSelectionModesAndFilters(true);
       break;
     }
   }
index 50742a71145b654cd5f26f0d7d325ede22cba636..2ea07f58e73b52ae27a88cc8d079036e572a1093 100755 (executable)
@@ -96,7 +96,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Widge
                              const ActionParamPtr& theParam = ActionParamPtr());
 
   /// Activate or deactivate selection and selection filters
-  virtual void activateSelectionAndFilters(bool toActivate);
+  virtual void updateSelectionModesAndFilters(bool toActivate);
 
   /// Checks the widget validity. By default, it returns true.
   /// \param thePrs a selected presentation in the view
index 6f4a021d8686d1a24a442dd9bbf1aee29ce051c2..673f0e18cbdab9425c7f00bc80b65445019c9e6f 100755 (executable)
@@ -165,14 +165,14 @@ bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape,
 }
 
 //********************************************************************
-void ModuleBase_WidgetSelector::selectionModes(QIntList& theModes, bool& isAdditional)
+void ModuleBase_WidgetSelector::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
 {
+  theModuleSelectionModes = -1;
   theModes.append(getShapeTypes());
-  isAdditional = true;
 }
 
 //********************************************************************
-void ModuleBase_WidgetSelector::activateSelectionAndFilters(bool toActivate)
+void ModuleBase_WidgetSelector::updateSelectionModesAndFilters(bool toActivate)
 {
   updateSelectionName();
 
index 86da4e12b37887600cce2df5b5bfbe8ce898e36b..fee235ad001f6692aa031124b09b638e2ef16f70 100755 (executable)
@@ -55,15 +55,15 @@ Q_OBJECT
   virtual ~ModuleBase_WidgetSelector();
 
   /// Fills given container with selection modes if the widget has it
-  /// \param theModes [out] a container of modes
-  /// \param isAdditional if true, the modes are combinated with the module ones
-  virtual void selectionModes(QIntList& theModes, bool& isAdditional);
+  /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
+  /// \param [out] theModes a container of modes
+  virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
 
   /// Defines if it is supposed that the widget should interact with the viewer.
   virtual bool isViewerSelector() { return true; }
 
   /// Activate or deactivate selection and selection filters
-  virtual void activateSelectionAndFilters(bool toActivate);
+  virtual void updateSelectionModesAndFilters(bool toActivate);
 
   /// Checks the widget validity. By default, it returns true.
   /// \param thePrs a selected presentation in the view
index 7d88e7afcccc67b685a99b6114f17379200be2c4..d1bebe79f38aae627666e0ea974a0d0857434582 100644 (file)
@@ -123,8 +123,9 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr&
     // it is not yet activated, so we need to activate/deactivate it manually
     bool isActivated = isFilterActivated();
     if (!isActivated) {
+      int aModuleSelectionFilters = -1;
       SelectMgr_ListOfFilter aSelectionFilters;
-      selectionFilters(aSelectionFilters);
+      selectionFilters(aModuleSelectionFilters, aSelectionFilters);
       /// after validation, the selection filters should be restored
       myWorkshop->selectionActivate()->activateSelectionFilters(aSelectionFilters);
     }
@@ -140,6 +141,7 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr&
     }
     if (!isActivated)
     {
+      // reset filters set in activateSelectionFilters above
       myWorkshop->selectionActivate()->updateSelectionFilters();
       clearValidatedCash();
     }
@@ -244,8 +246,10 @@ bool ModuleBase_WidgetValidated::isFilterActivated() const
 }
 
 //********************************************************************
-void ModuleBase_WidgetValidated::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
+void ModuleBase_WidgetValidated::selectionFilters(int& theModuleSelectionFilters,
+                                                  SelectMgr_ListOfFilter& theSelectionFilters)
 {
+  theModuleSelectionFilters = -1;
   theSelectionFilters.Append(myWorkshop->validatorFilter());
 }
 
index d47b71f14305bcbad4d3c5f0ff9435e29617ba66..502ae5dada4f57c4112dffe84b871b4339bf4ba3 100644 (file)
@@ -84,8 +84,10 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg
   bool isFilterActivated() const;
 
   /// Appends into container of workshop selection filters
+  /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
   /// \param [out] selection filters
-  virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
+  virtual void selectionFilters(int& theModuleSelectionFilters,
+                                SelectMgr_ListOfFilter& theSelectionFilters);
 
   /// Block the model flush of update and intialization of attribute
   /// \param theAttribute an attribute of blocking
index 8f6113c44054e819dd3607f3edd0ca752fea7b70..d0b2b5ce17e765aa102f4ee2fc969f4df9c8bed9 100755 (executable)
@@ -40,8 +40,10 @@ ModuleBase_WidgetValidator::~ModuleBase_WidgetValidator()
 }
 
 //********************************************************************
-void ModuleBase_WidgetValidator::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
+void ModuleBase_WidgetValidator::selectionFilters(int& theModuleSelectionFilters,
+                                                  SelectMgr_ListOfFilter& theSelectionFilters)
 {
+  theModuleSelectionFilters = -1;
   theSelectionFilters.Append(myWorkshop->validatorFilter());
 }
 
index f6c84426430e05229631e1faf7047320cbd078b8..3a84b0658c2655fe4ae3a69709e1ba14fc584647 100755 (executable)
@@ -52,13 +52,15 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidator
   virtual ~ModuleBase_WidgetValidator();
 
   /// Fills given container with selection modes if the widget has it
+  /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
   /// \param theModes [out] a container of modes
-  /// \param isAdditional if true, the modes are combinated with the module ones
-  virtual void selectionModes(QIntList& theModes, bool& isAdditional) {}
+  virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes) {}
 
   /// Appends into container of workshop selection filters
+  /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
   /// \param [out] selection filters
-  virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
+  virtual void selectionFilters(int& theModuleSelectionFilters,
+                                SelectMgr_ListOfFilter& theSelectionFilters);
 
   /// Returns true if the validation is activated
   bool isInValidate() const { return myIsInValidate; }
index 3bbb2d79c531b1dfa029d9c960f543267e15d3bd..fe9e50e37746d3f63d739939ca05862555a7f178 100755 (executable)
@@ -548,17 +548,6 @@ bool PartSet_Module::canActivateSelection(const ObjectPtr& theObject) const
   return aCanActivate;
 }
 
-//******************************************************
-void PartSet_Module::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters) const
-{
-  for (SelectMgr_ListOfFilter::Iterator aFiltersIt(mySelectionFilters); aFiltersIt.More();
-       aFiltersIt.Next())
-    theSelectionFilters.Append(aFiltersIt.Value());
-
-  if (mySketchMgr->activeSketch())
-    mySketchMgr->selectionFilters(theSelectionFilters);
-}
-
 //******************************************************
 bool PartSet_Module::addViewerMenu(const QMap<QString, QAction*>& theStdActions,
                                    QWidget* theParent,
@@ -614,6 +603,30 @@ void PartSet_Module::activeSelectionModes(QIntList& theModes)
     theModes = XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes();
 }
 
+//******************************************************
+void PartSet_Module::moduleSelectionModes(int theModesType, QIntList& theModes)
+{
+  customSubShapesSelectionModes(theModes);
+
+  //theModes.append(XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes());
+  //myWorkshop->module()->activeSelectionModes(theModes);
+}
+
+//******************************************************
+void PartSet_Module::moduleSelectionFilters(int theModesType,
+                                            SelectMgr_ListOfFilter& theSelectionFilters)
+{
+  //XGUI_Tools::workshop(myWorkshop)->selectionFilters(theSelectionFilters);
+  //selectionFilters(theSelectionFilters);
+
+  for (SelectMgr_ListOfFilter::Iterator aFiltersIt(mySelectionFilters); aFiltersIt.More();
+       aFiltersIt.Next())
+    theSelectionFilters.Append(aFiltersIt.Value());
+
+  if (mySketchMgr->activeSketch())
+    mySketchMgr->selectionFilters(theSelectionFilters);
+}
+
 //******************************************************
 void PartSet_Module::customSubShapesSelectionModes(QIntList& theModes)
 {
index 850c52f5d7a400ac15d7414dee5056a7c9933470..8a74b58541b94dd30da2b1f18c2dba1896deb7d7 100755 (executable)
@@ -200,10 +200,6 @@ public:
   /// \param theObject a model object
   virtual bool canActivateSelection(const ObjectPtr& theObject) const;
 
-  /// Appends into container of workshop selection filters
-  /// \param [out] selection filters
-  virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters) const;
-
   /// Add menu atems for object browser into the given menu
   /// \param theMenu a popup menu to be shown in the object browser
   virtual void addObjectBrowserMenu(QMenu* theMenu) const;
@@ -222,8 +218,15 @@ public:
   virtual void activeSelectionModes(QIntList& theModes);
 
   /// Appends specific selection modes for the module to the list of types
+  /// \param theModesType combination of available selection filters
   /// \param theModes a selection modes to be extended
-  virtual void customSubShapesSelectionModes(QIntList& theModes);
+  virtual void moduleSelectionModes(int theModesType, QIntList& theModes);
+
+  /// Appends into container of filters module filters corresponded to the modes type
+  /// \param theModesType combination of available selection filters
+  /// \param theSelectionFilters [out] container to be extend by elements
+  virtual void moduleSelectionFilters(int theModesType,
+                                      SelectMgr_ListOfFilter& theSelectionFilters);
 
   /// Returns whether the mouse enter the viewer's window
   /// \return true if items are added and there is no necessity to provide standard menu
@@ -410,6 +413,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
index 657d140755222f37198db290330151bc396f7a8f..f385a47dff87f958fd387d6778c3685162cc2324 100755 (executable)
@@ -1164,14 +1164,6 @@ void PartSet_SketcherMgr::selectionFilters(SelectMgr_ListOfFilter& theSelectionF
   theSelectionFilters.Append(myPlaneFilter);
 }
 
-void PartSet_SketcherMgr::activatePlaneFilter(const bool& toActivate)
-{
-  if (toActivate)
-    myModule->workshop()->viewer()->addSelectionFilter(myPlaneFilter);
-  else
-    myModule->workshop()->viewer()->removeSelectionFilter(myPlaneFilter);
-}
-
 bool PartSet_SketcherMgr::operationActivatedByPreselection()
 {
   bool isOperationStopped = false;
index 849a6a1b821007777b1ae6eae6fa9b1186f67dbd..07e44783a2985a8ef50189a2aa29f5cab54ecb18 100644 (file)
@@ -201,10 +201,6 @@ public:
   /// \param [out] selection filters
   virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters) const;
 
-  /// Append the sketch plane filter into the current viewer
-  /// \param toActivate state whether the filter should be activated/deactivated
-  void activatePlaneFilter(const bool& toActivate);
-
   /// Commit the operation if it is possible. If the operation is dimention constraint,
   /// it gives widget editor to input dimention value
   /// \return true if the operation is stopped after activation
index d987f86f7601f55694ef320e1e4cf7c9b163a47a..eb524325c96653b8ecf5f50333cea99d89807747 100644 (file)
@@ -336,7 +336,7 @@ void PartSet_SketcherReentrantMgr::setReentrantPreSelection(
 //    ModuleBase_WidgetSelector* aWSelector = dynamic_cast<ModuleBase_WidgetSelector*>
 //      (aFirstWidget);
 //    if (aWSelector) {
-//      myWorkshop->selectionActivate()->activateSelectionAndFilters(aWSelector);
+//      myWorkshop->selectionActivate()->updateSelectionModesAndFilters(aWSelector);
 //    }
 //  }
 //}
index c39cc3cdec0ede3f4b168ddcb93e30a213ab54de..1b4be74c099191fe1905422c064dd38050f389ac 100644 (file)
@@ -86,7 +86,7 @@ bool PartSet_WidgetFeaturePointSelector::isValidSelection(
 }
 
 //********************************************************************
-void PartSet_WidgetFeaturePointSelector::activateSelectionAndFilters(bool toActivate)
+void PartSet_WidgetFeaturePointSelector::updateSelectionModesAndFilters(bool toActivate)
 {
 #ifdef HIGHLIGHT_STAYS_PROBLEM
   Handle(AIS_InteractiveContext) aContext =
@@ -113,7 +113,7 @@ void PartSet_WidgetFeaturePointSelector::activateSelectionAndFilters(bool toActi
 
 #endif
 
-  ModuleBase_WidgetShapeSelector::activateSelectionAndFilters(toActivate);
+  ModuleBase_WidgetShapeSelector::updateSelectionModesAndFilters(toActivate);
 }
 
 //********************************************************************
index ab4160bc6378375478850f3ad4016099e2d444cd..4825cf68647b3c07901957496b509434c993d09d 100644 (file)
@@ -74,7 +74,7 @@ Q_OBJECT
 
   /// Activate or deactivate selection and selection filters
   /// \return true if the selection filter of the widget is activated in viewer context
-  virtual void activateSelectionAndFilters(bool toActivate);
+  virtual void updateSelectionModesAndFilters(bool toActivate);
 
   /// Set sketcher
   /// \param theSketch a sketcher object
index a4ba3b237bc34bd067abfdcabf22230fe4163816..8782a90acd49dfcecd4be4b191d7e037bf019a00 100644 (file)
@@ -443,11 +443,11 @@ QList<QWidget*> PartSet_WidgetPoint2D::getControls() const
 }
 
 //********************************************************************
-void PartSet_WidgetPoint2D::selectionModes(QIntList& theModes, bool& isAdditional)
+void PartSet_WidgetPoint2D::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
 {
+  theModuleSelectionModes = -1;
   theModes << TopAbs_VERTEX;
   theModes << TopAbs_EDGE;
-  isAdditional = true;
 }
 
 //********************************************************************
index bfc060b62ef8cc8fc5a38bdc575f159a1667a1e9..aa4fbc47752dcc0e7ac195bdbba69ff6d2f7cbc4 100755 (executable)
@@ -69,9 +69,9 @@ Q_OBJECT
   virtual ~PartSet_WidgetPoint2D();
 
   /// Fills given container with selection modes if the widget has it
+  /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
   /// \param theModes [out] a container of modes
-  /// \param isAdditional if true, the modes are combinated with the module ones
-  virtual void selectionModes(QIntList& theModes, bool& isAdditional);
+  virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
 
   /// Checks if the selection presentation is valid in widget
   /// \param theValue a selected presentation in the view
index 15a2571a29274cc6e3013dcda1840cf3c0e113e5..74136ce7a4ceab6317515dfbaffdd78bd44b7d7f 100755 (executable)
@@ -60,14 +60,18 @@ PartSet_WidgetShapeSelector::~PartSet_WidgetShapeSelector()
 }
 
 //********************************************************************
-void PartSet_WidgetShapeSelector::activateSelectionAndFilters(bool toActivate)
+void PartSet_WidgetShapeSelector::selectionFilters(int& theModuleSelectionFilters,
+                                                   SelectMgr_ListOfFilter& theSelectionFilters)
 {
-  ModuleBase_WidgetShapeSelector::activateSelectionAndFilters(toActivate);
+  ModuleBase_WidgetShapeSelector::selectionFilters(theModuleSelectionFilters, theSelectionFilters);
+
   if (!myUseSketchPlane) {
-    XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
-    PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(aWorkshop->module());
-    bool isUsePlaneFilterOnly = !toActivate;
-    aModule->sketchMgr()->activatePlaneFilter(isUsePlaneFilterOnly);
+    theModuleSelectionFilters = -1; // TODO!!!
+
+    //XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop);
+    //PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(aWorkshop->module());
+    //bool isUsePlaneFilterOnly = !toActivate;
+    //aModule->sketchMgr()->activatePlaneFilter(isUsePlaneFilterOnly);
   }
 }
 
index 90fe78baec9c7bb6dcbfa3df1c61b6a34b25a1e7..c7728e73e6ef394ac822ac50609b36d69f44700d 100644 (file)
@@ -54,9 +54,11 @@ Q_OBJECT
   /// Retrurns installed sketcher
   CompositeFeaturePtr sketch() const { return mySketch; }
 
-  /// Activate or deactivate selection and selection filters
-  /// \param toActivate boolean state whether it should be activated/deactivated
-  virtual void activateSelectionAndFilters(bool toActivate);
+  /// Appends into container of workshop selection filters
+  /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
+  /// \param [out] theSelectionFilters selection filters
+  virtual void selectionFilters(int& theModuleSelectionFilters,
+                                SelectMgr_ListOfFilter& theSelectionFilters);
 
 protected:
   /// Checks the widget validity. By default, it returns true.
index b5ad01f40834b2e303f51067e2e1befb7733431b..5a82272f4619177adefbfcaf9163fb2314680537 100644 (file)
@@ -526,20 +526,23 @@ void PartSet_WidgetSketchLabel::deactivate()
     myWorkshop->viewer()->update();
 }
 
-void PartSet_WidgetSketchLabel::selectionModes(QIntList& theModes, bool& isAdditional)
+void PartSet_WidgetSketchLabel::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
 {
+  theModuleSelectionModes = -1;
   std::shared_ptr<GeomAPI_Pln> aPlane = plane();
   if (!aPlane.get())
     theModes << TopAbs_FACE;
-  isAdditional = true;
 }
 
-void PartSet_WidgetSketchLabel::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
+void PartSet_WidgetSketchLabel::selectionFilters(int& theModuleSelectionFilters,
+                                                 SelectMgr_ListOfFilter& theSelectionFilters)
 {
+  theModuleSelectionFilters = -1;
   std::shared_ptr<GeomAPI_Pln> aPlane = plane();
   if (aPlane.get())
     return;
-  return ModuleBase_WidgetValidated::selectionFilters(theSelectionFilters);
+  return ModuleBase_WidgetValidated::selectionFilters(theModuleSelectionFilters,
+                                                      theSelectionFilters);
 }
 
 std::shared_ptr<GeomAPI_Dir>
index a9869882ce4606263f0b8706864dccb1c5ed45a7..16b2b92b8f8de2bbf1036ff7878cbfaae8fbaf81 100644 (file)
@@ -74,13 +74,15 @@ public:
                             const bool theToValidate);
 
   /// Fills given container with selection modes if the widget has it
-  // \param theModes [out] a container of modes
-  /// \param isAdditional if true, the modes are combinated with the module ones
-  virtual void selectionModes(QIntList& theModes, bool& isAdditional);
+  /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
+  /// \param theModes [out] a container of modes
+  virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
 
   /// Using widget selection filter only if plane is not defined.
+  /// \param [out] theModuleSelectionFilters module additional modes, -1 means all default modes
   /// \param [out] selection filters
-  virtual void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
+  virtual void selectionFilters(int& theModuleSelectionFilters,
+                                SelectMgr_ListOfFilter& theSelectionFilters);
 
   /// Returns list of widget controls
   /// \return a control list
index af1855f56c91ecb0350c656e496b90c3f81e379c..045be8ef68623a52e054403a15e1a5939e173c28 100644 (file)
@@ -89,7 +89,7 @@ void XGUI_SelectionActivate::updateSelectionModes()
     break;
     case FacesPanel: {
       XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionModes(aModes);
-      myWorkshop->module()->customSubShapesSelectionModes(aModes); // avoid wire selection
+      myWorkshop->module()->moduleSelectionModes(-1/*all modes*/, aModes);
     }
     break;
     default: break;
@@ -102,16 +102,18 @@ void XGUI_SelectionActivate::updateSelectionFilters()
 {
   SelectMgr_ListOfFilter aSelectionFilters;
   switch (activeSelectionPlace()) {
-  case Workshop:
-    XGUI_Tools::workshop(myWorkshop)->selectionFilters(aSelectionFilters);
+    case Workshop:
+      myWorkshop->module()->moduleSelectionFilters(-1/*all filters*/, aSelectionFilters);
     break;
     case PropertyPanel: {
       ModuleBase_ModelWidget* anActiveWidget = myWorkshop->module()->activeWidget();
-      getSelectionFilters(anActiveWidget, aSelectionFilters);
+      int aModuleSelectionFilters = -1;
+      if (anActiveWidget)
+        anActiveWidget->selectionFilters(aModuleSelectionFilters, aSelectionFilters);
+      myWorkshop->module()->moduleSelectionFilters(aModuleSelectionFilters, aSelectionFilters);
     }
     break;
     case FacesPanel: {
-      //XGUI_Tools::workshop(myWorkshop)->selectionFilters(aSelectionFilters);
       XGUI_Tools::workshop(myWorkshop)->facesPanel()->selectionFilters(aSelectionFilters);
     }
     break;
@@ -143,23 +145,9 @@ void XGUI_SelectionActivate::getSelectionModes(ModuleBase_ModelWidget* theWidget
   if (!theWidget)
     return;
 
-  bool isAdditional = false;
-  theWidget->selectionModes(theModes, isAdditional);
-  if (isAdditional) {
-    myWorkshop->module()->customSubShapesSelectionModes(theModes);
-    //theModes.append(XGUI_Tools::workshop(myWorkshop)->viewerSelectionModes());
-    //myWorkshop->module()->activeSelectionModes(theModes);
-  }
-}
-
-//**************************************************************
-void XGUI_SelectionActivate::getSelectionFilters(ModuleBase_ModelWidget* theWidget,
-                                                 SelectMgr_ListOfFilter& theSelectionFilters)
-{
-  XGUI_Tools::workshop(myWorkshop)->selectionFilters(theSelectionFilters);
-
-  if (theWidget)
-    theWidget->selectionFilters(theSelectionFilters);
+  int aModuleSelectionModes = -1;
+  theWidget->selectionModes(aModuleSelectionModes, theModes);
+  myWorkshop->module()->moduleSelectionModes(aModuleSelectionModes, theModes);
 }
 
 //**************************************************************
index 89c12fcaafc2c558268fb22cf9337b1021a298f2..93f65e46ddc38a6e4b5e5813ff9b5379a3b3172c 100644 (file)
@@ -138,12 +138,6 @@ protected:
   /// \param theModes selection modes
   void getSelectionModes(ModuleBase_ModelWidget* theWidget, QIntList& theModes);
 
-  /// Returns selection filters of the widget
-  /// \param theWidget model widget
-  /// \param theSelectionFilters selection filters
-  void getSelectionFilters(ModuleBase_ModelWidget* theWidget,
-                           SelectMgr_ListOfFilter& theSelectionFilters);
-
   /// Returns Trihedron object if it is displayed
   Handle(AIS_InteractiveObject) getTrihedron() const;
 
index 9d3a7bbea2ea508924cf4370ed22eb3f17fff6b4..89c21c6cfe26ddbed9b829863cef65b342147768 100755 (executable)
@@ -686,12 +686,6 @@ void XGUI_Workshop::connectToPropertyPanel(const bool isToConnect)
   }
 }
 
-//******************************************************
-void XGUI_Workshop::selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters)
-{
-  module()->selectionFilters(theSelectionFilters);
-}
-
 //******************************************************
 void XGUI_Workshop::onOperationResumed(ModuleBase_Operation* theOperation)
 {
index e8fc6c9908a141f7749711b81559577346050696..8393a2987136d00a7d46a2530e16a6df6b652c45 100755 (executable)
@@ -296,10 +296,6 @@ Q_OBJECT
   /// Returns defailt selection mode in 3d viewer
   QIntList viewerSelectionModes() const { return myViewerSelMode; }
 
-  /// Appends into container of workshop selection filters
-  /// \param [out] selection filters
-  void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
-
   /// Highlights result objects in Object Browser according to
   /// features found in the given list
   void highlightResults(const QObjectPtrList& theObjects);