X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_PointBuilder.cpp;h=096dc4a96bc01d45798762380b297aa7325a315d;hb=c65c7a084cf32f54c8d8a93fceace414c3b0fb21;hp=2ff0726bfd30020ed6664b6e95b12e9d1a14b2da;hpb=3874b57fe5aba25ff5aee2a07654fc23c1ee8eb0;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp index 2ff0726bf..096dc4a96 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp @@ -7,8 +7,12 @@ #include #include #include +#include #include +#include #include +#include +#include std::shared_ptr GeomAlgoAPI_PointBuilder::point( std::shared_ptr thePoint) @@ -16,7 +20,20 @@ std::shared_ptr GeomAlgoAPI_PointBuilder::point( const gp_Pnt& aPnt = thePoint->impl(); BRepBuilderAPI_MakeVertex aMaker(aPnt); TopoDS_Vertex aVertex = aMaker.Vertex(); - std::shared_ptr aRes(new GeomAPI_Shape); + std::shared_ptr aRes(new GeomAPI_Vertex); aRes->setImpl(new TopoDS_Shape(aVertex)); return aRes; } + + +std::shared_ptr GeomAlgoAPI_PointBuilder::point(std::shared_ptr theVertex) +{ + TopoDS_Shape aShape = theVertex->impl(); + if ((!aShape.IsNull()) && (aShape.ShapeType() == TopAbs_VERTEX)) { + TopoDS_Vertex aVertex = TopoDS::Vertex(aShape); + gp_Pnt aPoint = BRep_Tool::Pnt(aVertex); + std::shared_ptr aPnt(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z())); + return aPnt; + } + return std::shared_ptr(); +}