X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_MultiTranslation.cpp;h=b9af9671352fd044aa1e628b1af8dad648aa5916;hb=7417054f9f86129249fdfd652f804183484986ee;hp=d0e5360c4cb84c4b62ce5dae05770b381afd0fb2;hpb=690f27cde078b45ef727686558c1ae4f3685ece9;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp index d0e5360c4..b9af96713 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.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,15 +12,16 @@ // // 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 +#include #include +#include #include #include @@ -88,6 +89,7 @@ void FeaturesPlugin_MultiTranslation::performOneDirection() AttributeSelectionListPtr anObjectsSelList = selectionList(FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID()); if (anObjectsSelList->size() == 0) { + setError("Error: empty selection list"); return; } for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) { @@ -125,11 +127,6 @@ void FeaturesPlugin_MultiTranslation::performOneDirection() GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } - else - { - setError(aSelectionError); - return; - } if (!anEdge.get()) { @@ -176,7 +173,8 @@ void FeaturesPlugin_MultiTranslation::performOneDirection() } else { std::string anError; ListOfShape aListOfShape; - std::list > aListOfTranslationAlgo; + std::shared_ptr + aListOfTranslationAlgo(new GeomAlgoAPI_MakeShapeList); for (int i=0; i aTranslationAlgo( @@ -196,13 +194,16 @@ void FeaturesPlugin_MultiTranslation::performOneDirection() break; } aListOfShape.push_back(aTranslationAlgo->shape()); - aListOfTranslationAlgo.push_back(aTranslationAlgo); + aListOfTranslationAlgo->appendAlgo(aTranslationAlgo); } std::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - aResultBody->storeModified(aBaseShape, aCompound); - loadNamingDS(aListOfTranslationAlgo, aResultBody, aBaseShape); + + ListOfShape aBaseShapes; + aBaseShapes.push_back(aBaseShape); + FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapes, ListOfShape(), + aListOfTranslationAlgo, aCompound, "Translated"); setResult(aResultBody, aResultIndex); } @@ -222,6 +223,7 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection() AttributeSelectionListPtr anObjectsSelList = selectionList(FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID()); if (anObjectsSelList->size() == 0) { + setError("Error: empty selection list"); return; } for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) { @@ -259,11 +261,6 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection() GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } - else - { - setError(aSelectionError); - return; - } if (!anEdge.get()) { @@ -296,11 +293,6 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection() GeomAPI_ShapeIterator anIt(aShape); anEdge = anIt.current()->edge(); } - else - { - setError(aSelectionError); - return; - } if (!anEdge.get()) { @@ -374,7 +366,8 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection() } else { std::string anError; ListOfShape aListOfShape; - std::list > aListOfTranslationAlgo; + std::shared_ptr + aListOfTranslationAlgo(new GeomAlgoAPI_MakeShapeList); for (int j=0; jshape()); - aListOfTranslationAlgo.push_back(aTranslationAlgo); + aListOfTranslationAlgo->appendAlgo(aTranslationAlgo); } } std::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - aResultBody->storeModified(aBaseShape, aCompound); - loadNamingDS(aListOfTranslationAlgo, aResultBody, aBaseShape); + + ListOfShape aBaseShapes; + aBaseShapes.push_back(aBaseShape); + FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShapes, ListOfShape(), + aListOfTranslationAlgo, aCompound, "Translated"); + setResult(aResultBody, aResultIndex); } aResultIndex++; @@ -414,31 +411,3 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection() // Remove the rest results if there were produced in the previous pass. removeResults(aResultIndex); } - -//================================================================================================= -void FeaturesPlugin_MultiTranslation::loadNamingDS( - std::list > theListOfTranslationAlgo, - std::shared_ptr theResultBody, - std::shared_ptr theBaseShape) -{ - for (std::list >::const_iterator anIt = - theListOfTranslationAlgo.begin(); anIt != theListOfTranslationAlgo.cend(); ++anIt) { - // naming of faces - theResultBody->loadModifiedShapes(*anIt, - theBaseShape, - GeomAPI_Shape::FACE, - "Translated_Face"); - - // naming of edges - theResultBody->loadModifiedShapes(*anIt, - theBaseShape, - GeomAPI_Shape::EDGE, - "Translated_Edge"); - - // naming of vertex - theResultBody->loadModifiedShapes(*anIt, - theBaseShape, - GeomAPI_Shape::VERTEX, - "Translated_Vertex"); - } -}