From: Clarisse Genrault Date: Thu, 28 Sep 2017 13:53:04 +0000 (+0200) Subject: Correction on the naming. X-Git-Tag: V_2.9.0~32 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=953c011cb416075fbdd3eb3bd9f3eb74966c28de;p=modules%2Fshaper.git Correction on the naming. --- diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp index fba4eb498..4d92398d7 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp @@ -8,6 +8,7 @@ #include #include +#include #include @@ -17,6 +18,8 @@ #include #include +#include + //================================================================================================= PrimitivesPlugin_Cone::PrimitivesPlugin_Cone() { @@ -145,9 +148,25 @@ void PrimitivesPlugin_Cone::loadNamingDS(std::shared_ptr theCo 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++); + 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()) { + if (!aVertices.isBound(aVertExp.current())) { + std::ostringstream aStream; + aStream<<"Vertex_"<generated(aVertExp.current(), aStream.str(), num++); + aVertices.bind(aVertExp.current(), aVertExp.current()); + } + } } -} \ No newline at end of file +} diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp index 9e63047df..e6376b270 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Sphere.cpp @@ -6,6 +6,8 @@ #include +#include + #include #include @@ -14,6 +16,8 @@ #include #include +#include + //================================================================================================= PrimitivesPlugin_Sphere::PrimitivesPlugin_Sphere() { @@ -101,6 +105,7 @@ void PrimitivesPlugin_Sphere::loadNamingDS(std::shared_ptr t theSphereAlgo->prepareNamingFaces(); // Insert to faces + // Naming for faces and edges int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theSphereAlgo->getCreatedFaces(); @@ -109,4 +114,16 @@ void PrimitivesPlugin_Sphere::loadNamingDS(std::shared_ptr t std::shared_ptr aFace = (*it).second; theResultSphere->generated(aFace, (*it).first, num++); } + + // Naming vertices + GeomAPI_DataMapOfShapeShape aVertices; + GeomAPI_ShapeExplorer aVertExp(theSphereAlgo->shape(), GeomAPI_Shape::VERTEX); + for(int anIndex = 1; aVertExp.more(); aVertExp.next()) { + if (!aVertices.isBound(aVertExp.current())) { + std::ostringstream aStream; + aStream<<"Vertex_"<generated(aVertExp.current(), aStream.str(), num++); + aVertices.bind(aVertExp.current(), aVertExp.current()); + } + } } diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp index 817714a95..bd5a8851b 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp @@ -8,6 +8,7 @@ #include #include +#include #include @@ -17,6 +18,8 @@ #include #include +#include + //================================================================================================= PrimitivesPlugin_Torus::PrimitivesPlugin_Torus() { @@ -138,6 +141,7 @@ void PrimitivesPlugin_Torus::loadNamingDS(std::shared_ptr the theTorusAlgo->prepareNamingFaces(); // Insert to faces + // Naming for faces int num = 1; std::map< std::string, std::shared_ptr > listOfFaces = theTorusAlgo->getCreatedFaces(); @@ -146,4 +150,16 @@ void PrimitivesPlugin_Torus::loadNamingDS(std::shared_ptr the std::shared_ptr aFace = (*it).second; theResultTorus->generated(aFace, (*it).first, num++); } -} \ No newline at end of file + + // Naming of edges + GeomAPI_DataMapOfShapeShape anEdges; + GeomAPI_ShapeExplorer anEdgeExp(theTorusAlgo->shape(), GeomAPI_Shape::EDGE); + for(int anIndex = 1; anEdgeExp.more(); anEdgeExp.next()) { + if (!anEdges.isBound(anEdgeExp.current())) { + std::ostringstream aStream; + aStream<<"Edge_"<generated(anEdgeExp.current(), aStream.str(), num++); + anEdges.bind(anEdgeExp.current(), anEdgeExp.current()); + } + } +}