-// 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 "BuildPlugin_Edge.h"
#include <ModelAPI_ResultBody.h>
#include <GeomAlgoAPI_Copy.h>
+#include <GeomAlgoAPI_Tools.h>
//=================================================================================================
BuildPlugin_Edge::BuildPlugin_Edge()
// Copy shape.
GeomMakeShapePtr aCopyAlgo(new GeomAlgoAPI_Copy(aShape));
- // Check that algo is done.
- if(!aCopyAlgo->isDone()) {
- setError("Error: " + getKind() + " algorithm failed.");
- return;
- }
-
- // Check if shape is not null.
- if(!aCopyAlgo->shape().get() || aCopyAlgo->shape()->isNull()) {
- setError("Error: Resulting shape is null.");
- return;
- }
-
- // Check that resulting shape is valid.
- if(!aCopyAlgo->isValid()) {
- setError("Error: Resulting shape is not valid.");
+ std::string anError;
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
// Store result.
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- aResultBody->storeModified(aShape, aCopyAlgo->shape());
- aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::VERTEX, "Modified_Vertex");
+
+ ListOfShape aBaseShapes;
+ aBaseShapes.push_back(aShape);
+ aResultBody->storeModified(aBaseShapes, aCopyAlgo->shape(), aCopyAlgo);
+ aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::VERTEX);
setResult(aResultBody, aResultIndex);
++aResultIndex;