Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:00

0001 // Copyright (c) 2015 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 
0015 #ifndef _StdObject_gp_Trsfs_HeaderFile
0016 #define _StdObject_gp_Trsfs_HeaderFile
0017 
0018 
0019 #include <StdObject_gp_Vectors.hxx>
0020 
0021 #include <gp_Mat2d.hxx>
0022 #include <gp_Mat.hxx>
0023 #include <gp_Trsf2d.hxx>
0024 #include <gp_Trsf.hxx>
0025 
0026 
0027 inline StdObjMgt_ReadData& operator >>
0028   (StdObjMgt_ReadData& theReadData, gp_Mat2d& theMat)
0029 {
0030   StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
0031   theReadData
0032     >> theMat(1, 1) >> theMat(1, 2)
0033     >> theMat(2, 1) >> theMat(2, 2);
0034   return theReadData;
0035 }
0036 
0037 inline StdObjMgt_WriteData& operator <<
0038   (StdObjMgt_WriteData& theWriteData, const gp_Mat2d& theMat)
0039 {
0040   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
0041 
0042   theWriteData
0043     << theMat(1, 1) << theMat(1, 2)
0044     << theMat(2, 1) << theMat(2, 2);
0045   return theWriteData;
0046 }
0047 
0048 inline StdObjMgt_ReadData& operator >>
0049   (StdObjMgt_ReadData& theReadData, gp_Mat& theMat)
0050 {
0051   StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
0052   theReadData
0053     >> theMat(1, 1) >> theMat(1, 2) >> theMat(1, 3)
0054     >> theMat(2, 1) >> theMat(2, 2) >> theMat(2, 3)
0055     >> theMat(3, 1) >> theMat(3, 2) >> theMat(3, 3);
0056   return theReadData;
0057 }
0058 
0059 inline StdObjMgt_WriteData& operator <<
0060   (StdObjMgt_WriteData& theWriteData, const gp_Mat& theMat)
0061 {
0062   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
0063 
0064   theWriteData
0065     << theMat(1, 1) << theMat(1, 2) << theMat(1, 3)
0066     << theMat(2, 1) << theMat(2, 2) << theMat(2, 3)
0067     << theMat(3, 1) << theMat(3, 2) << theMat(3, 3);
0068   return theWriteData;
0069 }
0070 
0071 inline StdObjMgt_ReadData& operator >>
0072   (StdObjMgt_ReadData& theReadData, gp_Trsf2d& theTrsf)
0073 {
0074   StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
0075 
0076   Standard_Real    aScale;
0077   Standard_Integer aForm;
0078   gp_Mat2d         aMat;
0079   gp_XY            aLoc;
0080 
0081   theReadData >> aScale >> aForm >> aMat >> aLoc;
0082 
0083   theTrsf.SetValues (aScale * aMat(1, 1), aScale * aMat(1, 2), aLoc.X(),
0084                      aScale * aMat(2, 1), aScale * aMat(2, 2), aLoc.Y());
0085 
0086   return theReadData;
0087 }
0088 
0089 inline StdObjMgt_WriteData& operator <<
0090   (StdObjMgt_WriteData& theWriteData, const gp_Trsf2d& theTrsf)
0091 {
0092   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
0093 
0094   Standard_Real    aScale = theTrsf.ScaleFactor();
0095   Standard_Integer aForm  = theTrsf.Form();
0096   const gp_Mat2d&  aMat   = theTrsf.HVectorialPart();
0097   const gp_XY&     aLoc   = theTrsf.TranslationPart();
0098 
0099   theWriteData << aScale << aForm << aMat << aLoc;
0100 
0101   return theWriteData;
0102 }
0103 
0104 inline StdObjMgt_ReadData& operator >>
0105   (StdObjMgt_ReadData& theReadData, gp_Trsf& theTrsf)
0106 {
0107   StdObjMgt_ReadData::ObjectSentry aSentry (theReadData);
0108 
0109   Standard_Real    aScale;
0110   Standard_Integer aForm;
0111   gp_Mat           aMat;
0112   gp_XYZ           aLoc;
0113 
0114   theReadData >> aScale >> aForm >> aMat >> aLoc;
0115 
0116   theTrsf.SetValues (
0117     aScale * aMat(1, 1), aScale * aMat(1, 2), aScale * aMat(1, 3), aLoc.X(),
0118     aScale * aMat(2, 1), aScale * aMat(2, 2), aScale * aMat(2, 3), aLoc.Y(),
0119     aScale * aMat(3, 1), aScale * aMat(3, 2), aScale * aMat(3, 3), aLoc.Z());
0120 
0121   return theReadData;
0122 }
0123 
0124 inline StdObjMgt_WriteData& operator <<
0125   (StdObjMgt_WriteData& theWriteData, const gp_Trsf& theTrsf)
0126 {
0127   StdObjMgt_WriteData::ObjectSentry aSentry (theWriteData);
0128 
0129   Standard_Real    aScale = theTrsf.ScaleFactor();
0130   Standard_Integer aForm  = theTrsf.Form();
0131   const gp_Mat&    aMat   = theTrsf.HVectorialPart();
0132   const gp_XYZ&    aLoc   = theTrsf.TranslationPart();
0133 
0134   theWriteData << aScale << aForm << aMat << aLoc;
0135 
0136   return theWriteData;
0137 }
0138 
0139 #endif