Salome HOME
updated copyright message
[modules/shaper.git] / src / FiltersPlugin / FiltersPlugin_BelongsTo.cpp
index b03093e0ff05dc3454cbb66bee49878ce17ae7a5..067ca6f3bde27c7ec9831978b830d07a14f746a7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 
 #include <ModelAPI_AttributeSelectionList.h>
 
-bool FiltersPlugin_BelongsTo::isSupported(GeomAPI_Shape::ShapeType theType) const
+bool FiltersPlugin_BelongsTo::isSupported(GeomAPI_Shape::ShapeType /*theType*/) const
 {
   return true;
 }
 
-bool FiltersPlugin_BelongsTo::isOk(const GeomShapePtr& theShape,
-  const ModelAPI_FiltersArgs& theArgs) const
+bool FiltersPlugin_BelongsTo::isOk(const GeomShapePtr& theShape, const ResultPtr&,
+                                   const ModelAPI_FiltersArgs& theArgs) const
 {
   AttributePtr aAttr = theArgs.argument("BelongsTo");
   AttributeSelectionListPtr aList =
@@ -35,27 +35,17 @@ bool FiltersPlugin_BelongsTo::isOk(const GeomShapePtr& theShape,
   if (!aList.get())
     return false;
   for (int i = 0; i < aList->size(); i++) {
-    AttributeSelectionPtr aAttr = aList->value(i);
-    GeomShapePtr aGeom = aAttr->value();
-    if (aGeom->isSubShape(theShape))
+    AttributeSelectionPtr aCurAttr = aList->value(i);
+    GeomShapePtr aGeom = aCurAttr->value();
+    if (aGeom && aGeom->isSubShape(theShape))
       return true;
   }
   return false;
 }
 
-static std::string XMLRepresentation =
-"<filter id = \"BelongsTo\">"
-" <multi_selector id=\"BelongsTo__BelongsTo\""
-"   label=\"Objects:\""
-"   tooltip=\"Select objects to limit selection.\""
-"   type_choice=\"objects\">"
-" </multi_selector>"
-"</filter>";
-
-
 std::string FiltersPlugin_BelongsTo::xmlRepresentation() const
 {
-  return XMLRepresentation;
+  return xmlFromFile("filter-BelongsTo.xml");
 }
 
 void FiltersPlugin_BelongsTo::initAttributes(ModelAPI_FiltersArgs& theArguments)