Salome HOME
Correct case when the weak-named attribute is dumped in Geom mode: geometrical repres...
[modules/shaper.git] / src / GeomAPI / GeomAPI_Ax2.cpp
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #include <GeomAPI_Ax2.h>
22
23 #include <gp_Ax2.hxx>
24
25 #define MY_AX1 implPtr<gp_Ax2>()
26
27 //=================================================================================================
28 GeomAPI_Ax2::GeomAPI_Ax2()
29 : GeomAPI_Interface(new gp_Ax2())
30 {
31 }
32
33 //=================================================================================================
34 GeomAPI_Ax2::GeomAPI_Ax2(std::shared_ptr<GeomAPI_Pnt> theOrigin,
35                          std::shared_ptr<GeomAPI_Dir> theN,
36                          std::shared_ptr<GeomAPI_Dir> theVX)
37 : GeomAPI_Interface(new gp_Ax2(theOrigin->impl<gp_Pnt>(),
38                                theN->impl<gp_Dir>(),
39                                theVX->impl<gp_Dir>()))
40 {
41 }
42
43 //=================================================================================================
44 GeomAPI_Ax2::GeomAPI_Ax2(std::shared_ptr<GeomAPI_Pnt> theOrigin,
45                          std::shared_ptr<GeomAPI_Dir> theDir)
46 : GeomAPI_Interface(new gp_Ax2(theOrigin->impl<gp_Pnt>(),
47                                theDir->impl<gp_Dir>()))
48 {
49 }
50
51 //=================================================================================================
52 void GeomAPI_Ax2::setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin)
53 {
54   MY_AX1->SetLocation(theOrigin->impl<gp_Pnt>());
55 }
56
57 //=================================================================================================
58 std::shared_ptr<GeomAPI_Pnt> GeomAPI_Ax2::origin() const
59 {
60   gp_Pnt aPnt = MY_AX1->Location();
61   return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPnt.X(),aPnt.Y(),aPnt.Z()));
62 }
63
64 //=================================================================================================
65 void GeomAPI_Ax2::setDir(const std::shared_ptr<GeomAPI_Dir>& theDir)
66 {
67   MY_AX1->SetDirection(theDir->impl<gp_Dir>());
68 }
69
70 //=================================================================================================
71 std::shared_ptr<GeomAPI_Dir> GeomAPI_Ax2::dir() const
72 {
73   gp_Dir aDir = MY_AX1->Direction();
74   return std::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
75 }