#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeExplorer.h>
#include <GeomAlgoAPI_PointBuilder.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_Session.h>
+#include <sstream>
+
//=================================================================================================
PrimitivesPlugin_Cone::PrimitivesPlugin_Cone()
{
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++);
+ 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_"<<anIndex++;
+ theResultCone->generated(aVertExp.current(), aStream.str(), num++);
+ aVertices.bind(aVertExp.current(), aVertExp.current());
+ }
+ }
}
-}
\ No newline at end of file
+}
#include <PrimitivesPlugin_Sphere.h>
+#include <GeomAPI_ShapeExplorer.h>
+
#include <GeomAlgoAPI_PointBuilder.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_Session.h>
+#include <sstream>
+
//=================================================================================================
PrimitivesPlugin_Sphere::PrimitivesPlugin_Sphere()
{
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();
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());
+ }
+ }
}
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeExplorer.h>
#include <GeomAlgoAPI_PointBuilder.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_Session.h>
+#include <sstream>
+
//=================================================================================================
PrimitivesPlugin_Torus::PrimitivesPlugin_Torus()
{
theTorusAlgo->prepareNamingFaces();
// Insert to faces
+ // Naming for faces
int num = 1;
std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
theTorusAlgo->getCreatedFaces();
std::shared_ptr<GeomAPI_Shape> 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_"<<anIndex++;
+ theResultTorus->generated(anEdgeExp.current(), aStream.str(), num++);
+ anEdges.bind(anEdgeExp.current(), anEdgeExp.current());
+ }
+ }
+}