1 // Copyright (c) 2015 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #ifndef _StdObject_gp_HeaderFile
16 #define _StdObject_gp_HeaderFile
18 #include <StdObjMgt_ContentTypes.hxx>
20 class StdObject_gp : private StdObjMgt_ContentTypes
24 { Standard_EXPORT void Read (StdObjMgt_ReadData& theReadData); };
28 struct Object : StdObjMgt_ContentTypes::Object <object<Data> > {};
31 static Object<Data>& Ref (Data& theData)
32 { return static_cast<Object<Data>&> (theData); }
37 #include <gp_Pnt2d.hxx>
38 #include <gp_Vec2d.hxx>
39 #include <gp_Dir2d.hxx>
44 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_XY& theXY)
47 theReadData.ReadValue(aX);
48 theReadData.ReadValue(aY);
49 theXY.SetCoord(aX, aY);
53 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Pnt2d& thePnt)
56 theReadData.ReadValue(aX);
57 theReadData.ReadValue(aY);
58 thePnt.SetCoord(aX, aY);
62 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Vec2d& theVec)
65 theReadData.ReadValue(aX);
66 theReadData.ReadValue(aY);
67 theVec.SetCoord(aX, aY);
71 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Dir2d& theDir)
74 theReadData.ReadValue(aX);
75 theReadData.ReadValue(aY);
76 theDir.SetCoord(aX, aY);
80 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_XYZ& theXYZ)
82 Standard_Real aX, aY, aZ;
83 theReadData.ReadValue(aX);
84 theReadData.ReadValue(aY);
85 theReadData.ReadValue(aZ);
86 theXYZ.SetCoord(aX, aY, aZ);
90 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Pnt& thePnt)
92 Standard_Real aX, aY, aZ;
93 theReadData.ReadValue(aX);
94 theReadData.ReadValue(aY);
95 theReadData.ReadValue(aZ);
96 thePnt.SetCoord(aX, aY, aZ);
100 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Vec& theVec)
102 Standard_Real aX, aY, aZ;
103 theReadData.ReadValue(aX);
104 theReadData.ReadValue(aY);
105 theReadData.ReadValue(aZ);
106 theVec.SetCoord(aX, aY, aZ);
110 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Dir& theDir)
112 Standard_Real aX, aY, aZ;
113 theReadData.ReadValue(aX);
114 theReadData.ReadValue(aY);
115 theReadData.ReadValue(aZ);
116 theDir.SetCoord(aX, aY, aZ);
120 // read axis placements
122 #include <gp_Ax2d.hxx>
123 #include <gp_Ax22d.hxx>
124 #include <gp_Ax1.hxx>
125 #include <gp_Ax2.hxx>
126 #include <gp_Ax3.hxx>
128 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax2d& theAx)
132 theReadData >> aLoc >> aDir;
133 theAx = gp_Ax2d (aLoc, aDir);
137 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax22d& theAx)
140 gp_Dir2d aYDir, aXDir;
141 theReadData >> aLoc >> aYDir >> aXDir;
142 theAx = gp_Ax22d (aLoc, aXDir, aYDir);
146 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax1& theAx)
150 theReadData >> aLoc >> aDir;
151 theAx = gp_Ax1 (aLoc, aDir);
155 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax2& theAx)
159 theReadData >> anAx >> aYDir >> aXDir;
160 theAx = gp_Ax2 (anAx.Location(), anAx.Direction(), aXDir);
164 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax3& theAx)
168 theReadData >> anAx >> aYDir >> aXDir;
169 theAx = gp_Ax3 (anAx.Location(), anAx.Direction(), aXDir);
170 if (aYDir * theAx.YDirection() < 0.)
177 #include <gp_Lin2d.hxx>
178 #include <gp_Circ2d.hxx>
179 #include <gp_Elips2d.hxx>
180 #include <gp_Hypr2d.hxx>
181 #include <gp_Parab2d.hxx>
182 #include <gp_Lin.hxx>
183 #include <gp_Circ.hxx>
184 #include <gp_Elips.hxx>
185 #include <gp_Hypr.hxx>
186 #include <gp_Parab.hxx>
188 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Lin2d& theLin)
192 theLin.SetPosition(anAx);
196 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Circ2d& theCirc)
199 Standard_Real aRadius;
201 theReadData.ReadValue(aRadius);
202 theCirc.SetAxis(anAx);
203 theCirc.SetRadius (aRadius);
207 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Elips2d& theElips)
210 Standard_Real aMajorRadius, aMinorRadius;
212 theReadData.ReadValue(aMajorRadius);
213 theReadData.ReadValue(aMinorRadius);
214 theElips.SetAxis(anAx);
215 theElips.SetMajorRadius(aMajorRadius);
216 theElips.SetMinorRadius(aMinorRadius);
220 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Hypr2d& theHypr)
223 Standard_Real aMajorRadius, aMinorRadius;
225 theReadData.ReadValue(aMajorRadius);
226 theReadData.ReadValue(aMinorRadius);
227 theHypr.SetAxis(anAx);
228 theHypr.SetMajorRadius(aMajorRadius);
229 theHypr.SetMinorRadius(aMinorRadius);
233 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Parab2d& theParab)
236 Standard_Real aFocalLength;
238 theReadData.ReadValue(aFocalLength);
239 theParab.SetAxis(anAx);
240 theParab.SetFocal(aFocalLength);
244 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Lin& theLin)
248 theLin.SetPosition(anAx);
252 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Circ& theCirc)
255 Standard_Real aRadius;
257 theReadData.ReadValue(aRadius);
258 theCirc.SetPosition(anAx);
259 theCirc.SetRadius (aRadius);
263 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Elips& theElips)
266 Standard_Real aMajorRadius, aMinorRadius;
268 theReadData.ReadValue(aMajorRadius);
269 theReadData.ReadValue(aMinorRadius);
270 theElips.SetPosition(anAx);
271 theElips.SetMajorRadius(aMajorRadius);
272 theElips.SetMinorRadius(aMinorRadius);
276 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Hypr& theHypr)
279 Standard_Real aMajorRadius, aMinorRadius;
281 theReadData.ReadValue(aMajorRadius);
282 theReadData.ReadValue(aMinorRadius);
283 theHypr.SetPosition(anAx);
284 theHypr.SetMajorRadius(aMajorRadius);
285 theHypr.SetMinorRadius(aMinorRadius);
289 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Parab& theParab)
292 Standard_Real aFocalLength;
294 theReadData.ReadValue(aFocalLength);
295 theParab.SetPosition(anAx);
296 theParab.SetFocal(aFocalLength);
302 #include <gp_Cone.hxx>
303 #include <gp_Cylinder.hxx>
304 #include <gp_Sphere.hxx>
305 #include <gp_Torus.hxx>
307 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Cone& theCone)
310 Standard_Real aRadius, aSemiAngle;
312 theReadData.ReadValue(aRadius);
313 theReadData.ReadValue(aSemiAngle);
314 theCone.SetPosition(anAx);
315 theCone.SetRadius(aRadius);
316 theCone.SetSemiAngle(aSemiAngle);
320 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Cylinder& theCyl)
323 Standard_Real aRadius;
325 theReadData.ReadValue(aRadius);
326 theCyl.SetPosition(anAx);
327 theCyl.SetRadius(aRadius);
331 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Sphere& theSph)
334 Standard_Real aRadius;
336 theReadData.ReadValue(aRadius);
337 theSph.SetPosition(anAx);
338 theSph.SetRadius(aRadius);
342 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Torus& theTorus)
345 Standard_Real aMajorRadius, aMinorRadius;
347 theReadData.ReadValue(aMajorRadius);
348 theReadData.ReadValue(aMinorRadius);
349 theTorus.SetPosition(anAx);
350 theTorus.SetMajorRadius(aMajorRadius);
351 theTorus.SetMinorRadius(aMinorRadius);
355 // read transformations
357 #include <gp_Mat2d.hxx>
358 #include <gp_Mat.hxx>
359 #include <gp_Trsf2d.hxx>
360 #include <gp_Trsf.hxx>
362 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Mat2d& theMat)
365 theReadData >> aRow1 >> aRow2;
366 theMat.SetRows(aRow1, aRow2);
370 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Mat& theMat)
372 gp_XYZ aRow1, aRow2, aRow3;
373 theReadData >> aRow1 >> aRow2 >> aRow3;
374 theMat.SetRows(aRow1, aRow2, aRow3);
378 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Trsf2d& theTrsf)
380 Standard_Real aScale;
384 theReadData.ReadValue(aScale);
385 theReadData.ReadEnum(aForm);
386 theReadData >> aMat >> aLoc;
387 theTrsf.SetValues(aScale * aMat(1, 1), aScale * aMat(1, 2), aLoc.X(),
388 aScale * aMat(2, 1), aScale * aMat(2, 2), aLoc.Y());
392 inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Trsf& theTrsf)
394 Standard_Real aScale;
398 theReadData.ReadValue(aScale);
399 theReadData.ReadEnum(aForm);
400 theReadData >> aMat >> aLoc;
401 theTrsf.SetValues(aScale * aMat(1, 1), aScale * aMat(1, 2), aScale * aMat(1, 3), aLoc.X(),
402 aScale * aMat(2, 1), aScale * aMat(2, 2), aScale * aMat(2, 3), aLoc.Y(),
403 aScale * aMat(3, 1), aScale * aMat(3, 2), aScale * aMat(3, 3), aLoc.Z());
408 inline void StdObject_gp::object<T>::Read (StdObjMgt_ReadData& theReadData)
410 theReadData >> (*this);