From: nds Date: Sat, 12 Sep 2015 09:34:53 +0000 (+0300) Subject: Erroneous cases in SALOME mode: Sketch, start sub-feature operation[some control... X-Git-Tag: V_1.4.0_beta4~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7b4a6a2a335d41a647e0f6a6becb7c23df042be1;p=modules%2Fshaper.git Erroneous cases in SALOME mode: Sketch, start sub-feature operation[some control is active], close view, open view ->filters should be activated. Case 2: the same case: when viewer is removed(view is closed), we need to nullify AndFilter of Displayer, otherwise we lost all filters in opened view. It was realized for deactivate module and should be done when viewer is closed. --- diff --git a/src/ModuleBase/ModuleBase_WidgetValidated.h b/src/ModuleBase/ModuleBase_WidgetValidated.h index a9b77d939..70405e695 100644 --- a/src/ModuleBase/ModuleBase_WidgetValidated.h +++ b/src/ModuleBase/ModuleBase_WidgetValidated.h @@ -66,6 +66,11 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg //! Returns data object by AIS ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const; + /// It obtains selection filters from the workshop and activates them in the active viewer + /// \param theWorkshop an active workshop + /// \param toActivate a flag about activation or deactivation the filters + void activateFilters(const bool toActivate); + protected: /// Creates a backup of the current values of the attribute /// It should be realized in the specific widget because of different @@ -95,11 +100,6 @@ protected: /// \return boolean value bool isFilterActivated() const; - /// It obtains selection filters from the workshop and activates them in the active viewer - /// \param theWorkshop an active workshop - /// \param toActivate a flag about activation or deactivation the filters - void activateFilters(const bool toActivate); - /// Gets the validity state of the presentation in an internal map. Returns true if the valid state of value is stored /// \param theValue a viewer presentation /// \param theValid a valid state diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 5713d7dec..64674f19d 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -456,6 +456,11 @@ void PartSet_Module::closeDocument() void PartSet_Module::clearViewer() { myCustomPrs->clearPrs(); + + XGUI_ModuleConnector* aConnector = dynamic_cast(myWorkshop); + XGUI_Workshop* aWorkshop = aConnector->workshop(); + XGUI_Displayer* aDisplayer = aWorkshop->displayer(); + aDisplayer->deactivateSelectionFilters(); } void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation) @@ -1088,4 +1093,17 @@ void PartSet_Module::onViewCreated(ModuleBase_IViewWindow*) if (!aFound) aViewer->AddZLayer(myVisualLayerId); } + // if there is an active operation with validated widget, + // the filters of this widget should be activated in the created view + ModuleBase_Operation* aOperation = myWorkshop->currentOperation(); + if (aOperation) { + ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel(); + ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget(); + if (anActiveWidget) { + ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast + (anActiveWidget); + if (aWidgetValidated) + aWidgetValidated->activateFilters(true); + } + } } diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index 344704de0..cb24aa480 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -830,18 +830,19 @@ XGUI_Displayer::DisplayMode XGUI_Displayer::displayMode(ObjectPtr theObject) con void XGUI_Displayer::deactivateSelectionFilters() { Handle(AIS_InteractiveContext) aContext = AISContext(); - if (!aContext.IsNull() && !myAndFilter.IsNull()) { + if (!myAndFilter.IsNull()) { bool aFound = false; - const SelectMgr_ListOfFilter& aFilters = aContext->Filters(); - SelectMgr_ListIteratorOfListOfFilter anIt(aFilters); - for (; anIt.More() && !aFound; anIt.Next()) { - Handle(SelectMgr_Filter) aFilter = anIt.Value(); - aFound = aFilter == myAndFilter; - } - if (aFound) { - aContext->RemoveFilter(myAndFilter); - myAndFilter.Nullify(); + if (!aContext.IsNull()) { + const SelectMgr_ListOfFilter& aFilters = aContext->Filters(); + SelectMgr_ListIteratorOfListOfFilter anIt(aFilters); + for (; anIt.More() && !aFound; anIt.Next()) { + Handle(SelectMgr_Filter) aFilter = anIt.Value(); + aFound = aFilter == myAndFilter; + } + if (aFound) + aContext->RemoveFilter(myAndFilter); } + myAndFilter.Nullify(); } }