mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0028564: Support of applications using old persistence (ShapeSchema)
1. Bug fix in reading old persistent data using FSD_File storage driver 2. Persistence compatible with legacy format was restored for shapes a. Implemented a storage read / write wrapper for legacy persistence b. Added DRAW commands to read / write files in legacy format c. Added test cases for reading / writing operations with checking number of sub-shapes and physical properties d. Updated related sections of the development guide
This commit is contained in:
@@ -14,6 +14,28 @@
|
||||
#include <StdObject_Location.hxx>
|
||||
#include <StdPersistent_TopLoc.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Translate
|
||||
//purpose : Creates a persistent wrapper object for a location
|
||||
//=======================================================================
|
||||
StdObject_Location
|
||||
StdObject_Location::Translate (const TopLoc_Location& theLoc,
|
||||
StdObjMgt_TransientPersistentMap& theMap)
|
||||
{
|
||||
StdObject_Location aLoc;
|
||||
if (!theLoc.IsIdentity())
|
||||
aLoc.myData = StdPersistent_TopLoc::Translate(theLoc, theMap);
|
||||
return aLoc;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Location
|
||||
//purpose : Changes current location
|
||||
//=======================================================================
|
||||
void StdObject_Location::PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
|
||||
{
|
||||
theChildren.Append(myData);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Import
|
||||
|
@@ -16,21 +16,33 @@
|
||||
#define _StdObject_Location_HeaderFile
|
||||
|
||||
#include <StdObjMgt_ReadData.hxx>
|
||||
#include <StdObjMgt_WriteData.hxx>
|
||||
#include <StdObjMgt_Persistent.hxx>
|
||||
#include <StdObjMgt_TransientPersistentMap.hxx>
|
||||
|
||||
#include <TopLoc_Location.hxx>
|
||||
|
||||
|
||||
class StdObject_Location
|
||||
{
|
||||
public:
|
||||
|
||||
//! Gets persistent child objects
|
||||
Standard_EXPORT void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
|
||||
|
||||
//! Import transient object from the persistent data.
|
||||
TopLoc_Location Import() const;
|
||||
|
||||
//! Creates a persistent wrapper object for a location
|
||||
Standard_EXPORT static StdObject_Location Translate (const TopLoc_Location& theLoc,
|
||||
StdObjMgt_TransientPersistentMap& theMap);
|
||||
|
||||
private:
|
||||
Handle(StdObjMgt_Persistent) myData;
|
||||
|
||||
friend StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object, StdObject_Location&);
|
||||
friend StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object, const StdObject_Location&);
|
||||
};
|
||||
|
||||
//! Read persistent data from a file.
|
||||
@@ -40,4 +52,11 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData >> theLocation.myData;
|
||||
}
|
||||
|
||||
//! Write persistent data to a file.
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const StdObject_Location& theLocation)
|
||||
{
|
||||
return theWriteData << theLocation.myData;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -31,3 +31,13 @@ TopoDS_Shape StdObject_Shape::Import() const
|
||||
|
||||
return aShape;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PChildren
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void StdObject_Shape::PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const
|
||||
{
|
||||
theChildren.Append(myTShape);
|
||||
myLocation.PChildren(theChildren);
|
||||
}
|
@@ -16,6 +16,7 @@
|
||||
#define _StdObject_Shape_HeaderFile
|
||||
|
||||
#include <StdObjMgt_ReadData.hxx>
|
||||
#include <StdObjMgt_WriteData.hxx>
|
||||
#include <StdObject_Location.hxx>
|
||||
#include <StdPersistent_TopoDS.hxx>
|
||||
|
||||
@@ -24,22 +25,32 @@
|
||||
|
||||
class StdObject_Shape
|
||||
{
|
||||
friend class ShapePersistent_TopoDS;
|
||||
|
||||
public:
|
||||
//! Import transient object from the persistent data.
|
||||
Standard_EXPORT TopoDS_Shape Import() const;
|
||||
|
||||
Standard_EXPORT void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const;
|
||||
|
||||
protected:
|
||||
//! Read persistent data from a file.
|
||||
inline void read (StdObjMgt_ReadData& theReadData)
|
||||
{ theReadData >> myTShape >> myLocation >> myOrient; }
|
||||
|
||||
private:
|
||||
//! Write persistent data to a file.
|
||||
inline void write (StdObjMgt_WriteData& theWriteData) const
|
||||
{ theWriteData << myTShape << myLocation << myOrient; }
|
||||
|
||||
protected:
|
||||
Handle(StdPersistent_TopoDS::TShape) myTShape;
|
||||
StdObject_Location myLocation;
|
||||
Standard_Integer myOrient;
|
||||
|
||||
friend StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object, StdObject_Shape&);
|
||||
friend StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object, const StdObject_Shape&);
|
||||
};
|
||||
|
||||
//! Read persistent data from a file.
|
||||
@@ -50,4 +61,12 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
//! Write persistent data to a file.
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const StdObject_Shape& theShape)
|
||||
{
|
||||
theShape.write (theWriteData);
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -35,6 +35,24 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData&
|
||||
write (StdObjMgt_WriteData::Object theWriteData, const gp_Ax2d& theAx)
|
||||
{
|
||||
const gp_Pnt2d& aLoc = theAx.Location();
|
||||
const gp_Dir2d& aDir = theAx.Direction();
|
||||
theWriteData << aLoc << aDir;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Ax2d& theAx)
|
||||
{
|
||||
const gp_Pnt2d& aLoc = theAx.Location();
|
||||
const gp_Dir2d& aDir = theAx.Direction();
|
||||
theWriteData << aLoc << aDir;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Ax22d& theAx)
|
||||
{
|
||||
@@ -45,16 +63,44 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Ax22d& theAx)
|
||||
{
|
||||
const gp_Pnt2d& aLoc = theAx.Location();
|
||||
const gp_Dir2d& aYDir = theAx.YDirection();
|
||||
const gp_Dir2d& aXDir = theAx.XDirection();
|
||||
theWriteData << aLoc << aYDir << aXDir;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Ax1& theAx)
|
||||
{
|
||||
gp_XYZ aLoc;
|
||||
gp_Pnt aLoc;
|
||||
gp_Dir aDir;
|
||||
theReadData >> aLoc >> aDir;
|
||||
theAx = gp_Ax1 (aLoc, aDir);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData&
|
||||
write(StdObjMgt_WriteData::Object theWriteData, const gp_Ax1& theAx)
|
||||
{
|
||||
const gp_Pnt& aLoc = theAx.Location();
|
||||
const gp_Dir& aDir = theAx.Direction();
|
||||
theWriteData << aLoc << aDir;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Ax1& theAx)
|
||||
{
|
||||
const gp_Pnt& aLoc = theAx.Location();
|
||||
const gp_Dir& aDir = theAx.Direction();
|
||||
theWriteData << aLoc << aDir;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Ax2& theAx)
|
||||
{
|
||||
@@ -65,6 +111,16 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Ax2& theAx)
|
||||
{
|
||||
const gp_Ax1& anAx = theAx.Axis();
|
||||
const gp_Dir& aYDir = theAx.YDirection();
|
||||
const gp_Dir& aXDir = theAx.XDirection();
|
||||
theWriteData << anAx << aYDir << aXDir;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Ax3& theAx)
|
||||
{
|
||||
@@ -77,5 +133,15 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Ax3& theAx)
|
||||
{
|
||||
const gp_Ax1& anAx = theAx.Axis();
|
||||
const gp_Dir& aYDir = theAx.YDirection();
|
||||
const gp_Dir& aXDir = theAx.XDirection();
|
||||
theWriteData << anAx << aYDir << aXDir;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Lin2d& theLin)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Lin2d& theLin)
|
||||
{
|
||||
gp_Ax2d anAx;
|
||||
theReadData >> anAx;
|
||||
@@ -39,8 +39,16 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Lin2d& theLin)
|
||||
{
|
||||
const gp_Ax2d& anAx = theLin.Position();
|
||||
write (theWriteData, anAx);
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Circ2d& theCirc)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Circ2d& theCirc)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aRadius;
|
||||
@@ -53,8 +61,17 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Circ2d& theCirc)
|
||||
{
|
||||
const gp_Ax22d& anAx = theCirc.Position();
|
||||
Standard_Real aRadius = theCirc.Radius();
|
||||
theWriteData << anAx << aRadius;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Elips2d& theElips)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Elips2d& theElips)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
@@ -68,8 +85,18 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Elips2d& theElips)
|
||||
{
|
||||
const gp_Ax22d& anAx = theElips.Axis();
|
||||
Standard_Real aMajorRadius = theElips.MajorRadius();
|
||||
Standard_Real aMinorRadius = theElips.MinorRadius();
|
||||
theWriteData << anAx << aMajorRadius << aMinorRadius;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Hypr2d& theHypr)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Hypr2d& theHypr)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
@@ -83,8 +110,18 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Hypr2d& theHypr)
|
||||
{
|
||||
const gp_Ax22d& anAx = theHypr.Axis();
|
||||
Standard_Real aMajorRadius = theHypr.MajorRadius();
|
||||
Standard_Real aMinorRadius = theHypr.MinorRadius();
|
||||
theWriteData << anAx << aMajorRadius << aMinorRadius;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Parab2d& theParab)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Parab2d& theParab)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aFocalLength;
|
||||
@@ -97,8 +134,17 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Parab2d& theParab)
|
||||
{
|
||||
const gp_Ax22d& anAx = theParab.Axis();
|
||||
Standard_Real aFocalLength = theParab.Focal();
|
||||
theWriteData << anAx << aFocalLength;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Lin& theLin)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Lin& theLin)
|
||||
{
|
||||
gp_Ax1 anAx;
|
||||
theReadData >> anAx;
|
||||
@@ -106,8 +152,16 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Lin& theLin)
|
||||
{
|
||||
const gp_Ax1& anAx = theLin.Position();
|
||||
write (theWriteData, anAx);
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Circ& theCirc)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Circ& theCirc)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aRadius;
|
||||
@@ -120,8 +174,17 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Circ& theCirc)
|
||||
{
|
||||
const gp_Ax2& anAx = theCirc.Position();
|
||||
Standard_Real aRadius = theCirc.Radius();
|
||||
theWriteData << anAx << aRadius;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Elips& theElips)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Elips& theElips)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
@@ -135,8 +198,18 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Elips& theElips)
|
||||
{
|
||||
const gp_Ax2& anAx = theElips.Position();
|
||||
Standard_Real aMajorRadius = theElips.MajorRadius();
|
||||
Standard_Real aMinorRadius = theElips.MinorRadius();
|
||||
theWriteData << anAx << aMajorRadius << aMinorRadius;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Hypr& theHypr)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Hypr& theHypr)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
@@ -150,8 +223,18 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Hypr& theHypr)
|
||||
{
|
||||
const gp_Ax2& anAx = theHypr.Position();
|
||||
Standard_Real aMajorRadius = theHypr.MajorRadius();
|
||||
Standard_Real aMinorRadius = theHypr.MinorRadius();
|
||||
theWriteData << anAx << aMajorRadius << aMinorRadius;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Parab& theParab)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Parab& theParab)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aFocalLength;
|
||||
@@ -164,5 +247,14 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Parab& theParab)
|
||||
{
|
||||
const gp_Ax2& anAx = theParab.Position();
|
||||
Standard_Real aFocalLength = theParab.Focal();
|
||||
theWriteData << anAx << aFocalLength;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Cone& theCone)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Cone& theCone)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aRadius, aSemiAngle;
|
||||
@@ -39,8 +39,18 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Cone& theCone)
|
||||
{
|
||||
const gp_Ax3& anAx = theCone.Position();
|
||||
Standard_Real aRadius = theCone.RefRadius();
|
||||
Standard_Real aSemiAngle = theCone.SemiAngle();
|
||||
theWriteData << anAx << aRadius << aSemiAngle;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Cylinder& theCyl)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Cylinder& theCyl)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aRadius;
|
||||
@@ -53,8 +63,17 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Cylinder& theCyl)
|
||||
{
|
||||
const gp_Ax3& anAx = theCyl.Position();
|
||||
Standard_Real aRadius = theCyl.Radius();
|
||||
theWriteData << anAx << aRadius;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Sphere& theSph)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Sphere& theSph)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aRadius;
|
||||
@@ -67,8 +86,17 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Sphere& theSph)
|
||||
{
|
||||
const gp_Ax3& anAx = theSph.Position();
|
||||
Standard_Real aRadius = theSph.Radius();
|
||||
theWriteData << anAx << aRadius;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Torus& theTorus)
|
||||
(StdObjMgt_ReadData& theReadData, gp_Torus& theTorus)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
@@ -82,5 +110,15 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData& theWriteData, const gp_Torus& theTorus)
|
||||
{
|
||||
const gp_Ax3& anAx = theTorus.Position();
|
||||
Standard_Real aMajorRadius = theTorus.MajorRadius();
|
||||
Standard_Real aMinorRadius = theTorus.MinorRadius();
|
||||
theWriteData << anAx << aMajorRadius << aMinorRadius;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -27,21 +27,41 @@
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Mat2d& theMat)
|
||||
{
|
||||
gp_XY aRow1, aRow2;
|
||||
theReadData >> aRow1 >> aRow2;
|
||||
theMat.SetRows (aRow1, aRow2);
|
||||
theReadData
|
||||
>> theMat(1, 1) >> theMat(1, 2)
|
||||
>> theMat(2, 1) >> theMat(2, 2);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Mat2d& theMat)
|
||||
{
|
||||
theWriteData
|
||||
<< theMat(1, 1) << theMat(1, 2)
|
||||
<< theMat(2, 1) << theMat(2, 2);
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Mat& theMat)
|
||||
{
|
||||
gp_XYZ aRow1, aRow2, aRow3;
|
||||
theReadData >> aRow1 >> aRow2 >> aRow3;
|
||||
theMat.SetRows (aRow1, aRow2, aRow3);
|
||||
theReadData
|
||||
>> theMat(1, 1) >> theMat(1, 2) >> theMat(1, 3)
|
||||
>> theMat(2, 1) >> theMat(2, 2) >> theMat(2, 3)
|
||||
>> theMat(3, 1) >> theMat(3, 2) >> theMat(3, 3);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Mat& theMat)
|
||||
{
|
||||
theWriteData
|
||||
<< theMat(1, 1) << theMat(1, 2) << theMat(1, 3)
|
||||
<< theMat(2, 1) << theMat(2, 2) << theMat(2, 3)
|
||||
<< theMat(3, 1) << theMat(3, 2) << theMat(3, 3);
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Trsf2d& theTrsf)
|
||||
{
|
||||
@@ -58,6 +78,19 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Trsf2d& theTrsf)
|
||||
{
|
||||
Standard_Real aScale = theTrsf.ScaleFactor();
|
||||
Standard_Integer aForm = theTrsf.Form();
|
||||
const gp_Mat2d& aMat = theTrsf.HVectorialPart();
|
||||
const gp_XY& aLoc = theTrsf.TranslationPart();
|
||||
|
||||
theWriteData << aScale << aForm << aMat << aLoc;
|
||||
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Trsf& theTrsf)
|
||||
{
|
||||
@@ -76,5 +109,17 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Trsf& theTrsf)
|
||||
{
|
||||
Standard_Real aScale = theTrsf.ScaleFactor();
|
||||
Standard_Integer aForm = theTrsf.Form();
|
||||
const gp_Mat& aMat = theTrsf.HVectorialPart();
|
||||
const gp_XYZ& aLoc = theTrsf.TranslationPart();
|
||||
|
||||
theWriteData << aScale << aForm << aMat << aLoc;
|
||||
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -17,6 +17,7 @@
|
||||
|
||||
|
||||
#include <StdObjMgt_ReadData.hxx>
|
||||
#include <StdObjMgt_WriteData.hxx>
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
@@ -35,68 +36,126 @@ inline StdObjMgt_ReadData& operator >>
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_XY& theXY)
|
||||
{
|
||||
Standard_Real aX = theXY.X(), aY = theXY.Y();
|
||||
theWriteData << aX << aY;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Pnt2d& thePnt)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData >> aX >> aY;
|
||||
thePnt.SetCoord (aX, aY);
|
||||
gp_XY aXY;
|
||||
theReadData >> aXY;
|
||||
thePnt.SetXY (aXY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Pnt2d& thePnt)
|
||||
{
|
||||
theWriteData << thePnt.XY();
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Vec2d& theVec)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData >> aX >> aY;
|
||||
theVec.SetCoord (aX, aY);
|
||||
gp_XY aXY;
|
||||
theReadData >> aXY;
|
||||
theVec.SetXY (aXY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Vec2d& theVec)
|
||||
{
|
||||
theWriteData << theVec.XY();
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Dir2d& theDir)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData >> aX >> aY;
|
||||
theDir.SetCoord (aX, aY);
|
||||
gp_XY aXY;
|
||||
theReadData >> aXY;
|
||||
theDir.SetXY (aXY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Dir2d& theDir)
|
||||
{
|
||||
theWriteData << theDir.XY();
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_XYZ& theXYZ)
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
theReadData >> aX >> aY >> aZ;
|
||||
theXYZ.SetCoord (aX, aY, aZ);
|
||||
theXYZ.SetCoord(aX, aY, aZ);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_XYZ& theXYZ)
|
||||
{
|
||||
Standard_Real aX = theXYZ.X(), aY = theXYZ.Y(), aZ = theXYZ.Z();
|
||||
theWriteData << aX << aY << aZ;
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Pnt& thePnt)
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
theReadData >> aX >> aY >> aZ;
|
||||
thePnt.SetCoord (aX, aY, aZ);
|
||||
gp_XYZ aXYZ;
|
||||
theReadData >> aXYZ;
|
||||
thePnt.SetXYZ (aXYZ);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Pnt& thePnt)
|
||||
{
|
||||
theWriteData << thePnt.XYZ();
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Vec& theVec)
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
theReadData >> aX >> aY >> aZ;
|
||||
theVec.SetCoord (aX, aY, aZ);
|
||||
gp_XYZ aXYZ;
|
||||
theReadData >> aXYZ;
|
||||
theVec.SetXYZ (aXYZ);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Vec& theVec)
|
||||
{
|
||||
theWriteData << theVec.XYZ();
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Dir& theDir)
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
theReadData >> aX >> aY >> aZ;
|
||||
theDir.SetCoord (aX, aY, aZ);
|
||||
gp_XYZ aXYZ;
|
||||
theReadData >> aXYZ;
|
||||
theDir.SetXYZ(aXYZ);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_WriteData& operator <<
|
||||
(StdObjMgt_WriteData::Object theWriteData, const gp_Dir& theDir)
|
||||
{
|
||||
theWriteData << theDir.XYZ();
|
||||
return theWriteData;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user