X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FBuildPlugin%2FBuildPlugin_Filling.cpp;h=c9ce8a257a64e0ebbda3f69c01c98b23dad63527;hb=4cb749258f33b7de231da5bb50140407c0599d30;hp=7e2c884ced1522ec4055a6248901b5cd83984dc0;hpb=dc7d4d86b58b81684abc9b5a2be8ec30f210c2da;p=modules%2Fshaper.git diff --git a/src/BuildPlugin/BuildPlugin_Filling.cpp b/src/BuildPlugin/BuildPlugin_Filling.cpp index 7e2c884ce..c9ce8a257 100644 --- a/src/BuildPlugin/BuildPlugin_Filling.cpp +++ b/src/BuildPlugin/BuildPlugin_Filling.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2017-20xx CEA/DEN, EDF R&D +// Copyright (C) 2017-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,10 +12,9 @@ // // 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 "BuildPlugin_Filling.h" @@ -30,6 +29,7 @@ #include #include #include +#include #include #include @@ -67,8 +67,8 @@ void BuildPlugin_Filling::initAttributes() data()->addAttribute(TOLERANCE_3D_ID(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(APPROXIMATION_ID(), ModelAPI_AttributeBoolean::typeId()); - restoreDefaultParameters(); - string(ADVANCED_OPTIONS_ID())->setValue(""); + if (string(ADVANCED_OPTIONS_ID())->value().empty()) + restoreDefaultParameters(); } //================================================================================================= @@ -95,8 +95,10 @@ void BuildPlugin_Filling::execute() // get base objects list AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID()); - if (aSelectionList->size() <= 1) + if (aSelectionList->size() <= 1) { + setError("Not enough objects is selected"); return; + } // collect base shapes for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) { @@ -114,7 +116,9 @@ void BuildPlugin_Filling::execute() // build result aFilling->build(aParameters.isApprox); - if (isAlgorithmFailed(aFilling)) { + std::string anError; + if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilling, getKind(), anError)) { + setError(anError); removeResults(0); return; } @@ -127,32 +131,11 @@ void BuildPlugin_Filling::execute() int anEdgeInd = 0; for(GeomAPI_ShapeExplorer anExp(aCreatedFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) { GeomShapePtr anEdge = anExp.current(); - aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeInd), ++anEdgeInd); + aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeInd)); } setResult(aResultBody, 0); } -bool BuildPlugin_Filling::isAlgorithmFailed( - const std::shared_ptr& theAlgorithm) -{ - if (!theAlgorithm->isDone()) { - static const std::string aFeatureError = "Error: filling algorithm failed."; - setError(aFeatureError); - return true; - } - if (theAlgorithm->shape()->isNull()) { - static const std::string aShapeError = "Error: Resulting shape of filling is Null."; - setError(aShapeError); - return true; - } - if (!theAlgorithm->isValid()) { - std::string aFeatureError = "Error: Resulting shape of filling is not valid."; - setError(aFeatureError); - return true; - } - return false; -} - //================================================================================================= void BuildPlugin_Filling::attributeChanged(const std::string& theID) {