]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Updated generated shapes storing.
authordbv <dbv@opencascade.com>
Wed, 17 Oct 2018 14:18:39 +0000 (17:18 +0300)
committerdbv <dbv@opencascade.com>
Tue, 23 Oct 2018 12:39:19 +0000 (15:39 +0300)
19 files changed:
src/BuildPlugin/BuildPlugin_Polyline.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h
src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h
src/FeaturesPlugin/FeaturesPlugin_Fillet.cpp
src/FeaturesPlugin/FeaturesPlugin_Fillet.h
src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp
src/FeaturesPlugin/FeaturesPlugin_Pipe.h
src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h
src/FeaturesPlugin/FeaturesPlugin_Tools.cpp
src/Model/Model_BodyBuilder.cpp
src/Model/Model_BodyBuilder.h
src/ModelAPI/ModelAPI_BodyBuilder.h
src/ModelAPI/ModelAPI_ResultBody.cpp
src/ModelAPI/ModelAPI_ResultBody.h

index 312f1779082a6611a6930fb0f3a13eb2b31b9126..17702ae33c452b2cf6c756cf35ec4e0bf8434072 100644 (file)
@@ -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) {
index e17304991bf1e90881b9c98014da474c8cca9639..1c486f59e9309496f7bc62f3d0cb8b46f4a85520 100644 (file)
@@ -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<GeomAlgoAPI_MakeShape> theMakeShape,
-                                int& theTag)
+                                const std::shared_ptr<GeomAlgoAPI_MakeShape> 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);
   }
 }
 
index 3f07d107b14ffc804f1e11285deed8b5ac447e3c..237c62d9d934901b626312c9717b3180e6058de3 100644 (file)
@@ -55,7 +55,6 @@ protected:
     ResultBodyPtr resultBody;
     GeomShapePtr baseShape;
     std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape;
-    int delTag;
   };
 
 protected:
@@ -80,15 +79,13 @@ protected:
   /// Stores generation history.
   virtual void storeGenerationHistory(ResultBodyPtr theResultBody,
                                       const GeomShapePtr theBaseShape,
-                                      const std::shared_ptr<GeomAlgoAPI_MakeShape> 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<GeomAlgoAPI_MakeShape> theMakeShape,
-                                int& theTag);
+                                const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
 
   /// Stores deleted shapes.
   void storeDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
index 9caeeefc3d99a70459b764c77dfe8d42b0934d98..b9399a815a44a295cce514a29d82676897af4344 100644 (file)
@@ -42,7 +42,6 @@
 static void storeSubShape(ResultBodyPtr theResultBody,
                           const GeomShapePtr theShape,
                           const GeomAPI_Shape::ShapeType theType,
-                          const std::shared_ptr<GeomAPI_DataMapOfShapeShape> 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<GeomAlgoAPI_MakeShape> theMakeShape,
-                                        int& theTag)
+                                        const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
 {
   GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType();
   GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE;
-  std::string aGenName = "Generated_";
 
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
   switch(aBaseShapeType) {
     case GeomAPI_Shape::EDGE: {
             aShapeTypeToExplode = GeomAPI_Shape::VERTEX;
       break;
     }
     case GeomAPI_Shape::WIRE: {
-      //std::shared_ptr<GeomAPI_Vertex> 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<GeomAlgoAPI_MakeSweep>(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<GeomAPI_DataMapOfShapeShape> 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<GeomAPI_DataMapOfShapeShape> 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());
index 62d5c30f69770e6ea69ff8899aa83742694ecef7..074def66b82d6dbe5093c2bed24de2c62d9ed34d 100644 (file)
@@ -94,16 +94,13 @@ protected:
   /// Stores generation history.
   void storeGenerationHistory(ResultBodyPtr theResultBody,
                               const GeomShapePtr theBaseShape,
-                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                              int& theTag);
+                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
 
   /// Used to store from and to shapes.
   void storeShapes(ResultBodyPtr theResultBody,
                    const GeomAPI_Shape::ShapeType theBaseShapeType,
-                   const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
                    const ListOfShape& theShapes,
-                   const std::string theName,
-                   int& theTag);
+                   const std::string theName);
 
 };
 
index 88af05a750c715cb4dd46e280d65eefa8b9b6c9f..24ae1d7bc153ee7062cb02054d384a787dcc380d 100755 (executable)
@@ -38,9 +38,7 @@ bool FeaturesPlugin_ExtrusionBoolean::makeGeneration(ListOfShape& theBaseShapes,
 //=================================================================================================
 void FeaturesPlugin_ExtrusionBoolean::storeGenerationHistory(ResultBodyPtr theResultBody,
                                         const GeomShapePtr theBaseShape,
-                                        const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                                        int& theTag)
+                                        const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
 {
-  FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape,
-                                                   theMakeShape, theTag);
+  FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape, theMakeShape);
 }
index ed9f8f3c4d954f964345277dd585ee128b2a571c..8582456f19e75e5a93c9e8619e458fde7c043899 100644 (file)
@@ -44,8 +44,7 @@ protected:
   /// Stores generation history.
   void storeGenerationHistory(ResultBodyPtr theResultBody,
                               const GeomShapePtr theBaseShape,
-                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                              int& theTag);
+                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
 };
 
 #endif
index 2ee269e420726f08691b28464d7d0381651e89da..b4ce7d588badd97d7926ae166f79477979a264f5 100644 (file)
@@ -165,7 +165,7 @@ void FeaturesPlugin_Fillet::execute()
     std::shared_ptr<ModelAPI_ResultBody> 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<ModelAPI_ResultBody> theResultBody,
     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
-    const ListOfShape& theFilletShapes,
     const std::shared_ptr<GeomAPI_Shape> theResultShape,
     const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape)
 {
@@ -206,23 +205,22 @@ void FeaturesPlugin_Fillet::loadNamingDS(
     return;
   }
 
-  std::shared_ptr<GeomAPI_DataMapOfShapeShape> 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);
index d0aa71255a567699072cbc06dbedda56f310d71e..c91956ae0058746b3ec88edd5a7d021930852c52 100644 (file)
@@ -112,7 +112,6 @@ private:
   /// Load Naming data structure of the feature to the document
   void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                     const std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                    const ListOfShape& theFilletShapes,
                     const std::shared_ptr<GeomAPI_Shape> theResultShape,
                     const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
 };
index d8d90cd6efac17b29645cd287ef53584d28358b9..ff6815e168e531c5cc2c2032ba90b304ad140afc 100644 (file)
@@ -39,7 +39,6 @@
 static void storeSubShape(ResultBodyPtr theResultBody,
                           const GeomShapePtr theShape,
                           const GeomAPI_Shape::ShapeType theType,
-                          const std::shared_ptr<GeomAPI_DataMapOfShapeShape> 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<GeomAPI_Shape> aBaseShape = *anIter;
 
-      GeomAlgoAPI_Pipe aPipeAlgo = aCreationMethod ==
-        CREATION_METHOD_SIMPLE() ? GeomAlgoAPI_Pipe(aBaseShape, aPathShape) :
-                                   GeomAlgoAPI_Pipe(aBaseShape, aPathShape, aBiNormal);
+      std::shared_ptr<GeomAlgoAPI_Pipe> 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<GeomAlgoAPI_Pipe> 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<GeomAPI_Shape> theBaseShape,
-                                      GeomAlgoAPI_Pipe& thePipeAlgo,
+                                      const std::shared_ptr<GeomAlgoAPI_Pipe> 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<GeomAPI_DataMapOfShapeShape> 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<GeomAPI_Shape> theBa
       std::shared_ptr<GeomAPI_Vertex> 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<GeomAPI_Shape> 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<GeomAlgoAPI_Pipe> 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<GeomAPI_DataMapOfShapeShape> 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<GeomAPI_Vertex> 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<GeomAPI_DataMapOfShapeShape> 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<GeomAPI_DataMapOfShapeShape> 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());
index 074c8b088ec90222c437c5899f284be467d9d2a6..2699ef56f23353591ce00f1436001ea273e0f344 100644 (file)
@@ -121,19 +121,17 @@ public:
 
 private:
   void storeResult(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
-                   GeomAlgoAPI_Pipe& thePipeAlgo,
+                   const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
                    const int theResultIndex = 0);
 
   void storeResult(const ListOfShape& theBaseShapes,
-                   GeomAlgoAPI_Pipe& thePipeAlgo,
+                   const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
                    const int theResultIndex = 0);
 
   void storeShapes(ResultBodyPtr theResultBody,
                    const GeomAPI_Shape::ShapeType theBaseShapeType,
-                   const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
                    const ListOfShape& theShapes,
-                   const std::string theName,
-                   int& theTag);
+                   const std::string theName);
 };
 
 #endif
index 50c03fa4ef1a58ddc9aed69e1f3637bad3273ac7..107fecc8efb7c18bf086735c662916d9145f5cf6 100644 (file)
@@ -38,9 +38,7 @@ bool FeaturesPlugin_RevolutionBoolean::makeGeneration(ListOfShape& theBaseShapes
 //=================================================================================================
 void FeaturesPlugin_RevolutionBoolean::storeGenerationHistory(ResultBodyPtr theResultBody,
                                       const GeomShapePtr theBaseShape,
-                                      const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                                      int& theTag)
+                                      const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
 {
-  FeaturesPlugin_Revolution::storeGenerationHistory(theResultBody, theBaseShape,
-                                                    theMakeShape, theTag);
+  FeaturesPlugin_Revolution::storeGenerationHistory(theResultBody, theBaseShape, theMakeShape);
 }
index 8aceb322b95fcb46a3cfc74391b469d5e26c6ccb..a89288faa7c8deccfa492d6bed32364c13ba8401 100644 (file)
@@ -44,8 +44,7 @@ protected:
   /// Stores generation history.
   void storeGenerationHistory(ResultBodyPtr theResultBody,
                               const GeomShapePtr theBaseShape,
-                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
-                              int& theTag);
+                              const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
 };
 
 #endif
index e18c6f44ee7b833348f695dcdfd612448b0241ef..efdee580134ed3afa36a9cb0b81da35e8df9655b 100644 (file)
@@ -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);
     }
   }
 }
index 370ce2ad15cc01cf8debdae11968600083897edb..cc4f64f65d6bf0bf5d1f5ea1095c921777b61ff8 100755 (executable)
@@ -305,14 +305,16 @@ void Model_BodyBuilder::buildName(const int theTag, const std::string& theName)
 {
   std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(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<TopoDS_Shape>();
-  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<GeomShapePtr >::const_iterator
-      anIt = aList.begin(), aLast = aList.end();
-    for (; anIt != aLast; anIt++) {
-      TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
-      if (theSubShapes.isBound(*anIt)) {
-        GeomShapePtr aMapShape(theSubShapes.find(*anIt));
-        aNewShape.Orientation(aMapShape->impl<TopoDS_Shape>().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<Model_Document> aDoc =
-          std::dynamic_pointer_cast<Model_Document>(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<TopoDS_Shape>();
+
+    // 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<TopoDS_Shape>();
+
+      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);
       }
     }
   }
index ab82e48b224bf37a7896e9bfc54e13068286fc09..60e345fee0ea18984bd7c398e9a1bc9636218449 100755 (executable)
@@ -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,
index bd252e8d7438bcfd272a98ae2ddf08c33a9ba29f..84e9400c706c13ec3d5544e50d900a4271a2dbc5 100755 (executable)
@@ -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,
index c973853cdd9da51287d3f76b71ea5c7bc24bd715..cdc10a70323e4bb361c183d216879ca1068da7df 100644 (file)
@@ -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,
index 4b40d7d216e590c91f86e392c1ea03ee3058eee6..e7d13c8f8763e9d8e1e5ac1f230e48625650386e 100644 (file)
@@ -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<GeomAlgoAPI_MakeShape>& 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,