Salome HOME
Change icons for chamfer
[modules/shaper.git] / src / FiltersPlugin / FiltersPlugin_OnGeometry.cpp
index e62dba49c31cf3f72e5fa7e4515ed94a4d324b0a..aeeb676504db8f944fb90adeb9342a6cee0dcb7d 100644 (file)
@@ -26,8 +26,8 @@ bool FiltersPlugin_OnGeometry::isSupported(GeomAPI_Shape::ShapeType theType) con
   return theType == GeomAPI_Shape::EDGE || theType == GeomAPI_Shape::FACE;
 }
 
-bool FiltersPlugin_OnGeometry::isOk(const GeomShapePtr& theShape,
-  const ModelAPI_FiltersArgs& theArgs) const
+bool FiltersPlugin_OnGeometry::isOk(const GeomShapePtr& theShape, const ResultPtr&,
+                                    const ModelAPI_FiltersArgs& theArgs) const
 {
   AttributePtr aAttr = theArgs.argument("OnGeometry");
   AttributeSelectionListPtr aList =
@@ -37,26 +37,17 @@ bool FiltersPlugin_OnGeometry::isOk(const GeomShapePtr& theShape,
   for (int i = 0; i < aList->size(); i++) {
     AttributeSelectionPtr aAttr = aList->value(i);
     GeomShapePtr aGeom = aAttr->value();
-    if (aGeom->isSameGeometry(theShape))
+    if (!aGeom)
+      aGeom = aAttr->context()->shape();
+    if (aGeom && aGeom->isSameGeometry(theShape))
       return true;
   }
   return false;
 }
 
-static std::string XMLRepresentation =
-"<filter id = \"OnGeometry\">"
-" <multi_selector id=\"OnGeometry__OnGeometry\""
-"   label=\"Edges/faces:\""
-"   tooltip=\"Select objects to limit selection.\""
-"   type_choice=\"edges faces\">"
-"   <validator id=\"GeomValidators_ShapeType\" parameters=\"edge,face\"/>"
-" </multi_selector>"
-"</filter>";
-
-
 std::string FiltersPlugin_OnGeometry::xmlRepresentation() const
 {
-  return XMLRepresentation;
+  return xmlFromFile("filter-OnGeometry.xml");
 }
 
 void FiltersPlugin_OnGeometry::initAttributes(ModelAPI_FiltersArgs& theArguments)