1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #include <GeomAPI_Ax1.h>
25 #define MY_AX1 implPtr<gp_Ax1>()
27 //=================================================================================================
28 GeomAPI_Ax1::GeomAPI_Ax1()
29 : GeomAPI_Interface(new gp_Ax1())
33 //=================================================================================================
34 GeomAPI_Ax1::GeomAPI_Ax1(std::shared_ptr<GeomAPI_Pnt> theOrigin,
35 std::shared_ptr<GeomAPI_Dir> theDir)
36 : GeomAPI_Interface(new gp_Ax1(theOrigin->impl<gp_Pnt>(),
37 theDir->impl<gp_Dir>()))
41 //=================================================================================================
42 void GeomAPI_Ax1::setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin)
44 MY_AX1->SetLocation(theOrigin->impl<gp_Pnt>());
47 //=================================================================================================
48 std::shared_ptr<GeomAPI_Pnt> GeomAPI_Ax1::origin() const
50 gp_Pnt aPnt = MY_AX1->Location();
51 return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPnt.X(),aPnt.Y(),aPnt.Z()));
54 //=================================================================================================
55 void GeomAPI_Ax1::setDir(const std::shared_ptr<GeomAPI_Dir>& theDir)
57 MY_AX1->SetDirection(theDir->impl<gp_Dir>());
60 //=================================================================================================
61 std::shared_ptr<GeomAPI_Dir> GeomAPI_Ax1::dir() const
63 gp_Dir aDir = MY_AX1->Direction();
64 return std::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
67 //=================================================================================================
68 void GeomAPI_Ax1::reverse()
73 //=================================================================================================
74 std::shared_ptr<GeomAPI_Ax1> GeomAPI_Ax1::reversed()
76 gp_Ax1 anAxis = MY_AX1->Reversed();
77 std::shared_ptr<GeomAPI_Pnt> aPnt(
78 new GeomAPI_Pnt(anAxis.Location().X(), anAxis.Location().Y(), anAxis.Location().Z()));
79 std::shared_ptr<GeomAPI_Dir> aDir(
80 new GeomAPI_Dir(anAxis.Direction().X(), anAxis.Direction().Y(), anAxis.Direction().Z()));
81 return std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(aPnt, aDir));