1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +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:
myn
2016-03-11 22:08:01 +03:00
committed by abv
parent 944d808cd0
commit 45d8465ea2
82 changed files with 1524 additions and 1333 deletions

View File

@@ -11,9 +11,7 @@ ShapePersistent_Geom_Surface.hxx
ShapePersistent_Geom2d.hxx
ShapePersistent_Geom2d_Curve.cxx
ShapePersistent_Geom2d_Curve.hxx
ShapePersistent_HArray1.cxx
ShapePersistent_HArray1.hxx
ShapePersistent_HArray2.cxx
ShapePersistent_HArray2.hxx
ShapePersistent_HSequence.cxx
ShapePersistent_HSequence.hxx

View File

@@ -15,6 +15,7 @@
#include <StdObjMgt_MapOfInstantiators.hxx>
#include <StdLPersistent_HArray1.hxx>
#include <StdLPersistent_HArray2.hxx>
#include <StdPersistent_TopoDS.hxx>
#include <ShapePersistent_TopoDS.hxx>
#include <ShapePersistent_HArray1.hxx>
@@ -36,16 +37,32 @@
void ShapePersistent::BindTypes (StdObjMgt_MapOfInstantiators& theMap)
{
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PTopoDS_HArray1OfHShape");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfBoundedCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfBezierCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfBSplineCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfSurface");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom_HArray1OfBoundedSurface");
theMap.Bind <StdLPersistent_HArray2::Persistent> ("PColPGeom_HArray2OfSurface");
theMap.Bind <StdLPersistent_HArray2::Persistent> ("PColPGeom_HArray2OfBoundedSurface");
theMap.Bind <StdLPersistent_HArray2::Persistent> ("PColPGeom_HArray2OfBezierSurface");
theMap.Bind <StdLPersistent_HArray2::Persistent> ("PColPGeom_HArray2OfBSplineSurface");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom2d_HArray1OfCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom2d_HArray1OfBoundedCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom2d_HArray1OfBezierCurve");
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PColPGeom2d_HArray1OfBSplineCurve");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_HShape");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Vertex");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Edge");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Wire");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Face");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Shell");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Solid");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_CompSolid");
theMap.Bind <ShapePersistent_TopoDS::Shape> ("PTopoDS_Compound");
theMap.Bind <StdLPersistent_HArray2::Real> ("PColStd_HArray2OfReal");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_HShape");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Vertex");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Edge");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Wire");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Face");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Shell");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Solid");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_CompSolid");
theMap.Bind <ShapePersistent_TopoDS::HShape> ("PTopoDS_Compound");
theMap.Bind <StdPersistent_TopoDS::TShape> ("PTopoDS_TShape");

View File

@@ -74,11 +74,12 @@ void ShapePersistent_BRep::PointOnCurve::Read
Handle(BRep_PointRepresentation)
ShapePersistent_BRep::PointOnCurve::import() const
{
if (myCurve.IsNull())
return NULL;
Handle(Geom_Curve) aCurve;
if (myCurve)
aCurve = myCurve->Import();
return new BRep_PointOnCurve
(myParameter, myCurve->Import(), myLocation.Import());
(myParameter, aCurve, myLocation.Import());
}
void ShapePersistent_BRep::PointsOnSurface::Read
@@ -98,11 +99,16 @@ void ShapePersistent_BRep::PointOnCurveOnSurface::Read
Handle(BRep_PointRepresentation)
ShapePersistent_BRep::PointOnCurveOnSurface::import() const
{
if (mySurface.IsNull() || myPCurve.IsNull())
return NULL;
Handle(Geom2d_Curve) aPCurve;
if (myPCurve)
aPCurve = myPCurve->Import();
Handle(Geom_Surface) aSurface;
if (mySurface)
aSurface = mySurface->Import();
return new BRep_PointOnCurveOnSurface
(myParameter, myPCurve->Import(), mySurface->Import(), myLocation.Import());
(myParameter, aPCurve, aSurface, myLocation.Import());
}
void ShapePersistent_BRep::PointOnSurface::Read
@@ -115,11 +121,12 @@ void ShapePersistent_BRep::PointOnSurface::Read
Handle(BRep_PointRepresentation)
ShapePersistent_BRep::PointOnSurface::import() const
{
if (mySurface.IsNull())
return NULL;
Handle(Geom_Surface) aSurface;
if (mySurface)
aSurface = mySurface->Import();
return new BRep_PointOnSurface
(myParameter, myParameter2, mySurface->Import(), myLocation.Import());
(myParameter, myParameter2, aSurface, myLocation.Import());
}
//=======================================================================
@@ -164,12 +171,12 @@ void ShapePersistent_BRep::Curve3D::Read
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::Curve3D::import() const
{
Handle(Geom_Curve) aCurve;
Handle(Geom_Curve) aCurve3D;
if (myCurve3D)
aCurve = myCurve3D->Import();
aCurve3D = myCurve3D->Import();
Handle(BRep_Curve3D) aRepresentation =
new BRep_Curve3D (aCurve, myLocation.Import());
new BRep_Curve3D (aCurve3D, myLocation.Import());
aRepresentation->SetRange (myFirst, myLast);
return aRepresentation;
@@ -185,18 +192,21 @@ void ShapePersistent_BRep::CurveOnSurface::Read
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::CurveOnSurface::import() const
{
if (myPCurve.IsNull() || mySurface.IsNull())
return NULL;
Handle(Geom2d_Curve) aPCurve;
if (myPCurve)
aPCurve = myPCurve->Import();
Handle(BRep_CurveOnSurface) aCurve =
new BRep_CurveOnSurface (myPCurve->Import(),
mySurface->Import(),
myLocation.Import());
Handle(Geom_Surface) aSurface;
if (mySurface)
aSurface = mySurface->Import();
aCurve->SetUVPoints (myUV1, myUV2);
aCurve->SetRange (myFirst, myLast);
Handle(BRep_CurveOnSurface) aRepresentation =
new BRep_CurveOnSurface (aPCurve, aSurface, myLocation.Import());
return aCurve;
aRepresentation->SetUVPoints (myUV1, myUV2);
aRepresentation->SetRange (myFirst, myLast);
return aRepresentation;
}
void ShapePersistent_BRep::CurveOnClosedSurface::Read
@@ -209,21 +219,29 @@ void ShapePersistent_BRep::CurveOnClosedSurface::Read
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::CurveOnClosedSurface::import() const
{
if (myPCurve.IsNull() || mySurface.IsNull() || myPCurve2.IsNull())
return NULL;
Handle(Geom2d_Curve) aPCurve;
if (myPCurve)
aPCurve = myPCurve->Import();
Handle(BRep_CurveOnClosedSurface) aCurve =
new BRep_CurveOnClosedSurface (myPCurve->Import(),
myPCurve2->Import(),
mySurface->Import(),
myLocation.Import(),
myContinuity);
Handle(Geom2d_Curve) aPCurve2;
if (myPCurve2)
aPCurve2 = myPCurve2->Import();
aCurve->SetUVPoints (myUV1 , myUV2 );
aCurve->SetUVPoints2 (myUV21 , myUV22);
aCurve->SetRange (myFirst, myLast);
Handle(Geom_Surface) aSurface;
if (mySurface)
aSurface = mySurface->Import();
return aCurve;
GeomAbs_Shape aContinuity = static_cast<GeomAbs_Shape> (myContinuity);
Handle(BRep_CurveOnClosedSurface) aRepresentation =
new BRep_CurveOnClosedSurface
(aPCurve, aPCurve2, aSurface, myLocation.Import(), aContinuity);
aRepresentation->SetUVPoints (myUV1 , myUV2 );
aRepresentation->SetUVPoints2 (myUV21 , myUV22);
aRepresentation->SetRange (myFirst, myLast);
return aRepresentation;
}
void ShapePersistent_BRep::Polygon3D::Read
@@ -236,10 +254,11 @@ void ShapePersistent_BRep::Polygon3D::Read
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::Polygon3D::import() const
{
if (myPolygon3D.IsNull())
return NULL;
Handle(Poly_Polygon3D) aPolygon3D;
if (myPolygon3D)
aPolygon3D = myPolygon3D->Import();
return new BRep_Polygon3D (myPolygon3D->Import(), myLocation.Import());
return new BRep_Polygon3D (aPolygon3D, myLocation.Import());
}
void ShapePersistent_BRep::PolygonOnTriangulation::Read
@@ -252,12 +271,16 @@ void ShapePersistent_BRep::PolygonOnTriangulation::Read
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnTriangulation::import() const
{
if (myPolygon.IsNull() || myTriangulation.IsNull())
return NULL;
Handle(Poly_PolygonOnTriangulation) aPolygon;
if (myPolygon)
aPolygon = myPolygon->Import();
return new BRep_PolygonOnTriangulation (myPolygon->Import(),
myTriangulation->Import(),
myLocation.Import());
Handle(Poly_Triangulation) aTriangulation;
if (myTriangulation)
aTriangulation = myTriangulation->Import();
return new BRep_PolygonOnTriangulation
(aPolygon, aTriangulation, myLocation.Import());
}
void ShapePersistent_BRep::PolygonOnClosedTriangulation::Read
@@ -270,13 +293,20 @@ void ShapePersistent_BRep::PolygonOnClosedTriangulation::Read
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnClosedTriangulation::import() const
{
if (myPolygon.IsNull() || myTriangulation.IsNull() || myPolygon2.IsNull())
return NULL;
Handle(Poly_PolygonOnTriangulation) aPolygon;
if (myPolygon)
aPolygon = myPolygon->Import();
return new BRep_PolygonOnClosedTriangulation (myPolygon->Import(),
myPolygon2->Import(),
myTriangulation->Import(),
myLocation.Import());
Handle(Poly_PolygonOnTriangulation) aPolygon2;
if (myPolygon2)
aPolygon2 = myPolygon2->Import();
Handle(Poly_Triangulation) aTriangulation;
if (myTriangulation)
aTriangulation = myTriangulation->Import();
return new BRep_PolygonOnClosedTriangulation
(aPolygon, aPolygon2, aTriangulation, myLocation.Import());
}
void ShapePersistent_BRep::PolygonOnSurface::Read
@@ -289,12 +319,15 @@ void ShapePersistent_BRep::PolygonOnSurface::Read
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnSurface::import() const
{
if (myPolygon2D.IsNull() || mySurface.IsNull())
return NULL;
Handle(Poly_Polygon2D) aPolygon2D;
if (myPolygon2D)
aPolygon2D = myPolygon2D->Import();
return new BRep_PolygonOnSurface (myPolygon2D->Import(),
mySurface->Import(),
myLocation.Import());
Handle(Geom_Surface) aSurface;
if (mySurface)
aSurface = mySurface->Import();
return new BRep_PolygonOnSurface (aPolygon2D, aSurface, myLocation.Import());
}
void ShapePersistent_BRep::PolygonOnClosedSurface::Read
@@ -307,13 +340,20 @@ void ShapePersistent_BRep::PolygonOnClosedSurface::Read
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnClosedSurface::import() const
{
if (myPolygon2D.IsNull() || mySurface.IsNull() || myPolygon2.IsNull())
return NULL;
Handle(Poly_Polygon2D) aPolygon2D;
if (myPolygon2D)
aPolygon2D = myPolygon2D->Import();
return new BRep_PolygonOnClosedSurface (myPolygon2D->Import(),
myPolygon2->Import(),
mySurface->Import(),
myLocation.Import());
Handle(Poly_Polygon2D) aPolygon2;
if (myPolygon2)
aPolygon2 = myPolygon2->Import();
Handle(Geom_Surface) aSurface;
if (mySurface)
aSurface = mySurface->Import();
return new BRep_PolygonOnClosedSurface
(aPolygon2D, aPolygon2, aSurface, myLocation.Import());
}
void ShapePersistent_BRep::CurveOn2Surfaces::Read
@@ -326,14 +366,18 @@ void ShapePersistent_BRep::CurveOn2Surfaces::Read
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::CurveOn2Surfaces::import() const
{
if (mySurface.IsNull() || mySurface2.IsNull())
return NULL;
Handle(Geom_Surface) aSurface;
if (mySurface)
aSurface = mySurface->Import();
return new BRep_CurveOn2Surfaces (mySurface->Import(),
mySurface2->Import(),
myLocation.Import(),
myLocation2.Import(),
myContinuity);
Handle(Geom_Surface) aSurface2;
if (mySurface2)
aSurface2 = mySurface2->Import();
GeomAbs_Shape aContinuity = static_cast<GeomAbs_Shape> (myContinuity);
return new BRep_CurveOn2Surfaces
(aSurface, aSurface2, myLocation.Import(), myLocation2.Import(), aContinuity);
}
//=======================================================================

View File

@@ -20,14 +20,13 @@
#include <ShapePersistent_Geom2d.hxx>
#include <ShapePersistent_Poly.hxx>
#include <StdObject_Location.hxx>
#include <StdObject_gp.hxx>
#include <StdObject_gp_Vectors.hxx>
#include <BRep_ListOfPointRepresentation.hxx>
#include <BRep_ListOfCurveRepresentation.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <GeomAbs_Shape.hxx>
class BRep_PointRepresentation;
class BRep_CurveRepresentation;
@@ -50,11 +49,11 @@ public:
virtual Handle(BRep_PointRepresentation) import() const;
protected:
Object <StdObject_Location> myLocation;
Value <Standard_Real> myParameter;
StdObject_Location myLocation;
Standard_Real myParameter;
private:
Reference<PointRepresentation> myNext;
Handle(PointRepresentation) myNext;
};
class PointOnCurve : public PointRepresentation
@@ -64,7 +63,7 @@ public:
virtual Handle(BRep_PointRepresentation) import() const;
private:
Reference<ShapePersistent_Geom::Curve> myCurve;
Handle(ShapePersistent_Geom::Curve) myCurve;
};
class PointsOnSurface : public PointRepresentation
@@ -73,7 +72,7 @@ public:
virtual void Read (StdObjMgt_ReadData& theReadData);
protected:
Reference<ShapePersistent_Geom::Surface> mySurface;
Handle(ShapePersistent_Geom::Surface) mySurface;
};
class PointOnCurveOnSurface : public PointsOnSurface
@@ -83,7 +82,7 @@ public:
virtual Handle(BRep_PointRepresentation) import() const;
private:
Reference<ShapePersistent_Geom2d::Curve> myPCurve;
Handle(ShapePersistent_Geom2d::Curve) myPCurve;
};
class PointOnSurface : public PointsOnSurface
@@ -93,7 +92,7 @@ public:
virtual Handle(BRep_PointRepresentation) import() const;
private:
Value<Standard_Real> myParameter2;
Standard_Real myParameter2;
};
class CurveRepresentation : public StdObjMgt_Persistent
@@ -110,10 +109,10 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const;
protected:
Object<StdObject_Location> myLocation;
StdObject_Location myLocation;
private:
Reference<CurveRepresentation> myNext;
Handle(CurveRepresentation) myNext;
};
class GCurve : public CurveRepresentation
@@ -122,8 +121,8 @@ public:
virtual void Read (StdObjMgt_ReadData& theReadData);
protected:
Value<Standard_Real> myFirst;
Value<Standard_Real> myLast;
Standard_Real myFirst;
Standard_Real myLast;
};
class Curve3D : public GCurve
@@ -133,7 +132,7 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const;
private:
Reference<ShapePersistent_Geom::Curve> myCurve3D;
Handle(ShapePersistent_Geom::Curve) myCurve3D;
};
class CurveOnSurface : public GCurve
@@ -143,10 +142,10 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const;
protected:
Reference<ShapePersistent_Geom2d::Curve> myPCurve;
Reference<ShapePersistent_Geom::Surface> mySurface;
StdObject_gp::Object<gp_Pnt2d> myUV1;
StdObject_gp::Object<gp_Pnt2d> myUV2;
Handle(ShapePersistent_Geom2d::Curve) myPCurve;
Handle(ShapePersistent_Geom::Surface) mySurface;
gp_Pnt2d myUV1;
gp_Pnt2d myUV2;
};
class CurveOnClosedSurface : public CurveOnSurface
@@ -156,10 +155,10 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const;
private:
Reference<ShapePersistent_Geom2d::Curve> myPCurve2;
Enum<GeomAbs_Shape> myContinuity;
StdObject_gp::Object<gp_Pnt2d> myUV21;
StdObject_gp::Object<gp_Pnt2d> myUV22;
Handle(ShapePersistent_Geom2d::Curve) myPCurve2;
Standard_Integer myContinuity;
gp_Pnt2d myUV21;
gp_Pnt2d myUV22;
};
class Polygon3D : public CurveRepresentation
@@ -169,7 +168,7 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const;
private:
Reference<ShapePersistent_Poly::Polygon3D> myPolygon3D;
Handle(ShapePersistent_Poly::Polygon3D) myPolygon3D;
};
class PolygonOnTriangulation : public CurveRepresentation
@@ -179,8 +178,8 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const;
protected:
Reference<ShapePersistent_Poly::PolygonOnTriangulation> myPolygon;
Reference<ShapePersistent_Poly::Triangulation> myTriangulation;
Handle(ShapePersistent_Poly::PolygonOnTriangulation) myPolygon;
Handle(ShapePersistent_Poly::Triangulation) myTriangulation;
};
class PolygonOnClosedTriangulation : public PolygonOnTriangulation
@@ -190,7 +189,7 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const;
private:
Reference<ShapePersistent_Poly::PolygonOnTriangulation> myPolygon2;
Handle(ShapePersistent_Poly::PolygonOnTriangulation) myPolygon2;
};
class PolygonOnSurface : public CurveRepresentation
@@ -200,8 +199,8 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const;
protected:
Reference<ShapePersistent_Poly::Polygon2D> myPolygon2D;
Reference<ShapePersistent_Geom::Surface> mySurface;
Handle(ShapePersistent_Poly::Polygon2D) myPolygon2D;
Handle(ShapePersistent_Geom::Surface) mySurface;
};
class PolygonOnClosedSurface : public PolygonOnSurface
@@ -211,7 +210,7 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const;
private:
Reference<ShapePersistent_Poly::Polygon2D> myPolygon2;
Handle(ShapePersistent_Poly::Polygon2D) myPolygon2;
};
class CurveOn2Surfaces : public CurveRepresentation
@@ -221,10 +220,10 @@ public:
virtual Handle(BRep_CurveRepresentation) import() const;
private:
Reference <ShapePersistent_Geom::Surface> mySurface;
Reference <ShapePersistent_Geom::Surface> mySurface2;
Object <StdObject_Location> myLocation2;
Enum <GeomAbs_Shape> myContinuity;
Handle(ShapePersistent_Geom::Surface) mySurface;
Handle(ShapePersistent_Geom::Surface) mySurface2;
StdObject_Location myLocation2;
Standard_Integer myContinuity;
};
private:
@@ -241,9 +240,9 @@ private:
virtual Handle(TopoDS_TShape) createTShape() const;
private:
Value<Standard_Real> myTolerance;
StdObject_gp::Object<gp_Pnt> myPnt;
Reference<PointRepresentation> myPoints;
Standard_Real myTolerance;
gp_Pnt myPnt;
Handle(PointRepresentation) myPoints;
};
class pTEdge : public pTBase
@@ -259,9 +258,9 @@ private:
virtual Handle(TopoDS_TShape) createTShape() const;
private:
Value <Standard_Real> myTolerance;
Value <Standard_Integer> myFlags;
Reference <CurveRepresentation> myCurves;
Standard_Real myTolerance;
Standard_Integer myFlags;
Handle(CurveRepresentation) myCurves;
};
class pTFace : public pTBase
@@ -278,11 +277,11 @@ private:
virtual Handle(TopoDS_TShape) createTShape() const;
private:
Reference <ShapePersistent_Geom::Surface> mySurface;
Reference <ShapePersistent_Poly::Triangulation> myTriangulation;
Object <StdObject_Location> myLocation;
Value <Standard_Real> myTolerance;
Value <Standard_Boolean> myNaturalRestriction;
Handle(ShapePersistent_Geom::Surface) mySurface;
Handle(ShapePersistent_Poly::Triangulation) myTriangulation;
StdObject_Location myLocation;
Standard_Real myTolerance;
Standard_Boolean myNaturalRestriction;
};
public:

View File

@@ -12,6 +12,8 @@
// commercial license or contractual agreement.
#include <ShapePersistent_Geom.hxx>
#include <StdObject_gp_Axes.hxx>
#include <StdObject_gp_Vectors.hxx>
//=======================================================================
@@ -29,8 +31,8 @@ void ShapePersistent_Geom::instance<ShapePersistent_Geom::AxisPlacement,
Geom_Axis2Placement>
::Read (StdObjMgt_ReadData& theReadData)
{
StdObject_gp::Object<gp_Ax1> anAxis;
StdObject_gp::Object<gp_Dir> anXDirection;
gp_Ax1 anAxis;
gp_Dir anXDirection;
theReadData >> anAxis >> anXDirection;

View File

@@ -16,7 +16,12 @@
#define _ShapePersistent_Geom_HeaderFile
#include <StdObjMgt_SharedObject.hxx>
#include <StdObject_gp.hxx>
#include <StdObject_gp_Vectors.hxx>
#include <StdObject_gp_Axes.hxx>
#include <StdObject_gp_Curves.hxx>
#include <StdObject_gp_Surfaces.hxx>
#include <StdObject_gp_Trsfs.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_Direction.hxx>
@@ -52,7 +57,16 @@ protected:
};
template <class Base, class GpData>
struct subBase_gp : subBase <Base, StdObject_gp::Object<GpData> > {};
struct subBase_gp : public Base
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
{
GpData aData;
theReadData >> aData;
}
};
template <class Base>
struct subBase_empty : Base {};
@@ -64,7 +78,7 @@ protected:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
{
StdObject_gp::Object<Data> aData;
Data aData;
theReadData >> aData;
this->myTransient = new Target (aData);
}

View File

@@ -46,9 +46,9 @@ class ShapePersistent_Geom2d_Curve : protected ShapePersistent_Geom2d
virtual Handle(Geom2d_Curve) Import() const;
private:
Value <Standard_Boolean> myRational;
Reference <ShapePersistent_HArray1::Pnt2d> myPoles;
Reference <StdLPersistent_HArray1::Real> myWeights;
Standard_Boolean myRational;
Handle(ShapePersistent_HArray1::Pnt2d) myPoles;
Handle(StdLPersistent_HArray1::Real) myWeights;
};
class pBSpline : public pBounded
@@ -63,13 +63,13 @@ class ShapePersistent_Geom2d_Curve : protected ShapePersistent_Geom2d
virtual Handle(Geom2d_Curve) Import() const;
private:
Value <Standard_Boolean> myRational;
Value <Standard_Boolean> myPeriodic;
Value <Standard_Integer> mySpineDegree;
Reference <ShapePersistent_HArray1::Pnt2d> myPoles;
Reference <StdLPersistent_HArray1::Real> myWeights;
Reference <StdLPersistent_HArray1::Real> myKnots;
Reference <StdLPersistent_HArray1::Integer> myMultiplicities;
Standard_Boolean myRational;
Standard_Boolean myPeriodic;
Standard_Integer mySpineDegree;
Handle(ShapePersistent_HArray1::Pnt2d) myPoles;
Handle(StdLPersistent_HArray1::Real) myWeights;
Handle(StdLPersistent_HArray1::Real) myKnots;
Handle(StdLPersistent_HArray1::Integer) myMultiplicities;
};
class pTrimmed : public pBounded
@@ -81,9 +81,9 @@ class ShapePersistent_Geom2d_Curve : protected ShapePersistent_Geom2d
virtual Handle(Geom2d_Curve) Import() const;
private:
Reference<Curve> myBasisCurve;
Value<Standard_Real> myFirstU;
Value<Standard_Real> myLastU;
Handle(Curve) myBasisCurve;
Standard_Real myFirstU;
Standard_Real myLastU;
};
class pOffset : public pBase
@@ -95,8 +95,8 @@ class ShapePersistent_Geom2d_Curve : protected ShapePersistent_Geom2d
virtual Handle(Geom2d_Curve) Import() const;
private:
Reference<Curve> myBasisCurve;
Value<Standard_Real> myOffsetValue;
Handle(Curve) myBasisCurve;
Standard_Real myOffsetValue;
};
public:

View File

@@ -48,9 +48,9 @@ class ShapePersistent_Geom_Curve : private ShapePersistent_Geom
virtual Handle(Geom_Curve) Import() const;
private:
Value <Standard_Boolean> myRational;
Reference <ShapePersistent_HArray1::Pnt> myPoles;
Reference <StdLPersistent_HArray1::Real> myWeights;
Standard_Boolean myRational;
Handle(ShapePersistent_HArray1::Pnt) myPoles;
Handle(StdLPersistent_HArray1::Real) myWeights;
};
class pBSpline : public pBounded
@@ -65,13 +65,13 @@ class ShapePersistent_Geom_Curve : private ShapePersistent_Geom
virtual Handle(Geom_Curve) Import() const;
private:
Value <Standard_Boolean> myRational;
Value <Standard_Boolean> myPeriodic;
Value <Standard_Integer> mySpineDegree;
Reference <ShapePersistent_HArray1::Pnt> myPoles;
Reference <StdLPersistent_HArray1::Real> myWeights;
Reference <StdLPersistent_HArray1::Real> myKnots;
Reference <StdLPersistent_HArray1::Integer> myMultiplicities;
Standard_Boolean myRational;
Standard_Boolean myPeriodic;
Standard_Integer mySpineDegree;
Handle(ShapePersistent_HArray1::Pnt) myPoles;
Handle(StdLPersistent_HArray1::Real) myWeights;
Handle(StdLPersistent_HArray1::Real) myKnots;
Handle(StdLPersistent_HArray1::Integer) myMultiplicities;
};
class pTrimmed : public pBounded
@@ -83,9 +83,9 @@ class ShapePersistent_Geom_Curve : private ShapePersistent_Geom
virtual Handle(Geom_Curve) Import() const;
private:
Reference<Curve> myBasisCurve;
Value<Standard_Real> myFirstU;
Value<Standard_Real> myLastU;
Handle(Curve) myBasisCurve;
Standard_Real myFirstU;
Standard_Real myLastU;
};
class pOffset : public pBase
@@ -97,9 +97,9 @@ class ShapePersistent_Geom_Curve : private ShapePersistent_Geom
virtual Handle(Geom_Curve) Import() const;
private:
Reference<Curve> myBasisCurve;
StdObject_gp::Object<gp_Dir> myOffsetDirection;
Value<Standard_Real> myOffsetValue;
Handle(Curve) myBasisCurve;
gp_Dir myOffsetDirection;
Standard_Real myOffsetValue;
};
public:

View File

@@ -40,15 +40,15 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
{
typedef Surface::PersistentBase pBase;
class pSweptData : protected StdObjMgt_ContentTypes
class pSweptData
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myBasisCurve >> myDirection; }
protected:
Reference <Curve> myBasisCurve;
StdObject_gp::Object <gp_Dir> myDirection;
Handle(Curve) myBasisCurve;
gp_Dir myDirection;
};
struct pSwept : pBase, pSweptData {};
@@ -71,7 +71,7 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
virtual Handle(Geom_Surface) Import() const;
private:
StdObject_gp::Object<gp_Pnt> myLocation;
gp_Pnt myLocation;
};
typedef pBase pBounded;
@@ -85,10 +85,10 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
virtual Handle(Geom_Surface) Import() const;
private:
Value <Standard_Boolean> myURational;
Value <Standard_Boolean> myVRational;
Reference <ShapePersistent_HArray2::Pnt> myPoles;
Reference <StdLPersistent_HArray2::Real> myWeights;
Standard_Boolean myURational;
Standard_Boolean myVRational;
Handle(ShapePersistent_HArray2::Pnt) myPoles;
Handle(StdLPersistent_HArray2::Real) myWeights;
};
class pBSpline : public pBounded
@@ -108,18 +108,18 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
virtual Handle(Geom_Surface) Import() const;
private:
Value <Standard_Boolean> myURational;
Value <Standard_Boolean> myVRational;
Value <Standard_Boolean> myUPeriodic;
Value <Standard_Boolean> myVPeriodic;
Value <Standard_Integer> myUSpineDegree;
Value <Standard_Integer> myVSpineDegree;
Reference <ShapePersistent_HArray2::Pnt> myPoles;
Reference <StdLPersistent_HArray2::Real> myWeights;
Reference <StdLPersistent_HArray1::Real> myUKnots;
Reference <StdLPersistent_HArray1::Real> myVKnots;
Reference <StdLPersistent_HArray1::Integer> myUMultiplicities;
Reference <StdLPersistent_HArray1::Integer> myVMultiplicities;
Standard_Boolean myURational;
Standard_Boolean myVRational;
Standard_Boolean myUPeriodic;
Standard_Boolean myVPeriodic;
Standard_Integer myUSpineDegree;
Standard_Integer myVSpineDegree;
Handle(ShapePersistent_HArray2::Pnt) myPoles;
Handle(StdLPersistent_HArray2::Real) myWeights;
Handle(StdLPersistent_HArray1::Real) myUKnots;
Handle(StdLPersistent_HArray1::Real) myVKnots;
Handle(StdLPersistent_HArray1::Integer) myUMultiplicities;
Handle(StdLPersistent_HArray1::Integer) myVMultiplicities;
};
class pRectangularTrimmed : public pBounded
@@ -134,11 +134,11 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
virtual Handle(Geom_Surface) Import() const;
private:
Reference<Surface> myBasisSurface;
Value<Standard_Real> myFirstU;
Value<Standard_Real> myLastU;
Value<Standard_Real> myFirstV;
Value<Standard_Real> myLastV;
Handle(Surface) myBasisSurface;
Standard_Real myFirstU;
Standard_Real myLastU;
Standard_Real myFirstV;
Standard_Real myLastV;
};
class pOffset : public pBase
@@ -150,8 +150,8 @@ class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
virtual Handle(Geom_Surface) Import() const;
private:
Reference<Surface> myBasisSurface;
Value<Standard_Real> myOffsetValue;
Handle(Surface) myBasisSurface;
Standard_Real myOffsetValue;
};
public:

View File

@@ -1,45 +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.
#include <ShapePersistent_HArray1.hxx>
#include <StdObjMgt_ReadData.hxx>
#include <StdObject_gp.hxx>
template <class ArrayClass>
void ShapePersistent_HArray1::instance<ArrayClass>::readValue
(StdObjMgt_ReadData& theReadData, const Standard_Integer theIndex)
{
theReadData.ReadObject (StdObject_gp::Ref (this->myArray->ChangeValue (theIndex)));
}
template<>
void ShapePersistent_HArray1::instance<Poly_HArray1OfTriangle>::readValue
(StdObjMgt_ReadData& theReadData, const Standard_Integer theIndex)
{
Value<Standard_Integer> N1, N2, N3;
theReadData >> N1 >> N2 >> N3;
this->myArray->ChangeValue (theIndex).Set (N1, N2, N3);
}
template class ShapePersistent_HArray1::instance<TColgp_HArray1OfXYZ>;
template class ShapePersistent_HArray1::instance<TColgp_HArray1OfPnt>;
template class ShapePersistent_HArray1::instance<TColgp_HArray1OfDir>;
template class ShapePersistent_HArray1::instance<TColgp_HArray1OfVec>;
template class ShapePersistent_HArray1::instance<TColgp_HArray1OfXY>;
template class ShapePersistent_HArray1::instance<TColgp_HArray1OfPnt2d>;
template class ShapePersistent_HArray1::instance<TColgp_HArray1OfDir2d>;
template class ShapePersistent_HArray1::instance<TColgp_HArray1OfVec2d>;
template class ShapePersistent_HArray1::instance<TColgp_HArray1OfLin2d>;
template class ShapePersistent_HArray1::instance<TColgp_HArray1OfCirc2d>;
template class ShapePersistent_HArray1::instance<Poly_HArray1OfTriangle>;

View File

@@ -16,6 +16,8 @@
#define _ShapePersistent_HArray1_HeaderFile
#include <StdLPersistent_HArray1.hxx>
#include <StdObject_gp_Vectors.hxx>
#include <StdObject_gp_Curves.hxx>
#include <TColgp_HArray1OfXYZ.hxx>
#include <TColgp_HArray1OfPnt.hxx>
@@ -32,13 +34,6 @@
class ShapePersistent_HArray1 : private StdLPersistent_HArray1
{
template <class ArrayClass>
class instance : public StdLPersistent_HArray1::base<ArrayClass>
{
virtual void readValue (StdObjMgt_ReadData& theReadData,
const Standard_Integer theIndex);
};
public:
typedef instance<TColgp_HArray1OfXYZ> XYZ;
typedef instance<TColgp_HArray1OfPnt> Pnt;
@@ -53,4 +48,13 @@ public:
typedef instance<Poly_HArray1OfTriangle> Triangle;
};
inline StdObjMgt_ReadData& operator >>
(StdObjMgt_ReadData& theReadData, Poly_Triangle& theTriangle)
{
Standard_Integer N1, N2, N3;
theReadData >> N1 >> N2 >> N3;
theTriangle.Set (N1, N2, N3);
return theReadData;
}
#endif

View File

@@ -1,38 +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.
#include <ShapePersistent_HArray2.hxx>
#include <StdObjMgt_ReadData.hxx>
#include <StdObject_gp.hxx>
template <class ArrayClass>
void ShapePersistent_HArray2::instance<ArrayClass>::readValue (
StdObjMgt_ReadData& theReadData,
const Standard_Integer theRow,
const Standard_Integer theCol)
{
theReadData.ReadObject (
StdObject_gp::Ref (this->myArray->ChangeValue (theRow, theCol)));
}
template class ShapePersistent_HArray2::instance<TColgp_HArray2OfXYZ>;
template class ShapePersistent_HArray2::instance<TColgp_HArray2OfPnt>;
template class ShapePersistent_HArray2::instance<TColgp_HArray2OfDir>;
template class ShapePersistent_HArray2::instance<TColgp_HArray2OfVec>;
template class ShapePersistent_HArray2::instance<TColgp_HArray2OfXY>;
template class ShapePersistent_HArray2::instance<TColgp_HArray2OfPnt2d>;
template class ShapePersistent_HArray2::instance<TColgp_HArray2OfDir2d>;
template class ShapePersistent_HArray2::instance<TColgp_HArray2OfVec2d>;
template class ShapePersistent_HArray2::instance<TColgp_HArray2OfLin2d>;
template class ShapePersistent_HArray2::instance<TColgp_HArray2OfCirc2d>;

View File

@@ -16,6 +16,8 @@
#define _ShapePersistent_HArray2_HeaderFile
#include <StdLPersistent_HArray2.hxx>
#include <StdObject_gp_Vectors.hxx>
#include <StdObject_gp_Curves.hxx>
#include <TColgp_HArray2OfXYZ.hxx>
#include <TColgp_HArray2OfPnt.hxx>
@@ -31,14 +33,6 @@
class ShapePersistent_HArray2 : private StdLPersistent_HArray2
{
template <class ArrayClass>
class instance : public StdLPersistent_HArray2::base<ArrayClass>
{
virtual void readValue (StdObjMgt_ReadData& theReadData,
const Standard_Integer theRow,
const Standard_Integer theCol);
};
public:
typedef instance<TColgp_HArray2OfXYZ> XYZ;
typedef instance<TColgp_HArray2OfPnt> Pnt;

View File

@@ -16,7 +16,7 @@
#define _ShapePersistent_HSequence_HeaderFile
#include <StdObjMgt_Persistent.hxx>
#include <StdObject_gp.hxx>
#include <StdObject_gp_Vectors.hxx>
#include <TColgp_HSequenceOfXYZ.hxx>
#include <TColgp_HSequenceOfPnt.hxx>
@@ -41,9 +41,9 @@ class ShapePersistent_HSequence
const ItemType& Item() const { return myItem; }
private:
Reference<node> myPreviuos;
Reference<node> myNext;
StdObject_gp::Object<ItemType> myItem;
Handle(node) myPreviuos;
Handle(node) myNext;
ItemType myItem;
};
template <class SequenceClass>
@@ -60,9 +60,9 @@ class ShapePersistent_HSequence
Standard_EXPORT Handle(SequenceClass) Import() const;
private:
Reference<Node> myFirst;
Reference<Node> myLast;
Value<Standard_Integer> mySize;
Handle(Node) myFirst;
Handle(Node) myLast;
Standard_Integer mySize;
};
public:

View File

@@ -28,7 +28,7 @@ class Poly_Triangulation;
class ShapePersistent_Poly : private StdObjMgt_SharedObject
{
class pPolygon2D : public PersistentBase
class pPolygon2D : public Standard_Transient
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
@@ -37,11 +37,11 @@ class ShapePersistent_Poly : private StdObjMgt_SharedObject
Handle(Poly_Polygon2D) Import() const;
private:
Value <Standard_Real> myDeflection;
Reference <ShapePersistent_HArray1::Pnt2d> myNodes;
Standard_Real myDeflection;
Handle(ShapePersistent_HArray1::Pnt2d) myNodes;
};
class pPolygon3D : public PersistentBase
class pPolygon3D : public Standard_Transient
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
@@ -50,12 +50,12 @@ class ShapePersistent_Poly : private StdObjMgt_SharedObject
Handle(Poly_Polygon3D) Import() const;
private:
Value <Standard_Real> myDeflection;
Reference <ShapePersistent_HArray1::Pnt> myNodes;
Reference <StdLPersistent_HArray1::Real> myParameters;
Standard_Real myDeflection;
Handle(ShapePersistent_HArray1::Pnt) myNodes;
Handle(StdLPersistent_HArray1::Real) myParameters;
};
class pPolygonOnTriangulation : public PersistentBase
class pPolygonOnTriangulation : public Standard_Transient
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
@@ -64,12 +64,12 @@ class ShapePersistent_Poly : private StdObjMgt_SharedObject
Handle(Poly_PolygonOnTriangulation) Import() const;
private:
Value <Standard_Real> myDeflection;
Reference <StdLPersistent_HArray1::Integer> myNodes;
Reference <StdLPersistent_HArray1::Real> myParameters;
Standard_Real myDeflection;
Handle(StdLPersistent_HArray1::Integer) myNodes;
Handle(StdLPersistent_HArray1::Real) myParameters;
};
class pTriangulation : public PersistentBase
class pTriangulation : public Standard_Transient
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
@@ -78,10 +78,10 @@ class ShapePersistent_Poly : private StdObjMgt_SharedObject
Handle(Poly_Triangulation) Import() const;
private:
Value <Standard_Real> myDeflection;
Reference <ShapePersistent_HArray1::Pnt> myNodes;
Reference <ShapePersistent_HArray1::Pnt2d> myUVNodes;
Reference <ShapePersistent_HArray1::Triangle> myTriangles;
Standard_Real myDeflection;
Handle(ShapePersistent_HArray1::Pnt) myNodes;
Handle(ShapePersistent_HArray1::Pnt2d) myUVNodes;
Handle(ShapePersistent_HArray1::Triangle) myTriangles;
};
template <class Persistent, class Transient>

View File

@@ -31,10 +31,10 @@ enum
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void ShapePersistent_TopoDS::Shape::Read (StdObjMgt_ReadData& theReadData)
void ShapePersistent_TopoDS::HShape::Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> myEntry;
myShape.Read (theReadData);
StdObject_Shape::read (theReadData);
}
void ShapePersistent_TopoDS::pTBase::setFlags
@@ -52,8 +52,8 @@ void ShapePersistent_TopoDS::pTBase::setFlags
static inline void AddShape
(TopoDS_Shape& theParent, const Handle(StdObjMgt_Persistent)& theRef)
{
Handle(ShapePersistent_TopoDS::Shape) aShape =
Handle(ShapePersistent_TopoDS::Shape)::DownCast (theRef);
Handle(ShapePersistent_TopoDS::HShape) aShape =
Handle(ShapePersistent_TopoDS::HShape)::DownCast (theRef);
if (aShape)
BRep_Builder().Add (theParent, aShape->Import());
@@ -69,8 +69,8 @@ template <class ShapesArray>
void ShapePersistent_TopoDS::pTBase::addShapesT
(TopoDS_Shape& theParent) const
{
Handle(ShapesArray) aShapes;
if (myShapes.Cast (aShapes))
Handle(ShapesArray) aShapes = Handle(ShapesArray)::DownCast (myShapes);
if (aShapes)
{
typename ShapesArray::Iterator anIter (*aShapes->Array());
for (; anIter.More(); anIter.Next())

View File

@@ -30,18 +30,14 @@
class ShapePersistent_TopoDS : public StdPersistent_TopoDS
{
public:
class Shape : public StdObjMgt_Persistent
class HShape : public StdObjMgt_Persistent, public StdObject_Shape
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
//! Import transient object from the persistent data.
TopoDS_Shape Import() const { return myShape.Import(); }
private:
Reference<> myEntry;
StdObject_Shape myShape;
Handle(StdObjMgt_Persistent) myEntry;
};
protected: