From 1360833d0861ef1dac27f1c89773d6c11df63b47 Mon Sep 17 00:00:00 2001 From: dbv Date: Wed, 10 Jun 2015 18:43:16 +0300 Subject: [PATCH] Naming for extrusion cut. --- src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp | 3 -- src/FeaturesPlugin/FeaturesPlugin_Boolean.h | 2 +- .../FeaturesPlugin_ExtrusionCut.cpp | 39 +++++++++++++++---- .../FeaturesPlugin_ExtrusionCut.h | 8 ++++ 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp index 555590596..80effcb20 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp @@ -130,9 +130,6 @@ void FeaturesPlugin_Boolean::execute() if(GeomAlgoAPI_ShapeProps::volume(aBoolAlgo.shape()) > 1.e-7) { std::shared_ptr aResultBody = document()->createBody(data(), aResultIndex); - std::shared_ptr aMakeShapeList = std::shared_ptr( - new GeomAlgoAPI_MakeShapeList(aListOfMakeShape)); - LoadNamingDS(aResultBody, anObject, aTools, aBoolAlgo); setResult(aResultBody, aResultIndex); aResultIndex++; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Boolean.h b/src/FeaturesPlugin/FeaturesPlugin_Boolean.h index 20f29ddbf..df9065b25 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Boolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Boolean.h @@ -9,7 +9,7 @@ #include "FeaturesPlugin.h" #include -#include + #include class GeomAlgoAPI_MakeShapeList; diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp index 63409d438..6cd449d82 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp @@ -171,13 +171,38 @@ void FeaturesPlugin_ExtrusionCut::execute() if(GeomAlgoAPI_ShapeProps::volume(aBoolAlgo.shape()) > 1.e-7) { std::shared_ptr aResultBody = document()->createBody(data(), aResultIndex); - if(anObject->isEqual(aBoolAlgo.shape())) { - aResultBody->store(aBoolAlgo.shape()); - } else { - aResultBody->storeModified(anObject, aBoolAlgo.shape()); - setResult(aResultBody, aResultIndex); - aResultIndex++; - } + LoadNamingDS(aResultBody, anObject, anExtrusionList, aBoolAlgo); + setResult(aResultBody, aResultIndex); + aResultIndex++; + } + } +} + +//================================================================================================= +void FeaturesPlugin_ExtrusionCut::LoadNamingDS(std::shared_ptr theResultBody, + const std::shared_ptr& theBaseShape, + const ListOfShape& theTools, + const GeomAlgoAPI_Boolean& theAlgo) +{ + //load result + if(theBaseShape->isEqual(theAlgo.shape())) { + theResultBody->store(theAlgo.shape()); + } else { + theResultBody->storeModified(theBaseShape, theAlgo.shape()); + + GeomAPI_DataMapOfShapeShape* aSubShapes = new GeomAPI_DataMapOfShapeShape(); + + const int aModTag = 1; + const int aDeleteTag = 2; + const std::string aModName = "Modified"; + theResultBody->loadAndOrientModifiedShapes(theAlgo.makeShape().get(), theBaseShape, GeomAPI_Shape::FACE, + aModTag, aModName, *theAlgo.mapOfShapes().get()); + theResultBody->loadDeletedShapes(theAlgo.makeShape().get(), theBaseShape, GeomAPI_Shape::FACE, aDeleteTag); + + for(ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++) { + theResultBody->loadAndOrientModifiedShapes(theAlgo.makeShape().get(), *anIter, GeomAPI_Shape::FACE, + aModTag, aModName, *theAlgo.mapOfShapes().get()); + theResultBody->loadDeletedShapes(theAlgo.makeShape().get(), *anIter, GeomAPI_Shape::FACE, aDeleteTag); } } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h index 650a6bcc0..5735242fa 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h @@ -11,6 +11,8 @@ #include +#include + /** \class FeaturesPlugin_ExtrusionCut * \ingroup Plugins */ @@ -101,6 +103,12 @@ class FeaturesPlugin_ExtrusionCut : public ModelAPI_CompositeFeature /// This method to inform that sub-feature is removed and must be removed from the internal data /// structures of the owner (the remove from the document will be done outside just after) FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr theFeature); + +private: + void LoadNamingDS(std::shared_ptr theResultBody, + const std::shared_ptr& theBaseShape, + const ListOfShape& theTools, + const GeomAlgoAPI_Boolean& theAlgo); }; #endif -- 2.39.2