From: dbv Date: Tue, 1 Sep 2015 08:38:13 +0000 (+0300) Subject: Partition naming X-Git-Tag: V_1.4.0_beta4~175 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=61174325c0d2309e15854d81f138e9a8832083f9;p=modules%2Fshaper.git Partition naming --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp index e05b22cf5..b761d0665 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp @@ -369,8 +369,6 @@ void FeaturesPlugin_Boolean::loadNamingDS(std::shared_ptr t theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag); - GeomAPI_DataMapOfShapeShape* aSubShapes = new GeomAPI_DataMapOfShapeShape(); - std::string aModName = "Modified"; theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE, aModifyTag, aModName, theMapOfShapes); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp index 362081c0b..6000c9d84 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.cpp @@ -123,11 +123,8 @@ void FeaturesPlugin_Partition::execute() if (GeomAlgoAPI_ShapeTools::volume(aPartitionAlgo.shape()) > 1.e-7) { std::shared_ptr aResultBody = document()->createBody(data(), aResultIndex); - aResultBody->store(aPartitionAlgo.shape()); - -// LoadNamingDS(aResultBody, anObject, aTools, aPartitionAlgo); - + loadNamingDS(aResultBody, anObject, aTools, aPartitionAlgo); setResult(aResultBody, aResultIndex); aResultIndex++; } @@ -136,3 +133,35 @@ void FeaturesPlugin_Partition::execute() // remove the rest results if there were produced in the previous pass removeResults(aResultIndex); } + +//================================================================================================= +void FeaturesPlugin_Partition::loadNamingDS(std::shared_ptr theResultBody, + const std::shared_ptr theBaseShape, + const ListOfShape& theTools, + const GeomAlgoAPI_Partition& thePartitionAlgo) +{ + //load result + if(theBaseShape->isEqual(thePartitionAlgo.shape())) { + theResultBody->store(thePartitionAlgo.shape()); + } else { + const int aModifyTag = 1; + const int aDeletedTag = 2; + const int aSubsolidsTag = 3; /// sub solids will be placed at labels 3, 4, etc. if result is compound of solids + + theResultBody->storeModified(theBaseShape, thePartitionAlgo.shape(), aSubsolidsTag); + + std::shared_ptr aMkShape = thePartitionAlgo.makeShape(); + std::shared_ptr aMapOfShapes = thePartitionAlgo.mapOfShapes(); + + std::string aModName = "Modified"; + theResultBody->loadAndOrientModifiedShapes(aMkShape.get(), theBaseShape, GeomAPI_Shape::FACE, + aModifyTag, aModName, *aMapOfShapes.get()); + theResultBody->loadDeletedShapes(aMkShape.get(), theBaseShape, GeomAPI_Shape::FACE, aDeletedTag); + + for(ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++) { + theResultBody->loadAndOrientModifiedShapes(aMkShape.get(), *anIter, GeomAPI_Shape::FACE, + aModifyTag, aModName, *aMapOfShapes.get()); + theResultBody->loadDeletedShapes(aMkShape.get(), *anIter, GeomAPI_Shape::FACE, aDeletedTag); + } + } +} diff --git a/src/FeaturesPlugin/FeaturesPlugin_Partition.h b/src/FeaturesPlugin/FeaturesPlugin_Partition.h index 444d3e8fb..a058fd843 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_Partition.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Partition.h @@ -10,6 +10,8 @@ #include "FeaturesPlugin.h" #include +#include + /**\class FeaturesPlugin_Partition * \ingroup Plugins * \brief Feature for applying of Partition operations on Solids. Partition makes conjunctional @@ -57,6 +59,12 @@ public: private: std::shared_ptr getShape(const std::string& theAttrName); + /// Load Naming data structure of the feature to the document + void loadNamingDS(std::shared_ptr theResultBody, + const std::shared_ptr theBaseShape, + const ListOfShape& theTools, + const GeomAlgoAPI_Partition& thePartitionAlgo); + }; #endif diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp index 512ac28c6..cd1e00d28 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_Partition.cpp @@ -47,14 +47,12 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, myMkShape.reset(new GeomAlgoAPI_MakeShape(anOperation, GeomAlgoAPI_MakeShape::BOPAlgoBuilder)); // Getting objects. - TopTools_ListOfShape anObjects; for (ListOfShape::const_iterator anObjectsIt = theObjects.begin(); anObjectsIt != theObjects.end(); anObjectsIt++) { const TopoDS_Shape& aShape = (*anObjectsIt)->impl(); anOperation->AddArgument(aShape); } // Getting tools. - TopTools_ListOfShape aTools; for (ListOfShape::const_iterator aToolsIt = theTools.begin(); aToolsIt != theTools.end(); aToolsIt++) { const TopoDS_Shape& aShape = (*aToolsIt)->impl(); anOperation->AddTool(aShape); @@ -81,7 +79,6 @@ void GeomAlgoAPI_Partition::build(const ListOfShape& theObjects, } myShape.reset(new GeomAPI_Shape()); myShape->setImpl(new TopoDS_Shape(aResult)); - } //=================================================================================================