X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_FusionFaces.cpp;h=7a1e75453a33877c9aa406ae976cf3b5d017f293;hb=8f36dafd50feb0050fa09601fe31a5395eb70ea4;hp=b3cc312c52097f8113056fb743f35972132a157e;hpb=1e2eaa713f139d2617c80eba9ede62d4e9976bb7;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp b/src/FeaturesPlugin/FeaturesPlugin_FusionFaces.cpp index b3cc312c5..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,36 +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 int aModifyEdgeTag = 1; - const int aModifyFaceTag = 2; - const std::string aModEName = "Modified_Edge"; - const std::string aModFName = "Modified_Face"; - std::shared_ptr aMapOfShapes = anAlgo->mapOfSubShapes(); - aResultBody->loadAndOrientModifiedShapes(anAlgo.get(), aBaseShape, GeomAPI_Shape::EDGE, - aModifyEdgeTag, aModEName, *aMapOfShapes.get(), true); - aResultBody->loadAndOrientModifiedShapes(anAlgo.get(), aBaseShape, GeomAPI_Shape::FACE, - aModifyFaceTag, aModFName, *aMapOfShapes.get(), true); - } + ListOfShape aBaseShapesList; + aBaseShapesList.push_back(aBaseShape); + FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapesList, ListOfShape(), + anAlgo, aResultShape); setResult(aResultBody); }