-// 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_FusionFaces.h"
#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAlgoAPI_UnifySameDomain.h>
std::shared_ptr<GeomAlgoAPI_UnifySameDomain> 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;
}
} 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<GeomAPI_DataMapOfShapeShape> 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);
+ aResultBody->loadModifiedShapes(anAlgo, aBaseShape, GeomAPI_Shape::EDGE);
+ aResultBody->loadModifiedShapes(anAlgo, aBaseShape, GeomAPI_Shape::FACE);
}
setResult(aResultBody);
}