]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Naming now stores primitives on tags 11+.
authordbv <dbv@opencascade.com>
Tue, 9 Oct 2018 10:39:53 +0000 (13:39 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Nov 2018 08:45:52 +0000 (11:45 +0300)
20 files changed:
src/BuildPlugin/BuildPlugin_Face.cpp
src/BuildPlugin/BuildPlugin_Filling.cpp
src/BuildPlugin/BuildPlugin_Interpolation.cpp
src/BuildPlugin/BuildPlugin_Polyline.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp
src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp
src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp
src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp
src/GDMLPlugin/GDMLPlugin_Ellipsoid.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
src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp

index 391ea4bd908365dd7bfc51564660f58fe3686c1a..c7992999ad4dbe04b768aabb5c37e6561cf547ad 100644 (file)
@@ -107,7 +107,7 @@ void BuildPlugin_Face::execute()
     int anEdgeIndex = 1;
     for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
       GeomShapePtr anEdge = anExp.current();
-      aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeIndex), anEdgeIndex);
+      aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeIndex));
       ++anEdgeIndex;
     }
 
index 4aff9c942bdca78ac2c1f54fc59be893f3fc0845..0dec8a14d2b85b32e76c75dd5a5be85c5b922969 100644 (file)
@@ -127,7 +127,7 @@ void BuildPlugin_Filling::execute()
   int anEdgeInd = 0;
   for(GeomAPI_ShapeExplorer anExp(aCreatedFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
     GeomShapePtr anEdge = anExp.current();
-    aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeInd), ++anEdgeInd);
+    aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeInd));
   }
   setResult(aResultBody, 0);
 }
index 4af802725d2602ab120461a2c1cd9fc511e40b56..e1ace5e4a235293acad4fa5a670786c2259a4130 100644 (file)
@@ -133,7 +133,7 @@ void BuildPlugin_Interpolation::execute()
   int aVertexIndex = 1;
   for (GeomAPI_ShapeExplorer anExp(anEdge, GeomAPI_Shape::VERTEX); anExp.more(); anExp.next()) {
     std::string aVertexName = "Vertex_" + std::to_string((long long)aVertexIndex);
-    aResultBody->generated(anExp.current(), aVertexName, aVertexIndex++);
+    aResultBody->generated(anExp.current(), aVertexName);
   }
 
   setResult(aResultBody);
index 7d2369c20897f2ea51f28a8bbbf4da0b885b4c88..d06f265d142f822182d8666635d9d914d35103fd 100644 (file)
@@ -125,8 +125,8 @@ void BuildPlugin_Polyline::execute()
       aResPoints.push_back(anExp.current());
     }
 
-    aResultBody->generated(aResPoints.front(), "FirstVertex", 2);
-    aResultBody->generated(aResPoints.back(), "LastVertex", 3);
+    aResultBody->generated(aResPoints.front(), "FirstVertex");
+    aResultBody->generated(aResPoints.back(), "LastVertex");
   }
 
   setResult(aResultBody);
index 77766fcb58be2cd4dacf071a65bca81d18ae6104..9caeeefc3d99a70459b764c77dfe8d42b0934d98 100644 (file)
@@ -44,8 +44,7 @@ static void storeSubShape(ResultBodyPtr theResultBody,
                           const GeomAPI_Shape::ShapeType theType,
                           const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
                           const std::string theName,
-                          int& theShapeIndex,
-                          int& theTag);
+                          int& theShapeIndex);
 
 //=================================================================================================
 void FeaturesPlugin_CompositeSketch::initCompositeSketchAttribtues(const int theInitFlags)
@@ -367,8 +366,8 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes
           if (anEdgesFromVertices.isBound(aGenerated)) // already here
             continue;
           std::ostringstream aStream;
-          aStream<<"Lateral_"<<theTag++;
-          theResultBody->generated(aGenerated, aStream.str(), theTag++);
+          aStream << "Lateral_" << theTag++;
+          theResultBody->generated(aGenerated, aStream.str());
 
           anEdgesFromVertices.bind(aGenerated, aVertExp.current());
           std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aGenerated));
@@ -381,8 +380,8 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes
           if (!anEdgesFromVertices.isBound(anEdgesExp.current())) {
             // found a base edge
             std::ostringstream aStream;
-            aStream<<"Base_Edge_"<<theTag++;
-            theResultBody->generated(anEdgesExp.current(), aStream.str(), theTag++);
+            aStream << "Base_Edge_" << theTag++;
+            theResultBody->generated(anEdgesExp.current(), aStream.str());
             // only one orientation is needed
             anEdgesFromVertices.bind(anEdgesExp.current(), anEdgesExp.current());
           }
@@ -395,8 +394,8 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes
           if (!aVertices.isBound(aVertExp.current())) {
             // found a base edge
             std::ostringstream aStream;
-            aStream<<"Vertex_"<<theTag++;
-            theResultBody->generated(aVertExp.current(), aStream.str(), theTag++);
+            aStream << "Vertex_" << theTag++;
+            theResultBody->generated(aVertExp.current(), aStream.str());
             // only one orientation is needed
             aVertices.bind(aVertExp.current(), aVertExp.current());
           }
@@ -436,14 +435,14 @@ void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theRes
             }
             if (aNumEdges == 2 && aNumClosed == 1) {
               std::ostringstream aStream;
-              aStream<<"Base_Edge_"<<theTag++;
-              theResultBody->generated(aNotClosedEdge, aStream.str(), theTag++);
+              aStream << "Base_Edge_" << theTag++;
+              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++;
-                  theResultBody->generated(anEdgeExp.current(), aStream.str(), theTag++);
+                  theResultBody->generated(anEdgeExp.current(), aStream.str());
                 }
               }
             }
@@ -513,16 +512,15 @@ void FeaturesPlugin_CompositeSketch::storeShapes(ResultBodyPtr theResultBody,
                     aShape->shapeType(),
                     theMapOfSubShapes,
                     aName,
-                    aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex,
-                    theTag);
+                    aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex);
     } else {
       std::string aName = theName + aShapeTypeStr;
       storeSubShape(theResultBody, aShape, aShapeTypeToExplore,
-                    theMapOfSubShapes, aName, aShapeIndex, theTag);
+                    theMapOfSubShapes, 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, theTag);
+                      theMapOfSubShapes, aName, aShapeIndex);
       }
     }
   }
@@ -533,8 +531,7 @@ void storeSubShape(ResultBodyPtr theResultBody,
                    const GeomAPI_Shape::ShapeType theType,
                    const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
                    const std::string theName,
-                   int& theShapeIndex,
-                   int& theTag)
+                   int& theShapeIndex)
 {
   for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) {
     GeomShapePtr aSubShape = anExp.current();
@@ -543,6 +540,6 @@ void storeSubShape(ResultBodyPtr theResultBody,
     }
     std::ostringstream aStr;
     aStr << theName << "_" << theShapeIndex++;
-    theResultBody->generated(aSubShape, aStr.str(), theTag++);
+    theResultBody->generated(aSubShape, aStr.str());
   }
 }
index 7a33f2d463cf4e09dd340ae3ee9a247beac11f3e..e421c55f42cee3d451f69cbfcc70cd91d117679a 100644 (file)
@@ -150,12 +150,12 @@ void FeaturesPlugin_Intersection::loadNamingDS(std::shared_ptr<ModelAPI_ResultBo
                                                       : aModifiedEdgeIndex++)),
           aTag++);
       } else {
-        theResultBody->generated(aSubShape,
+        theResultBody->generated(
+          aSubShape,
           std::string("Generated_")
             + (anIndex == 0 ? "Vertex_" : "Edge_")
             + std::to_string((long long)(anIndex == 0 ? aGeneratedVertexIndex++
-                                                      : aGeneratedEdgeIndex++)),
-          aTag++);
+                                                      : aGeneratedEdgeIndex++)));
       }
       aStoredShapes.bind(aSubShape, aSubShape);
     }
index 5f8870f5952bb4799b2cf337555b26e35b7a766c..90c4599492f19155b987f2121de1fba52870a797 100644 (file)
@@ -425,7 +425,6 @@ void FeaturesPlugin_MultiRotation::loadNamingDS3(
     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
     std::shared_ptr<GeomAPI_Shape> theBaseShape, int nb)
 {
-  int aTag = 6*nb+1;
   int anIndex = nb+1;
   std::string aRotatedName;
 
@@ -438,7 +437,7 @@ void FeaturesPlugin_MultiRotation::loadNamingDS3(
     for(; anExp.more(); anExp.next()) {
        aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex);
        aRotatedName = aRotatedName + "_" + std::to_string((long long) numFace);
-       theResultBody->generated(anExp.current(), aRotatedName, aTag++);
+       theResultBody->generated(anExp.current(), aRotatedName);
        ++numFace;
     }
     ++anIndex;
index ca72a5aeb951bc15b49bf129cd14b79e5e0e3508..3448c72c5b2b2c6f5f122f31c0d75d81ee47c483 100644 (file)
@@ -41,8 +41,7 @@ static void storeSubShape(ResultBodyPtr theResultBody,
                           const GeomAPI_Shape::ShapeType theType,
                           const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
                           const std::string theName,
-                          int& theShapeIndex,
-                          int& theTag);
+                          int& theShapeIndex);
 
 //==================================================================================================
 FeaturesPlugin_Pipe::FeaturesPlugin_Pipe()
@@ -463,12 +462,11 @@ void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody,
                     aShape->shapeType(),
                     theMapOfSubShapes,
                     aName,
-                    aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex,
-                    theTag);
+                    aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex);
     } else {
       std::string aName = theName + aShapeTypeStr;
       storeSubShape(theResultBody, aShape, aShapeTypeToExplore,
-                    theMapOfSubShapes, aName, aShapeIndex, theTag);
+                    theMapOfSubShapes, aName, aShapeIndex);
     }
   }
 }
@@ -479,8 +477,7 @@ void storeSubShape(ResultBodyPtr theResultBody,
                    const GeomAPI_Shape::ShapeType theType,
                    const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
                    const std::string theName,
-                   int& theShapeIndex,
-                   int& theTag)
+                   int& theShapeIndex)
 {
   for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) {
     GeomShapePtr aSubShape = anExp.current();
@@ -489,6 +486,6 @@ void storeSubShape(ResultBodyPtr theResultBody,
     }
     std::ostringstream aStr;
     aStr << theName << "_" << theShapeIndex++;
-    theResultBody->generated(aSubShape, aStr.str(), theTag++);
+    theResultBody->generated(aSubShape, aStr.str());
   }
 }
index 2429edd78744ceb42dfd34179252e312340cc992..13bc106c5bd6c95c09b88f5a55e0486fab53a361 100644 (file)
@@ -94,13 +94,13 @@ void GDMLPlugin_ConeSegment::loadNamingDS(
   theConeSegmentAlgo->prepareNamingFaces();
 
   // Insert to faces
-  int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
     theConeSegmentAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultConeSegment->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultConeSegment->generated((*it).second, (*it).first);
   }
 }
 
index 55e2d14454f6f688a69b55f5634bd632b2dbdddd..c7b4c5aeb9c57c355d231d85e9fe08f3baa46104 100644 (file)
@@ -113,23 +113,26 @@ void GDMLPlugin_Ellipsoid::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Ellipsoid> t
 
   // Insert to faces
   // Naming for faces and edges
-  int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
       theEllipsoidAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultEllipsoid->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it!=listOfFaces.end();
+       ++it)
+  {
+    theResultEllipsoid->generated((*it).second, (*it).first);
   }
 
   // Naming vertices
   GeomAPI_DataMapOfShapeShape aVertices;
-  GeomAPI_ShapeExplorer aVertExp(theEllipsoidAlgo->shape(), GeomAPI_Shape::VERTEX);
-  for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
+  int anIndex = 1;
+  for (GeomAPI_ShapeExplorer aVertExp(theEllipsoidAlgo->shape(), GeomAPI_Shape::VERTEX);
+       aVertExp.more();
+       aVertExp.next())
+  {
     if (!aVertices.isBound(aVertExp.current())) {
       std::ostringstream aStream;
       aStream<<"Vertex_"<<anIndex++;
-      theResultEllipsoid->generated(aVertExp.current(), aStream.str(), num++);
+      theResultEllipsoid->generated(aVertExp.current(), aStream.str());
       aVertices.bind(aVertExp.current(), aVertExp.current());
     }
   }
index 8428157d31ca889add69f292514427f879f1dbcd..dbed19f4b8212a7456ae146f13af20e4d5e127fb 100755 (executable)
 //#include <TDF_Tool.hxx>
 //#define DEB_IMPORT 1
 
+static const int VERTICES_TAG = 1;
+static const int EDGES_TAG = 2;
+static const int FACES_TAG = 3;
+static const int DELETED_TAG = 4;
+static const int PRIMITIVES_START_TAG = 11;
+
 Model_BodyBuilder::Model_BodyBuilder(ModelAPI_Object* theOwner)
 : ModelAPI_BodyBuilder(theOwner),
+  myPrimitiveTag(PRIMITIVES_START_TAG),
   myDividedIndex(1),
   myVIndex(1),
   myEIndex(1),
@@ -291,6 +298,7 @@ void Model_BodyBuilder::clean()
   myBuilders.clear();
   // remove the old reference (if any)
   aLab.ForgetAttribute(TDF_Reference::GetID());
+  myPrimitiveTag = PRIMITIVES_START_TAG;
   myDividedIndex = 1;
   myVIndex = 1;
   myEIndex = 1;
@@ -308,13 +316,16 @@ void Model_BodyBuilder::buildName(const int theTag, const std::string& theName)
   //aDoc->addNamingName(builder(theTag)->NamedShape()->Label(), theName);
   TDataStd_Name::Set(builder(theTag)->NamedShape()->Label(), theName.c_str());
 }
-void Model_BodyBuilder::generated(
-  const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag)
+void Model_BodyBuilder::generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
+                                  const std::string& theName)
 {
   TopoDS_Shape aShape = theNewShape->impl<TopoDS_Shape>();
-  builder(theTag)->Generated(aShape);
-  if(!theName.empty())
-    buildName(theTag, theName);
+  builder(myPrimitiveTag)->Generated(aShape);
+  if (!theName.empty()) {
+    buildName(myPrimitiveTag, theName);
+  }
+
+  ++myPrimitiveTag;
 }
 
 void Model_BodyBuilder::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
index d34fb0b173bac339d4a8b6e77ea3789334ff8a3d..36be6cfbb5cf89ae901524cdc7fd53e35f96e20d 100755 (executable)
@@ -67,7 +67,7 @@ public:
   /// Records the subshape newShape which was generated during a topological construction.
   /// As an example, consider the case of a face generated in construction of a box.
   MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-    const std::string& theName, const int theTag = 1);
+                                      const std::string& theName) override;
 
   /// Records the shape newShape which was generated from the shape oldShape during a topological
   /// construction. As an example, consider the case of a face generated from an edge in
@@ -155,6 +155,7 @@ private:
   void buildName(const int theTag, const std::string& theName);
 
 private:
+  int myPrimitiveTag;
   int myDividedIndex;
   int myVIndex;
   int myEIndex;
index 8da3d2158fc56eeb50d6d2e65362f293c816f1bd..90bd71015870b9742f476b8ae146db4bf30f9818 100755 (executable)
@@ -62,9 +62,8 @@ public:
 
   /// Records the subshape newShape which was generated during a topological construction.
   /// As an example, consider the case of a face generated in construction of a box.
-  virtual void generated(
-    const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
-    const int theTag = 1) = 0;
+  virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
+                         const std::string& theName) = 0;
 
   /// Records the shape newShape which was generated from the shape oldShape during a topological
   /// construction. As an example, consider the case of a face generated from an edge in
index 0ee6696c2e4d28b6c8e8b79eb1d020d618e449ba..9ca7a38ec05d3a2d4363f792c0ab1b100e3e30a7 100644 (file)
@@ -99,9 +99,9 @@ std::shared_ptr<GeomAPI_Shape> ModelAPI_ResultBody::shape()
 }
 
 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-  const std::string& theName, const int theTag)
+                                    const std::string& theName)
 {
-  myBuilder->generated(theNewShape, theName, theTag);
+  myBuilder->generated(theNewShape, theName);
 }
 
 void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
index b934744c6a93e15336f28d498dc8c5f912b1012f..9bc81dfc4ab58d614cae68a5e7e32c90651912b4 100644 (file)
@@ -116,7 +116,7 @@ public:
   /// Records the subshape newShape which was generated during a topological construction.
   /// As an example, consider the case of a face generated in construction of a box.
   MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
-    const std::string& theName, const int theTag = 1);
+                                         const std::string& theName);
 
   /// Records the shape newShape which was generated from the shape oldShape during a topological
   /// construction. As an example, consider the case of a face generated from an edge in
index efb5684259f67363c12e44a64fd159e985cd1651..6d08828f0fc84a4f9bc1157dc6836813ba95540d 100644 (file)
@@ -163,10 +163,11 @@ void PrimitivesPlugin_Box::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxA
   int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
     theBoxAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultBox->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultBox->generated((*it).second, (*it).first);
   }
 }
 
index 2c2916586faf73884dc1a01fe6be55f172f3d4ee..c4c68b3711d414c7ec19ad781879a9cac3069475 100644 (file)
@@ -145,26 +145,27 @@ void PrimitivesPlugin_Cone::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Cone> theCo
   theConeAlgo->prepareNamingFaces();
 
   // Insert to faces
-  int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
       theConeAlgo->getCreatedFaces();
   int nbFaces = 0;
   for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
        it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultCone->generated(aFace, (*it).first, num++);
+    theResultCone->generated((*it).second, (*it).first);
     nbFaces++;
   }
 
   if (nbFaces == 2) {
     // Naming vertices
     GeomAPI_DataMapOfShapeShape aVertices;
-    GeomAPI_ShapeExplorer aVertExp(theConeAlgo->shape(), GeomAPI_Shape::VERTEX);
-    for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
+    int anIndex = 1;
+    for (GeomAPI_ShapeExplorer aVertExp(theConeAlgo->shape(), GeomAPI_Shape::VERTEX);
+         aVertExp.more();
+         aVertExp.next())
+    {
       if (!aVertices.isBound(aVertExp.current())) {
         std::ostringstream aStream;
         aStream<<"Vertex_"<<anIndex++;
-        theResultCone->generated(aVertExp.current(), aStream.str(), num++);
+        theResultCone->generated(aVertExp.current(), aStream.str());
         aVertices.bind(aVertExp.current(), aVertExp.current());
       }
     }
index c3d5b82235327c599349018d31b12fb1d094574f..ee68294df4e4debb6bb296ff47abcc3a81378072 100644 (file)
@@ -184,12 +184,12 @@ void PrimitivesPlugin_Cylinder::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Cylinde
   theCylinderAlgo->prepareNamingFaces();
 
   // Insert to faces
-  int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
     theCylinderAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultCylinder->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultCylinder->generated((*it).second, (*it).first);
   }
 }
index c01d2b2fb73ba92e9b3c44427525b244a4dea460..df9fe3220e52dc42aafc23f587b7d3bf0c880e01 100644 (file)
@@ -106,23 +106,26 @@ void PrimitivesPlugin_Sphere::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Sphere> t
 
   // Insert to faces
   // Naming for faces and edges
-  int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
       theSphereAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultSphere->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultSphere->generated((*it).second, (*it).first);
   }
 
   // Naming vertices
   GeomAPI_DataMapOfShapeShape aVertices;
-  GeomAPI_ShapeExplorer aVertExp(theSphereAlgo->shape(), GeomAPI_Shape::VERTEX);
-  for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
+  int anIndex = 1;
+  for (GeomAPI_ShapeExplorer aVertExp(theSphereAlgo->shape(), GeomAPI_Shape::VERTEX);
+       aVertExp.more();
+       aVertExp.next())
+  {
     if (!aVertices.isBound(aVertExp.current())) {
       std::ostringstream aStream;
       aStream<<"Vertex_"<<anIndex++;
-      theResultSphere->generated(aVertExp.current(), aStream.str(), num++);
+      theResultSphere->generated(aVertExp.current(), aStream.str());
       aVertices.bind(aVertExp.current(), aVertExp.current());
     }
   }
index a086def17e8aa7171a97ac95766409bf36cd9883..43405e23e9fe501a0a6ba089c50ab6a57d48440b 100644 (file)
@@ -145,20 +145,24 @@ void PrimitivesPlugin_Torus::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Torus> the
   int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
       theTorusAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultTorus->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultTorus->generated((*it).second, (*it).first);
   }
 
   // Naming of edges
   GeomAPI_DataMapOfShapeShape anEdges;
-  GeomAPI_ShapeExplorer anEdgeExp(theTorusAlgo->shape(), GeomAPI_Shape::EDGE);
-  for(int anIndex = 1; anEdgeExp.more(); anEdgeExp.next()) {
+  int anIndex = 1;
+  for (GeomAPI_ShapeExplorer anEdgeExp(theTorusAlgo->shape(), GeomAPI_Shape::EDGE);
+       anEdgeExp.more();
+       anEdgeExp.next())
+  {
     if (!anEdges.isBound(anEdgeExp.current())) {
       std::ostringstream aStream;
       aStream<<"Edge_"<<anIndex++;
-      theResultTorus->generated(anEdgeExp.current(), aStream.str(), num++);
+      theResultTorus->generated(anEdgeExp.current(), aStream.str());
       anEdges.bind(anEdgeExp.current(), anEdgeExp.current());
     }
   }