0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / StdObject / StdObject_gp_Trsfs.hxx
CommitLineData
45d8465e 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
27inline StdObjMgt_ReadData& operator >>
472433e2 28 (StdObjMgt_ReadData& theReadData, gp_Mat2d& theMat)
45d8465e 29{
472433e2 30 StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
ec964372 31 theReadData
32 >> theMat(1, 1) >> theMat(1, 2)
33 >> theMat(2, 1) >> theMat(2, 2);
45d8465e 34 return theReadData;
35}
36
ec964372 37inline StdObjMgt_WriteData& operator <<
472433e2 38 (StdObjMgt_WriteData& theWriteData, const gp_Mat2d& theMat)
ec964372 39{
472433e2 40 StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
41
ec964372 42 theWriteData
43 << theMat(1, 1) << theMat(1, 2)
44 << theMat(2, 1) << theMat(2, 2);
45 return theWriteData;
46}
47
45d8465e 48inline StdObjMgt_ReadData& operator >>
472433e2 49 (StdObjMgt_ReadData& theReadData, gp_Mat& theMat)
45d8465e 50{
472433e2 51 StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
ec964372 52 theReadData
53 >> theMat(1, 1) >> theMat(1, 2) >> theMat(1, 3)
54 >> theMat(2, 1) >> theMat(2, 2) >> theMat(2, 3)
55 >> theMat(3, 1) >> theMat(3, 2) >> theMat(3, 3);
45d8465e 56 return theReadData;
57}
58
ec964372 59inline StdObjMgt_WriteData& operator <<
472433e2 60 (StdObjMgt_WriteData& theWriteData, const gp_Mat& theMat)
ec964372 61{
472433e2 62 StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
63
ec964372 64 theWriteData
65 << theMat(1, 1) << theMat(1, 2) << theMat(1, 3)
66 << theMat(2, 1) << theMat(2, 2) << theMat(2, 3)
67 << theMat(3, 1) << theMat(3, 2) << theMat(3, 3);
68 return theWriteData;
69}
70
45d8465e 71inline StdObjMgt_ReadData& operator >>
472433e2 72 (StdObjMgt_ReadData& theReadData, gp_Trsf2d& theTrsf)
45d8465e 73{
472433e2 74 StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
75
45d8465e 76 Standard_Real aScale;
77 Standard_Integer aForm;
78 gp_Mat2d aMat;
79 gp_XY aLoc;
80
81 theReadData >> aScale >> aForm >> aMat >> aLoc;
82
83 theTrsf.SetValues (aScale * aMat(1, 1), aScale * aMat(1, 2), aLoc.X(),
84 aScale * aMat(2, 1), aScale * aMat(2, 2), aLoc.Y());
85
86 return theReadData;
87}
88
ec964372 89inline StdObjMgt_WriteData& operator <<
472433e2 90 (StdObjMgt_WriteData& theWriteData, const gp_Trsf2d& theTrsf)
ec964372 91{
472433e2 92 StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
93
ec964372 94 Standard_Real aScale = theTrsf.ScaleFactor();
95 Standard_Integer aForm = theTrsf.Form();
96 const gp_Mat2d& aMat = theTrsf.HVectorialPart();
97 const gp_XY& aLoc = theTrsf.TranslationPart();
98
99 theWriteData << aScale << aForm << aMat << aLoc;
100
101 return theWriteData;
102}
103
45d8465e 104inline StdObjMgt_ReadData& operator >>
472433e2 105 (StdObjMgt_ReadData& theReadData, gp_Trsf& theTrsf)
45d8465e 106{
472433e2 107 StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
108
45d8465e 109 Standard_Real aScale;
110 Standard_Integer aForm;
111 gp_Mat aMat;
112 gp_XYZ aLoc;
113
114 theReadData >> aScale >> aForm >> aMat >> aLoc;
115
116 theTrsf.SetValues (
117 aScale * aMat(1, 1), aScale * aMat(1, 2), aScale * aMat(1, 3), aLoc.X(),
118 aScale * aMat(2, 1), aScale * aMat(2, 2), aScale * aMat(2, 3), aLoc.Y(),
119 aScale * aMat(3, 1), aScale * aMat(3, 2), aScale * aMat(3, 3), aLoc.Z());
120
121 return theReadData;
122}
123
ec964372 124inline StdObjMgt_WriteData& operator <<
472433e2 125 (StdObjMgt_WriteData& theWriteData, const gp_Trsf& theTrsf)
ec964372 126{
472433e2 127 StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
128
ec964372 129 Standard_Real aScale = theTrsf.ScaleFactor();
130 Standard_Integer aForm = theTrsf.Form();
131 const gp_Mat& aMat = theTrsf.HVectorialPart();
132 const gp_XYZ& aLoc = theTrsf.TranslationPart();
133
134 theWriteData << aScale << aForm << aMat << aLoc;
135
136 return theWriteData;
137}
45d8465e 138
139#endif