]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/FeaturesPlugin/FeaturesPlugin_BooleanFill.cpp
Salome HOME
Update copyrights
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_BooleanFill.cpp
index 1bf9809428391ed68df021fafde435e96c82f11a..1fecf3926810c3549faa81ee3bb7bc149c784a3f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  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
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "FeaturesPlugin_BooleanFill.h"
@@ -30,6 +29,8 @@
 #include <GeomAlgoAPI_Partition.h>
 #include <GeomAlgoAPI_PaveFiller.h>
 #include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
+
 #include <GeomAPI_Face.h>
 #include <GeomAPI_ShapeExplorer.h>
 #include <GeomAPI_ShapeIterator.h>
@@ -46,6 +47,7 @@ FeaturesPlugin_BooleanFill::FeaturesPlugin_BooleanFill()
 //=================================================================================================
 void FeaturesPlugin_BooleanFill::execute()
 {
+  std::string anError;
   ListOfShape anObjects, aTools, anEdgesAndFaces, aPlanes;
   std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
 
@@ -148,19 +150,8 @@ void FeaturesPlugin_BooleanFill::execute()
     }
 
     // Checking that the algorithm worked properly.
-    if(!aBoolAlgo->isDone()) {
-      static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-      setError(aFeatureError);
-      return;
-    }
-    if(aResShape->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      return;
-    }
-    if(!aBoolAlgo->isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }
 
@@ -224,19 +215,8 @@ void FeaturesPlugin_BooleanFill::execute()
     aBoolAlgo.reset(new GeomAlgoAPI_Partition(aUsedInOperationSolids, aToolsWithPlanes));
 
     // Checking that the algorithm worked properly.
-    if(!aBoolAlgo->isDone()) {
-      static const std::string aFeatureError = "Error: Boolean algorithm failed.";
-      setError(aFeatureError);
-      return;
-    }
-    if(aBoolAlgo->shape()->isNull()) {
-      static const std::string aShapeError = "Error: Resulting shape is Null.";
-      setError(aShapeError);
-      return;
-    }
-    if(!aBoolAlgo->isValid()) {
-      std::string aFeatureError = "Error: Resulting shape is not valid.";
-      setError(aFeatureError);
+    if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) {
+      setError(anError);
       return;
     }