From: nds Date: Thu, 14 Dec 2017 05:58:09 +0000 (+0300) Subject: Sketch shape in plane selection filter should not be activated while PartSet_WidgetSh... X-Git-Tag: V_2.10.0RC~42 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b394e9c094d25b01f1d7b9b59b218807c5be087b;p=modules%2Fshaper.git Sketch shape in plane selection filter should not be activated while PartSet_WidgetShapeSelector do not use sketch plane by XML. The integration is a preparation to give such information in the module. --- diff --git a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp index e7e400d37..94989abb5 100644 --- a/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp +++ b/src/CollectionPlugin/CollectionPlugin_WidgetField.cpp @@ -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()); diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index 0a2b14991..66711b4c5 100755 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -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 diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index 904d28ab1..097f5175d 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -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); } //************************************************************** diff --git a/src/ModuleBase/ModuleBase_ModelWidget.h b/src/ModuleBase/ModuleBase_ModelWidget.h index 306f8eb12..d4ecf3f89 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.h +++ b/src/ModuleBase/ModuleBase_ModelWidget.h @@ -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) diff --git a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp index 7872179a3..77538f608 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.cpp @@ -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; } //******************************************************************** diff --git a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h index 5261f53f7..f4166d35b 100644 --- a/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetFeatureSelector.h @@ -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 diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index c7b42d7ee..b3884b496 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -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 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; } } diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h index 50742a711..2ea07f58e 100755 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.h @@ -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 diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp index 6f4a021d8..673f0e18c 100755 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp @@ -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(); diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.h b/src/ModuleBase/ModuleBase_WidgetSelector.h index 86da4e12b..fee235ad0 100755 --- a/src/ModuleBase/ModuleBase_WidgetSelector.h +++ b/src/ModuleBase/ModuleBase_WidgetSelector.h @@ -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 diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.cpp b/src/ModuleBase/ModuleBase_WidgetValidated.cpp index 7d88e7afc..d1bebe79f 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidated.cpp @@ -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()); } diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.h b/src/ModuleBase/ModuleBase_WidgetValidated.h index d47b71f14..502ae5dad 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.h +++ b/src/ModuleBase/ModuleBase_WidgetValidated.h @@ -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 diff --git a/src/ModuleBase/ModuleBase_WidgetValidator.cpp b/src/ModuleBase/ModuleBase_WidgetValidator.cpp index 8f6113c44..d0b2b5ce1 100755 --- a/src/ModuleBase/ModuleBase_WidgetValidator.cpp +++ b/src/ModuleBase/ModuleBase_WidgetValidator.cpp @@ -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()); } diff --git a/src/ModuleBase/ModuleBase_WidgetValidator.h b/src/ModuleBase/ModuleBase_WidgetValidator.h index f6c844264..3a84b0658 100755 --- a/src/ModuleBase/ModuleBase_WidgetValidator.h +++ b/src/ModuleBase/ModuleBase_WidgetValidator.h @@ -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; } diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 3bbb2d79c..fe9e50e37 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -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& 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) { diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 850c52f5d..8a74b5854 100755 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -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 diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index 657d14075..f385a47df 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -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; diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 849a6a1b8..07e44783a 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -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 diff --git a/src/PartSet/PartSet_SketcherReentrantMgr.cpp b/src/PartSet/PartSet_SketcherReentrantMgr.cpp index d987f86f7..eb524325c 100644 --- a/src/PartSet/PartSet_SketcherReentrantMgr.cpp +++ b/src/PartSet/PartSet_SketcherReentrantMgr.cpp @@ -336,7 +336,7 @@ void PartSet_SketcherReentrantMgr::setReentrantPreSelection( // ModuleBase_WidgetSelector* aWSelector = dynamic_cast // (aFirstWidget); // if (aWSelector) { -// myWorkshop->selectionActivate()->activateSelectionAndFilters(aWSelector); +// myWorkshop->selectionActivate()->updateSelectionModesAndFilters(aWSelector); // } // } //} diff --git a/src/PartSet/PartSet_WidgetFeaturePointSelector.cpp b/src/PartSet/PartSet_WidgetFeaturePointSelector.cpp index c39cc3cde..1b4be74c0 100644 --- a/src/PartSet/PartSet_WidgetFeaturePointSelector.cpp +++ b/src/PartSet/PartSet_WidgetFeaturePointSelector.cpp @@ -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); } //******************************************************************** diff --git a/src/PartSet/PartSet_WidgetFeaturePointSelector.h b/src/PartSet/PartSet_WidgetFeaturePointSelector.h index ab4160bc6..4825cf686 100644 --- a/src/PartSet/PartSet_WidgetFeaturePointSelector.h +++ b/src/PartSet/PartSet_WidgetFeaturePointSelector.h @@ -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 diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index a4ba3b237..8782a90ac 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -443,11 +443,11 @@ QList 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; } //******************************************************************** diff --git a/src/PartSet/PartSet_WidgetPoint2d.h b/src/PartSet/PartSet_WidgetPoint2d.h index bfc060b62..aa4fbc477 100755 --- a/src/PartSet/PartSet_WidgetPoint2d.h +++ b/src/PartSet/PartSet_WidgetPoint2d.h @@ -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 diff --git a/src/PartSet/PartSet_WidgetShapeSelector.cpp b/src/PartSet/PartSet_WidgetShapeSelector.cpp index 15a2571a2..74136ce7a 100755 --- a/src/PartSet/PartSet_WidgetShapeSelector.cpp +++ b/src/PartSet/PartSet_WidgetShapeSelector.cpp @@ -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(aWorkshop->module()); - bool isUsePlaneFilterOnly = !toActivate; - aModule->sketchMgr()->activatePlaneFilter(isUsePlaneFilterOnly); + theModuleSelectionFilters = -1; // TODO!!! + + //XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myWorkshop); + //PartSet_Module* aModule = dynamic_cast(aWorkshop->module()); + //bool isUsePlaneFilterOnly = !toActivate; + //aModule->sketchMgr()->activatePlaneFilter(isUsePlaneFilterOnly); } } diff --git a/src/PartSet/PartSet_WidgetShapeSelector.h b/src/PartSet/PartSet_WidgetShapeSelector.h index 90fe78bae..c7728e73e 100644 --- a/src/PartSet/PartSet_WidgetShapeSelector.h +++ b/src/PartSet/PartSet_WidgetShapeSelector.h @@ -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. diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index b5ad01f40..5a82272f4 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -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 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 aPlane = plane(); if (aPlane.get()) return; - return ModuleBase_WidgetValidated::selectionFilters(theSelectionFilters); + return ModuleBase_WidgetValidated::selectionFilters(theModuleSelectionFilters, + theSelectionFilters); } std::shared_ptr diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index a9869882c..16b2b92b8 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -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 diff --git a/src/XGUI/XGUI_SelectionActivate.cpp b/src/XGUI/XGUI_SelectionActivate.cpp index af1855f56..045be8ef6 100644 --- a/src/XGUI/XGUI_SelectionActivate.cpp +++ b/src/XGUI/XGUI_SelectionActivate.cpp @@ -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); } //************************************************************** diff --git a/src/XGUI/XGUI_SelectionActivate.h b/src/XGUI/XGUI_SelectionActivate.h index 89c12fcaa..93f65e46d 100644 --- a/src/XGUI/XGUI_SelectionActivate.h +++ b/src/XGUI/XGUI_SelectionActivate.h @@ -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; diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 9d3a7bbea..89c21c6cf 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -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) { diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index e8fc6c990..8393a2987 100755 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -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);