From: dbv Date: Wed, 23 Dec 2015 14:26:16 +0000 (+0300) Subject: Composite features update due to changes in Extrusion and Revolution algos X-Git-Tag: V_2.1.0~84 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ea4d65430ad05a8f47f4c2d95c4b09260d6ed3ab;p=modules%2Fshaper.git Composite features update due to changes in Extrusion and Revolution algos --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp index f31196f42..2737a82fb 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -142,7 +143,7 @@ void FeaturesPlugin_CompositeBoolean::execute() // Pass shells/faces to solids creation function. ListOfShape aTools; - std::list> aSolidsAlgos; + ListOfMakeShape aSolidsAlgos; makeSolids(aShells, aTools, aSolidsAlgos); if(aTools.empty()) { return; @@ -377,7 +378,7 @@ void FeaturesPlugin_CompositeBoolean::execute() //================================================================================================= void FeaturesPlugin_CompositeBoolean::loadNamingDS(std::shared_ptr theResultBody, const ListOfShape& theShells, - const std::list>& theSolidsAlgos, + ListOfMakeShape& theSolidsAlgos, const std::shared_ptr theBaseShape, const ListOfShape& theTools, const std::shared_ptr theResultShape, @@ -403,47 +404,39 @@ void FeaturesPlugin_CompositeBoolean::loadNamingDS(std::shared_ptrstoreModified(theBaseShape, theResultShape, aSubsolidsTag); ListOfShape::const_iterator aShellsIter = theShells.begin(); - std::list>::const_iterator aSolidsAlgosIter = theSolidsAlgos.begin(); + ListOfMakeShape::const_iterator aSolidsAlgosIter = theSolidsAlgos.begin(); for(; aShellsIter != theShells.end() && aSolidsAlgosIter != theSolidsAlgos.end(); aShellsIter++, aSolidsAlgosIter++) { - ListOfShape aFromFaces; - ListOfShape aToFaces; - std::shared_ptr aSubShapes; - //Insert lateral face : Face from Edge - if(std::dynamic_pointer_cast(*aSolidsAlgosIter)) { - std::shared_ptr aPrismAlgo = std::dynamic_pointer_cast(*aSolidsAlgosIter); - aSubShapes = aPrismAlgo->mapOfSubShapes(); - theResultBody->loadAndOrientGeneratedShapes(aPrismAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag, + std::shared_ptr aSolidAlgo = std::dynamic_pointer_cast(*aSolidsAlgosIter); + if(aSolidAlgo.get()) { + std::shared_ptr aSubShapes = aSolidAlgo->mapOfSubShapes(); + theResultBody->loadAndOrientGeneratedShapes(aSolidAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag, aLatName, *aSubShapes.get()); - aFromFaces = aPrismAlgo->fromFaces(); - aToFaces = aPrismAlgo->toFaces(); - } else if(std::dynamic_pointer_cast(*aSolidsAlgosIter)) { - std::shared_ptr aRevolAlgo = std::dynamic_pointer_cast(*aSolidsAlgosIter); - aSubShapes = aRevolAlgo->mapOfSubShapes(); - theResultBody->loadAndOrientGeneratedShapes(aRevolAlgo.get(), *aShellsIter, GeomAPI_Shape::EDGE, aGenTag, - aLatName, *aSubShapes.get()); - aFromFaces = aRevolAlgo->fromFaces(); - aToFaces = aRevolAlgo->toFaces(); - } - //Insert to faces - for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) { - std::shared_ptr aToFace = *anIt; - if(aSubShapes->isBound(aToFace)) { - aToFace = aSubShapes->find(aToFace); - } - theResultBody->generated(aToFace, aToName, aToTag++); - } + std::shared_ptr aSweepAlgo = std::dynamic_pointer_cast(aSolidAlgo); + if(aSweepAlgo.get()) { + //Insert to faces + const ListOfShape& aToFaces = aSweepAlgo->toFaces(); + for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) { + std::shared_ptr aToFace = *anIt; + if(aSubShapes->isBound(aToFace)) { + aToFace = aSubShapes->find(aToFace); + } + theResultBody->generated(aToFace, aToName, aToTag++); + } - //Insert from faces - if (aFromTag < aToTag) aFromTag = aToTag; - for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) { - std::shared_ptr aFromFace = *anIt; - if(aSubShapes->isBound(aFromFace)) { - aFromFace = aSubShapes->find(aFromFace); + //Insert from faces + const ListOfShape& aFromFaces = aSweepAlgo->fromFaces(); + if (aFromTag < aToTag) aFromTag = aToTag; + for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) { + std::shared_ptr aFromFace = *anIt; + if(aSubShapes->isBound(aFromFace)) { + aFromFace = aSubShapes->find(aFromFace); + } + theResultBody->generated(aFromFace, aFromName, aFromTag++); + } } - theResultBody->generated(aFromFace, aFromName, aFromTag++); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h index bc2e313d7..f171bc6e8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h @@ -78,12 +78,12 @@ protected: /// Define this function to create solids from faces with extrusion/revolution. virtual void makeSolids(const ListOfShape& theFaces, ListOfShape& theResults, - std::list>& theAlgos) = 0; + ListOfMakeShape& theAlgos) = 0; /// Results naming. void loadNamingDS(std::shared_ptr theResultBody, const ListOfShape& theShells, - const std::list>& theSolidsAlgos, + ListOfMakeShape& theSolidsAlgos, const std::shared_ptr theBaseShape, const ListOfShape& theTools, const std::shared_ptr theResultShape, diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index d9ff9ccfc..3f95c49e8 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -140,20 +140,17 @@ void FeaturesPlugin_CompositeSketch::execute() int aErrorsNum = 0; int aResultIndex = 0; for(ListOfShape::const_iterator anIter = aShells.cbegin(); anIter != aShells.cend(); anIter++) { - std::shared_ptr aResult; - ListOfShape aFromFaces, aToFaces; std::shared_ptr aMakeShape; - std::shared_ptr aDataMap; std::shared_ptr aBaseFace = *anIter; - makeSolid(aBaseFace, aResult, aFromFaces, aToFaces, aMakeShape, aDataMap); - if(!aResult.get()) { + makeSolid(aBaseFace, aMakeShape); + if(!aMakeShape.get()) { aErrorsNum++; continue; } ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex); - loadNamingDS(aResultBody, aBaseFace, aResult, aFromFaces, aToFaces, aMakeShape, aDataMap); + loadNamingDS(aResultBody, aBaseFace, aMakeShape); setResult(aResultBody, aResultIndex); aResultIndex++; } @@ -171,39 +168,41 @@ void FeaturesPlugin_CompositeSketch::execute() //================================================================================================= void FeaturesPlugin_CompositeSketch::loadNamingDS(std::shared_ptr theResultBody, const std::shared_ptr& theBaseShape, - const std::shared_ptr& theResult, - const ListOfShape& theFromFaces, - const ListOfShape& theToFaces, - const std::shared_ptr& theMakeShape, - const std::shared_ptr& theDataMap) + const std::shared_ptr& theMakeShape) { //load result - theResultBody->storeGenerated(theBaseShape, theResult); + theResultBody->storeGenerated(theBaseShape, theMakeShape->shape()); //Insert lateral face : Face from Edge const std::string aLatName = "LateralFace"; const int aLatTag = 1; - theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, GeomAPI_Shape::EDGE, aLatTag, aLatName, *theDataMap); - - //Insert to faces - const std::string aToName = "ToFace"; - int aToTag = 2; - for(ListOfShape::const_iterator anIt = theToFaces.cbegin(); anIt != theToFaces.cend(); anIt++) { - std::shared_ptr aToFace = *anIt; - if(theDataMap->isBound(aToFace)) { - aToFace = theDataMap->find(aToFace); + std::shared_ptr aDataMap = theMakeShape->mapOfSubShapes(); + theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, GeomAPI_Shape::EDGE, aLatTag, aLatName, *aDataMap.get()); + + std::shared_ptr aSweepAlgo = std::dynamic_pointer_cast(theMakeShape); + if(aSweepAlgo.get()) { + //Insert to faces + const std::string aToName = "ToFace"; + int aToTag = 2; + const ListOfShape& aToFaces = aSweepAlgo->toFaces(); + for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) { + std::shared_ptr aToFace = *anIt; + if(aDataMap->isBound(aToFace)) { + aToFace = aDataMap->find(aToFace); + } + theResultBody->generated(aToFace, aToName, aToTag++); } - theResultBody->generated(aToFace, aToName, aToTag++); - } - //Insert from faces - const std::string aFromName = "FromFace"; - int aFromTag = aToTag > 10000 ? aToTag : 10000; - for(ListOfShape::const_iterator anIt = theFromFaces.cbegin(); anIt != theFromFaces.cend(); anIt++) { - std::shared_ptr aFromFace = *anIt; - if(theDataMap->isBound(aFromFace)) { - aFromFace = theDataMap->find(aFromFace); + //Insert from faces + const std::string aFromName = "FromFace"; + int aFromTag = aToTag > 10000 ? aToTag : 10000; + const ListOfShape& aFromFaces = aSweepAlgo->fromFaces(); + for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) { + std::shared_ptr aFromFace = *anIt; + if(aDataMap->isBound(aFromFace)) { + aFromFace = aDataMap->find(aFromFace); + } + theResultBody->generated(aFromFace, aFromName, aFromTag++); } - theResultBody->generated(aFromFace, aFromName, aFromTag++); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h index 350369699..d4307edeb 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h @@ -70,20 +70,12 @@ protected: /// Define this function to create solids from faces with extrusion/revolution. virtual void makeSolid(const std::shared_ptr theFace, - std::shared_ptr& theResult, - ListOfShape& theFromFaces, - ListOfShape& theToFaces, - std::shared_ptr& theMakeShape, - std::shared_ptr& theDataMap) = 0; + std::shared_ptr& theMakeShape) = 0; /// Results naming. void loadNamingDS(std::shared_ptr theResultBody, const std::shared_ptr& theBaseShape, - const std::shared_ptr& theResult, - const ListOfShape& theFromFaces, - const ListOfShape& theToFaces, - const std::shared_ptr& theMakeShape, - const std::shared_ptr& theDataMap); + const std::shared_ptr& theMakeShape); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp index 7fceaf804..79b5cda61 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp @@ -35,7 +35,7 @@ void FeaturesPlugin_ExtrusionBoolean::initMakeSolidsAttributes() //================================================================================================= void FeaturesPlugin_ExtrusionBoolean::makeSolids(const ListOfShape& theFaces, ListOfShape& theResults, - std::list>& theAlgos) + ListOfMakeShape& theAlgos) { // Getting extrusion sizes. double aToSize = 0.0; diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h index c8962430d..b9efd63f6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h @@ -73,7 +73,7 @@ protected: /// Create solids from faces with extrusion. virtual void makeSolids(const ListOfShape& theFaces, ListOfShape& theResults, - std::list>& theAlgos); + ListOfMakeShape& theAlgos); protected: FeaturesPlugin_ExtrusionBoolean(){}; diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionSketch.cpp index 94fb46a4c..7854fc251 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionSketch.cpp @@ -39,11 +39,7 @@ void FeaturesPlugin_ExtrusionSketch::initMakeSolidsAttributes() //================================================================================================= void FeaturesPlugin_ExtrusionSketch::makeSolid(const std::shared_ptr theFace, - std::shared_ptr& theResult, - ListOfShape& theFromFaces, - ListOfShape& theToFaces, - std::shared_ptr& theMakeShape, - std::shared_ptr& theDataMap) + std::shared_ptr& theMakeShape) { // Getting extrusion sizes. double aToSize = 0.0; @@ -87,9 +83,5 @@ void FeaturesPlugin_ExtrusionSketch::makeSolid(const std::shared_ptrshape(); - theFromFaces = aPrismAlgo->fromFaces(); - theToFaces = aPrismAlgo->toFaces(); theMakeShape = aPrismAlgo; - theDataMap = aPrismAlgo->mapOfSubShapes(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionSketch.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionSketch.h index 71e934aca..fd6da45fc 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionSketch.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionSketch.h @@ -86,11 +86,7 @@ protected: /// Create solid from face with extrusion. virtual void makeSolid(const std::shared_ptr theFace, - std::shared_ptr& theResult, - ListOfShape& theFromFaces, - ListOfShape& theToFaces, - std::shared_ptr& theMakeShape, - std::shared_ptr& theDataMap); + std::shared_ptr& theMakeShape); public: /// Use plugin manager for features creation. diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp index ee3e750db..566cac8a1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp @@ -39,7 +39,7 @@ void FeaturesPlugin_RevolutionBoolean::initMakeSolidsAttributes() //================================================================================================= void FeaturesPlugin_RevolutionBoolean::makeSolids(const ListOfShape& theFaces, ListOfShape& theResults, - std::list>& theAlgos) + ListOfMakeShape& theAlgos) { //Getting axis. std::shared_ptr anAxis; diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h index 16862065f..b645190f7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h @@ -79,7 +79,7 @@ protected: /// Create solids from faces with revolution. virtual void makeSolids(const ListOfShape& theFaces, ListOfShape& theResults, - std::list>& theAlgos); + ListOfMakeShape& theAlgos); protected: FeaturesPlugin_RevolutionBoolean(){}; diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_RevolutionSketch.cpp index b2acb5c92..183508057 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionSketch.cpp @@ -43,11 +43,7 @@ void FeaturesPlugin_RevolutionSketch::initMakeSolidsAttributes() //================================================================================================= void FeaturesPlugin_RevolutionSketch::makeSolid(const std::shared_ptr theFace, - std::shared_ptr& theResult, - ListOfShape& theFromFaces, - ListOfShape& theToFaces, - std::shared_ptr& theMakeShape, - std::shared_ptr& theDataMap) + std::shared_ptr& theMakeShape) { //Getting axis. std::shared_ptr anAxis; @@ -104,9 +100,5 @@ void FeaturesPlugin_RevolutionSketch::makeSolid(const std::shared_ptrshape(); - theFromFaces = aRevolAlgo->fromFaces(); - theToFaces = aRevolAlgo->toFaces(); theMakeShape = aRevolAlgo; - theDataMap = aRevolAlgo->mapOfSubShapes(); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionSketch.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionSketch.h index fe914cc5d..b3d61b269 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionSketch.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionSketch.h @@ -93,11 +93,7 @@ protected: /// Create solids from faces with revolution. virtual void makeSolid(const std::shared_ptr theFace, - std::shared_ptr& theResult, - ListOfShape& theFromFaces, - ListOfShape& theToFaces, - std::shared_ptr& theMakeShape, - std::shared_ptr& theDataMap); + std::shared_ptr& theMakeShape); public: /// Use plugin manager for features creation.