mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0027241: Create a complete test case to verify reading of all attribute types from MDTV-Standard document
Added test case that works in one of two modes: 1) create synthetic document (in old version of OCCT) containing all possible attributes. 2) open the document and compare all attributes with expected values. Fixed reading of TDataStd_NamedData, TDataXtd_PatternStd, and PColStd_HArray2OfReal. Point and curve representations are created even from NULL geometry handles. The code is simplified by abandoning usage of templates from StdObjMgt_ContentTypes class for persistent data elements. Fixed SetAsciiString Draw command failed when the target label contained NamedData attribute.
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
StdObject_gp.hxx
|
||||
StdObject_gp_Axes.hxx
|
||||
StdObject_gp_Curves.hxx
|
||||
StdObject_gp_Surfaces.hxx
|
||||
StdObject_gp_Trsfs.hxx
|
||||
StdObject_gp_Vectors.hxx
|
||||
StdObject_Location.cxx
|
||||
StdObject_Location.hxx
|
||||
StdObject_Shape.cxx
|
||||
|
@@ -21,9 +21,7 @@
|
||||
//=======================================================================
|
||||
TopLoc_Location StdObject_Location::Import() const
|
||||
{
|
||||
Handle(StdPersistent_TopLoc::ItemLocation) anItemLocation;
|
||||
if (myData.Cast (anItemLocation))
|
||||
return anItemLocation->Import();
|
||||
else
|
||||
return TopLoc_Location();
|
||||
Handle(StdPersistent_TopLoc::ItemLocation) anItemLocation =
|
||||
Handle(StdPersistent_TopLoc::ItemLocation)::DownCast (myData);
|
||||
return anItemLocation ? anItemLocation->Import() : TopLoc_Location();
|
||||
}
|
||||
|
@@ -15,23 +15,29 @@
|
||||
#ifndef _StdObject_Location_HeaderFile
|
||||
#define _StdObject_Location_HeaderFile
|
||||
|
||||
#include <StdObjMgt_ContentTypes.hxx>
|
||||
#include <StdObjMgt_ReadData.hxx>
|
||||
|
||||
#include <TopLoc_Location.hxx>
|
||||
|
||||
|
||||
class StdObject_Location : private StdObjMgt_ContentTypes
|
||||
class StdObject_Location
|
||||
{
|
||||
public:
|
||||
//! Read persistent data from a file.
|
||||
inline void Read (StdObjMgt_ReadData& theReadData)
|
||||
{ theReadData >> myData; }
|
||||
|
||||
//! Import transient object from the persistent data.
|
||||
TopLoc_Location Import() const;
|
||||
|
||||
private:
|
||||
Reference<> myData;
|
||||
Handle(StdObjMgt_Persistent) myData;
|
||||
|
||||
friend StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object, StdObject_Location&);
|
||||
};
|
||||
|
||||
//! Read persistent data from a file.
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, StdObject_Location& theLocation)
|
||||
{
|
||||
return theReadData >> theLocation.myData;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -27,7 +27,7 @@ TopoDS_Shape StdObject_Shape::Import() const
|
||||
aShape.TShape (myTShape->Import());
|
||||
|
||||
aShape.Location (myLocation.Import());
|
||||
aShape.Orientation (myOrient);
|
||||
aShape.Orientation (static_cast<TopAbs_Orientation> (myOrient));
|
||||
|
||||
return aShape;
|
||||
}
|
||||
|
@@ -15,28 +15,39 @@
|
||||
#ifndef _StdObject_Shape_HeaderFile
|
||||
#define _StdObject_Shape_HeaderFile
|
||||
|
||||
#include <StdObjMgt_ContentTypes.hxx>
|
||||
#include <StdObjMgt_ReadData.hxx>
|
||||
#include <StdObject_Location.hxx>
|
||||
#include <StdPersistent_TopoDS.hxx>
|
||||
|
||||
#include <TopAbs_Orientation.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
|
||||
class StdObject_Shape : private StdObjMgt_ContentTypes
|
||||
class StdObject_Shape
|
||||
{
|
||||
public:
|
||||
//! Read persistent data from a file.
|
||||
inline void Read (StdObjMgt_ReadData& theReadData)
|
||||
{ theReadData >> myTShape >> myLocation >> myOrient; }
|
||||
|
||||
//! Import transient object from the persistent data.
|
||||
Standard_EXPORT TopoDS_Shape Import() const;
|
||||
|
||||
protected:
|
||||
//! Read persistent data from a file.
|
||||
inline void read (StdObjMgt_ReadData& theReadData)
|
||||
{ theReadData >> myTShape >> myLocation >> myOrient; }
|
||||
|
||||
private:
|
||||
Reference <StdPersistent_TopoDS::TShape> myTShape;
|
||||
Object <StdObject_Location> myLocation;
|
||||
Enum <TopAbs_Orientation> myOrient;
|
||||
Handle(StdPersistent_TopoDS::TShape) myTShape;
|
||||
StdObject_Location myLocation;
|
||||
Standard_Integer myOrient;
|
||||
|
||||
friend StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object, StdObject_Shape&);
|
||||
};
|
||||
|
||||
//! Read persistent data from a file.
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, StdObject_Shape& theShape)
|
||||
{
|
||||
theShape.read (theReadData);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -1,414 +0,0 @@
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef _StdObject_gp_HeaderFile
|
||||
#define _StdObject_gp_HeaderFile
|
||||
|
||||
#include <StdObjMgt_ContentTypes.hxx>
|
||||
|
||||
class StdObject_gp : private StdObjMgt_ContentTypes
|
||||
{
|
||||
template <class Data>
|
||||
struct object : Data
|
||||
{ Standard_EXPORT void Read (StdObjMgt_ReadData& theReadData); };
|
||||
|
||||
public:
|
||||
template <class Data>
|
||||
struct Object : StdObjMgt_ContentTypes::Object <object<Data> > {};
|
||||
|
||||
template <class Data>
|
||||
static Object<Data>& Ref (Data& theData)
|
||||
{ return static_cast<Object<Data>&> (theData); }
|
||||
};
|
||||
|
||||
// read vectors
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_XY& theXY)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData.ReadValue(aX);
|
||||
theReadData.ReadValue(aY);
|
||||
theXY.SetCoord(aX, aY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Pnt2d& thePnt)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData.ReadValue(aX);
|
||||
theReadData.ReadValue(aY);
|
||||
thePnt.SetCoord(aX, aY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Vec2d& theVec)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData.ReadValue(aX);
|
||||
theReadData.ReadValue(aY);
|
||||
theVec.SetCoord(aX, aY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Dir2d& theDir)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData.ReadValue(aX);
|
||||
theReadData.ReadValue(aY);
|
||||
theDir.SetCoord(aX, aY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_XYZ& theXYZ)
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
theReadData.ReadValue(aX);
|
||||
theReadData.ReadValue(aY);
|
||||
theReadData.ReadValue(aZ);
|
||||
theXYZ.SetCoord(aX, aY, aZ);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Pnt& thePnt)
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
theReadData.ReadValue(aX);
|
||||
theReadData.ReadValue(aY);
|
||||
theReadData.ReadValue(aZ);
|
||||
thePnt.SetCoord(aX, aY, aZ);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Vec& theVec)
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
theReadData.ReadValue(aX);
|
||||
theReadData.ReadValue(aY);
|
||||
theReadData.ReadValue(aZ);
|
||||
theVec.SetCoord(aX, aY, aZ);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Dir& theDir)
|
||||
{
|
||||
Standard_Real aX, aY, aZ;
|
||||
theReadData.ReadValue(aX);
|
||||
theReadData.ReadValue(aY);
|
||||
theReadData.ReadValue(aZ);
|
||||
theDir.SetCoord(aX, aY, aZ);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
// read axis placements
|
||||
|
||||
#include <gp_Ax2d.hxx>
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax2d& theAx)
|
||||
{
|
||||
gp_Pnt2d aLoc;
|
||||
gp_Dir2d aDir;
|
||||
theReadData >> aLoc >> aDir;
|
||||
theAx = gp_Ax2d (aLoc, aDir);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax22d& theAx)
|
||||
{
|
||||
gp_Pnt2d aLoc;
|
||||
gp_Dir2d aYDir, aXDir;
|
||||
theReadData >> aLoc >> aYDir >> aXDir;
|
||||
theAx = gp_Ax22d (aLoc, aXDir, aYDir);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax1& theAx)
|
||||
{
|
||||
gp_XYZ aLoc;
|
||||
gp_Dir aDir;
|
||||
theReadData >> aLoc >> aDir;
|
||||
theAx = gp_Ax1 (aLoc, aDir);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax2& theAx)
|
||||
{
|
||||
gp_Ax1 anAx;
|
||||
gp_Dir aYDir, aXDir;
|
||||
theReadData >> anAx >> aYDir >> aXDir;
|
||||
theAx = gp_Ax2 (anAx.Location(), anAx.Direction(), aXDir);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Ax3& theAx)
|
||||
{
|
||||
gp_Ax1 anAx;
|
||||
gp_Dir aYDir, aXDir;
|
||||
theReadData >> anAx >> aYDir >> aXDir;
|
||||
theAx = gp_Ax3 (anAx.Location(), anAx.Direction(), aXDir);
|
||||
if (aYDir * theAx.YDirection() < 0.)
|
||||
theAx.YReverse();
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
// read curves
|
||||
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Elips2d.hxx>
|
||||
#include <gp_Hypr2d.hxx>
|
||||
#include <gp_Parab2d.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <gp_Hypr.hxx>
|
||||
#include <gp_Parab.hxx>
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Lin2d& theLin)
|
||||
{
|
||||
gp_Ax2d anAx;
|
||||
theReadData >> anAx;
|
||||
theLin.SetPosition(anAx);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Circ2d& theCirc)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aRadius;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aRadius);
|
||||
theCirc.SetAxis(anAx);
|
||||
theCirc.SetRadius (aRadius);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Elips2d& theElips)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aMajorRadius);
|
||||
theReadData.ReadValue(aMinorRadius);
|
||||
theElips.SetAxis(anAx);
|
||||
theElips.SetMajorRadius(aMajorRadius);
|
||||
theElips.SetMinorRadius(aMinorRadius);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Hypr2d& theHypr)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aMajorRadius);
|
||||
theReadData.ReadValue(aMinorRadius);
|
||||
theHypr.SetAxis(anAx);
|
||||
theHypr.SetMajorRadius(aMajorRadius);
|
||||
theHypr.SetMinorRadius(aMinorRadius);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Parab2d& theParab)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aFocalLength;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aFocalLength);
|
||||
theParab.SetAxis(anAx);
|
||||
theParab.SetFocal(aFocalLength);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Lin& theLin)
|
||||
{
|
||||
gp_Ax1 anAx;
|
||||
theReadData >> anAx;
|
||||
theLin.SetPosition(anAx);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Circ& theCirc)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aRadius;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aRadius);
|
||||
theCirc.SetPosition(anAx);
|
||||
theCirc.SetRadius (aRadius);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Elips& theElips)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aMajorRadius);
|
||||
theReadData.ReadValue(aMinorRadius);
|
||||
theElips.SetPosition(anAx);
|
||||
theElips.SetMajorRadius(aMajorRadius);
|
||||
theElips.SetMinorRadius(aMinorRadius);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Hypr& theHypr)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aMajorRadius);
|
||||
theReadData.ReadValue(aMinorRadius);
|
||||
theHypr.SetPosition(anAx);
|
||||
theHypr.SetMajorRadius(aMajorRadius);
|
||||
theHypr.SetMinorRadius(aMinorRadius);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Parab& theParab)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aFocalLength;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aFocalLength);
|
||||
theParab.SetPosition(anAx);
|
||||
theParab.SetFocal(aFocalLength);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
// read surfaces
|
||||
|
||||
#include <gp_Cone.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Cone& theCone)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aRadius, aSemiAngle;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aRadius);
|
||||
theReadData.ReadValue(aSemiAngle);
|
||||
theCone.SetPosition(anAx);
|
||||
theCone.SetRadius(aRadius);
|
||||
theCone.SetSemiAngle(aSemiAngle);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Cylinder& theCyl)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aRadius;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aRadius);
|
||||
theCyl.SetPosition(anAx);
|
||||
theCyl.SetRadius(aRadius);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Sphere& theSph)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aRadius;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aRadius);
|
||||
theSph.SetPosition(anAx);
|
||||
theSph.SetRadius(aRadius);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Torus& theTorus)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
theReadData >> anAx;
|
||||
theReadData.ReadValue(aMajorRadius);
|
||||
theReadData.ReadValue(aMinorRadius);
|
||||
theTorus.SetPosition(anAx);
|
||||
theTorus.SetMajorRadius(aMajorRadius);
|
||||
theTorus.SetMinorRadius(aMinorRadius);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
// read transformations
|
||||
|
||||
#include <gp_Mat2d.hxx>
|
||||
#include <gp_Mat.hxx>
|
||||
#include <gp_Trsf2d.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Mat2d& theMat)
|
||||
{
|
||||
gp_XY aRow1, aRow2;
|
||||
theReadData >> aRow1 >> aRow2;
|
||||
theMat.SetRows(aRow1, aRow2);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Mat& theMat)
|
||||
{
|
||||
gp_XYZ aRow1, aRow2, aRow3;
|
||||
theReadData >> aRow1 >> aRow2 >> aRow3;
|
||||
theMat.SetRows(aRow1, aRow2, aRow3);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Trsf2d& theTrsf)
|
||||
{
|
||||
Standard_Real aScale;
|
||||
gp_TrsfForm aForm;
|
||||
gp_Mat2d aMat;
|
||||
gp_XY aLoc;
|
||||
theReadData.ReadValue(aScale);
|
||||
theReadData.ReadEnum(aForm);
|
||||
theReadData >> aMat >> aLoc;
|
||||
theTrsf.SetValues(aScale * aMat(1, 1), aScale * aMat(1, 2), aLoc.X(),
|
||||
aScale * aMat(2, 1), aScale * aMat(2, 2), aLoc.Y());
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >> (StdObjMgt_ReadData& theReadData, gp_Trsf& theTrsf)
|
||||
{
|
||||
Standard_Real aScale;
|
||||
gp_TrsfForm aForm;
|
||||
gp_Mat aMat;
|
||||
gp_XYZ aLoc;
|
||||
theReadData.ReadValue(aScale);
|
||||
theReadData.ReadEnum(aForm);
|
||||
theReadData >> aMat >> aLoc;
|
||||
theTrsf.SetValues(aScale * aMat(1, 1), aScale * aMat(1, 2), aScale * aMat(1, 3), aLoc.X(),
|
||||
aScale * aMat(2, 1), aScale * aMat(2, 2), aScale * aMat(2, 3), aLoc.Y(),
|
||||
aScale * aMat(3, 1), aScale * aMat(3, 2), aScale * aMat(3, 3), aLoc.Z());
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void StdObject_gp::object<T>::Read (StdObjMgt_ReadData& theReadData)
|
||||
{
|
||||
theReadData >> (*this);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
81
src/StdObject/StdObject_gp_Axes.hxx
Normal file
81
src/StdObject/StdObject_gp_Axes.hxx
Normal file
@@ -0,0 +1,81 @@
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef _StdObject_gp_Axes_HeaderFile
|
||||
#define _StdObject_gp_Axes_HeaderFile
|
||||
|
||||
|
||||
#include <StdObject_gp_Vectors.hxx>
|
||||
|
||||
#include <gp_Ax2d.hxx>
|
||||
#include <gp_Ax22d.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Ax2d& theAx)
|
||||
{
|
||||
gp_Pnt2d aLoc;
|
||||
gp_Dir2d aDir;
|
||||
theReadData >> aLoc >> aDir;
|
||||
theAx = gp_Ax2d (aLoc, aDir);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Ax22d& theAx)
|
||||
{
|
||||
gp_Pnt2d aLoc;
|
||||
gp_Dir2d aYDir, aXDir;
|
||||
theReadData >> aLoc >> aYDir >> aXDir;
|
||||
theAx = gp_Ax22d (aLoc, aXDir, aYDir);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Ax1& theAx)
|
||||
{
|
||||
gp_XYZ aLoc;
|
||||
gp_Dir aDir;
|
||||
theReadData >> aLoc >> aDir;
|
||||
theAx = gp_Ax1 (aLoc, aDir);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Ax2& theAx)
|
||||
{
|
||||
gp_Ax1 anAx;
|
||||
gp_Dir aYDir, aXDir;
|
||||
theReadData >> anAx >> aYDir >> aXDir;
|
||||
theAx = gp_Ax2 (anAx.Location(), anAx.Direction(), aXDir);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Ax3& theAx)
|
||||
{
|
||||
gp_Ax1 anAx;
|
||||
gp_Dir aYDir, aXDir;
|
||||
theReadData >> anAx >> aYDir >> aXDir;
|
||||
theAx = gp_Ax3 (anAx.Location(), anAx.Direction(), aXDir);
|
||||
if (aYDir * theAx.YDirection() < 0.)
|
||||
theAx.YReverse();
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
168
src/StdObject/StdObject_gp_Curves.hxx
Normal file
168
src/StdObject/StdObject_gp_Curves.hxx
Normal file
@@ -0,0 +1,168 @@
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef _StdObject_gp_Curves_HeaderFile
|
||||
#define _StdObject_gp_Curves_HeaderFile
|
||||
|
||||
|
||||
#include <StdObject_gp_Axes.hxx>
|
||||
|
||||
#include <gp_Lin2d.hxx>
|
||||
#include <gp_Circ2d.hxx>
|
||||
#include <gp_Elips2d.hxx>
|
||||
#include <gp_Hypr2d.hxx>
|
||||
#include <gp_Parab2d.hxx>
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <gp_Hypr.hxx>
|
||||
#include <gp_Parab.hxx>
|
||||
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Lin2d& theLin)
|
||||
{
|
||||
gp_Ax2d anAx;
|
||||
theReadData >> anAx;
|
||||
theLin.SetPosition (anAx);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Circ2d& theCirc)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aRadius;
|
||||
|
||||
theReadData >> anAx >> aRadius;
|
||||
|
||||
theCirc.SetAxis (anAx);
|
||||
theCirc.SetRadius (aRadius);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Elips2d& theElips)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
|
||||
theReadData >> anAx >> aMajorRadius >> aMinorRadius;
|
||||
|
||||
theElips.SetAxis (anAx);
|
||||
theElips.SetMajorRadius (aMajorRadius);
|
||||
theElips.SetMinorRadius (aMinorRadius);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Hypr2d& theHypr)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
|
||||
theReadData >> anAx >> aMajorRadius >> aMinorRadius;
|
||||
|
||||
theHypr.SetAxis (anAx);
|
||||
theHypr.SetMajorRadius (aMajorRadius);
|
||||
theHypr.SetMinorRadius (aMinorRadius);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Parab2d& theParab)
|
||||
{
|
||||
gp_Ax22d anAx;
|
||||
Standard_Real aFocalLength;
|
||||
|
||||
theReadData >> anAx >> aFocalLength;
|
||||
|
||||
theParab.SetAxis (anAx);
|
||||
theParab.SetFocal (aFocalLength);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Lin& theLin)
|
||||
{
|
||||
gp_Ax1 anAx;
|
||||
theReadData >> anAx;
|
||||
theLin.SetPosition (anAx);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Circ& theCirc)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aRadius;
|
||||
|
||||
theReadData >> anAx >> aRadius;
|
||||
|
||||
theCirc.SetPosition (anAx);
|
||||
theCirc.SetRadius (aRadius);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Elips& theElips)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
|
||||
theReadData >> anAx >> aMajorRadius >> aMinorRadius;
|
||||
|
||||
theElips.SetPosition (anAx);
|
||||
theElips.SetMajorRadius (aMajorRadius);
|
||||
theElips.SetMinorRadius (aMinorRadius);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Hypr& theHypr)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
|
||||
theReadData >> anAx >> aMajorRadius >> aMinorRadius;
|
||||
|
||||
theHypr.SetPosition (anAx);
|
||||
theHypr.SetMajorRadius (aMajorRadius);
|
||||
theHypr.SetMinorRadius (aMinorRadius);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Parab& theParab)
|
||||
{
|
||||
gp_Ax2 anAx;
|
||||
Standard_Real aFocalLength;
|
||||
|
||||
theReadData >> anAx >> aFocalLength;
|
||||
|
||||
theParab.SetPosition (anAx);
|
||||
theParab.SetFocal (aFocalLength);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
86
src/StdObject/StdObject_gp_Surfaces.hxx
Normal file
86
src/StdObject/StdObject_gp_Surfaces.hxx
Normal file
@@ -0,0 +1,86 @@
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef _StdObject_gp_Surfaces_HeaderFile
|
||||
#define _StdObject_gp_Surfaces_HeaderFile
|
||||
|
||||
|
||||
#include <StdObject_gp_Axes.hxx>
|
||||
|
||||
#include <gp_Cone.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Cone& theCone)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aRadius, aSemiAngle;
|
||||
|
||||
theReadData >> anAx >> aRadius >> aSemiAngle;
|
||||
|
||||
theCone.SetPosition (anAx);
|
||||
theCone.SetRadius (aRadius);
|
||||
theCone.SetSemiAngle (aSemiAngle);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Cylinder& theCyl)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aRadius;
|
||||
|
||||
theReadData >> anAx >> aRadius;
|
||||
|
||||
theCyl.SetPosition (anAx);
|
||||
theCyl.SetRadius (aRadius);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Sphere& theSph)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aRadius;
|
||||
|
||||
theReadData >> anAx >> aRadius;
|
||||
|
||||
theSph.SetPosition (anAx);
|
||||
theSph.SetRadius (aRadius);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Torus& theTorus)
|
||||
{
|
||||
gp_Ax3 anAx;
|
||||
Standard_Real aMajorRadius, aMinorRadius;
|
||||
|
||||
theReadData >> anAx >> aMajorRadius >> aMinorRadius;
|
||||
|
||||
theTorus.SetPosition (anAx);
|
||||
theTorus.SetMajorRadius (aMajorRadius);
|
||||
theTorus.SetMinorRadius (aMinorRadius);
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
80
src/StdObject/StdObject_gp_Trsfs.hxx
Normal file
80
src/StdObject/StdObject_gp_Trsfs.hxx
Normal file
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef _StdObject_gp_Trsfs_HeaderFile
|
||||
#define _StdObject_gp_Trsfs_HeaderFile
|
||||
|
||||
|
||||
#include <StdObject_gp_Vectors.hxx>
|
||||
|
||||
#include <gp_Mat2d.hxx>
|
||||
#include <gp_Mat.hxx>
|
||||
#include <gp_Trsf2d.hxx>
|
||||
#include <gp_Trsf.hxx>
|
||||
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Mat2d& theMat)
|
||||
{
|
||||
gp_XY aRow1, aRow2;
|
||||
theReadData >> aRow1 >> aRow2;
|
||||
theMat.SetRows (aRow1, aRow2);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
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);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Trsf2d& theTrsf)
|
||||
{
|
||||
Standard_Real aScale;
|
||||
Standard_Integer aForm;
|
||||
gp_Mat2d aMat;
|
||||
gp_XY aLoc;
|
||||
|
||||
theReadData >> aScale >> aForm >> aMat >> aLoc;
|
||||
|
||||
theTrsf.SetValues (aScale * aMat(1, 1), aScale * aMat(1, 2), aLoc.X(),
|
||||
aScale * aMat(2, 1), aScale * aMat(2, 2), aLoc.Y());
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Trsf& theTrsf)
|
||||
{
|
||||
Standard_Real aScale;
|
||||
Standard_Integer aForm;
|
||||
gp_Mat aMat;
|
||||
gp_XYZ aLoc;
|
||||
|
||||
theReadData >> aScale >> aForm >> aMat >> aLoc;
|
||||
|
||||
theTrsf.SetValues (
|
||||
aScale * aMat(1, 1), aScale * aMat(1, 2), aScale * aMat(1, 3), aLoc.X(),
|
||||
aScale * aMat(2, 1), aScale * aMat(2, 2), aScale * aMat(2, 3), aLoc.Y(),
|
||||
aScale * aMat(3, 1), aScale * aMat(3, 2), aScale * aMat(3, 3), aLoc.Z());
|
||||
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
102
src/StdObject/StdObject_gp_Vectors.hxx
Normal file
102
src/StdObject/StdObject_gp_Vectors.hxx
Normal file
@@ -0,0 +1,102 @@
|
||||
// Copyright (c) 2015 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef _StdObject_gp_Vectors_HeaderFile
|
||||
#define _StdObject_gp_Vectors_HeaderFile
|
||||
|
||||
|
||||
#include <StdObjMgt_ReadData.hxx>
|
||||
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <gp_Vec2d.hxx>
|
||||
#include <gp_Dir2d.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_XY& theXY)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData >> aX >> aY;
|
||||
theXY.SetCoord (aX, aY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Pnt2d& thePnt)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData >> aX >> aY;
|
||||
thePnt.SetCoord (aX, aY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Vec2d& theVec)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData >> aX >> aY;
|
||||
theVec.SetCoord (aX, aY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
inline StdObjMgt_ReadData& operator >>
|
||||
(StdObjMgt_ReadData::Object theReadData, gp_Dir2d& theDir)
|
||||
{
|
||||
Standard_Real aX, aY;
|
||||
theReadData >> aX >> aY;
|
||||
theDir.SetCoord (aX, aY);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
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);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
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);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
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);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
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);
|
||||
return theReadData;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user