f5c78bc335518c9e47eda758a23745a2e253fe86
[occt.git] / src / StdObject / StdObject_gp_Axes.hxx
1 // Copyright (c) 2015 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #ifndef _StdObject_gp_Axes_HeaderFile
16 #define _StdObject_gp_Axes_HeaderFile
17
18
19 #include <StdObject_gp_Vectors.hxx>
20
21 #include <gp_Ax2d.hxx>
22 #include <gp_Ax22d.hxx>
23 #include <gp_Ax1.hxx>
24 #include <gp_Ax2.hxx>
25 #include <gp_Ax3.hxx>
26
27
28 inline StdObjMgt_ReadData& operator >>
29   (StdObjMgt_ReadData::Object theReadData, gp_Ax2d& theAx)
30 {
31   gp_Pnt2d aLoc;
32   gp_Dir2d aDir;
33   theReadData >> aLoc >> aDir;
34   theAx = gp_Ax2d (aLoc, aDir);
35   return theReadData;
36 }
37
38 inline StdObjMgt_WriteData& 
39   write (StdObjMgt_WriteData::Object theWriteData, const gp_Ax2d& theAx)
40 {
41   const gp_Pnt2d& aLoc = theAx.Location();
42   const gp_Dir2d& aDir = theAx.Direction();
43   theWriteData << aLoc << aDir;
44   return theWriteData;
45 }
46
47 inline StdObjMgt_WriteData& operator <<
48   (StdObjMgt_WriteData::Object theWriteData, const gp_Ax2d& theAx)
49 {
50   const gp_Pnt2d& aLoc = theAx.Location();
51   const gp_Dir2d& aDir = theAx.Direction();
52   theWriteData << aLoc << aDir;
53   return theWriteData;
54 }
55
56 inline StdObjMgt_ReadData& operator >>
57   (StdObjMgt_ReadData::Object theReadData, gp_Ax22d& theAx)
58 {
59   gp_Pnt2d aLoc;
60   gp_Dir2d aYDir, aXDir;
61   theReadData >> aLoc >> aYDir >> aXDir;
62   theAx = gp_Ax22d (aLoc, aXDir, aYDir);
63   return theReadData;
64 }
65
66 inline StdObjMgt_WriteData& operator <<
67   (StdObjMgt_WriteData::Object theWriteData, const gp_Ax22d& theAx)
68 {
69   const gp_Pnt2d& aLoc = theAx.Location();
70   const gp_Dir2d& aYDir = theAx.YDirection();
71   const gp_Dir2d& aXDir = theAx.XDirection();
72   theWriteData << aLoc << aYDir << aXDir;
73   return theWriteData;
74 }
75
76 inline StdObjMgt_ReadData& operator >>
77   (StdObjMgt_ReadData::Object theReadData, gp_Ax1& theAx)
78 {
79   gp_Pnt aLoc;
80   gp_Dir aDir;
81   theReadData >> aLoc >> aDir;
82   theAx = gp_Ax1 (aLoc, aDir);
83   return theReadData;
84 }
85
86 inline StdObjMgt_WriteData&
87   write(StdObjMgt_WriteData::Object theWriteData, const gp_Ax1& theAx)
88 {
89   const gp_Pnt& aLoc = theAx.Location();
90   const gp_Dir& aDir = theAx.Direction();
91   theWriteData << aLoc << aDir;
92   return theWriteData;
93 }
94
95 inline StdObjMgt_WriteData& operator <<
96   (StdObjMgt_WriteData::Object theWriteData, const gp_Ax1& theAx)
97 {
98   const gp_Pnt& aLoc = theAx.Location();
99   const gp_Dir& aDir = theAx.Direction();
100   theWriteData << aLoc << aDir;
101   return theWriteData;
102 }
103
104 inline StdObjMgt_ReadData& operator >>
105   (StdObjMgt_ReadData::Object theReadData, gp_Ax2& theAx)
106 {
107   gp_Ax1 anAx;
108   gp_Dir aYDir, aXDir;
109   theReadData >> anAx >> aYDir >> aXDir;
110   theAx = gp_Ax2 (anAx.Location(), anAx.Direction(), aXDir);
111   return theReadData;
112 }
113
114 inline StdObjMgt_WriteData& operator <<
115   (StdObjMgt_WriteData::Object theWriteData, const gp_Ax2& theAx)
116 {
117   const gp_Ax1& anAx = theAx.Axis();
118   const gp_Dir& aYDir = theAx.YDirection();
119   const gp_Dir& aXDir = theAx.XDirection();
120   theWriteData << anAx << aYDir << aXDir;
121   return theWriteData;
122 }
123
124 inline StdObjMgt_ReadData& operator >>
125   (StdObjMgt_ReadData::Object theReadData, gp_Ax3& theAx)
126 {
127   gp_Ax1 anAx;
128   gp_Dir aYDir, aXDir;
129   theReadData >> anAx >> aYDir >> aXDir;
130   theAx = gp_Ax3 (anAx.Location(), anAx.Direction(), aXDir);
131   if (aYDir * theAx.YDirection() < 0.)
132     theAx.YReverse();
133   return theReadData;
134 }
135
136 inline StdObjMgt_WriteData& operator <<
137 (StdObjMgt_WriteData::Object theWriteData, const gp_Ax3& theAx)
138 {
139   const gp_Ax1& anAx = theAx.Axis();
140   const gp_Dir& aYDir = theAx.YDirection();
141   const gp_Dir& aXDir = theAx.XDirection();
142   theWriteData << anAx << aYDir << aXDir;
143   return theWriteData;
144 }
145
146
147 #endif