Salome HOME
Regression: do not rotate viewer if sketch plane is selected from a face of a shape
[modules/shaper.git] / src / GeomAPI / GeomAPI_Ax2.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAPI_Ax2.cpp
4 // Created:     08 September 2015
5 // Author:      Dmitry Bobylev
6
7 #include <GeomAPI_Ax2.h>
8
9 #include <gp_Ax2.hxx>
10
11 #define MY_AX1 implPtr<gp_Ax2>()
12
13 //=================================================================================================
14 GeomAPI_Ax2::GeomAPI_Ax2()
15 : GeomAPI_Interface(new gp_Ax2())
16 {
17 }
18
19 //=================================================================================================
20 GeomAPI_Ax2::GeomAPI_Ax2(std::shared_ptr<GeomAPI_Pnt> theOrigin,
21                          std::shared_ptr<GeomAPI_Dir> theN,
22                          std::shared_ptr<GeomAPI_Dir> theVX)
23 : GeomAPI_Interface(new gp_Ax2(theOrigin->impl<gp_Pnt>(),
24                                theN->impl<gp_Dir>(),
25                                theVX->impl<gp_Dir>()))
26 {
27 }
28
29 //=================================================================================================
30 GeomAPI_Ax2::GeomAPI_Ax2(std::shared_ptr<GeomAPI_Pnt> theOrigin,
31                          std::shared_ptr<GeomAPI_Dir> theDir)
32 : GeomAPI_Interface(new gp_Ax2(theOrigin->impl<gp_Pnt>(),
33                                theDir->impl<gp_Dir>()))
34 {
35 }
36
37 //=================================================================================================
38 void GeomAPI_Ax2::setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin)
39 {
40   MY_AX1->SetLocation(theOrigin->impl<gp_Pnt>());
41 }
42
43 //=================================================================================================
44 std::shared_ptr<GeomAPI_Pnt> GeomAPI_Ax2::origin() const
45 {
46   gp_Pnt aPnt = MY_AX1->Location();
47   return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPnt.X(),aPnt.Y(),aPnt.Z()));
48 }
49
50 //=================================================================================================
51 void GeomAPI_Ax2::setDir(const std::shared_ptr<GeomAPI_Dir>& theDir)
52 {
53   MY_AX1->SetDirection(theDir->impl<gp_Dir>());
54 }
55
56 //=================================================================================================
57 std::shared_ptr<GeomAPI_Dir> GeomAPI_Ax2::dir() const
58 {
59   gp_Dir aDir = MY_AX1->Direction();
60   return std::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
61 }