0027241: Create a complete test case to verify reading of all attribute types from...
[occt.git] / src / StdObject / StdObject_gp_Trsfs.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_Trsfs_HeaderFile
16 #define _StdObject_gp_Trsfs_HeaderFile
17
18
19 #include <StdObject_gp_Vectors.hxx>
20
21 #include <gp_Mat2d.hxx>
22 #include <gp_Mat.hxx>
23 #include <gp_Trsf2d.hxx>
24 #include <gp_Trsf.hxx>
25
26
27 inline StdObjMgt_ReadData& operator >>
28   (StdObjMgt_ReadData::Object theReadData, gp_Mat2d& theMat)
29 {
30   gp_XY aRow1, aRow2;
31   theReadData >> aRow1 >> aRow2;
32   theMat.SetRows (aRow1, aRow2);
33   return theReadData;
34 }
35
36 inline StdObjMgt_ReadData& operator >>
37   (StdObjMgt_ReadData::Object theReadData, gp_Mat& theMat)
38 {
39   gp_XYZ aRow1, aRow2, aRow3;
40   theReadData >> aRow1 >> aRow2 >> aRow3;
41   theMat.SetRows (aRow1, aRow2, aRow3);
42   return theReadData;
43 }
44
45 inline StdObjMgt_ReadData& operator >>
46   (StdObjMgt_ReadData::Object theReadData, gp_Trsf2d& theTrsf)
47 {
48   Standard_Real    aScale;
49   Standard_Integer aForm;
50   gp_Mat2d         aMat;
51   gp_XY            aLoc;
52
53   theReadData >> aScale >> aForm >> aMat >> aLoc;
54
55   theTrsf.SetValues (aScale * aMat(1, 1), aScale * aMat(1, 2), aLoc.X(),
56                      aScale * aMat(2, 1), aScale * aMat(2, 2), aLoc.Y());
57
58   return theReadData;
59 }
60
61 inline StdObjMgt_ReadData& operator >>
62   (StdObjMgt_ReadData::Object theReadData, gp_Trsf& theTrsf)
63 {
64   Standard_Real    aScale;
65   Standard_Integer aForm;
66   gp_Mat           aMat;
67   gp_XYZ           aLoc;
68
69   theReadData >> aScale >> aForm >> aMat >> aLoc;
70
71   theTrsf.SetValues (
72     aScale * aMat(1, 1), aScale * aMat(1, 2), aScale * aMat(1, 3), aLoc.X(),
73     aScale * aMat(2, 1), aScale * aMat(2, 2), aScale * aMat(2, 3), aLoc.Y(),
74     aScale * aMat(3, 1), aScale * aMat(3, 2), aScale * aMat(3, 3), aLoc.Z());
75
76   return theReadData;
77 }
78
79
80 #endif