Salome HOME
Correct case when the weak-named attribute is dumped in Geom mode: geometrical repres...
[modules/shaper.git] / src / PrimitivesPlugin / PrimitivesPlugin_Sphere.cpp
index 9e63047df90e31419cf531780fdb03c349950da2..c01d2b2fb73ba92e9b3c44427525b244a4dea460 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <PrimitivesPlugin_Sphere.h>
 
+#include <GeomAPI_ShapeExplorer.h>
+
 #include <GeomAlgoAPI_PointBuilder.h>
 
 #include <ModelAPI_AttributeDouble.h>
@@ -14,6 +16,8 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_Session.h>
 
+#include <sstream>
+
 //=================================================================================================
 PrimitivesPlugin_Sphere::PrimitivesPlugin_Sphere()
 {
@@ -101,6 +105,7 @@ void PrimitivesPlugin_Sphere::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Sphere> t
   theSphereAlgo->prepareNamingFaces();
 
   // Insert to faces
+  // Naming for faces and edges
   int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
       theSphereAlgo->getCreatedFaces();
@@ -109,4 +114,16 @@ void PrimitivesPlugin_Sphere::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Sphere> t
     std::shared_ptr<GeomAPI_Shape> 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_"<<anIndex++;
+      theResultSphere->generated(aVertExp.current(), aStream.str(), num++);
+      aVertices.bind(aVertExp.current(), aVertExp.current());
+    }
+  }
 }