0029355: OCCT 6.9.1 persistence restored in OCCT 7.2.0 not working
[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& theReadData, gp_Ax2d& theAx)
30 {
31   StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
32   gp_Pnt2d aLoc;
33   gp_Dir2d aDir;
34   theReadData >> aLoc >> aDir;
35   theAx = gp_Ax2d (aLoc, aDir);
36   return theReadData;
37 }
38
39 inline StdObjMgt_WriteData& 
40   write (StdObjMgt_WriteData& theWriteData, const gp_Ax2d& theAx)
41 {
42   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
43
44   const gp_Pnt2d& aLoc = theAx.Location();
45   const gp_Dir2d& aDir = theAx.Direction();
46   theWriteData << aLoc << aDir;
47   return theWriteData;
48 }
49
50 inline StdObjMgt_WriteData& operator <<
51   (StdObjMgt_WriteData& theWriteData, const gp_Ax2d& theAx)
52 {
53   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
54
55   const gp_Pnt2d& aLoc = theAx.Location();
56   const gp_Dir2d& aDir = theAx.Direction();
57   theWriteData << aLoc << aDir;
58   return theWriteData;
59 }
60
61 inline StdObjMgt_ReadData& operator >>
62   (StdObjMgt_ReadData& theReadData, gp_Ax22d& theAx)
63 {
64   StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
65   gp_Pnt2d aLoc;
66   gp_Dir2d aYDir, aXDir;
67   theReadData >> aLoc >> aYDir >> aXDir;
68   theAx = gp_Ax22d (aLoc, aXDir, aYDir);
69   return theReadData;
70 }
71
72 inline StdObjMgt_WriteData& operator <<
73   (StdObjMgt_WriteData& theWriteData, const gp_Ax22d& theAx)
74 {
75   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
76
77   const gp_Pnt2d& aLoc = theAx.Location();
78   const gp_Dir2d& aYDir = theAx.YDirection();
79   const gp_Dir2d& aXDir = theAx.XDirection();
80   theWriteData << aLoc << aYDir << aXDir;
81   return theWriteData;
82 }
83
84 inline StdObjMgt_ReadData& operator >>
85   (StdObjMgt_ReadData& theReadData, gp_Ax1& theAx)
86 {
87   StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
88   gp_Pnt aLoc;
89   gp_Dir aDir;
90   theReadData >> aLoc >> aDir;
91   theAx = gp_Ax1 (aLoc, aDir);
92   return theReadData;
93 }
94
95 inline StdObjMgt_WriteData&
96   write(StdObjMgt_WriteData& theWriteData, const gp_Ax1& theAx)
97 {
98   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
99
100   const gp_Pnt& aLoc = theAx.Location();
101   const gp_Dir& aDir = theAx.Direction();
102   theWriteData << aLoc << aDir;
103   return theWriteData;
104 }
105
106 inline StdObjMgt_WriteData& operator <<
107   (StdObjMgt_WriteData& theWriteData, const gp_Ax1& theAx)
108 {
109   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
110
111   const gp_Pnt& aLoc = theAx.Location();
112   const gp_Dir& aDir = theAx.Direction();
113   theWriteData << aLoc << aDir;
114   return theWriteData;
115 }
116
117 inline StdObjMgt_ReadData& operator >>
118   (StdObjMgt_ReadData& theReadData, gp_Ax2& theAx)
119 {
120   StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
121   gp_Ax1 anAx;
122   gp_Dir aYDir, aXDir;
123   theReadData >> anAx >> aYDir >> aXDir;
124   theAx = gp_Ax2 (anAx.Location(), anAx.Direction(), aXDir);
125   return theReadData;
126 }
127
128 inline StdObjMgt_WriteData& operator <<
129   (StdObjMgt_WriteData& theWriteData, const gp_Ax2& theAx)
130 {
131   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
132
133   const gp_Ax1& anAx = theAx.Axis();
134   const gp_Dir& aYDir = theAx.YDirection();
135   const gp_Dir& aXDir = theAx.XDirection();
136   theWriteData << anAx << aYDir << aXDir;
137   return theWriteData;
138 }
139
140 inline StdObjMgt_ReadData& operator >>
141   (StdObjMgt_ReadData& theReadData, gp_Ax3& theAx)
142 {
143   StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
144   gp_Ax1 anAx;
145   gp_Dir aYDir, aXDir;
146   theReadData >> anAx >> aYDir >> aXDir;
147   theAx = gp_Ax3 (anAx.Location(), anAx.Direction(), aXDir);
148   if (aYDir * theAx.YDirection() < 0.)
149     theAx.YReverse();
150   return theReadData;
151 }
152
153 inline StdObjMgt_WriteData& operator <<
154   (StdObjMgt_WriteData& theWriteData, const gp_Ax3& theAx)
155 {
156   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
157
158   const gp_Ax1& anAx = theAx.Axis();
159   const gp_Dir& aYDir = theAx.YDirection();
160   const gp_Dir& aXDir = theAx.XDirection();
161   theWriteData << anAx << aYDir << aXDir;
162   return theWriteData;
163 }
164
165
166 #endif