Salome HOME
Sources formated according to the codeing standards
[modules/shaper.git] / src / GeomAPI / GeomAPI_Pnt.cpp
1 // File:        GeomAPI_Pnt.cpp
2 // Created:     23 Apr 2014
3 // Author:      Mikhail PONIKAROV
4
5 #include<GeomAPI_Pnt.h>
6 #include<GeomAPI_XYZ.h>
7
8 #include<gp_Pnt.hxx>
9
10 #define MY_PNT static_cast<gp_Pnt*>(myImpl)
11
12 GeomAPI_Pnt::GeomAPI_Pnt(const double theX, const double theY, const double theZ)
13     : GeomAPI_Interface(new gp_Pnt(theX, theY, theZ))
14 {
15 }
16
17 GeomAPI_Pnt::GeomAPI_Pnt(const boost::shared_ptr<GeomAPI_XYZ>& theCoords)
18     : GeomAPI_Interface(new gp_Pnt(theCoords->x(), theCoords->y(), theCoords->z()))
19 {
20 }
21
22 double GeomAPI_Pnt::x() const
23 {
24   return MY_PNT->X();
25 }
26
27 double GeomAPI_Pnt::y() const
28 {
29   return MY_PNT->Y();
30 }
31
32 double GeomAPI_Pnt::z() const
33 {
34   return MY_PNT->Z();
35 }
36
37 void GeomAPI_Pnt::setX(const double theX)
38 {
39   return MY_PNT->SetX(theX);
40 }
41
42 void GeomAPI_Pnt::setY(const double theY)
43 {
44   return MY_PNT->SetY(theY);
45 }
46
47 void GeomAPI_Pnt::setZ(const double theZ)
48 {
49   return MY_PNT->SetZ(theZ);
50 }
51
52 const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Pnt::xyz()
53 {
54   return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(MY_PNT->X(), MY_PNT->Y(), MY_PNT->Z()));
55 }
56
57 double GeomAPI_Pnt::distance(const boost::shared_ptr<GeomAPI_Pnt>& theOther) const
58 {
59   return MY_PNT->Distance(theOther->impl<gp_Pnt>());
60 }