X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_FusionFaces.cpp;h=7a1e75453a33877c9aa406ae976cf3b5d017f293;hb=d5c7ad3c50f89a2ddc2de1866ffb7f09397f3be2;hp=12e0325e0752471bf6b5335acfc4fd26be4fd52e;hpb=a276c3f6288ffcd67f1dab8323d7e4666a1aded7;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp index 12e0325e0..7a1e75453 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp @@ -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 @@ -12,13 +12,13 @@ // // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "FeaturesPlugin_FusionFaces.h" +#include "FeaturesPlugin_Tools.h" #include #include @@ -30,6 +30,7 @@ #include #include +#include #include @@ -60,31 +61,19 @@ void FeaturesPlugin_FusionFaces::execute() std::shared_ptr anAlgo(new GeomAlgoAPI_UnifySameDomain(aBaseShape)); // Check algo status - if (!anAlgo->isDone()) { - setError("Error: Fusion algorithm failed."); - return; - } - if (anAlgo->shape()->isNull()) { - setError("Error: Resulting shape is Null."); - return; - } - if (!anAlgo->isValid()) { - setError("Error: Resulting shape is not valid."); + std::string anError; + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(), anError)) { + setError(anError); return; } // Store result GeomShapePtr aResultShape = anAlgo->shape(); ResultBodyPtr aResultBody = document()->createBody(data()); - if (aResultShape->isEqual(aBaseShape)) { - aResultBody->store(aResultShape); - } else { - aResultBody->storeModified(aBaseShape, aResultShape); - const std::string aModEName = "Modified_Edge"; - const std::string aModFName = "Modified_Face"; - aResultBody->loadModifiedShapes(anAlgo, aBaseShape, GeomAPI_Shape::EDGE, aModEName); - aResultBody->loadModifiedShapes(anAlgo, aBaseShape, GeomAPI_Shape::FACE, aModFName); - } + ListOfShape aBaseShapesList; + aBaseShapesList.push_back(aBaseShape); + FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapesList, ListOfShape(), + anAlgo, aResultShape); setResult(aResultBody); }