1 // Copyright (C) 2014-2019 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 email : webmaster.salome@opencascade.com
20 #include <GeomAPI_Ax1.h>
24 #define MY_AX1 implPtr<gp_Ax1>()
26 //=================================================================================================
27 GeomAPI_Ax1::GeomAPI_Ax1()
28 : GeomAPI_Interface(new gp_Ax1())
32 //=================================================================================================
33 GeomAPI_Ax1::GeomAPI_Ax1(std::shared_ptr<GeomAPI_Pnt> theOrigin,
34 std::shared_ptr<GeomAPI_Dir> theDir)
35 : GeomAPI_Interface(new gp_Ax1(theOrigin->impl<gp_Pnt>(),
36 theDir->impl<gp_Dir>()))
40 //=================================================================================================
41 void GeomAPI_Ax1::setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin)
43 MY_AX1->SetLocation(theOrigin->impl<gp_Pnt>());
46 //=================================================================================================
47 std::shared_ptr<GeomAPI_Pnt> GeomAPI_Ax1::origin() const
49 gp_Pnt aPnt = MY_AX1->Location();
50 return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPnt.X(),aPnt.Y(),aPnt.Z()));
53 //=================================================================================================
54 void GeomAPI_Ax1::setDir(const std::shared_ptr<GeomAPI_Dir>& theDir)
56 MY_AX1->SetDirection(theDir->impl<gp_Dir>());
59 //=================================================================================================
60 std::shared_ptr<GeomAPI_Dir> GeomAPI_Ax1::dir() const
62 gp_Dir aDir = MY_AX1->Direction();
63 return std::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
66 //=================================================================================================
67 void GeomAPI_Ax1::reverse()
72 //=================================================================================================
73 std::shared_ptr<GeomAPI_Ax1> GeomAPI_Ax1::reversed()
75 gp_Ax1 anAxis = MY_AX1->Reversed();
76 std::shared_ptr<GeomAPI_Pnt> aPnt(
77 new GeomAPI_Pnt(anAxis.Location().X(), anAxis.Location().Y(), anAxis.Location().Z()));
78 std::shared_ptr<GeomAPI_Dir> aDir(
79 new GeomAPI_Dir(anAxis.Direction().X(), anAxis.Direction().Y(), anAxis.Direction().Z()));
80 return std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(aPnt, aDir));