X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FFeaturesPlugin%2FFeaturesPlugin_Partition.cpp;h=4e84bef15a1df03452186b6c29365aaebd3dedde;hb=919584a7e5ee83c384873c2627b9865e8ba02272;hp=7d5e2e90c5f23d1e5f5ad882df715cc45b17f50f;hpb=3f1a42a51c7de1911c75453ff7134593d7d2c6b1;p=modules%2Fshaper.git diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp index 7d5e2e90c..4e84bef15 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -56,6 +57,13 @@ void FeaturesPlugin_Partition::execute() anObjects.push_back(anObject); } } + + if(anObjects.empty()) { + static const std::string aFeatureError = "Error: No objects for partition."; + setError(aFeatureError); + return; + } + std::list > aBoundingPoints = GeomAlgoAPI_ShapeTools::getBoundingBox(anObjects, 1.0); // Resize planes. @@ -136,8 +144,9 @@ void FeaturesPlugin_Partition::storeResult(const ListOfShape& theObjects, ResultBodyPtr aResultBody = document()->createBody(data(), theIndex); // Store modified shape. - if(aBaseShape->isEqual(theResultShape)) { + if(!aBaseShape.get() || aBaseShape->isEqual(theResultShape)) { aResultBody->store(theResultShape); + setResult(aResultBody, theIndex); return; } @@ -151,15 +160,16 @@ void FeaturesPlugin_Partition::storeResult(const ListOfShape& theObjects, std::shared_ptr aMapOfSubShapes = theMakeShape->mapOfSubShapes(); int anIndex = 1; for(ListOfShape::const_iterator anIt = theObjects.cbegin(); anIt != theObjects.cend(); ++anIt) { - std::ostringstream aStream; - aStream << aModName << "_" << anIndex++; + std::string aModEdgeName = aModName + "_Edge_" + std::to_string((long long)anIndex); + std::string aModFaceName = aModName + "_Face_" + std::to_string((long long)anIndex++); aResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), *anIt, GeomAPI_Shape::EDGE, - aModTag, aStream.str(), *aMapOfSubShapes.get(), true); + aModTag, aModEdgeName, *aMapOfSubShapes.get(), true); + aModTag += 1000; aResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), *anIt, GeomAPI_Shape::FACE, - aModTag, aStream.str(), *aMapOfSubShapes.get(), true); + aModTag, aModFaceName, *aMapOfSubShapes.get(), true); + aModTag += 1000; aResultBody->loadDeletedShapes(theMakeShape.get(), *anIt, GeomAPI_Shape::EDGE, aDelTag); aResultBody->loadDeletedShapes(theMakeShape.get(), *anIt, GeomAPI_Shape::FACE, aDelTag); - aModTag += 10000; } setResult(aResultBody, theIndex);