Salome HOME
Fix for the issue Crash on export file if name of resulting file contain the name...
[modules/shaper.git] / src / PartSet / PartSet_Filters.cpp
index b7e5ccbb1e62e2d116921ed8220e201ff44e65af..88ba16c9ad36518e8722fbb5326eea378693d354 100644 (file)
 
 IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter);
 
+PartSet_GlobalFilter::PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop)
+  : ModuleBase_ShapeDocumentFilter(theWorkshop)
+{
+  addNonSelectableType(ModelAPI_ResultField::group().c_str());
+  addNonSelectableType(ModelAPI_ResultGroup::group().c_str());
+}
+
+
 Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
 {
   bool aValid = true;
@@ -63,8 +71,7 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)&
           if (aResultGroupName == ModelAPI_ResultPart::group()) {
             SessionPtr aMgr = ModelAPI_Session::get();
             aValid = aMgr->activeDocument() == aMgr->moduleDocument();
-          } else if (aResultGroupName == ModelAPI_ResultGroup::group() ||
-                     aResultGroupName == ModelAPI_ResultField::group()) {
+          } else if (myNonSelectableTypes.contains(aResultGroupName.c_str())) {
             aValid = Standard_False;
           } else
             aValid = Standard_True;
@@ -73,7 +80,7 @@ Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)&
           // only and there can not be Group feature
           FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
           if (aFeature) {
-            aValid = aFeature->getKind() != "Group";
+            aValid = !myNonSelectableTypes.contains(aFeature->getKind().c_str());
           } else
             aValid = Standard_True;
         }