Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / PartSet / PartSet_WidgetShapeSelector.cpp
index 056ca9dd6ea1d770a31e21b44961c7723b305cb4..fb8a9df78fc57d065b234694a568541f4fa2a364 100755 (executable)
@@ -60,24 +60,23 @@ PartSet_WidgetShapeSelector::~PartSet_WidgetShapeSelector()
 }
 
 //********************************************************************
-bool PartSet_WidgetShapeSelector::activateSelectionAndFilters(bool toActivate)
+void PartSet_WidgetShapeSelector::selectionFilters(QIntList& theModuleSelectionFilters,
+                                                   SelectMgr_ListOfFilter& theSelectionFilters)
 {
-  bool aHasSelectionFilter = 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);
+    if (theModuleSelectionFilters.contains(SF_SketchPlaneFilter))
+      theModuleSelectionFilters.removeAll(SF_SketchPlaneFilter);
   }
-  return aHasSelectionFilter;
 }
 
 //********************************************************************
 bool PartSet_WidgetShapeSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   bool aValid = false;
-  if (thePrs.get() && thePrs->interactive()->IsKind(STANDARD_TYPE(PartSet_CenterPrs)))
+  if (thePrs.get() && thePrs->interactive().get() &&
+      thePrs->interactive()->IsKind(STANDARD_TYPE(PartSet_CenterPrs)))
     aValid = true; // we should not check acceptSubShape for such presentation
   else
     aValid = ModuleBase_WidgetShapeSelector::isValidSelectionCustom(thePrs);