]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/FiltersPlugin/FiltersPlugin_OnPlaneSide.cpp
Salome HOME
Copyright update 2022
[modules/shaper.git] / src / FiltersPlugin / FiltersPlugin_OnPlaneSide.cpp
index 1d77e6b742e1d879536414db15d6ee7f951e93fc..6a5c458d8b65c7a2bad9049e39d1ce5a61c391ff 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  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
@@ -27,7 +27,7 @@
 #include <GeomAPI_XYZ.h>
 
 
-bool FiltersPlugin_OnPlaneSide::isSupported(GeomAPI_Shape::ShapeType theType) const
+bool FiltersPlugin_OnPlaneSide::isSupported(GeomAPI_Shape::ShapeType /*theType*/) const
 {
   return true;
 }
@@ -42,8 +42,12 @@ bool FiltersPlugin_OnPlaneSide::isOk(const GeomShapePtr& theShape, const ResultP
   if (!aList.get())
     return false;
   GeomShapePtr aPlanarShape = aList->value();
-  if (!aPlanarShape)
-    aPlanarShape = aList->context()->shape();
+  if (!aPlanarShape) {
+    ResultPtr aContext = aList->context();
+    if (!aContext)
+      return false;
+    aPlanarShape = aContext->shape();
+  }
 
   GeomPlanePtr aPlane = aPlanarShape->face()->getPlane();
   GeomPointPtr aPlaneLoc = aPlane->location();
@@ -55,20 +59,9 @@ bool FiltersPlugin_OnPlaneSide::isOk(const GeomShapePtr& theShape, const ResultP
   return aVec->dot(aPlaneNorm->xyz()) > THE_TOLERANCE;
 }
 
-static std::string XMLRepresentation =
-"<filter id = \"OnPlaneSide\">"
-" <shape_selector id=\"OnPlaneSide__OnPlaneSide\""
-"   label=\"Plane:\""
-"   tooltip=\"Select plane or planar face.\""
-"   shape_types=\"faces\">"
-"   <validator id=\"GeomValidators_ShapeType\" parameters=\"plane\"/>"
-" </shape_selector>"
-"</filter>";
-
-
 std::string FiltersPlugin_OnPlaneSide::xmlRepresentation() const
 {
-  return XMLRepresentation;
+  return xmlFromFile("filter-OnPlaneSide.xml");
 }
 
 void FiltersPlugin_OnPlaneSide::initAttributes(ModelAPI_FiltersArgs& theArguments)