-// 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_Intersection.h"
#include <ModelAPI_AttributeSelectionList.h>
#include <GeomAlgoAPI_Intersection.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_ShapeExplorer.h>
#include <sstream>
GeomMakeShapePtr anIntersectionAlgo(new GeomAlgoAPI_Intersection(anObjects));
// Checking that the algorithm worked properly.
- if (!anIntersectionAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Intersection algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (anIntersectionAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!anIntersectionAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ std::string anError;
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anIntersectionAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
setResult(aResultBody, aResultIndex);
aResultIndex++;
-
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);
}
const GeomMakeShapePtr& theMakeShape)
{
std::shared_ptr<GeomAPI_Shape> aResultShape = theMakeShape->shape();
- theResultBody->storeModified(theObjects.front(), aResultShape);
+
+ if(theObjects.front()->isEqual(aResultShape)) {
+ theResultBody->store(aResultShape, false);
+ return;
+ }
+
+ theResultBody->storeModified(theObjects, aResultShape, theMakeShape);
const int aShapeTypesNb = 3;
const GeomAPI_Shape::ShapeType aShapeTypes[aShapeTypesNb] = {GeomAPI_Shape::VERTEX,