X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Curve.cpp;h=f96fd7b7850d7d4492dbbbf4419a85064ce66621;hb=28bb5c301466d4581d9a1b4aa920e0e101b8ac47;hp=77bf7d9a2660842d0fee494d689961fbe6b57106;hpb=cc917b5dfaca1fcba1a25c1e54d6bd1ef0b4c057;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Curve.cpp b/src/GeomAPI/GeomAPI_Curve.cpp index 77bf7d9a2..f96fd7b78 100644 --- a/src/GeomAPI/GeomAPI_Curve.cpp +++ b/src/GeomAPI/GeomAPI_Curve.cpp @@ -1,8 +1,11 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: GeomAPI_Curve.cpp // Created: 04 Sep 2014 // Author: Mikhail PONIKAROV #include +#include #include #include @@ -11,24 +14,24 @@ #include #include #include +#include -#define MY_CURVE (*(static_cast(myImpl))) +#define MY_CURVE (*(implPtr())) GeomAPI_Curve::GeomAPI_Curve() - : GeomAPI_Interface(new Handle_Geom_Curve()) + : GeomAPI_Interface(new Handle_Geom_Curve()), myStart(0), myEnd(1) { } -GeomAPI_Curve::GeomAPI_Curve(const boost::shared_ptr& theShape) +GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr& theShape) : GeomAPI_Interface(new Handle_Geom_Curve()) // initially it is null { const TopoDS_Shape& aShape = theShape->impl(); TopoDS_Edge anEdge = TopoDS::Edge(aShape); if (!anEdge.IsNull()) { - Standard_Real aStart, anEnd; - Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aStart, anEnd); + Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, myStart, myEnd); if (!aCurve.IsNull()) { - setImpl(&aCurve); + setImpl(new Handle(Geom_Curve)(aCurve)); } } } @@ -47,3 +50,10 @@ bool GeomAPI_Curve::isCircle() const { return !isNull() && MY_CURVE->DynamicType() == STANDARD_TYPE(Geom_Circle); } + +std::shared_ptr GeomAPI_Curve::getPoint(double theParam) +{ + GeomAdaptor_Curve aAdaptor(MY_CURVE, myStart, myEnd); + gp_Pnt aPnt = aAdaptor.Value(theParam); + return std::shared_ptr(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); +}