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.
//! 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
/// \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
void PartSet_Module::clearViewer()
{
myCustomPrs->clearPrs();
+
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
+ XGUI_Workshop* aWorkshop = aConnector->workshop();
+ XGUI_Displayer* aDisplayer = aWorkshop->displayer();
+ aDisplayer->deactivateSelectionFilters();
}
void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
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<ModuleBase_WidgetValidated*>
+ (anActiveWidget);
+ if (aWidgetValidated)
+ aWidgetValidated->activateFilters(true);
+ }
+ }
}
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();
}
}