X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Boolean.cpp;h=d3fcd0ba506dd41acd7efc5474a7b9b8c8da09d3;hb=ea593bc59e7e9461f6c4e2afd3f24d621edb1011;hp=81848ff1131d9df47f0b2f6dd7d560bccc71243f;hpb=c458464ec86d4031ff1a476d2b368146bc3c932a;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp index 81848ff11..d3fcd0ba5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.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,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 "FeaturesPlugin_Boolean.h" @@ -31,11 +30,14 @@ #include #include +#include #include #include #include #include +#include #include +#include #include #include #include @@ -63,20 +65,6 @@ void FeaturesPlugin_Boolean::initAttributes() ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID()); } -//================================================================================================= -std::shared_ptr FeaturesPlugin_Boolean::getShape(const std::string& theAttrName) -{ - std::shared_ptr aObjRef = std::dynamic_pointer_cast< - ModelAPI_AttributeReference>(data()->attribute(theAttrName)); - if (aObjRef) { - std::shared_ptr aConstr = std::dynamic_pointer_cast< - ModelAPI_ResultBody>(aObjRef->value()); - if (aConstr) - return aConstr->shape(); - } - return std::shared_ptr(); -} - //================================================================================================= FeaturesPlugin_Boolean::OperationType FeaturesPlugin_Boolean::operationType() { @@ -115,3 +103,39 @@ void FeaturesPlugin_Boolean::loadNamingDS(std::shared_ptr t theResultBody->loadDeletedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE); } } + +//================================================================================================= +void FeaturesPlugin_Boolean::storeResult( + const ListOfShape& theObjects, + const ListOfShape& theTools, + const GeomShapePtr theResultShape, + int& theResultIndex, + std::shared_ptr theMakeShapeList, + std::vector& theResultBaseAlgoList) +{ + if (!theResultShape) + return; + + std::shared_ptr aResultBody = + document()->createBody(data(), theResultIndex); + + FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, + theObjects, + theTools, + theMakeShapeList, + theResultShape); + setResult(aResultBody, theResultIndex++); + + // merge algorithms + FeaturesPlugin_Tools::ResultBaseAlgo aRBA; + aRBA.resultBody = aResultBody; + aRBA.baseShape = theObjects.front(); + for (std::vector::iterator + aRBAIt = theResultBaseAlgoList.begin(); + aRBAIt != theResultBaseAlgoList.end(); ++aRBAIt) { + theMakeShapeList->appendAlgo(aRBAIt->makeShape); + } + aRBA.makeShape = theMakeShapeList; + theResultBaseAlgoList.clear(); + theResultBaseAlgoList.push_back(aRBA); +}