Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / GeomAPI / GeomAPI_Pnt2d.cpp
1 // File:        GeomAPI_Pnt2d.cpp
2 // Created:     29 May 2014
3 // Author:      Artem ZHIDKOV
4
5 #include<GeomAPI_Pnt2d.h>
6 #include<GeomAPI_XY.h>
7
8 #include<gp_Pnt2d.hxx>
9
10 #define MY_PNT2D static_cast<gp_Pnt2d*>(myImpl)
11
12 GeomAPI_Pnt2d::GeomAPI_Pnt2d(const double theX, const double theY)
13   : GeomAPI_Interface(new gp_Pnt2d(theX, theY))
14 {}
15
16 GeomAPI_Pnt2d::GeomAPI_Pnt2d(const boost::shared_ptr<GeomAPI_XY>& theCoords)
17   : GeomAPI_Interface(new gp_Pnt2d(theCoords->x(), theCoords->y()))
18 {}
19
20 double GeomAPI_Pnt2d::x() const
21 {
22   return MY_PNT2D->X();
23 }
24
25 double GeomAPI_Pnt2d::y() const
26 {
27   return MY_PNT2D->Y();
28 }
29
30 void GeomAPI_Pnt2d::setX(const double theX)
31 {
32   return MY_PNT2D->SetX(theX);
33 }
34
35 void GeomAPI_Pnt2d::setY(const double theY)
36 {
37   return MY_PNT2D->SetY(theY);
38 }
39
40 const boost::shared_ptr<GeomAPI_XY> GeomAPI_Pnt2d::xy()
41 {
42   return boost::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_PNT2D->X(), MY_PNT2D->Y()));
43 }
44
45 double GeomAPI_Pnt2d::distance(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const
46 {
47   return MY_PNT2D->Distance(theOther->impl<gp_Pnt2d>());
48 }