From 15be4e658262ccb2680bf19dfde3f254c285f1d5 Mon Sep 17 00:00:00 2001 From: dbv Date: Tue, 9 Oct 2018 13:39:53 +0300 Subject: [PATCH] Naming now stores primitives on tags 11+. --- src/BuildPlugin/BuildPlugin_Face.cpp | 2 +- src/BuildPlugin/BuildPlugin_Filling.cpp | 2 +- src/BuildPlugin/BuildPlugin_Interpolation.cpp | 2 +- src/BuildPlugin/BuildPlugin_Polyline.cpp | 4 +-- .../FeaturesPlugin_CompositeSketch.cpp | 33 +++++++++---------- .../FeaturesPlugin_Intersection.cpp | 6 ++-- .../FeaturesPlugin_MultiRotation.cpp | 3 +- src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp | 13 +++----- src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp | 10 +++--- src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp | 19 ++++++----- src/Model/Model_BodyBuilder.cpp | 21 +++++++++--- src/Model/Model_BodyBuilder.h | 3 +- src/ModelAPI/ModelAPI_BodyBuilder.h | 5 ++- src/ModelAPI/ModelAPI_ResultBody.cpp | 4 +-- src/ModelAPI/ModelAPI_ResultBody.h | 2 +- src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp | 9 ++--- .../PrimitivesPlugin_Cone.cpp | 13 ++++---- .../PrimitivesPlugin_Cylinder.cpp | 10 +++--- .../PrimitivesPlugin_Sphere.cpp | 19 ++++++----- .../PrimitivesPlugin_Torus.cpp | 18 ++++++---- 20 files changed, 107 insertions(+), 91 deletions(-) diff --git a/src/BuildPlugin/BuildPlugin_Face.cpp b/src/BuildPlugin/BuildPlugin_Face.cpp index 391ea4bd9..c7992999a 100644 --- a/src/BuildPlugin/BuildPlugin_Face.cpp +++ b/src/BuildPlugin/BuildPlugin_Face.cpp @@ -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; } diff --git a/src/BuildPlugin/BuildPlugin_Filling.cpp b/src/BuildPlugin/BuildPlugin_Filling.cpp index 4aff9c942..0dec8a14d 100644 --- a/src/BuildPlugin/BuildPlugin_Filling.cpp +++ b/src/BuildPlugin/BuildPlugin_Filling.cpp @@ -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); } diff --git a/src/BuildPlugin/BuildPlugin_Interpolation.cpp b/src/BuildPlugin/BuildPlugin_Interpolation.cpp index 4af802725..e1ace5e4a 100644 --- a/src/BuildPlugin/BuildPlugin_Interpolation.cpp +++ b/src/BuildPlugin/BuildPlugin_Interpolation.cpp @@ -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); diff --git a/src/BuildPlugin/BuildPlugin_Polyline.cpp b/src/BuildPlugin/BuildPlugin_Polyline.cpp index 7d2369c20..d06f265d1 100644 --- a/src/BuildPlugin/BuildPlugin_Polyline.cpp +++ b/src/BuildPlugin/BuildPlugin_Polyline.cpp @@ -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); diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp index 77766fcb5..9caeeefc3 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp @@ -44,8 +44,7 @@ static void storeSubShape(ResultBodyPtr theResultBody, const GeomAPI_Shape::ShapeType theType, const std::shared_ptr 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_"<generated(aGenerated, aStream.str(), theTag++); + aStream << "Lateral_" << theTag++; + theResultBody->generated(aGenerated, aStream.str()); anEdgesFromVertices.bind(aGenerated, aVertExp.current()); std::shared_ptr 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_"<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_"<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_"<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 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()); } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp b/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp index 7a33f2d46..e421c55f4 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Intersection.cpp @@ -150,12 +150,12 @@ void FeaturesPlugin_Intersection::loadNamingDS(std::shared_ptrgenerated(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); } diff --git a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp index 5f8870f59..90c459949 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp @@ -425,7 +425,6 @@ void FeaturesPlugin_MultiRotation::loadNamingDS3( std::shared_ptr theResultBody, std::shared_ptr 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; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp index ca72a5aeb..3448c72c5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Pipe.cpp @@ -41,8 +41,7 @@ static void storeSubShape(ResultBodyPtr theResultBody, const GeomAPI_Shape::ShapeType theType, const std::shared_ptr 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 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()); } } diff --git a/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp b/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp index 2429edd78..13bc106c5 100644 --- a/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp +++ b/src/GDMLPlugin/GDMLPlugin_ConeSegment.cpp @@ -94,13 +94,13 @@ void GDMLPlugin_ConeSegment::loadNamingDS( theConeSegmentAlgo->prepareNamingFaces(); // Insert to faces - int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theConeSegmentAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator - it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) { - std::shared_ptr aFace = (*it).second; - theResultConeSegment->generated(aFace, (*it).first, num++); + for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); + it != listOfFaces.end(); + ++it) + { + theResultConeSegment->generated((*it).second, (*it).first); } } diff --git a/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp b/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp index 55e2d1445..c7b4c5aeb 100644 --- a/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp +++ b/src/GDMLPlugin/GDMLPlugin_Ellipsoid.cpp @@ -113,23 +113,26 @@ void GDMLPlugin_Ellipsoid::loadNamingDS(std::shared_ptr t // Insert to faces // Naming for faces and edges - int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theEllipsoidAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator - it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) { - std::shared_ptr aFace = (*it).second; - theResultEllipsoid->generated(aFace, (*it).first, num++); + for (std::map< std::string, std::shared_ptr >::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_"<generated(aVertExp.current(), aStream.str(), num++); + theResultEllipsoid->generated(aVertExp.current(), aStream.str()); aVertices.bind(aVertExp.current(), aVertExp.current()); } } diff --git a/src/Model/Model_BodyBuilder.cpp b/src/Model/Model_BodyBuilder.cpp index 8428157d3..dbed19f4b 100755 --- a/src/Model/Model_BodyBuilder.cpp +++ b/src/Model/Model_BodyBuilder.cpp @@ -57,8 +57,15 @@ //#include //#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& theNewShape, const std::string& theName, const int theTag) +void Model_BodyBuilder::generated(const std::shared_ptr& theNewShape, + const std::string& theName) { TopoDS_Shape aShape = theNewShape->impl(); - 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& theOldShape, diff --git a/src/Model/Model_BodyBuilder.h b/src/Model/Model_BodyBuilder.h index d34fb0b17..36be6cfbb 100755 --- a/src/Model/Model_BodyBuilder.h +++ b/src/Model/Model_BodyBuilder.h @@ -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& 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; diff --git a/src/ModelAPI/ModelAPI_BodyBuilder.h b/src/ModelAPI/ModelAPI_BodyBuilder.h index 8da3d2158..90bd71015 100755 --- a/src/ModelAPI/ModelAPI_BodyBuilder.h +++ b/src/ModelAPI/ModelAPI_BodyBuilder.h @@ -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& theNewShape, const std::string& theName, - const int theTag = 1) = 0; + virtual void generated(const std::shared_ptr& 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 diff --git a/src/ModelAPI/ModelAPI_ResultBody.cpp b/src/ModelAPI/ModelAPI_ResultBody.cpp index 0ee6696c2..9ca7a38ec 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.cpp +++ b/src/ModelAPI/ModelAPI_ResultBody.cpp @@ -99,9 +99,9 @@ std::shared_ptr ModelAPI_ResultBody::shape() } void ModelAPI_ResultBody::generated(const std::shared_ptr& 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& theOldShape, diff --git a/src/ModelAPI/ModelAPI_ResultBody.h b/src/ModelAPI/ModelAPI_ResultBody.h index b934744c6..9bc81dfc4 100644 --- a/src/ModelAPI/ModelAPI_ResultBody.h +++ b/src/ModelAPI/ModelAPI_ResultBody.h @@ -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& 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 diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp index efb568425..6d08828f0 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp @@ -163,10 +163,11 @@ void PrimitivesPlugin_Box::loadNamingDS(std::shared_ptr theBoxA int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theBoxAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator - it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) { - std::shared_ptr aFace = (*it).second; - theResultBox->generated(aFace, (*it).first, num++); + for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); + it != listOfFaces.end(); + ++it) + { + theResultBox->generated((*it).second, (*it).first); } } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp index 2c2916586..c4c68b371 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp @@ -145,26 +145,27 @@ void PrimitivesPlugin_Cone::loadNamingDS(std::shared_ptr theCo theConeAlgo->prepareNamingFaces(); // Insert to faces - int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theConeAlgo->getCreatedFaces(); int nbFaces = 0; for (std::map< std::string, std::shared_ptr >::iterator it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) { - std::shared_ptr 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_"<generated(aVertExp.current(), aStream.str(), num++); + theResultCone->generated(aVertExp.current(), aStream.str()); aVertices.bind(aVertExp.current(), aVertExp.current()); } } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp index c3d5b8223..ee68294df 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp @@ -184,12 +184,12 @@ void PrimitivesPlugin_Cylinder::loadNamingDS(std::shared_ptrprepareNamingFaces(); // Insert to faces - int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theCylinderAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator - it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) { - std::shared_ptr aFace = (*it).second; - theResultCylinder->generated(aFace, (*it).first, num++); + for (std::map< std::string, std::shared_ptr >::iterator it = listOfFaces.begin(); + it != listOfFaces.end(); + ++it) + { + theResultCylinder->generated((*it).second, (*it).first); } } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp index c01d2b2fb..df9fe3220 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp @@ -106,23 +106,26 @@ void PrimitivesPlugin_Sphere::loadNamingDS(std::shared_ptr t // Insert to faces // Naming for faces and edges - int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theSphereAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator - it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) { - std::shared_ptr aFace = (*it).second; - theResultSphere->generated(aFace, (*it).first, num++); + for (std::map< std::string, std::shared_ptr >::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_"<generated(aVertExp.current(), aStream.str(), num++); + theResultSphere->generated(aVertExp.current(), aStream.str()); aVertices.bind(aVertExp.current(), aVertExp.current()); } } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp index a086def17..43405e23e 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp @@ -145,20 +145,24 @@ void PrimitivesPlugin_Torus::loadNamingDS(std::shared_ptr the int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theTorusAlgo->getCreatedFaces(); - for (std::map< std::string, std::shared_ptr >::iterator - it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) { - std::shared_ptr aFace = (*it).second; - theResultTorus->generated(aFace, (*it).first, num++); + for (std::map< std::string, std::shared_ptr >::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_"<generated(anEdgeExp.current(), aStream.str(), num++); + theResultTorus->generated(anEdgeExp.current(), aStream.str()); anEdges.bind(anEdgeExp.current(), anEdgeExp.current()); } } -- 2.39.2