Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:17:47

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 #ifndef _StdObject_gp_Trsfs_HeaderFile
0015 #define _StdObject_gp_Trsfs_HeaderFile
0016 
0017 #include <StdObject_gp_Vectors.hxx>
0018 
0019 #include <gp_Mat2d.hxx>
0020 #include <gp_Mat.hxx>
0021 #include <gp_Trsf2d.hxx>
0022 #include <gp_Trsf.hxx>
0023 
0024 inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_Mat2d& theMat)
0025 {
0026   StdObjMgt_ReadData::ObjectSentry aSentry(theReadData);
0027   theReadData >> theMat(1, 1) >> theMat(1, 2) >> theMat(2, 1) >> theMat(2, 2);
0028   return theReadData;
0029 }
0030 
0031 inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_Mat2d& theMat)
0032 {
0033   StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData);
0034 
0035   theWriteData << theMat(1, 1) << theMat(1, 2) << theMat(2, 1) << theMat(2, 2);
0036   return theWriteData;
0037 }
0038 
0039 inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_Mat& theMat)
0040 {
0041   StdObjMgt_ReadData::ObjectSentry aSentry(theReadData);
0042   theReadData >> theMat(1, 1) >> theMat(1, 2) >> theMat(1, 3) >> theMat(2, 1) >> theMat(2, 2)
0043     >> theMat(2, 3) >> theMat(3, 1) >> theMat(3, 2) >> theMat(3, 3);
0044   return theReadData;
0045 }
0046 
0047 inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_Mat& theMat)
0048 {
0049   StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData);
0050 
0051   theWriteData << theMat(1, 1) << theMat(1, 2) << theMat(1, 3) << theMat(2, 1) << theMat(2, 2)
0052                << theMat(2, 3) << theMat(3, 1) << theMat(3, 2) << theMat(3, 3);
0053   return theWriteData;
0054 }
0055 
0056 inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_Trsf2d& theTrsf)
0057 {
0058   StdObjMgt_ReadData::ObjectSentry aSentry(theReadData);
0059 
0060   double   aScale;
0061   int      aForm;
0062   gp_Mat2d aMat;
0063   gp_XY    aLoc;
0064 
0065   theReadData >> aScale >> aForm >> aMat >> aLoc;
0066 
0067   theTrsf.SetValues(aScale * aMat(1, 1),
0068                     aScale * aMat(1, 2),
0069                     aLoc.X(),
0070                     aScale * aMat(2, 1),
0071                     aScale * aMat(2, 2),
0072                     aLoc.Y());
0073 
0074   return theReadData;
0075 }
0076 
0077 inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_Trsf2d& theTrsf)
0078 {
0079   StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData);
0080 
0081   double          aScale = theTrsf.ScaleFactor();
0082   int             aForm  = theTrsf.Form();
0083   const gp_Mat2d& aMat   = theTrsf.HVectorialPart();
0084   const gp_XY&    aLoc   = theTrsf.TranslationPart();
0085 
0086   theWriteData << aScale << aForm << aMat << aLoc;
0087 
0088   return theWriteData;
0089 }
0090 
0091 inline StdObjMgt_ReadData& operator>>(StdObjMgt_ReadData& theReadData, gp_Trsf& theTrsf)
0092 {
0093   StdObjMgt_ReadData::ObjectSentry aSentry(theReadData);
0094 
0095   double aScale;
0096   int    aForm;
0097   gp_Mat aMat;
0098   gp_XYZ aLoc;
0099 
0100   theReadData >> aScale >> aForm >> aMat >> aLoc;
0101 
0102   theTrsf.SetValues(aScale * aMat(1, 1),
0103                     aScale * aMat(1, 2),
0104                     aScale * aMat(1, 3),
0105                     aLoc.X(),
0106                     aScale * aMat(2, 1),
0107                     aScale * aMat(2, 2),
0108                     aScale * aMat(2, 3),
0109                     aLoc.Y(),
0110                     aScale * aMat(3, 1),
0111                     aScale * aMat(3, 2),
0112                     aScale * aMat(3, 3),
0113                     aLoc.Z());
0114 
0115   return theReadData;
0116 }
0117 
0118 inline StdObjMgt_WriteData& operator<<(StdObjMgt_WriteData& theWriteData, const gp_Trsf& theTrsf)
0119 {
0120   StdObjMgt_WriteData::ObjectSentry aSentry(theWriteData);
0121 
0122   double        aScale = theTrsf.ScaleFactor();
0123   int           aForm  = theTrsf.Form();
0124   const gp_Mat& aMat   = theTrsf.HVectorialPart();
0125   const gp_XYZ& aLoc   = theTrsf.TranslationPart();
0126 
0127   theWriteData << aScale << aForm << aMat << aLoc;
0128 
0129   return theWriteData;
0130 }
0131 
0132 #endif