From 31cb13c6f72349480240ab828a4befc0ef45baed Mon Sep 17 00:00:00 2001 From: dbv Date: Wed, 17 Oct 2018 17:18:39 +0300 Subject: [PATCH] Updated generated shapes storing. --- src/BuildPlugin/BuildPlugin_Polyline.cpp | 2 +- .../FeaturesPlugin_CompositeBoolean.cpp | 25 +--- .../FeaturesPlugin_CompositeBoolean.h | 7 +- .../FeaturesPlugin_CompositeSketch.cpp | 74 ++++------- .../FeaturesPlugin_CompositeSketch.h | 7 +- .../FeaturesPlugin_ExtrusionBoolean.cpp | 6 +- .../FeaturesPlugin_ExtrusionBoolean.h | 3 +- src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp | 22 ++-- src/FeaturesPlugin/FeaturesPlugin_Fillet.h | 1 - src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp | 108 +++++++--------- src/FeaturesPlugin/FeaturesPlugin_Pipe.h | 8 +- .../FeaturesPlugin_RevolutionBoolean.cpp | 6 +- .../FeaturesPlugin_RevolutionBoolean.h | 3 +- src/FeaturesPlugin/FeaturesPlugin_Tools.cpp | 6 +- src/Model/Model_BodyBuilder.cpp | 118 +++++++++--------- src/Model/Model_BodyBuilder.h | 10 +- src/ModelAPI/ModelAPI_BodyBuilder.h | 10 +- src/ModelAPI/ModelAPI_ResultBody.cpp | 15 +-- src/ModelAPI/ModelAPI_ResultBody.h | 10 +- 19 files changed, 176 insertions(+), 265 deletions(-) diff --git a/src/BuildPlugin/BuildPlugin_Polyline.cpp b/src/BuildPlugin/BuildPlugin_Polyline.cpp index 312f17790..17702ae33 100644 --- a/src/BuildPlugin/BuildPlugin_Polyline.cpp +++ b/src/BuildPlugin/BuildPlugin_Polyline.cpp @@ -115,7 +115,7 @@ void BuildPlugin_Polyline::execute() for (; anExp.more() && aPointsIt != aPoints.cend(); anExp.next(), ++aPointsIt) { GeomShapePtr aPoint = *aPointsIt; GeomShapePtr anEdge = anExp.current(); - aResultBody->generated(aPoint, anEdge, "Edge"); + aResultBody->generated(aPoint, anEdge); } if (!isClosed) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp index e17304991..1c486f59e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp @@ -95,17 +95,15 @@ void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean() ListOfMakeShape::const_iterator aGenMSIt = aGenMakeShapes.cbegin(); for(; aGenBaseIt != aGenBaseShapes.cend() && aGenMSIt != aGenMakeShapes.cend(); ++aGenBaseIt, ++aGenMSIt) { - storeGenerationHistory(aResultBody, *aGenBaseIt, *aGenMSIt, aTag); + storeGenerationHistory(aResultBody, *aGenBaseIt, *aGenMSIt); } - int aModTag = aTag; - storeModificationHistory(aResultBody, *aBoolObjIt, aTools, *aBoolMSIt, aModTag); + storeModificationHistory(aResultBody, *aBoolObjIt, aTools, *aBoolMSIt); ResultBaseAlgo aRBA; aRBA.resultBody = aResultBody; aRBA.baseShape = *aBoolObjIt; aRBA.makeShape = *aBoolMSIt; - aRBA.delTag = aModTag; aResultBaseAlgoList.push_back(aRBA); aResultShapesList.push_back((*aBoolMSIt)->shape()); } @@ -380,14 +378,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, void FeaturesPlugin_CompositeBoolean::storeModificationHistory(ResultBodyPtr theResultBody, const GeomShapePtr theObject, const ListOfShape& theTools, - const std::shared_ptr theMakeShape, - int& theTag) + const std::shared_ptr theMakeShape) { - int aModTag = theTag; - int anEdgesAndFacesTag = ++aModTag; - int aDelTag = ++anEdgesAndFacesTag; - theTag = aDelTag; - const std::string aModName = "Modfied"; ListOfShape aTools = theTools; @@ -395,19 +387,10 @@ void FeaturesPlugin_CompositeBoolean::storeModificationHistory(ResultBodyPtr the std::string aName; for(ListOfShape::const_iterator anIt = aTools.begin(); anIt != aTools.end(); anIt++) { - if((*anIt)->shapeType() == GeomAPI_Shape::EDGE) { - aName = aModName + "_Edge"; - } - else if((*anIt)->shapeType() == GeomAPI_Shape::FACE) { - aName = aModName + "_Face"; - } else { - aName = aModName; - } theResultBody->loadModifiedShapes(theMakeShape, *anIt, (*anIt)->shapeType() == GeomAPI_Shape::EDGE ? GeomAPI_Shape::EDGE : - GeomAPI_Shape::FACE, - aName); + GeomAPI_Shape::FACE); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h index 3f07d107b..237c62d9d 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h @@ -55,7 +55,6 @@ protected: ResultBodyPtr resultBody; GeomShapePtr baseShape; std::shared_ptr makeShape; - int delTag; }; protected: @@ -80,15 +79,13 @@ protected: /// Stores generation history. virtual void storeGenerationHistory(ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape, - int& theTag) = 0; + const GeomMakeShapePtr theMakeShape) = 0; /// Stores modification history. void storeModificationHistory(ResultBodyPtr theResultBody, const GeomShapePtr theObject, const ListOfShape& theTools, - const std::shared_ptr theMakeShape, - int& theTag); + const std::shared_ptr theMakeShape); /// Stores deleted shapes. void storeDeletedShapes(std::vector& theResultBaseAlgoList, diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index 9caeeefc3..b9399a815 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -42,7 +42,6 @@ static void storeSubShape(ResultBodyPtr theResultBody, const GeomShapePtr theShape, const GeomAPI_Shape::ShapeType theType, - const std::shared_ptr theMapOfSubShapes, const std::string theName, int& theShapeIndex); @@ -273,8 +272,7 @@ void FeaturesPlugin_CompositeSketch::storeResult(const GeomShapePtr theBaseShape aResultBody->storeGenerated(theBaseShape, theMakeShape->shape()); // Store generated edges/faces. - int aGenTag = 1; - storeGenerationHistory(aResultBody, theBaseShape, theMakeShape, aGenTag); + storeGenerationHistory(aResultBody, theBaseShape, theMakeShape); setResult(aResultBody, theIndex); } @@ -282,31 +280,17 @@ void FeaturesPlugin_CompositeSketch::storeResult(const GeomShapePtr theBaseShape //================================================================================================= void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape, - int& theTag) + const std::shared_ptr theMakeShape) { GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType(); GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE; - std::string aGenName = "Generated_"; - std::shared_ptr aMapOfSubShapes = theMakeShape->mapOfSubShapes(); switch(aBaseShapeType) { case GeomAPI_Shape::EDGE: { aShapeTypeToExplode = GeomAPI_Shape::VERTEX; break; } case GeomAPI_Shape::WIRE: { - //std::shared_ptr aV1, aV2; - //GeomAlgoAPI_ShapeTools::findBounds(theBaseShape, aV1, aV2); - //ListOfShape aV1History, aV2History; - //theMakeShape->generated(aV1, aV1History); - //theMakeShape->generated(aV2, aV2History); - //if(!aV1History.empty()) { - // theResultBody->generated(aV1, aV1History.front(), aGenName + "Edge_1", theTag++); - //} - //if(!aV2History.empty()) { - // theResultBody->generated(aV2, aV2History.front(), aGenName + "Edge_2", theTag++); - //} aShapeTypeToExplode = GeomAPI_Shape::COMPOUND; break; } @@ -320,19 +304,18 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes } } + int aLateralIndex = 1; + int aBaseEdgeIndex = 1; + int aVertexIndex = 1; + int aBaseVertexIndex = 1; + if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX || aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) { - theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, - GeomAPI_Shape::VERTEX, - theTag++, aGenName + "Edge", - *aMapOfSubShapes.get()); + theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX); } if(aShapeTypeToExplode == GeomAPI_Shape::EDGE || aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) { - theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), - theBaseShape, GeomAPI_Shape::EDGE, - theTag++, aGenName + "Face", - *aMapOfSubShapes.get()); + theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE); } // issue #2197: make naming of edges generated from vertices if (aShapeTypeToExplode == GeomAPI_Shape::EDGE) { @@ -366,7 +349,7 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes if (anEdgesFromVertices.isBound(aGenerated)) // already here continue; std::ostringstream aStream; - aStream << "Lateral_" << theTag++; + aStream << "Lateral_" << aLateralIndex++; theResultBody->generated(aGenerated, aStream.str()); anEdgesFromVertices.bind(aGenerated, aVertExp.current()); @@ -380,7 +363,7 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes if (!anEdgesFromVertices.isBound(anEdgesExp.current())) { // found a base edge std::ostringstream aStream; - aStream << "Base_Edge_" << theTag++; + aStream << "Base_Edge_" << aBaseEdgeIndex++; theResultBody->generated(anEdgesExp.current(), aStream.str()); // only one orientation is needed anEdgesFromVertices.bind(anEdgesExp.current(), anEdgesExp.current()); @@ -394,7 +377,7 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes if (!aVertices.isBound(aVertExp.current())) { // found a base edge std::ostringstream aStream; - aStream << "Vertex_" << theTag++; + aStream << "Vertex_" << aVertexIndex++; theResultBody->generated(aVertExp.current(), aStream.str()); // only one orientation is needed aVertices.bind(aVertExp.current(), aVertExp.current()); @@ -435,13 +418,13 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes } if (aNumEdges == 2 && aNumClosed == 1) { std::ostringstream aStream; - aStream << "Base_Edge_" << theTag++; + aStream << "Base_Edge_" << aBaseEdgeIndex++; theResultBody->generated(aNotClosedEdge, aStream.str()); if (aDegenerateEdge.get()) { // export vertex of the degenerated edge (apex) #2520 GeomAPI_ShapeExplorer anEdgeExp(aDegenerateEdge, GeomAPI_Shape::VERTEX); if (anEdgeExp.more()) { std::ostringstream aStream; - aStream << "Base_Vertex_" << theTag++; + aStream << "Base_Vertex_" << aBaseVertexIndex++; theResultBody->generated(anEdgeExp.current(), aStream.str()); } } @@ -456,22 +439,18 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes std::dynamic_pointer_cast(theMakeShape); if(aMakeSweep.get()) { // Store from shapes. - storeShapes(theResultBody, aBaseShapeType, aMapOfSubShapes, - aMakeSweep->fromShapes(), "From_", theTag); + storeShapes(theResultBody, aBaseShapeType, aMakeSweep->fromShapes(), "From_"); // Store to shapes. - storeShapes(theResultBody, aBaseShapeType, aMapOfSubShapes, - aMakeSweep->toShapes(), "To_", theTag); + storeShapes(theResultBody, aBaseShapeType, aMakeSweep->toShapes(), "To_"); } } //================================================================================================= void FeaturesPlugin_CompositeSketch::storeShapes(ResultBodyPtr theResultBody, const GeomAPI_Shape::ShapeType theBaseShapeType, - const std::shared_ptr theMapOfSubShapes, const ListOfShape& theShapes, - const std::string theName, - int& theTag) + const std::string theName) { GeomAPI_Shape::ShapeType aShapeTypeToExplore = GeomAPI_Shape::FACE; std::string aShapeTypeStr = "Face"; @@ -510,17 +489,22 @@ void FeaturesPlugin_CompositeSketch::storeShapes(ResultBodyPtr theResultBody, storeSubShape(theResultBody, aShape, aShape->shapeType(), - theMapOfSubShapes, aName, aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex); } else { std::string aName = theName + aShapeTypeStr; - storeSubShape(theResultBody, aShape, aShapeTypeToExplore, - theMapOfSubShapes, aName, aShapeIndex); + storeSubShape(theResultBody, + aShape, + aShapeTypeToExplore, + aName, + aShapeIndex); if (theBaseShapeType == GeomAPI_Shape::WIRE) { // issue 2289: special names also for vertices aName = theName + "Vertex"; - storeSubShape(theResultBody, aShape, GeomAPI_Shape::VERTEX, - theMapOfSubShapes, aName, aShapeIndex); + storeSubShape(theResultBody, + aShape, + GeomAPI_Shape::VERTEX, + aName, + aShapeIndex); } } } @@ -529,15 +513,11 @@ void FeaturesPlugin_CompositeSketch::storeShapes(ResultBodyPtr theResultBody, void storeSubShape(ResultBodyPtr theResultBody, const GeomShapePtr theShape, const GeomAPI_Shape::ShapeType theType, - const std::shared_ptr theMapOfSubShapes, const std::string theName, int& theShapeIndex) { for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) { GeomShapePtr aSubShape = anExp.current(); - if(theMapOfSubShapes->isBound(aSubShape)) { - aSubShape = theMapOfSubShapes->find(aSubShape); - } std::ostringstream aStr; aStr << theName << "_" << theShapeIndex++; theResultBody->generated(aSubShape, aStr.str()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h index 62d5c30f6..074def66b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h @@ -94,16 +94,13 @@ protected: /// Stores generation history. void storeGenerationHistory(ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape, - int& theTag); + const std::shared_ptr theMakeShape); /// Used to store from and to shapes. void storeShapes(ResultBodyPtr theResultBody, const GeomAPI_Shape::ShapeType theBaseShapeType, - const std::shared_ptr theMapOfSubShapes, const ListOfShape& theShapes, - const std::string theName, - int& theTag); + const std::string theName); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp index 88af05a75..24ae1d7bc 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp @@ -38,9 +38,7 @@ bool FeaturesPlugin_ExtrusionBoolean::makeGeneration(ListOfShape& theBaseShapes, //================================================================================================= void FeaturesPlugin_ExtrusionBoolean::storeGenerationHistory(ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape, - int& theTag) + const std::shared_ptr theMakeShape) { - FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape, - theMakeShape, theTag); + FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape, theMakeShape); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h index ed9f8f3c4..8582456f1 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h @@ -44,8 +44,7 @@ protected: /// Stores generation history. void storeGenerationHistory(ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape, - int& theTag); + const std::shared_ptr theMakeShape); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp b/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp index 2ee269e42..b4ce7d588 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp @@ -165,7 +165,7 @@ void FeaturesPlugin_Fillet::execute() std::shared_ptr aResultBody = document()->createBody(data(), aResultIndex); - loadNamingDS(aResultBody, aSolid, aFilletEdgesAndVertices, aResult, aFilletBuilder); + loadNamingDS(aResultBody, aSolid, aResult, aFilletBuilder); setResult(aResultBody, aResultIndex); aResultIndex++; } @@ -196,7 +196,6 @@ bool FeaturesPlugin_Fillet::isFailed( void FeaturesPlugin_Fillet::loadNamingDS( std::shared_ptr theResultBody, const std::shared_ptr theBaseShape, - const ListOfShape& theFilletShapes, const std::shared_ptr theResultShape, const std::shared_ptr& theMakeShape) { @@ -206,23 +205,22 @@ void FeaturesPlugin_Fillet::loadNamingDS( return; } - std::shared_ptr aMapOfShapes = theMakeShape->mapOfSubShapes(); - - const int aGeneratedTag = 3; - theResultBody->storeModified(theBaseShape, theResultShape); - const std::string aModFaceName = "Modified_Face"; const std::string aFilletFaceName = "Fillet_Face"; // Store modified faces - theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE, aModFaceName); + theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE); // Store new faces generated from edges and vertices - theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, - GeomAPI_Shape::EDGE, aGeneratedTag, aFilletFaceName, *aMapOfShapes); - theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape, - GeomAPI_Shape::VERTEX, aGeneratedTag, aFilletFaceName, *aMapOfShapes); + theResultBody->loadGeneratedShapes(theMakeShape, + theBaseShape, + GeomAPI_Shape::EDGE, + aFilletFaceName); + theResultBody->loadGeneratedShapes(theMakeShape, + theBaseShape, + GeomAPI_Shape::VERTEX, + aFilletFaceName); // Deleted shapes theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Fillet.h b/src/FeaturesPlugin/FeaturesPlugin_Fillet.h index d0aa71255..c91956ae0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Fillet.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Fillet.h @@ -112,7 +112,6 @@ private: /// Load Naming data structure of the feature to the document void loadNamingDS(std::shared_ptr theResultBody, const std::shared_ptr theBaseShape, - const ListOfShape& theFilletShapes, const std::shared_ptr theResultShape, const std::shared_ptr& theMakeShape); }; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp index d8d90cd6e..ff6815e16 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp @@ -39,7 +39,6 @@ static void storeSubShape(ResultBodyPtr theResultBody, const GeomShapePtr theShape, const GeomAPI_Shape::ShapeType theType, - const std::shared_ptr theMapOfSubShapes, const std::string theName, int& theShapeIndex); @@ -229,23 +228,26 @@ void FeaturesPlugin_Pipe::execute() anIter = aBaseShapesList.cbegin(); anIter != aBaseShapesList.cend(); anIter++) { std::shared_ptr aBaseShape = *anIter; - GeomAlgoAPI_Pipe aPipeAlgo = aCreationMethod == - CREATION_METHOD_SIMPLE() ? GeomAlgoAPI_Pipe(aBaseShape, aPathShape) : - GeomAlgoAPI_Pipe(aBaseShape, aPathShape, aBiNormal); + std::shared_ptr aPipeAlgo( + aCreationMethod == CREATION_METHOD_SIMPLE() ? new GeomAlgoAPI_Pipe(aBaseShape, + aPathShape) + : new GeomAlgoAPI_Pipe(aBaseShape, + aPathShape, + aBiNormal)); - if(!aPipeAlgo.isDone()) { + if(!aPipeAlgo->isDone()) { setError("Error: Pipe algorithm failed."); aResultIndex = 0; break; } // Check if shape is valid - if(!aPipeAlgo.shape().get() || aPipeAlgo.shape()->isNull()) { + if(!aPipeAlgo->shape().get() || aPipeAlgo->shape()->isNull()) { setError("Error: Resulting shape is Null."); aResultIndex = 0; break; } - if(!aPipeAlgo.isValid()) { + if(!aPipeAlgo->isValid()) { setError("Error: Resulting shape is not valid."); aResultIndex = 0; break; @@ -254,21 +256,23 @@ void FeaturesPlugin_Pipe::execute() storeResult(aBaseShape, aPipeAlgo, aResultIndex++); } } else if(aCreationMethod == CREATION_METHOD_LOCATIONS()) { - GeomAlgoAPI_Pipe aPipeAlgo = GeomAlgoAPI_Pipe(aBaseShapesList, aLocations, aPathShape); + std::shared_ptr aPipeAlgo(new GeomAlgoAPI_Pipe(aBaseShapesList, + aLocations, + aPathShape)); - if(!aPipeAlgo.isDone()) { + if(!aPipeAlgo->isDone()) { setError("Error: Pipe algorithm failed."); removeResults(0); return; } // Check if shape is valid - if(!aPipeAlgo.shape().get() || aPipeAlgo.shape()->isNull()) { + if(!aPipeAlgo->shape().get() || aPipeAlgo->shape()->isNull()) { setError("Error: Resulting shape is Null."); removeResults(0); return; } - if(!aPipeAlgo.isValid()) { + if(!aPipeAlgo->isValid()) { setError("Error: Resulting shape is not valid."); removeResults(0); return; @@ -285,22 +289,19 @@ void FeaturesPlugin_Pipe::execute() //================================================================================================== void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBaseShape, - GeomAlgoAPI_Pipe& thePipeAlgo, + const std::shared_ptr thePipeAlgo, const int theResultIndex) { // Create result body. ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex); // Store generated shape. - aResultBody->storeGenerated(theBaseShape, thePipeAlgo.shape()); + aResultBody->storeGenerated(theBaseShape, thePipeAlgo->shape()); // Store generated edges/faces. GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType(); GeomAPI_Shape::ShapeType aShapeTypeToExplode; - int aGenTag = 1; - std::string aGenName = "Generated_"; - std::shared_ptr aMapOfSubShapes = thePipeAlgo.mapOfSubShapes(); switch(aBaseShapeType) { case GeomAPI_Shape::VERTEX: { aShapeTypeToExplode = GeomAPI_Shape::VERTEX; @@ -311,13 +312,13 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBa std::shared_ptr aV1, aV2; GeomAlgoAPI_ShapeTools::findBounds(theBaseShape, aV1, aV2); ListOfShape aV1History, aV2History; - thePipeAlgo.generated(aV1, aV1History); - thePipeAlgo.generated(aV2, aV2History); + thePipeAlgo->generated(aV1, aV1History); + thePipeAlgo->generated(aV2, aV2History); if(!aV1History.empty()) { - aResultBody->generated(aV1, aV1History.front(), aGenName + "Edge_1"); + aResultBody->generated(aV1, aV1History.front()); } if(!aV2History.empty()) { - aResultBody->generated(aV2, aV2History.front(), aGenName + "Edge_2"); + aResultBody->generated(aV2, aV2History.front()); } } case GeomAPI_Shape::FACE: @@ -332,52 +333,44 @@ void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr theBa if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX || aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) { - aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, theBaseShape, GeomAPI_Shape::VERTEX, - aGenTag++, aGenName + "Edge", *aMapOfSubShapes.get()); + aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, GeomAPI_Shape::VERTEX); } if(aShapeTypeToExplode == GeomAPI_Shape::EDGE || aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) { - aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, theBaseShape, GeomAPI_Shape::EDGE, - aGenTag++, aGenName + "Face", *aMapOfSubShapes.get()); + aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, GeomAPI_Shape::EDGE); } // Store from shapes. - int aFromTag = aGenTag; - storeShapes(aResultBody, aBaseShapeType, aMapOfSubShapes, - thePipeAlgo.fromShapes(), "From_", aFromTag); + storeShapes(aResultBody, aBaseShapeType, thePipeAlgo->fromShapes(), "From_"); // Store to shapes. - int aToTag = aFromTag; - storeShapes(aResultBody, aBaseShapeType, aMapOfSubShapes, thePipeAlgo.toShapes(), "To_", aToTag); + storeShapes(aResultBody, aBaseShapeType, thePipeAlgo->toShapes(), "To_"); setResult(aResultBody, theResultIndex); } //================================================================================================== void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes, - GeomAlgoAPI_Pipe& thePipeAlgo, + const std::shared_ptr thePipeAlgo, const int theResultIndex) { // Create result body. ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex); // Store generated shape. - aResultBody->storeGenerated(theBaseShapes.front(), thePipeAlgo.shape()); + aResultBody->storeGenerated(theBaseShapes.front(), thePipeAlgo->shape()); // Store generated edges/faces. - int aGenTag = 1; - std::shared_ptr aMapOfSubShapes = thePipeAlgo.mapOfSubShapes(); - - for(ListOfShape::const_iterator - anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) { + for(ListOfShape::const_iterator anIter = theBaseShapes.cbegin(); + anIter != theBaseShapes.cend(); + ++anIter) + { GeomShapePtr aBaseShape = *anIter; GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType(); GeomAPI_Shape::ShapeType aShapeTypeToExplode; - std::string aGenName = "Generated_"; switch(aBaseShapeType) { case GeomAPI_Shape::VERTEX: { aShapeTypeToExplode = GeomAPI_Shape::VERTEX; - aGenName += "Edge"; break; } case GeomAPI_Shape::EDGE: @@ -385,31 +378,25 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes, std::shared_ptr aV1, aV2; GeomAlgoAPI_ShapeTools::findBounds(aBaseShape, aV1, aV2); ListOfShape aV1History, aV2History; - thePipeAlgo.generated(aV1, aV1History); - thePipeAlgo.generated(aV2, aV2History); - aResultBody->generated(aV1, aV1History.front(), aGenName + "Edge_1"); - aResultBody->generated(aV2, aV2History.front(), aGenName + "Edge_2"); + thePipeAlgo->generated(aV1, aV1History); + thePipeAlgo->generated(aV2, aV2History); + aResultBody->generated(aV1, aV1History.front()); + aResultBody->generated(aV2, aV2History.front()); } case GeomAPI_Shape::FACE: case GeomAPI_Shape::SHELL: { aShapeTypeToExplode = GeomAPI_Shape::EDGE; - aGenName += "Face"; break; } } - aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, aBaseShape, aShapeTypeToExplode, - aGenTag++, aGenName, *aMapOfSubShapes.get()); + aResultBody->loadGeneratedShapes(thePipeAlgo, aBaseShape, aShapeTypeToExplode); } // Store from shapes. - int aFromTag = aGenTag; - storeShapes(aResultBody, theBaseShapes.front()->shapeType(), aMapOfSubShapes, - thePipeAlgo.fromShapes(), "From", aFromTag); + storeShapes(aResultBody, theBaseShapes.front()->shapeType(), thePipeAlgo->fromShapes(), "From_"); // Store to shapes. - int aToTag = aFromTag; - storeShapes(aResultBody, theBaseShapes.back()->shapeType(), - aMapOfSubShapes, thePipeAlgo.toShapes(), "To", aToTag); + storeShapes(aResultBody, theBaseShapes.back()->shapeType(), thePipeAlgo->toShapes(), "To_"); setResult(aResultBody, theResultIndex); @@ -417,11 +404,9 @@ void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes, //================================================================================================== void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody, - const GeomAPI_Shape::ShapeType theBaseShapeType, - const std::shared_ptr theMapOfSubShapes, - const ListOfShape& theShapes, - const std::string theName, - int& theTag) + const GeomAPI_Shape::ShapeType theBaseShapeType, + const ListOfShape& theShapes, + const std::string theName) { GeomAPI_Shape::ShapeType aShapeTypeToExplore = GeomAPI_Shape::FACE; std::string aShapeTypeStr = "Face"; @@ -457,16 +442,13 @@ void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody, if(aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) { std::string aName = theName + (aShape->shapeType() == GeomAPI_Shape::EDGE ? "Edge" : "Face"); - storeSubShape(theResultBody, - aShape, + storeSubShape(theResultBody, aShape, aShape->shapeType(), - theMapOfSubShapes, aName, aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex); } else { std::string aName = theName + aShapeTypeStr; - storeSubShape(theResultBody, aShape, aShapeTypeToExplore, - theMapOfSubShapes, aName, aShapeIndex); + storeSubShape(theResultBody, aShape, aShapeTypeToExplore, aName, aShapeIndex); } } } @@ -475,15 +457,11 @@ void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody, void storeSubShape(ResultBodyPtr theResultBody, const GeomShapePtr theShape, const GeomAPI_Shape::ShapeType theType, - const std::shared_ptr theMapOfSubShapes, const std::string theName, int& theShapeIndex) { for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) { GeomShapePtr aSubShape = anExp.current(); - if(theMapOfSubShapes->isBound(aSubShape)) { - aSubShape = theMapOfSubShapes->find(aSubShape); - } std::ostringstream aStr; aStr << theName << "_" << theShapeIndex++; theResultBody->generated(aSubShape, aStr.str()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Pipe.h b/src/FeaturesPlugin/FeaturesPlugin_Pipe.h index 074c8b088..2699ef56f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Pipe.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Pipe.h @@ -121,19 +121,17 @@ public: private: void storeResult(const std::shared_ptr theBaseShape, - GeomAlgoAPI_Pipe& thePipeAlgo, + const std::shared_ptr thePipeAlgo, const int theResultIndex = 0); void storeResult(const ListOfShape& theBaseShapes, - GeomAlgoAPI_Pipe& thePipeAlgo, + const std::shared_ptr thePipeAlgo, const int theResultIndex = 0); void storeShapes(ResultBodyPtr theResultBody, const GeomAPI_Shape::ShapeType theBaseShapeType, - const std::shared_ptr theMapOfSubShapes, const ListOfShape& theShapes, - const std::string theName, - int& theTag); + const std::string theName); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp index 50c03fa4e..107fecc8e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp @@ -38,9 +38,7 @@ bool FeaturesPlugin_RevolutionBoolean::makeGeneration(ListOfShape& theBaseShapes //================================================================================================= void FeaturesPlugin_RevolutionBoolean::storeGenerationHistory(ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape, - int& theTag) + const std::shared_ptr theMakeShape) { - FeaturesPlugin_Revolution::storeGenerationHistory(theResultBody, theBaseShape, - theMakeShape, theTag); + FeaturesPlugin_Revolution::storeGenerationHistory(theResultBody, theBaseShape, theMakeShape); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h index 8aceb322b..a89288faa 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h @@ -44,8 +44,7 @@ protected: /// Stores generation history. void storeGenerationHistory(ResultBodyPtr theResultBody, const GeomShapePtr theBaseShape, - const std::shared_ptr theMakeShape, - int& theTag); + const std::shared_ptr theMakeShape); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp b/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp index e18c6f44e..efdee5801 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Tools.cpp @@ -72,20 +72,20 @@ void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody, theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE, - theName + "_Face"); + theName); } case GeomAPI_Shape::FACE: case GeomAPI_Shape::WIRE: { theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE, - theName + "_Edge"); + theName); } case GeomAPI_Shape::EDGE: { theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX, - theName + "_Vertex"); + theName); } } } diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 370ce2ad1..cc4f64f65 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -305,14 +305,16 @@ void Model_BodyBuilder::buildName(const int theTag, const std::string& theName) { std::shared_ptr aDoc = std::dynamic_pointer_cast(document()); std::string aName = theName; + std::string aPrefix = ""; switch (theTag) { - case GENERATED_VERTICES_TAG: aName += aName.empty() ? "Generated_Vertex" : "_GV"; break; - case GENERATED_EDGES_TAG: aName += aName.empty() ? "Generated_Edge" : "_GE"; break; - case GENERATED_FACES_TAG: aName += aName.empty() ? "Generated_Face" : "_GF"; break; - case MODIFIED_VERTICES_TAG: aName += aName.empty() ? "Modified_Vertex" : "_MV"; break; - case MODIFIED_EDGES_TAG: aName += aName.empty() ? "Modified_Edge" : "_ME"; break; - case MODIFIED_FACES_TAG: aName += aName.empty() ? "Modified_Face" : "_MF"; break; + case GENERATED_VERTICES_TAG: aPrefix = aName.empty() ? "Generated_Vertex" : "GV:"; break; + case GENERATED_EDGES_TAG: aPrefix = aName.empty() ? "Generated_Edge" : "GE:"; break; + case GENERATED_FACES_TAG: aPrefix = aName.empty() ? "Generated_Face" : "GF:"; break; + case MODIFIED_VERTICES_TAG: aPrefix = aName.empty() ? "Modified_Vertex" : "MV:"; break; + case MODIFIED_EDGES_TAG: aPrefix = aName.empty() ? "Modified_Edge" : "ME:"; break; + case MODIFIED_FACES_TAG: aPrefix = aName.empty() ? "Modified_Face" : "MF:"; break; } + aName.insert(0, aPrefix); TDataStd_Name::Set(builder(theTag)->NamedShape()->Label(), aName.c_str()); } @@ -338,12 +340,12 @@ void Model_BodyBuilder::generated(const GeomShapePtr& theOldShape, int aTag; if (aNewShapeType == TopAbs_WIRE || aNewShapeType == TopAbs_SHELL) { // TODO: This is a workaround. New shape should be only vertex, edge or face. - TopAbs_ShapeEnum anExplodeShapeType = aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE; + TopAbs_ShapeEnum aShapeTypeToExplore = aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE; aTag = TopAbs_WIRE ? GENERATED_EDGES_TAG : GENERATED_FACES_TAG; - for (TopExp_Explorer anExp(aNewShape, anExplodeShapeType); anExp.More(); anExp.Next()) { + for (TopExp_Explorer anExp(aNewShape, aShapeTypeToExplore); anExp.More(); anExp.Next()) { builder(aTag)->Generated(anOldShape, anExp.Current()); - buildName(aTag, theName); } + buildName(aTag, theName); } else { aTag = getGenerationTag(aNewShape); if (aTag == INVALID_TAG) return; @@ -420,8 +422,9 @@ static void removeBadShapes(ListOfShape& theShapes) } // Keep only the shapes with minimal shape type -static void keepTopLevelShapes(ListOfShape& theShapes, const TopoDS_Shape& theRoot, - const GeomShapePtr& theResultShape = GeomShapePtr()) +static void keepTopLevelShapes(ListOfShape& theShapes, + const TopoDS_Shape& theRoot, + const GeomShapePtr& theResultShape = GeomShapePtr()) { GeomAPI_Shape::ShapeType aKeepShapeType = GeomAPI_Shape::SHAPE; ListOfShape::iterator anIt = theShapes.begin(); @@ -552,58 +555,51 @@ void Model_BodyBuilder::loadModifiedShapes(const GeomMakeShapePtr& theAlgo, } } -void Model_BodyBuilder::loadAndOrientGeneratedShapes ( - GeomAlgoAPI_MakeShape* theMS, - GeomShapePtr theShapeIn, - const int theKindOfShape, - const int theTag, - const std::string& theName, - GeomAPI_DataMapOfShapeShape& theSubShapes) +void Model_BodyBuilder::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, + const GeomShapePtr& theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string& theName) { - TopoDS_Shape aShapeIn = theShapeIn->impl(); - TopTools_MapOfShape aView; - bool isBuilt = !theName.empty(); - TopExp_Explorer aShapeExplorer (aShapeIn, (TopAbs_ShapeEnum)theKindOfShape); - for (; aShapeExplorer.More(); aShapeExplorer.Next ()) { - const TopoDS_Shape& aRoot = aShapeExplorer.Current (); - if (!aView.Add(aRoot)) continue; - //if (TNaming_Tool::NamedShape(aRoot, builder(theTag)->NamedShape()->Label()).IsNull()) - // continue; // there is no sense to write history if old shape does not exist in the document - ListOfShape aList; - GeomShapePtr aRShape(new GeomAPI_Shape()); - aRShape->setImpl((new TopoDS_Shape(aRoot))); - theMS->generated(aRShape, aList); - keepTopLevelShapes(aList, aRoot); - std::list::const_iterator - anIt = aList.begin(), aLast = aList.end(); - for (; anIt != aLast; anIt++) { - TopoDS_Shape aNewShape = (*anIt)->impl(); - if (theSubShapes.isBound(*anIt)) { - GeomShapePtr aMapShape(theSubShapes.find(*anIt)); - aNewShape.Orientation(aMapShape->impl().Orientation()); - } - if (!aRoot.IsSame (aNewShape)) { - builder(theTag)->Generated(aRoot,aNewShape); - if(isBuilt) - buildName(theTag, theName); - } - TopAbs_ShapeEnum aGenShapeType = aNewShape.ShapeType(); - if(aGenShapeType == TopAbs_WIRE || aGenShapeType == TopAbs_SHELL) { - TopAbs_ShapeEnum anExplodeShapeType = - aGenShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE; - const TDF_Label aLabel = builder(theTag)->NamedShape()->Label(); - int aTag = 1; - std::shared_ptr aDoc = - std::dynamic_pointer_cast(document()); - for(TopExp_Explorer anExp(aNewShape, anExplodeShapeType); anExp.More(); anExp.Next()) { - TDF_Label aChildLabel = aLabel.FindChild(aTag); - TNaming_Builder aBuilder(aChildLabel); - aBuilder.Generated(aRoot, anExp.Current()); - TCollection_AsciiString aChildName = - TCollection_AsciiString((theName + "_").c_str()) + aTag; - TDataStd_Name::Set(aChildLabel, aChildName.ToCString()); - aTag++; + TopTools_MapOfShape anAlreadyProcessedShapes; + for (GeomAPI_ShapeExplorer anOldShapeExp(theOldShape, theShapeTypeToExplore); + anOldShapeExp.more(); + anOldShapeExp.next()) + { + GeomShapePtr anOldSubShape = anOldShapeExp.current(); + const TopoDS_Shape& anOldSubShape_ = anOldSubShape->impl(); + + // There is no sense to write history if shape already processed. + if (!anAlreadyProcessedShapes.Add(anOldSubShape_)) continue; + + // Get new shapes. + ListOfShape aNewShapes; + theAlgo->generated(anOldSubShape, aNewShapes); + + keepTopLevelShapes(aNewShapes, anOldSubShape_); + + for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin(); + aNewShapesIt != aNewShapes.cend(); + ++aNewShapesIt) + { + GeomShapePtr aNewShape = *aNewShapesIt; + const TopoDS_Shape& aNewShape_ = aNewShape->impl(); + + TopAbs_ShapeEnum aNewShapeType = aNewShape_.ShapeType(); + if (aNewShapeType == TopAbs_WIRE || aNewShapeType == TopAbs_SHELL) { + // TODO: This is a workaround. New shape should be only edge or face. + TopAbs_ShapeEnum aShapeTypeToExplore = aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE + : TopAbs_FACE; + int aTag = TopAbs_WIRE ? GENERATED_EDGES_TAG : GENERATED_FACES_TAG; + for (TopExp_Explorer anExp(aNewShape_, aShapeTypeToExplore); anExp.More(); anExp.Next()) { + builder(aTag)->Generated(anOldSubShape_, anExp.Current()); } + buildName(aTag, theName); + } + else { + int aTag = getGenerationTag(aNewShape_); + if (aTag == INVALID_TAG) return; + builder(aTag)->Generated(anOldSubShape_, aNewShape_); + buildName(aTag, theName); } } } diff --git a/src/Model/Model_BodyBuilder.h b/src/Model/Model_BodyBuilder.h index ab82e48b2..60e345fee 100755 --- a/src/Model/Model_BodyBuilder.h +++ b/src/Model/Model_BodyBuilder.h @@ -103,12 +103,10 @@ public: /// load and orient generated shapes MODEL_EXPORT - virtual void loadAndOrientGeneratedShapes(GeomAlgoAPI_MakeShape* theMS, - GeomShapePtr theShapeIn, - const int theKindOfShape, - const int theTag, - const std::string& theName, - GeomAPI_DataMapOfShapeShape& theSubShapes); + virtual void loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, + const GeomShapePtr& theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string& theName = "") override; /// Loads shapes of the first level (to be used during shape import) MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape, diff --git a/src/ModelAPI/ModelAPI_BodyBuilder.h b/src/ModelAPI/ModelAPI_BodyBuilder.h index bd252e8d7..84e9400c7 100755 --- a/src/ModelAPI/ModelAPI_BodyBuilder.h +++ b/src/ModelAPI/ModelAPI_BodyBuilder.h @@ -95,12 +95,10 @@ public: const std::string& theName = "") = 0; /// load and orient generated shapes - virtual void loadAndOrientGeneratedShapes(GeomAlgoAPI_MakeShape* theMS, - GeomShapePtr theShapeIn, - const int theKindOfShape, - const int theTag, - const std::string& theName, - GeomAPI_DataMapOfShapeShape& theSubShapes) = 0; + virtual void loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, + const GeomShapePtr& theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string& theName = "") = 0; /// load shapes of the first level (to be used during shape import) virtual void loadFirstLevel(GeomShapePtr theShape, diff --git a/src/ModelAPI/ModelAPI_ResultBody.cpp b/src/ModelAPI/ModelAPI_ResultBody.cpp index c973853cd..cdc10a703 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.cpp +++ b/src/ModelAPI/ModelAPI_ResultBody.cpp @@ -140,15 +140,12 @@ void ModelAPI_ResultBody::loadModifiedShapes(const GeomMakeShapePtr& theAlgo, myBuilder->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName); } -void ModelAPI_ResultBody::loadAndOrientGeneratedShapes(GeomAlgoAPI_MakeShape* theMS, - GeomShapePtr theShapeIn, - const int theKindOfShape, - const int theTag, - const std::string& theName, - GeomAPI_DataMapOfShapeShape& theSubShapes) -{ - myBuilder->loadAndOrientGeneratedShapes( - theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes); +void ModelAPI_ResultBody::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo, + const GeomShapePtr& theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string& theName) +{ + myBuilder->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName); } void ModelAPI_ResultBody::loadFirstLevel(GeomShapePtr theShape, diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index 4b40d7d21..e7d13c8f8 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -151,12 +151,10 @@ public: /// load and orient generated shapes MODELAPI_EXPORT - virtual void loadAndOrientGeneratedShapes(GeomAlgoAPI_MakeShape* theMS, - GeomShapePtr theShapeIn, - const int theKindOfShape, - const int theTag, - const std::string& theName, - GeomAPI_DataMapOfShapeShape& theSubShapes); + virtual void loadGeneratedShapes(const std::shared_ptr& theAlgo, + const GeomShapePtr& theOldShape, + const GeomAPI_Shape::ShapeType theShapeTypeToExplore, + const std::string& theName = ""); /// load shapes of the first level (to be used during shape import) MODELAPI_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape, -- 2.39.2