X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_PointBuilder.cpp;h=dffcecce403d8ab1f74c70d577937e0e0a9edccf;hb=e014b807fc2f417db0092b2faf4d89a8ca50eea4;hp=d12bd6a86c61debae635c578b6efe1eef374f7fd;hpb=587c5c1821f464e323eec057ba860b2433d4f412;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp index d12bd6a86..dffcecce4 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp @@ -1,22 +1,49 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAlgoAPI_PointBuilder.cpp // Created: 02 Jun 2014 // Author: Mikhail PONIKAROV - - #include #include #include +#include #include +#include #include +#include +#include -boost::shared_ptr GeomAlgoAPI_PointBuilder::point( - boost::shared_ptr thePoint) +std::shared_ptr GeomAlgoAPI_PointBuilder::point( + std::shared_ptr thePoint) { const gp_Pnt& aPnt = thePoint->impl(); BRepBuilderAPI_MakeVertex aMaker(aPnt); TopoDS_Vertex aVertex = aMaker.Vertex(); - boost::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( + const double theX, const double theY, const double theZ) +{ + const gp_Pnt aPnt(theX, theY, theZ); + BRepBuilderAPI_MakeVertex aMaker(aPnt); + TopoDS_Vertex aVertex = aMaker.Vertex(); + 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(); +}