1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0026961: Recover possibility to read files in old persistence format

Possibility to read shapes and OCAF documents from old persistence format (Std and StdL schema) is restored.

Test cases used old persistent files on input are restored with suffix "_std"

Removing toolkit from OS package
This commit is contained in:
myn
2016-03-02 23:04:30 +03:00
committed by abv
parent 1d8656890c
commit ff205346c9
115 changed files with 6856 additions and 442 deletions

View File

@@ -1,3 +1,23 @@
FILES
ShapePersistent.cxx
ShapePersistent.hxx
ShapePersistent_BRep.cxx
ShapePersistent_BRep.hxx
ShapePersistent_Geom.cxx
ShapePersistent_Geom.hxx
ShapePersistent_Geom_Curve.cxx
ShapePersistent_Geom_Curve.hxx
ShapePersistent_Geom_Surface.cxx
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
ShapePersistent_Poly.cxx
ShapePersistent_Poly.hxx
ShapePersistent_TopoDS.cxx
ShapePersistent_TopoDS.hxx

View File

@@ -14,10 +14,334 @@
#include <ShapePersistent.hxx>
#include <StdObjMgt_MapOfInstantiators.hxx>
#include <StdLPersistent_HArray1.hxx>
#include <StdPersistent_TopoDS.hxx>
#include <ShapePersistent_TopoDS.hxx>
#include <ShapePersistent_HArray1.hxx>
#include <ShapePersistent_HArray2.hxx>
#include <ShapePersistent_HSequence.hxx>
#include <ShapePersistent_Geom2d.hxx>
#include <ShapePersistent_Geom2d_Curve.hxx>
#include <ShapePersistent_Geom.hxx>
#include <ShapePersistent_Geom_Curve.hxx>
#include <ShapePersistent_Geom_Surface.hxx>
#include <ShapePersistent_Poly.hxx>
#include <ShapePersistent_BRep.hxx>
//=======================================================================
//function : BindTypes
//purpose : Register types
//=======================================================================
void ShapePersistent::BindTypes (StdObjMgt_MapOfInstantiators& /*theMap*/)
void ShapePersistent::BindTypes (StdObjMgt_MapOfInstantiators& theMap)
{
theMap.Bind <StdLPersistent_HArray1::Persistent> ("PTopoDS_HArray1OfHShape");
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 <StdPersistent_TopoDS::TShape> ("PTopoDS_TShape");
theMap.Bind <StdPersistent_TopoDS::TShape> ("PTopoDS_TVertex");
theMap.Bind <StdPersistent_TopoDS::TShape> ("PTopoDS_TVertex1");
theMap.Bind <StdPersistent_TopoDS::TShape> ("PTopoDS_TEdge");
theMap.Bind <StdPersistent_TopoDS::TShape> ("PTopoDS_TEdge1");
theMap.Bind <StdPersistent_TopoDS::TShape> ("PTopoDS_TFace");
theMap.Bind <StdPersistent_TopoDS::TShape> ("PTopoDS_TFace1");
theMap.Bind <ShapePersistent_TopoDS::TWire> ("PTopoDS_TWire");
theMap.Bind <ShapePersistent_TopoDS::TWire1> ("PTopoDS_TWire1");
theMap.Bind <ShapePersistent_TopoDS::TShell> ("PTopoDS_TShell");
theMap.Bind <ShapePersistent_TopoDS::TShell1> ("PTopoDS_TShell1");
theMap.Bind <ShapePersistent_TopoDS::TSolid> ("PTopoDS_TSolid");
theMap.Bind <ShapePersistent_TopoDS::TSolid1> ("PTopoDS_TSolid1");
theMap.Bind <ShapePersistent_TopoDS::TCompSolid> ("PTopoDS_TCompSolid");
theMap.Bind <ShapePersistent_TopoDS::TCompSolid1> ("PTopoDS_TCompSolid1");
theMap.Bind <ShapePersistent_TopoDS::TCompound> ("PTopoDS_TCompound");
theMap.Bind <ShapePersistent_TopoDS::TCompound1> ("PTopoDS_TCompound1");
theMap.Bind <ShapePersistent_HArray1::XYZ> ("PColgp_HArray1OfXYZ");
theMap.Bind <ShapePersistent_HArray1::Pnt> ("PColgp_HArray1OfPnt");
theMap.Bind <ShapePersistent_HArray1::Dir> ("PColgp_HArray1OfDir");
theMap.Bind <ShapePersistent_HArray1::Vec> ("PColgp_HArray1OfVec");
theMap.Bind <ShapePersistent_HArray1::XY> ("PColgp_HArray1OfXY");
theMap.Bind <ShapePersistent_HArray1::Pnt2d> ("PColgp_HArray1OfPnt2d");
theMap.Bind <ShapePersistent_HArray1::Dir2d> ("PColgp_HArray1OfDir2d");
theMap.Bind <ShapePersistent_HArray1::Vec2d> ("PColgp_HArray1OfVec2d");
theMap.Bind <ShapePersistent_HArray1::Lin2d> ("PColgp_HArray1OfLin2d");
theMap.Bind <ShapePersistent_HArray1::Circ2d> ("PColgp_HArray1OfCirc2d");
theMap.Bind <ShapePersistent_HArray1::Triangle> ("PPoly_HArray1OfTriangle");
theMap.Bind <ShapePersistent_HArray2::XYZ> ("PColgp_HArray2OfXYZ");
theMap.Bind <ShapePersistent_HArray2::Pnt> ("PColgp_HArray2OfPnt");
theMap.Bind <ShapePersistent_HArray2::Dir> ("PColgp_HArray2OfDir");
theMap.Bind <ShapePersistent_HArray2::Vec> ("PColgp_HArray2OfVec");
theMap.Bind <ShapePersistent_HArray2::XY> ("PColgp_HArray2OfXY");
theMap.Bind <ShapePersistent_HArray2::Pnt2d> ("PColgp_HArray2OfPnt2d");
theMap.Bind <ShapePersistent_HArray2::Dir2d> ("PColgp_HArray2OfDir2d");
theMap.Bind <ShapePersistent_HArray2::Vec2d> ("PColgp_HArray2OfVec2d");
theMap.Bind <ShapePersistent_HArray2::Lin2d> ("PColgp_HArray2OfLin2d");
theMap.Bind <ShapePersistent_HArray2::Circ2d> ("PColgp_HArray2OfCirc2d");
theMap.Bind <ShapePersistent_HSequence::XYZ> ("PColgp_HSequenceOfXYZ");
theMap.Bind <ShapePersistent_HSequence::Pnt> ("PColgp_HSequenceOfPnt");
theMap.Bind <ShapePersistent_HSequence::Dir> ("PColgp_HSequenceOfDir");
theMap.Bind <ShapePersistent_HSequence::Vec> ("PColgp_HSequenceOfVec");
theMap.Bind <ShapePersistent_HSequence::XYZ::Node>
("PColgp_SeqNodeOfHSequenceOfXYZ");
theMap.Bind <ShapePersistent_HSequence::Pnt::Node>
("PColgp_SeqNodeOfHSequenceOfPnt");
theMap.Bind <ShapePersistent_HSequence::Dir::Node>
("PColgp_SeqNodeOfHSequenceOfDir");
theMap.Bind <ShapePersistent_HSequence::Vec::Node>
("PColgp_SeqNodeOfHSequenceOfVec");
theMap.Bind <ShapePersistent_Geom2d::Transformation>
("PGeom2d_Transformation");
theMap.Bind <ShapePersistent_Geom2d::Geometry>
("PGeom2d_Geometry");
theMap.Bind <ShapePersistent_Geom2d::Point>
("PGeom2d_Point");
theMap.Bind <ShapePersistent_Geom2d::CartesianPoint>
("PGeom2d_CartesianPoint");
theMap.Bind <ShapePersistent_Geom2d::Vector>
("PGeom2d_Vector");
theMap.Bind <ShapePersistent_Geom2d::Direction>
("PGeom2d_Direction");
theMap.Bind <ShapePersistent_Geom2d::VectorWithMagnitude>
("PGeom2d_VectorWithMagnitude");
theMap.Bind <ShapePersistent_Geom2d::AxisPlacement>
("PGeom2d_AxisPlacement");
theMap.Bind <ShapePersistent_Geom2d::Curve>
("PGeom2d_Curve");
theMap.Bind <ShapePersistent_Geom2d_Curve::Line>
("PGeom2d_Line");
theMap.Bind <ShapePersistent_Geom2d_Curve::Conic>
("PGeom2d_Conic");
theMap.Bind <ShapePersistent_Geom2d_Curve::Circle>
("PGeom2d_Circle");
theMap.Bind <ShapePersistent_Geom2d_Curve::Ellipse>
("PGeom2d_Ellipse");
theMap.Bind <ShapePersistent_Geom2d_Curve::Hyperbola>
("PGeom2d_Hyperbola");
theMap.Bind <ShapePersistent_Geom2d_Curve::Parabola>
("PGeom2d_Parabola");
theMap.Bind <ShapePersistent_Geom2d_Curve::Bounded>
("PGeom2d_BoundedCurve");
theMap.Bind <ShapePersistent_Geom2d_Curve::Bezier>
("PGeom2d_BezierCurve");
theMap.Bind <ShapePersistent_Geom2d_Curve::BSpline>
("PGeom2d_BSplineCurve");
theMap.Bind <ShapePersistent_Geom2d_Curve::Trimmed>
("PGeom2d_TrimmedCurve");
theMap.Bind <ShapePersistent_Geom2d_Curve::Offset>
("PGeom2d_OffsetCurve");
theMap.Bind <ShapePersistent_Geom::Transformation>
("PGeom_Transformation");
theMap.Bind <ShapePersistent_Geom::Geometry>
("PGeom_Geometry");
theMap.Bind <ShapePersistent_Geom::Point>
("PGeom_Point");
theMap.Bind <ShapePersistent_Geom::CartesianPoint>
("PGeom_CartesianPoint");
theMap.Bind <ShapePersistent_Geom::Vector>
("PGeom_Vector");
theMap.Bind <ShapePersistent_Geom::Direction>
("PGeom_Direction");
theMap.Bind <ShapePersistent_Geom::VectorWithMagnitude>
("PGeom_VectorWithMagnitude");
theMap.Bind <ShapePersistent_Geom::AxisPlacement>
("PGeom_AxisPlacement");
theMap.Bind <ShapePersistent_Geom::Axis1Placement>
("PGeom_Axis1Placement");
theMap.Bind <ShapePersistent_Geom::Axis2Placement>
("PGeom_Axis2Placement");
theMap.Bind <ShapePersistent_Geom::Curve>
("PGeom_Curve");
theMap.Bind <ShapePersistent_Geom_Curve::Line>
("PGeom_Line");
theMap.Bind <ShapePersistent_Geom_Curve::Conic>
("PGeom_Conic");
theMap.Bind <ShapePersistent_Geom_Curve::Circle>
("PGeom_Circle");
theMap.Bind <ShapePersistent_Geom_Curve::Ellipse>
("PGeom_Ellipse");
theMap.Bind <ShapePersistent_Geom_Curve::Hyperbola>
("PGeom_Hyperbola");
theMap.Bind <ShapePersistent_Geom_Curve::Parabola>
("PGeom_Parabola");
theMap.Bind <ShapePersistent_Geom_Curve::Bounded>
("PGeom_BoundedCurve");
theMap.Bind <ShapePersistent_Geom_Curve::Bezier>
("PGeom_BezierCurve");
theMap.Bind <ShapePersistent_Geom_Curve::BSpline>
("PGeom_BSplineCurve");
theMap.Bind <ShapePersistent_Geom_Curve::Trimmed>
("PGeom_TrimmedCurve");
theMap.Bind <ShapePersistent_Geom_Curve::Offset>
("PGeom_OffsetCurve");
theMap.Bind <ShapePersistent_Geom::Surface>
("PGeom_Surface");
theMap.Bind <ShapePersistent_Geom_Surface::Elementary>
("PGeom_ElementarySurface");
theMap.Bind <ShapePersistent_Geom_Surface::Plane>
("PGeom_Plane");
theMap.Bind <ShapePersistent_Geom_Surface::Conical>
("PGeom_ConicalSurface");
theMap.Bind <ShapePersistent_Geom_Surface::Cylindrical>
("PGeom_CylindricalSurface");
theMap.Bind <ShapePersistent_Geom_Surface::Spherical>
("PGeom_SphericalSurface");
theMap.Bind <ShapePersistent_Geom_Surface::Toroidal>
("PGeom_ToroidalSurface");
theMap.Bind <ShapePersistent_Geom_Surface::Swept>
("PGeom_SweptSurface");
theMap.Bind <ShapePersistent_Geom_Surface::LinearExtrusion>
("PGeom_SurfaceOfLinearExtrusion");
theMap.Bind <ShapePersistent_Geom_Surface::Revolution>
("PGeom_SurfaceOfRevolution");
theMap.Bind <ShapePersistent_Geom_Surface::Bounded>
("PGeom_BoundedSurface");
theMap.Bind <ShapePersistent_Geom_Surface::Bezier>
("PGeom_BezierSurface");
theMap.Bind <ShapePersistent_Geom_Surface::BSpline>
("PGeom_BSplineSurface");
theMap.Bind <ShapePersistent_Geom_Surface::RectangularTrimmed>
("PGeom_RectangularTrimmedSurface");
theMap.Bind <ShapePersistent_Geom_Surface::Offset>
("PGeom_OffsetSurface");
theMap.Bind <ShapePersistent_Poly::Polygon2D>
("PPoly_Polygon2D");
theMap.Bind <ShapePersistent_Poly::Polygon3D>
("PPoly_Polygon3D");
theMap.Bind <ShapePersistent_Poly::PolygonOnTriangulation>
("PPoly_PolygonOnTriangulation");
theMap.Bind <ShapePersistent_Poly::Triangulation>
("PPoly_Triangulation");
theMap.Bind <ShapePersistent_BRep::PointRepresentation>
("PBRep_PointRepresentation");
theMap.Bind <ShapePersistent_BRep::PointOnCurve>
("PBRep_PointOnCurve");
theMap.Bind <ShapePersistent_BRep::PointsOnSurface>
("PBRep_PointsOnSurface");
theMap.Bind <ShapePersistent_BRep::PointOnCurveOnSurface>
("PBRep_PointOnCurveOnSurface");
theMap.Bind <ShapePersistent_BRep::PointOnSurface>
("PBRep_PointOnSurface");
theMap.Bind <ShapePersistent_BRep::CurveRepresentation>
("PBRep_CurveRepresentation");
theMap.Bind <ShapePersistent_BRep::GCurve>
("PBRep_GCurve");
theMap.Bind <ShapePersistent_BRep::Curve3D>
("PBRep_Curve3D");
theMap.Bind <ShapePersistent_BRep::CurveOnSurface>
("PBRep_CurveOnSurface");
theMap.Bind <ShapePersistent_BRep::CurveOnClosedSurface>
("PBRep_CurveOnClosedSurface");
theMap.Bind <ShapePersistent_BRep::Polygon3D>
("PBRep_Polygon3D");
theMap.Bind <ShapePersistent_BRep::PolygonOnTriangulation>
("PBRep_PolygonOnTriangulation");
theMap.Bind <ShapePersistent_BRep::PolygonOnClosedTriangulation>
("PBRep_PolygonOnClosedTriangulation");
theMap.Bind <ShapePersistent_BRep::PolygonOnSurface>
("PBRep_PolygonOnSurface");
theMap.Bind <ShapePersistent_BRep::PolygonOnClosedSurface>
("PBRep_PolygonOnClosedSurface");
theMap.Bind <ShapePersistent_BRep::CurveOn2Surfaces>
("PBRep_CurveOn2Surfaces");
theMap.Bind <ShapePersistent_BRep::TVertex> ("PBRep_TVertex");
theMap.Bind <ShapePersistent_BRep::TVertex1> ("PBRep_TVertex1");
theMap.Bind <ShapePersistent_BRep::TEdge> ("PBRep_TEdge");
theMap.Bind <ShapePersistent_BRep::TEdge1> ("PBRep_TEdge1");
theMap.Bind <ShapePersistent_BRep::TFace> ("PBRep_TFace");
theMap.Bind <ShapePersistent_BRep::TFace1> ("PBRep_TFace1");
}

View File

@@ -0,0 +1,392 @@
// 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_BRep.hxx>
#include <BRep_PointOnCurve.hxx>
#include <BRep_PointOnCurveOnSurface.hxx>
#include <BRep_PointOnSurface.hxx>
#include <BRep_Curve3D.hxx>
#include <BRep_CurveOnSurface.hxx>
#include <BRep_CurveOnClosedSurface.hxx>
#include <BRep_Polygon3D.hxx>
#include <BRep_PolygonOnTriangulation.hxx>
#include <BRep_PolygonOnClosedTriangulation.hxx>
#include <BRep_PolygonOnSurface.hxx>
#include <BRep_PolygonOnClosedSurface.hxx>
#include <BRep_CurveOn2Surfaces.hxx>
#include <BRep_TVertex.hxx>
#include <BRep_TEdge.hxx>
#include <BRep_TFace.hxx>
enum
{
ParameterMask = 1,
RangeMask = 2,
DegeneratedMask = 4
};
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void ShapePersistent_BRep::PointRepresentation::Read
(StdObjMgt_ReadData& theReadData)
{ theReadData >> myLocation >> myParameter >> myNext; }
//=======================================================================
//function : Import
//purpose : Import transient object from the persistent data
//=======================================================================
void ShapePersistent_BRep::PointRepresentation::Import
(BRep_ListOfPointRepresentation& thePoints) const
{
thePoints.Clear();
Handle(PointRepresentation) aPoint = this;
for (; aPoint; aPoint = aPoint->myNext)
thePoints.Prepend (aPoint->import());
}
Handle(BRep_PointRepresentation)
ShapePersistent_BRep::PointRepresentation::import() const
{ return NULL; }
void ShapePersistent_BRep::PointOnCurve::Read
(StdObjMgt_ReadData& theReadData)
{
PointRepresentation::Read (theReadData);
theReadData >> myCurve;
}
Handle(BRep_PointRepresentation)
ShapePersistent_BRep::PointOnCurve::import() const
{
if (myCurve.IsNull())
return NULL;
return new BRep_PointOnCurve
(myParameter, myCurve->Import(), myLocation.Import());
}
void ShapePersistent_BRep::PointsOnSurface::Read
(StdObjMgt_ReadData& theReadData)
{
PointRepresentation::Read (theReadData);
theReadData >> mySurface;
}
void ShapePersistent_BRep::PointOnCurveOnSurface::Read
(StdObjMgt_ReadData& theReadData)
{
PointsOnSurface::Read (theReadData);
theReadData >> myPCurve;
}
Handle(BRep_PointRepresentation)
ShapePersistent_BRep::PointOnCurveOnSurface::import() const
{
if (mySurface.IsNull() || myPCurve.IsNull())
return NULL;
return new BRep_PointOnCurveOnSurface
(myParameter, myPCurve->Import(), mySurface->Import(), myLocation.Import());
}
void ShapePersistent_BRep::PointOnSurface::Read
(StdObjMgt_ReadData& theReadData)
{
PointsOnSurface::Read (theReadData);
theReadData >> myParameter2;
}
Handle(BRep_PointRepresentation)
ShapePersistent_BRep::PointOnSurface::import() const
{
if (mySurface.IsNull())
return NULL;
return new BRep_PointOnSurface
(myParameter, myParameter2, mySurface->Import(), myLocation.Import());
}
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void ShapePersistent_BRep::CurveRepresentation::Read
(StdObjMgt_ReadData& theReadData)
{ theReadData >> myLocation >> myNext; }
//=======================================================================
//function : Import
//purpose : Import transient object from the persistent data
//=======================================================================
void ShapePersistent_BRep::CurveRepresentation::Import
(BRep_ListOfCurveRepresentation& theCurves) const
{
theCurves.Clear();
Handle(CurveRepresentation) aCurve = this;
for (; aCurve; aCurve = aCurve->myNext)
theCurves.Prepend (aCurve->import());
}
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::CurveRepresentation::import() const
{ return NULL; }
void ShapePersistent_BRep::GCurve::Read
(StdObjMgt_ReadData& theReadData)
{
CurveRepresentation::Read (theReadData);
theReadData >> myFirst >> myLast;
}
void ShapePersistent_BRep::Curve3D::Read
(StdObjMgt_ReadData& theReadData)
{
GCurve::Read (theReadData);
theReadData >> myCurve3D;
}
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::Curve3D::import() const
{
Handle(Geom_Curve) aCurve;
if (myCurve3D)
aCurve = myCurve3D->Import();
Handle(BRep_Curve3D) aRepresentation =
new BRep_Curve3D (aCurve, myLocation.Import());
aRepresentation->SetRange (myFirst, myLast);
return aRepresentation;
}
void ShapePersistent_BRep::CurveOnSurface::Read
(StdObjMgt_ReadData& theReadData)
{
GCurve::Read (theReadData);
theReadData >> myPCurve >> mySurface >> myUV1 >> myUV2;
}
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::CurveOnSurface::import() const
{
if (myPCurve.IsNull() || mySurface.IsNull())
return NULL;
Handle(BRep_CurveOnSurface) aCurve =
new BRep_CurveOnSurface (myPCurve->Import(),
mySurface->Import(),
myLocation.Import());
aCurve->SetUVPoints (myUV1, myUV2);
aCurve->SetRange (myFirst, myLast);
return aCurve;
}
void ShapePersistent_BRep::CurveOnClosedSurface::Read
(StdObjMgt_ReadData& theReadData)
{
CurveOnSurface::Read (theReadData);
theReadData >> myPCurve2 >> myContinuity >> myUV21 >> myUV22;
}
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::CurveOnClosedSurface::import() const
{
if (myPCurve.IsNull() || mySurface.IsNull() || myPCurve2.IsNull())
return NULL;
Handle(BRep_CurveOnClosedSurface) aCurve =
new BRep_CurveOnClosedSurface (myPCurve->Import(),
myPCurve2->Import(),
mySurface->Import(),
myLocation.Import(),
myContinuity);
aCurve->SetUVPoints (myUV1 , myUV2 );
aCurve->SetUVPoints2 (myUV21 , myUV22);
aCurve->SetRange (myFirst, myLast);
return aCurve;
}
void ShapePersistent_BRep::Polygon3D::Read
(StdObjMgt_ReadData& theReadData)
{
CurveRepresentation::Read (theReadData);
theReadData >> myPolygon3D;
}
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::Polygon3D::import() const
{
if (myPolygon3D.IsNull())
return NULL;
return new BRep_Polygon3D (myPolygon3D->Import(), myLocation.Import());
}
void ShapePersistent_BRep::PolygonOnTriangulation::Read
(StdObjMgt_ReadData& theReadData)
{
CurveRepresentation::Read (theReadData);
theReadData >> myPolygon >> myTriangulation;
}
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnTriangulation::import() const
{
if (myPolygon.IsNull() || myTriangulation.IsNull())
return NULL;
return new BRep_PolygonOnTriangulation (myPolygon->Import(),
myTriangulation->Import(),
myLocation.Import());
}
void ShapePersistent_BRep::PolygonOnClosedTriangulation::Read
(StdObjMgt_ReadData& theReadData)
{
PolygonOnTriangulation::Read (theReadData);
theReadData >> myPolygon2;
}
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnClosedTriangulation::import() const
{
if (myPolygon.IsNull() || myTriangulation.IsNull() || myPolygon2.IsNull())
return NULL;
return new BRep_PolygonOnClosedTriangulation (myPolygon->Import(),
myPolygon2->Import(),
myTriangulation->Import(),
myLocation.Import());
}
void ShapePersistent_BRep::PolygonOnSurface::Read
(StdObjMgt_ReadData& theReadData)
{
CurveRepresentation::Read (theReadData);
theReadData >> myPolygon2D >> mySurface;
}
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnSurface::import() const
{
if (myPolygon2D.IsNull() || mySurface.IsNull())
return NULL;
return new BRep_PolygonOnSurface (myPolygon2D->Import(),
mySurface->Import(),
myLocation.Import());
}
void ShapePersistent_BRep::PolygonOnClosedSurface::Read
(StdObjMgt_ReadData& theReadData)
{
PolygonOnSurface::Read (theReadData);
theReadData >> myPolygon2;
}
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::PolygonOnClosedSurface::import() const
{
if (myPolygon2D.IsNull() || mySurface.IsNull() || myPolygon2.IsNull())
return NULL;
return new BRep_PolygonOnClosedSurface (myPolygon2D->Import(),
myPolygon2->Import(),
mySurface->Import(),
myLocation.Import());
}
void ShapePersistent_BRep::CurveOn2Surfaces::Read
(StdObjMgt_ReadData& theReadData)
{
CurveRepresentation::Read (theReadData);
theReadData >> mySurface >> mySurface2 >> myLocation2 >> myContinuity;
}
Handle(BRep_CurveRepresentation)
ShapePersistent_BRep::CurveOn2Surfaces::import() const
{
if (mySurface.IsNull() || mySurface2.IsNull())
return NULL;
return new BRep_CurveOn2Surfaces (mySurface->Import(),
mySurface2->Import(),
myLocation.Import(),
myLocation2.Import(),
myContinuity);
}
//=======================================================================
//function : createTShape
//purpose : Create transient TShape object
//=======================================================================
Handle(TopoDS_TShape) ShapePersistent_BRep::pTVertex::createTShape() const
{
Handle(BRep_TVertex) aTVertex = new BRep_TVertex;
aTVertex->Tolerance (myTolerance);
aTVertex->Pnt (myPnt);
myPoints->Import (aTVertex->ChangePoints());
return aTVertex;
}
//=======================================================================
//function : createTShape
//purpose : Create transient TShape object
//=======================================================================
Handle(TopoDS_TShape) ShapePersistent_BRep::pTEdge::createTShape() const
{
Handle(BRep_TEdge) aTEdge = new BRep_TEdge;
aTEdge->Tolerance (myTolerance);
aTEdge->SameParameter (myFlags & ParameterMask);
aTEdge->SameRange (myFlags & RangeMask);
aTEdge->Degenerated (myFlags & DegeneratedMask);
myCurves->Import (aTEdge->ChangeCurves());
return aTEdge;
}
//=======================================================================
//function : createTShape
//purpose : Create transient TShape object
//=======================================================================
Handle(TopoDS_TShape) ShapePersistent_BRep::pTFace::createTShape() const
{
Handle(BRep_TFace) aTFace = new BRep_TFace;
aTFace->NaturalRestriction (myNaturalRestriction);
aTFace->Tolerance (myTolerance);
aTFace->Location (myLocation.Import());
if (mySurface)
aTFace->Surface (mySurface->Import());
if (myTriangulation)
aTFace->Triangulation (myTriangulation->Import());
return aTFace;
}

View File

@@ -0,0 +1,298 @@
// 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 _ShapePersistent_BRep_HeaderFile
#define _ShapePersistent_BRep_HeaderFile
#include <ShapePersistent_TopoDS.hxx>
#include <ShapePersistent_Geom.hxx>
#include <ShapePersistent_Geom2d.hxx>
#include <ShapePersistent_Poly.hxx>
#include <StdObject_Location.hxx>
#include <StdObject_gp.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;
class ShapePersistent_BRep : public ShapePersistent_TopoDS
{
public:
class PointRepresentation : public StdObjMgt_Persistent
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
//! Import transient object from the persistent data.
Standard_EXPORT void Import (BRep_ListOfPointRepresentation& thePoints)
const;
protected:
virtual Handle(BRep_PointRepresentation) import() const;
protected:
Object <StdObject_Location> myLocation;
Value <Standard_Real> myParameter;
private:
Reference<PointRepresentation> myNext;
};
class PointOnCurve : public PointRepresentation
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
virtual Handle(BRep_PointRepresentation) import() const;
private:
Reference<ShapePersistent_Geom::Curve> myCurve;
};
class PointsOnSurface : public PointRepresentation
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
protected:
Reference<ShapePersistent_Geom::Surface> mySurface;
};
class PointOnCurveOnSurface : public PointsOnSurface
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
virtual Handle(BRep_PointRepresentation) import() const;
private:
Reference<ShapePersistent_Geom2d::Curve> myPCurve;
};
class PointOnSurface : public PointsOnSurface
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
virtual Handle(BRep_PointRepresentation) import() const;
private:
Value<Standard_Real> myParameter2;
};
class CurveRepresentation : public StdObjMgt_Persistent
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
//! Import transient object from the persistent data.
Standard_EXPORT void Import (BRep_ListOfCurveRepresentation& theCurves)
const;
protected:
virtual Handle(BRep_CurveRepresentation) import() const;
protected:
Object<StdObject_Location> myLocation;
private:
Reference<CurveRepresentation> myNext;
};
class GCurve : public CurveRepresentation
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
protected:
Value<Standard_Real> myFirst;
Value<Standard_Real> myLast;
};
class Curve3D : public GCurve
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
virtual Handle(BRep_CurveRepresentation) import() const;
private:
Reference<ShapePersistent_Geom::Curve> myCurve3D;
};
class CurveOnSurface : public GCurve
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
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;
};
class CurveOnClosedSurface : public CurveOnSurface
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
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;
};
class Polygon3D : public CurveRepresentation
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
virtual Handle(BRep_CurveRepresentation) import() const;
private:
Reference<ShapePersistent_Poly::Polygon3D> myPolygon3D;
};
class PolygonOnTriangulation : public CurveRepresentation
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
virtual Handle(BRep_CurveRepresentation) import() const;
protected:
Reference<ShapePersistent_Poly::PolygonOnTriangulation> myPolygon;
Reference<ShapePersistent_Poly::Triangulation> myTriangulation;
};
class PolygonOnClosedTriangulation : public PolygonOnTriangulation
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
virtual Handle(BRep_CurveRepresentation) import() const;
private:
Reference<ShapePersistent_Poly::PolygonOnTriangulation> myPolygon2;
};
class PolygonOnSurface : public CurveRepresentation
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
virtual Handle(BRep_CurveRepresentation) import() const;
protected:
Reference<ShapePersistent_Poly::Polygon2D> myPolygon2D;
Reference<ShapePersistent_Geom::Surface> mySurface;
};
class PolygonOnClosedSurface : public PolygonOnSurface
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
virtual Handle(BRep_CurveRepresentation) import() const;
private:
Reference<ShapePersistent_Poly::Polygon2D> myPolygon2;
};
class CurveOn2Surfaces : public CurveRepresentation
{
public:
virtual void Read (StdObjMgt_ReadData& theReadData);
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;
};
private:
class pTVertex : public pTBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{
pTBase::Read (theReadData);
theReadData >> myTolerance >> myPnt >> myPoints;
}
private:
virtual Handle(TopoDS_TShape) createTShape() const;
private:
Value<Standard_Real> myTolerance;
StdObject_gp::Object<gp_Pnt> myPnt;
Reference<PointRepresentation> myPoints;
};
class pTEdge : public pTBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{
pTBase::Read (theReadData);
theReadData >> myTolerance >> myFlags >> myCurves;
}
private:
virtual Handle(TopoDS_TShape) createTShape() const;
private:
Value <Standard_Real> myTolerance;
Value <Standard_Integer> myFlags;
Reference <CurveRepresentation> myCurves;
};
class pTFace : public pTBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{
pTBase::Read (theReadData);
theReadData >> mySurface >> myTriangulation >> myLocation;
theReadData >> myTolerance >> myNaturalRestriction;
}
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;
};
public:
typedef tObject <pTVertex> TVertex;
typedef tObject <pTEdge> TEdge;
typedef tObject <pTFace> TFace;
typedef tObject1 <pTVertex> TVertex1;
typedef tObject1 <pTEdge> TEdge1;
typedef tObject1 <pTFace> TFace1;
};
#endif

View File

@@ -0,0 +1,40 @@
// 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_Geom.hxx>
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void ShapePersistent_Geom::Geometry::Read (StdObjMgt_ReadData&) {}
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
template<>
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;
theReadData >> anAxis >> anXDirection;
myTransient = new Geom_Axis2Placement (anAxis.Location(),
anAxis.Direction(),
anXDirection);
}

View File

@@ -0,0 +1,101 @@
// 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 _ShapePersistent_Geom_HeaderFile
#define _ShapePersistent_Geom_HeaderFile
#include <StdObjMgt_SharedObject.hxx>
#include <StdObject_gp.hxx>
#include <Geom_CartesianPoint.hxx>
#include <Geom_Direction.hxx>
#include <Geom_VectorWithMagnitude.hxx>
#include <Geom_Axis1Placement.hxx>
#include <Geom_Axis2Placement.hxx>
#include <Geom_Transformation.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
class ShapePersistent_Geom : protected StdObjMgt_SharedObject
{
public:
class Geometry : public StdObjMgt_Persistent
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
};
protected:
template <class Transient>
struct geometryBase : DelayedBase<Geometry, Transient> {};
template <class Base, class PData>
class subBase : public Base
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
{ PData().Read (theReadData); }
};
template <class Base, class GpData>
struct subBase_gp : subBase <Base, StdObject_gp::Object<GpData> > {};
template <class Base>
struct subBase_empty : Base {};
template <class Base, class Target, class Data = void>
class instance : public Base
{
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData)
{
StdObject_gp::Object<Data> aData;
theReadData >> aData;
this->myTransient = new Target (aData);
}
};
private:
typedef geometryBase<Geom_Geometry> basic;
public:
typedef subBase_empty<basic> Point;
typedef instance<Point, Geom_CartesianPoint, gp_Pnt> CartesianPoint;
typedef subBase_gp<basic, gp_Vec> Vector;
typedef instance<Vector, Geom_Direction , gp_Dir> Direction;
typedef instance<Vector, Geom_VectorWithMagnitude, gp_Vec> VectorWithMagnitude;
typedef subBase_gp<basic, gp_Ax1> AxisPlacement;
typedef instance<AxisPlacement, Geom_Axis1Placement, gp_Ax1> Axis1Placement;
typedef instance<AxisPlacement, Geom_Axis2Placement> Axis2Placement;
typedef instance <SharedBase<Geom_Transformation>,
Geom_Transformation,
gp_Trsf> Transformation;
typedef geometryBase<Geom_Curve> Curve;
typedef geometryBase<Geom_Surface> Surface;
};
template<>
void ShapePersistent_Geom::instance<ShapePersistent_Geom::AxisPlacement,
Geom_Axis2Placement>
::Read (StdObjMgt_ReadData& theReadData);
#endif

View File

@@ -0,0 +1,51 @@
// 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 _ShapePersistent_Geom2d_HeaderFile
#define _ShapePersistent_Geom2d_HeaderFile
#include <ShapePersistent_Geom.hxx>
#include <Geom2d_CartesianPoint.hxx>
#include <Geom2d_Direction.hxx>
#include <Geom2d_VectorWithMagnitude.hxx>
#include <Geom2d_AxisPlacement.hxx>
#include <Geom2d_Transformation.hxx>
#include <Geom2d_Curve.hxx>
class ShapePersistent_Geom2d : protected ShapePersistent_Geom
{
typedef geometryBase<Geom2d_Geometry> basic;
public:
typedef ShapePersistent_Geom::Geometry Geometry;
typedef subBase_empty<basic> Point;
typedef instance<Point, Geom2d_CartesianPoint, gp_Pnt2d> CartesianPoint;
typedef subBase_gp<basic, gp_Vec2d> Vector;
typedef instance<Vector, Geom2d_Direction , gp_Dir2d> Direction;
typedef instance<Vector, Geom2d_VectorWithMagnitude, gp_Vec2d> VectorWithMagnitude;
typedef instance<basic, Geom2d_AxisPlacement, gp_Ax2d> AxisPlacement;
typedef instance <SharedBase<Geom2d_Transformation>,
Geom2d_Transformation,
gp_Trsf2d> Transformation;
typedef geometryBase<Geom2d_Curve> Curve;
};
#endif

View File

@@ -0,0 +1,76 @@
// 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_Geom2d_Curve.hxx>
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2d_OffsetCurve.hxx>
Handle(Geom2d_Curve) ShapePersistent_Geom2d_Curve::pBezier::Import() const
{
if (myPoles.IsNull())
return NULL;
if (myRational)
{
if (myWeights.IsNull())
return NULL;
return new Geom2d_BezierCurve (*myPoles->Array(), *myWeights->Array());
}
else
return new Geom2d_BezierCurve (*myPoles->Array());
}
Handle(Geom2d_Curve) ShapePersistent_Geom2d_Curve::pBSpline::Import() const
{
if (myPoles.IsNull() || myKnots.IsNull() || myMultiplicities.IsNull())
return NULL;
if (myRational)
{
if (myWeights.IsNull())
return NULL;
return new Geom2d_BSplineCurve (*myPoles->Array(),
*myWeights->Array(),
*myKnots->Array(),
*myMultiplicities->Array(),
mySpineDegree,
myPeriodic);
}
else
return new Geom2d_BSplineCurve (*myPoles->Array(),
*myKnots->Array(),
*myMultiplicities->Array(),
mySpineDegree,
myPeriodic);
}
Handle(Geom2d_Curve) ShapePersistent_Geom2d_Curve::pTrimmed::Import() const
{
if (myBasisCurve.IsNull())
return NULL;
return new Geom2d_TrimmedCurve (myBasisCurve->Import(), myFirstU, myLastU);
}
Handle(Geom2d_Curve) ShapePersistent_Geom2d_Curve::pOffset::Import() const
{
if (myBasisCurve.IsNull())
return NULL;
return new Geom2d_OffsetCurve (myBasisCurve->Import(), myOffsetValue);
}

View File

@@ -0,0 +1,119 @@
// 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 _ShapePersistent_Geom2d_Curve_HeaderFile
#define _ShapePersistent_Geom2d_Curve_HeaderFile
#include <ShapePersistent_Geom2d.hxx>
#include <ShapePersistent_HArray1.hxx>
#include <StdLPersistent_HArray1.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_Circle.hxx>
#include <Geom2d_Ellipse.hxx>
#include <Geom2d_Hyperbola.hxx>
#include <Geom2d_Parabola.hxx>
#include <gp_Circ2d.hxx>
#include <gp_Elips2d.hxx>
#include <gp_Hypr2d.hxx>
#include <gp_Parab2d.hxx>
class ShapePersistent_Geom2d_Curve : protected ShapePersistent_Geom2d
{
typedef Curve::PersistentBase pBase;
typedef pBase pBounded;
class pBezier : public pBounded
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myRational >> myPoles >> myWeights; }
virtual Handle(Geom2d_Curve) Import() const;
private:
Value <Standard_Boolean> myRational;
Reference <ShapePersistent_HArray1::Pnt2d> myPoles;
Reference <StdLPersistent_HArray1::Real> myWeights;
};
class pBSpline : public pBounded
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> myRational >> myPeriodic >> mySpineDegree;
theReadData >> myPoles >> myWeights >> myKnots >> myMultiplicities;
}
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;
};
class pTrimmed : public pBounded
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myBasisCurve >> myFirstU >> myLastU; }
virtual Handle(Geom2d_Curve) Import() const;
private:
Reference<Curve> myBasisCurve;
Value<Standard_Real> myFirstU;
Value<Standard_Real> myLastU;
};
class pOffset : public pBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myBasisCurve >> myOffsetValue; }
virtual Handle(Geom2d_Curve) Import() const;
private:
Reference<Curve> myBasisCurve;
Value<Standard_Real> myOffsetValue;
};
public:
typedef instance<Curve, Geom2d_Line, gp_Ax2d> Line;
typedef subBase_gp<Curve, gp_Ax22d> Conic;
typedef instance<Conic, Geom2d_Circle , gp_Circ2d > Circle;
typedef instance<Conic, Geom2d_Ellipse , gp_Elips2d> Ellipse;
typedef instance<Conic, Geom2d_Hyperbola, gp_Hypr2d > Hyperbola;
typedef instance<Conic, Geom2d_Parabola , gp_Parab2d> Parabola;
typedef subBase_empty<Curve> Bounded;
typedef Delayed<Bounded, pBezier> Bezier;
typedef Delayed<Bounded, pBSpline> BSpline;
typedef Delayed<Bounded, pTrimmed> Trimmed;
typedef Delayed<Curve, pOffset> Offset;
};
#endif

View File

@@ -0,0 +1,77 @@
// 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_Geom_Curve.hxx>
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom_OffsetCurve.hxx>
Handle(Geom_Curve) ShapePersistent_Geom_Curve::pBezier::Import() const
{
if (myPoles.IsNull())
return NULL;
if (myRational)
{
if (myWeights.IsNull())
return NULL;
return new Geom_BezierCurve (*myPoles->Array(), *myWeights->Array());
}
else
return new Geom_BezierCurve (*myPoles->Array());
}
Handle(Geom_Curve) ShapePersistent_Geom_Curve::pBSpline::Import() const
{
if (myPoles.IsNull() || myKnots.IsNull() || myMultiplicities.IsNull())
return NULL;
if (myRational)
{
if (myWeights.IsNull())
return NULL;
return new Geom_BSplineCurve (*myPoles->Array(),
*myWeights->Array(),
*myKnots->Array(),
*myMultiplicities->Array(),
mySpineDegree,
myPeriodic);
}
else
return new Geom_BSplineCurve (*myPoles->Array(),
*myKnots->Array(),
*myMultiplicities->Array(),
mySpineDegree,
myPeriodic);
}
Handle(Geom_Curve) ShapePersistent_Geom_Curve::pTrimmed::Import() const
{
if (myBasisCurve.IsNull())
return NULL;
return new Geom_TrimmedCurve (myBasisCurve->Import(), myFirstU, myLastU);
}
Handle(Geom_Curve) ShapePersistent_Geom_Curve::pOffset::Import() const
{
if (myBasisCurve.IsNull())
return NULL;
return new Geom_OffsetCurve
(myBasisCurve->Import(), myOffsetValue, myOffsetDirection);
}

View File

@@ -0,0 +1,122 @@
// 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 _ShapePersistent_Geom_Curve_HeaderFile
#define _ShapePersistent_Geom_Curve_HeaderFile
#include <ShapePersistent_Geom.hxx>
#include <ShapePersistent_HArray1.hxx>
#include <StdLPersistent_HArray1.hxx>
#include <Geom_Line.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include <Geom_Hyperbola.hxx>
#include <Geom_Parabola.hxx>
#include <gp_Circ.hxx>
#include <gp_Elips.hxx>
#include <gp_Hypr.hxx>
#include <gp_Parab.hxx>
class gp_Dir;
class ShapePersistent_Geom_Curve : private ShapePersistent_Geom
{
typedef Curve::PersistentBase pBase;
typedef pBase pBounded;
class pBezier : public pBounded
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myRational >> myPoles >> myWeights; }
virtual Handle(Geom_Curve) Import() const;
private:
Value <Standard_Boolean> myRational;
Reference <ShapePersistent_HArray1::Pnt> myPoles;
Reference <StdLPersistent_HArray1::Real> myWeights;
};
class pBSpline : public pBounded
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> myRational >> myPeriodic >> mySpineDegree;
theReadData >> myPoles >> myWeights >> myKnots >> myMultiplicities;
}
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;
};
class pTrimmed : public pBounded
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myBasisCurve >> myFirstU >> myLastU; }
virtual Handle(Geom_Curve) Import() const;
private:
Reference<Curve> myBasisCurve;
Value<Standard_Real> myFirstU;
Value<Standard_Real> myLastU;
};
class pOffset : public pBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myBasisCurve >> myOffsetDirection >> myOffsetValue; }
virtual Handle(Geom_Curve) Import() const;
private:
Reference<Curve> myBasisCurve;
StdObject_gp::Object<gp_Dir> myOffsetDirection;
Value<Standard_Real> myOffsetValue;
};
public:
typedef instance<Curve, Geom_Line, gp_Ax1> Line;
typedef subBase_gp<Curve, gp_Ax2> Conic;
typedef instance<Conic, Geom_Circle , gp_Circ > Circle;
typedef instance<Conic, Geom_Ellipse , gp_Elips> Ellipse;
typedef instance<Conic, Geom_Hyperbola, gp_Hypr > Hyperbola;
typedef instance<Conic, Geom_Parabola , gp_Parab> Parabola;
typedef subBase_empty<Curve> Bounded;
typedef Delayed<Bounded, pBezier> Bezier;
typedef Delayed<Bounded, pBSpline> BSpline;
typedef Delayed<Bounded, pTrimmed> Trimmed;
typedef Delayed<Curve, pOffset> Offset;
};
#endif

View File

@@ -0,0 +1,110 @@
// 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_Geom_Surface.hxx>
#include <Geom_SurfaceOfLinearExtrusion.hxx>
#include <Geom_SurfaceOfRevolution.hxx>
#include <Geom_BezierSurface.hxx>
#include <Geom_BSplineSurface.hxx>
#include <Geom_RectangularTrimmedSurface.hxx>
#include <Geom_OffsetSurface.hxx>
#include <gp_Ax1.hxx>
Handle(Geom_Surface) ShapePersistent_Geom_Surface::pLinearExtrusion::Import()
const
{
if (myBasisCurve.IsNull())
return NULL;
return new Geom_SurfaceOfLinearExtrusion
(myBasisCurve->Import(), myDirection);
}
Handle(Geom_Surface) ShapePersistent_Geom_Surface::pRevolution::Import() const
{
if (myBasisCurve.IsNull())
return NULL;
return new Geom_SurfaceOfRevolution
(myBasisCurve->Import(), gp_Ax1 (myLocation, myDirection));
}
Handle(Geom_Surface) ShapePersistent_Geom_Surface::pBezier::Import() const
{
if (myPoles.IsNull())
return NULL;
if (myURational || myVRational)
{
if (myWeights.IsNull())
return NULL;
return new Geom_BezierSurface (*myPoles->Array(), *myWeights->Array());
}
else
return new Geom_BezierSurface (*myPoles->Array());
}
Handle(Geom_Surface) ShapePersistent_Geom_Surface::pBSpline::Import() const
{
if (myPoles.IsNull() || myUKnots.IsNull() || myVKnots.IsNull()
|| myUMultiplicities.IsNull() || myVMultiplicities.IsNull())
return NULL;
if (myURational || myVRational)
{
if (myWeights.IsNull())
return NULL;
return new Geom_BSplineSurface (*myPoles->Array(),
*myWeights->Array(),
*myUKnots->Array(),
*myVKnots->Array(),
*myUMultiplicities->Array(),
*myVMultiplicities->Array(),
myUSpineDegree,
myVSpineDegree,
myUPeriodic,
myVPeriodic);
}
else
return new Geom_BSplineSurface (*myPoles->Array(),
*myUKnots->Array(),
*myVKnots->Array(),
*myUMultiplicities->Array(),
*myVMultiplicities->Array(),
myUSpineDegree,
myVSpineDegree,
myUPeriodic,
myVPeriodic);
}
Handle(Geom_Surface) ShapePersistent_Geom_Surface::pRectangularTrimmed::Import()
const
{
if (myBasisSurface.IsNull())
return NULL;
return new Geom_RectangularTrimmedSurface
(myBasisSurface->Import(), myFirstU, myLastU, myFirstV, myLastV);
}
Handle(Geom_Surface) ShapePersistent_Geom_Surface::pOffset::Import() const
{
if (myBasisSurface.IsNull())
return NULL;
return new Geom_OffsetSurface (myBasisSurface->Import(), myOffsetValue);
}

View File

@@ -0,0 +1,177 @@
// 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 _ShapePersistent_Geom_Surface_HeaderFile
#define _ShapePersistent_Geom_Surface_HeaderFile
#include <ShapePersistent_Geom.hxx>
#include <ShapePersistent_HArray2.hxx>
#include <StdLPersistent_HArray1.hxx>
#include <StdLPersistent_HArray2.hxx>
#include <Geom_Plane.hxx>
#include <Geom_ConicalSurface.hxx>
#include <Geom_CylindricalSurface.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_ToroidalSurface.hxx>
#include <gp_Ax3.hxx>
#include <gp_Cone.hxx>
#include <gp_Cylinder.hxx>
#include <gp_Sphere.hxx>
#include <gp_Torus.hxx>
class gp_Dir;
class gp_Pnt;
class ShapePersistent_Geom_Surface : private ShapePersistent_Geom
{
typedef Surface::PersistentBase pBase;
class pSweptData : protected StdObjMgt_ContentTypes
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myBasisCurve >> myDirection; }
protected:
Reference <Curve> myBasisCurve;
StdObject_gp::Object <gp_Dir> myDirection;
};
struct pSwept : pBase, pSweptData {};
class pLinearExtrusion : public pSwept
{
public:
virtual Handle(Geom_Surface) Import() const;
};
class pRevolution : public pSwept
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{
pSwept::Read (theReadData);
theReadData >> myLocation;
}
virtual Handle(Geom_Surface) Import() const;
private:
StdObject_gp::Object<gp_Pnt> myLocation;
};
typedef pBase pBounded;
class pBezier : public pBounded
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myURational >> myVRational >> myPoles >> myWeights; }
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;
};
class pBSpline : public pBounded
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> myURational >> myVRational;
theReadData >> myUPeriodic >> myVPeriodic;
theReadData >> myUSpineDegree >> myVSpineDegree;
theReadData >> myPoles;
theReadData >> myWeights;
theReadData >> myUKnots >> myVKnots;
theReadData >> myUMultiplicities >> myVMultiplicities;
}
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;
};
class pRectangularTrimmed : public pBounded
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> myBasisSurface;
theReadData >> myFirstU >> myLastU >> myFirstV >> myLastV;
}
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;
};
class pOffset : public pBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myBasisSurface >> myOffsetValue; }
virtual Handle(Geom_Surface) Import() const;
private:
Reference<Surface> myBasisSurface;
Value<Standard_Real> myOffsetValue;
};
public:
typedef subBase_gp<Surface, gp_Ax3> Elementary;
typedef instance<Elementary, Geom_Plane , gp_Ax3> Plane;
typedef instance<Elementary, Geom_ConicalSurface , gp_Cone> Conical;
typedef instance<Elementary, Geom_CylindricalSurface, gp_Cylinder> Cylindrical;
typedef instance<Elementary, Geom_SphericalSurface , gp_Sphere> Spherical;
typedef instance<Elementary, Geom_ToroidalSurface , gp_Torus> Toroidal;
typedef subBase<Surface, pSweptData> Swept;
typedef Delayed<Swept, pLinearExtrusion> LinearExtrusion;
typedef Delayed<Swept, pRevolution> Revolution;
typedef subBase_empty<Surface> Bounded;
typedef Delayed<Bounded, pBezier> Bezier;
typedef Delayed<Bounded, pBSpline> BSpline;
typedef Delayed<Bounded, pRectangularTrimmed> RectangularTrimmed;
typedef Delayed<Surface, pOffset> Offset;
};
#endif

View File

@@ -0,0 +1,45 @@
// 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

@@ -0,0 +1,56 @@
// 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 _ShapePersistent_HArray1_HeaderFile
#define _ShapePersistent_HArray1_HeaderFile
#include <StdLPersistent_HArray1.hxx>
#include <TColgp_HArray1OfXYZ.hxx>
#include <TColgp_HArray1OfPnt.hxx>
#include <TColgp_HArray1OfDir.hxx>
#include <TColgp_HArray1OfVec.hxx>
#include <TColgp_HArray1OfXY.hxx>
#include <TColgp_HArray1OfPnt2d.hxx>
#include <TColgp_HArray1OfDir2d.hxx>
#include <TColgp_HArray1OfVec2d.hxx>
#include <TColgp_HArray1OfLin2d.hxx>
#include <TColgp_HArray1OfCirc2d.hxx>
#include <Poly_HArray1OfTriangle.hxx>
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;
typedef instance<TColgp_HArray1OfDir> Dir;
typedef instance<TColgp_HArray1OfVec> Vec;
typedef instance<TColgp_HArray1OfXY> XY;
typedef instance<TColgp_HArray1OfPnt2d> Pnt2d;
typedef instance<TColgp_HArray1OfDir2d> Dir2d;
typedef instance<TColgp_HArray1OfVec2d> Vec2d;
typedef instance<TColgp_HArray1OfLin2d> Lin2d;
typedef instance<TColgp_HArray1OfCirc2d> Circ2d;
typedef instance<Poly_HArray1OfTriangle> Triangle;
};
#endif

View File

@@ -0,0 +1,38 @@
// 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

@@ -0,0 +1,55 @@
// 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 _ShapePersistent_HArray2_HeaderFile
#define _ShapePersistent_HArray2_HeaderFile
#include <StdLPersistent_HArray2.hxx>
#include <TColgp_HArray2OfXYZ.hxx>
#include <TColgp_HArray2OfPnt.hxx>
#include <TColgp_HArray2OfDir.hxx>
#include <TColgp_HArray2OfVec.hxx>
#include <TColgp_HArray2OfXY.hxx>
#include <TColgp_HArray2OfPnt2d.hxx>
#include <TColgp_HArray2OfDir2d.hxx>
#include <TColgp_HArray2OfVec2d.hxx>
#include <TColgp_HArray2OfLin2d.hxx>
#include <TColgp_HArray2OfCirc2d.hxx>
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;
typedef instance<TColgp_HArray2OfDir> Dir;
typedef instance<TColgp_HArray2OfVec> Vec;
typedef instance<TColgp_HArray2OfXY> XY;
typedef instance<TColgp_HArray2OfPnt2d> Pnt2d;
typedef instance<TColgp_HArray2OfDir2d> Dir2d;
typedef instance<TColgp_HArray2OfVec2d> Vec2d;
typedef instance<TColgp_HArray2OfLin2d> Lin2d;
typedef instance<TColgp_HArray2OfCirc2d> Circ2d;
};
#endif

View File

@@ -0,0 +1,52 @@
// 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_HSequence.hxx>
#include <StdObjMgt_ReadData.hxx>
template <class SequenceClass>
void ShapePersistent_HSequence::node<SequenceClass>::Read
(StdObjMgt_ReadData& theReadData)
{
theReadData >> myPreviuos >> myItem >> myNext;
}
template <class SequenceClass>
void ShapePersistent_HSequence::instance<SequenceClass>::Read
(StdObjMgt_ReadData& theReadData)
{
theReadData >> myFirst >> myLast >> mySize;
}
template <class SequenceClass>
Handle(SequenceClass)
ShapePersistent_HSequence::instance<SequenceClass>::Import() const
{
Handle(SequenceClass) aSequence = new SequenceClass;
for (Handle(Node) aNode = myFirst; aNode; aNode = aNode->Next())
aSequence->Append (aNode->Item());
return aSequence;
}
template class ShapePersistent_HSequence::node<TColgp_HSequenceOfXYZ>;
template class ShapePersistent_HSequence::node<TColgp_HSequenceOfPnt>;
template class ShapePersistent_HSequence::node<TColgp_HSequenceOfDir>;
template class ShapePersistent_HSequence::node<TColgp_HSequenceOfVec>;
template class ShapePersistent_HSequence::instance<TColgp_HSequenceOfXYZ>;
template class ShapePersistent_HSequence::instance<TColgp_HSequenceOfPnt>;
template class ShapePersistent_HSequence::instance<TColgp_HSequenceOfDir>;
template class ShapePersistent_HSequence::instance<TColgp_HSequenceOfVec>;

View File

@@ -0,0 +1,75 @@
// 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 _ShapePersistent_HSequence_HeaderFile
#define _ShapePersistent_HSequence_HeaderFile
#include <StdObjMgt_Persistent.hxx>
#include <StdObject_gp.hxx>
#include <TColgp_HSequenceOfXYZ.hxx>
#include <TColgp_HSequenceOfPnt.hxx>
#include <TColgp_HSequenceOfDir.hxx>
#include <TColgp_HSequenceOfVec.hxx>
class ShapePersistent_HSequence
{
template <class SequenceClass>
class node : public StdObjMgt_Persistent
{
public:
typedef typename SequenceClass::value_type ItemType;
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
const Handle(node)& Previuos() const { return myPreviuos; }
const Handle(node)& Next() const { return myNext; }
const ItemType& Item() const { return myItem; }
private:
Reference<node> myPreviuos;
Reference<node> myNext;
StdObject_gp::Object<ItemType> myItem;
};
template <class SequenceClass>
class instance : public StdObjMgt_Persistent
{
public:
typedef node<SequenceClass> Node;
public:
//! Read persistent data from a file.
Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
//! Import transient object from the persistent data.
Standard_EXPORT Handle(SequenceClass) Import() const;
private:
Reference<Node> myFirst;
Reference<Node> myLast;
Value<Standard_Integer> mySize;
};
public:
typedef instance<TColgp_HSequenceOfXYZ> XYZ;
typedef instance<TColgp_HSequenceOfPnt> Pnt;
typedef instance<TColgp_HSequenceOfDir> Dir;
typedef instance<TColgp_HSequenceOfVec> Vec;
};
#endif

View File

@@ -0,0 +1,83 @@
// 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_Poly.hxx>
#include <Poly_Polygon2D.hxx>
#include <Poly_Polygon3D.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <Poly_Triangulation.hxx>
Handle(Poly_Polygon2D) ShapePersistent_Poly::pPolygon2D::Import() const
{
if (myNodes.IsNull())
return NULL;
Handle(Poly_Polygon2D) aPolygon = new Poly_Polygon2D (*myNodes->Array());
aPolygon->Deflection (myDeflection);
return aPolygon;
}
Handle(Poly_Polygon3D) ShapePersistent_Poly::pPolygon3D::Import() const
{
if (myNodes.IsNull() || myParameters.IsNull())
return NULL;
Handle(Poly_Polygon3D) aPolygon = new Poly_Polygon3D (*myNodes->Array(),
*myParameters->Array());
aPolygon->Deflection (myDeflection);
return aPolygon;
}
Handle(Poly_PolygonOnTriangulation)
ShapePersistent_Poly::pPolygonOnTriangulation::Import() const
{
Handle(Poly_PolygonOnTriangulation) aPolygon;
if (myNodes)
{
if (myParameters)
aPolygon = new Poly_PolygonOnTriangulation (*myNodes->Array(),
*myParameters->Array());
else
aPolygon = new Poly_PolygonOnTriangulation (*myNodes->Array());
aPolygon->Deflection (myDeflection);
}
return aPolygon;
}
Handle(Poly_Triangulation) ShapePersistent_Poly::pTriangulation::Import() const
{
Handle(Poly_Triangulation) aTriangulation;
// Triangulation is not used
#if 0
if (myNodes && myTriangles)
{
if (myUVNodes)
aTriangulation = new Poly_Triangulation (*myNodes->Array(),
*myUVNodes->Array(),
*myTriangles->Array());
else
aTriangulation = new Poly_Triangulation (*myNodes->Array(),
*myTriangles->Array());
aTriangulation->Deflection (myDeflection);
}
#endif
return aTriangulation;
}

View File

@@ -0,0 +1,99 @@
// 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 _ShapePersistent_Poly_HeaderFile
#define _ShapePersistent_Poly_HeaderFile
#include <StdObjMgt_SharedObject.hxx>
#include <StdObjMgt_ReadData.hxx>
#include <StdLPersistent_HArray1.hxx>
#include <ShapePersistent_HArray1.hxx>
class Poly_Polygon2D;
class Poly_Polygon3D;
class Poly_PolygonOnTriangulation;
class Poly_Triangulation;
class ShapePersistent_Poly : private StdObjMgt_SharedObject
{
class pPolygon2D : public PersistentBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myDeflection >> myNodes; }
Handle(Poly_Polygon2D) Import() const;
private:
Value <Standard_Real> myDeflection;
Reference <ShapePersistent_HArray1::Pnt2d> myNodes;
};
class pPolygon3D : public PersistentBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myDeflection >> myNodes >> myParameters; }
Handle(Poly_Polygon3D) Import() const;
private:
Value <Standard_Real> myDeflection;
Reference <ShapePersistent_HArray1::Pnt> myNodes;
Reference <StdLPersistent_HArray1::Real> myParameters;
};
class pPolygonOnTriangulation : public PersistentBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myDeflection >> myNodes >> myParameters; }
Handle(Poly_PolygonOnTriangulation) Import() const;
private:
Value <Standard_Real> myDeflection;
Reference <StdLPersistent_HArray1::Integer> myNodes;
Reference <StdLPersistent_HArray1::Real> myParameters;
};
class pTriangulation : public PersistentBase
{
public:
inline void Read (StdObjMgt_ReadData& theReadData)
{ theReadData >> myDeflection >> myNodes >> myUVNodes >> myTriangles; }
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;
};
template <class Persistent, class Transient>
struct instance
: Delayed <DelayedBase<StdObjMgt_Persistent, Transient, Persistent> > {};
public:
typedef instance <pPolygon2D, Poly_Polygon2D> Polygon2D;
typedef instance <pPolygon3D, Poly_Polygon3D> Polygon3D;
typedef instance <pPolygonOnTriangulation,
Poly_PolygonOnTriangulation> PolygonOnTriangulation;
typedef instance <pTriangulation, Poly_Triangulation> Triangulation;
};
#endif

View File

@@ -0,0 +1,96 @@
// 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_TopoDS.hxx>
#include <BRep_Builder.hxx>
enum
{
ModifiedMask = 2,
CheckedMask = 4,
OrientableMask = 8,
ClosedMask = 16,
InfiniteMask = 32,
ConvexMask = 64
};
//=======================================================================
//function : Read
//purpose : Read persistent data from a file
//=======================================================================
void ShapePersistent_TopoDS::Shape::Read (StdObjMgt_ReadData& theReadData)
{
theReadData >> myEntry;
myShape.Read (theReadData);
}
void ShapePersistent_TopoDS::pTBase::setFlags
(const Handle(TopoDS_TShape)& theTShape) const
{
theTShape->Free (Standard_False); // Always frozen when coming from DB
theTShape->Modified (myFlags & ModifiedMask);
theTShape->Checked (myFlags & CheckedMask);
theTShape->Orientable (myFlags & OrientableMask);
theTShape->Closed (myFlags & ClosedMask);
theTShape->Infinite (myFlags & InfiniteMask);
theTShape->Convex (myFlags & ConvexMask);
}
static inline void AddShape
(TopoDS_Shape& theParent, const Handle(StdObjMgt_Persistent)& theRef)
{
Handle(ShapePersistent_TopoDS::Shape) aShape =
Handle(ShapePersistent_TopoDS::Shape)::DownCast (theRef);
if (aShape)
BRep_Builder().Add (theParent, aShape->Import());
}
static inline void AddShape
(TopoDS_Shape& theParent, const StdObject_Shape& theShape)
{
BRep_Builder().Add (theParent, theShape.Import());
}
template <class ShapesArray>
void ShapePersistent_TopoDS::pTBase::addShapesT
(TopoDS_Shape& theParent) const
{
Handle(ShapesArray) aShapes;
if (myShapes.Cast (aShapes))
{
typename ShapesArray::Iterator anIter (*aShapes->Array());
for (; anIter.More(); anIter.Next())
AddShape (theParent, anIter.Value());
}
}
template void ShapePersistent_TopoDS::pTBase::addShapesT
<StdLPersistent_HArray1::Persistent> (TopoDS_Shape& theParent) const;
template void ShapePersistent_TopoDS::pTBase::addShapesT
<StdPersistent_HArray1::Shape1> (TopoDS_Shape& theParent) const;
template <class Target>
Handle(TopoDS_TShape)
ShapePersistent_TopoDS::pTSimple<Target>::createTShape() const
{ return new Target; }
template class ShapePersistent_TopoDS::pTSimple<TopoDS_TWire>;
template class ShapePersistent_TopoDS::pTSimple<TopoDS_TShell>;
template class ShapePersistent_TopoDS::pTSimple<TopoDS_TSolid>;
template class ShapePersistent_TopoDS::pTSimple<TopoDS_TCompSolid>;
template class ShapePersistent_TopoDS::pTSimple<TopoDS_TCompound>;

View File

@@ -0,0 +1,115 @@
// 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 _ShapePersistent_TopoDS_HeaderFile
#define _ShapePersistent_TopoDS_HeaderFile
#include <StdPersistent_TopoDS.hxx>
#include <StdPersistent_HArray1.hxx>
#include <StdLPersistent_HArray1.hxx>
#include <StdObject_Shape.hxx>
#include <TopoDS_TWire.hxx>
#include <TopoDS_TShell.hxx>
#include <TopoDS_TSolid.hxx>
#include <TopoDS_TCompSolid.hxx>
#include <TopoDS_TCompound.hxx>
class ShapePersistent_TopoDS : public StdPersistent_TopoDS
{
public:
class Shape : public StdObjMgt_Persistent
{
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;
};
protected:
class pTBase : public pTShape
{
public:
inline Handle(TopoDS_TShape) Import() const
{
Handle(TopoDS_TShape) aTShape = createTShape();
TopoDS_Shape aWrapperShape;
aWrapperShape.TShape (aTShape);
addShapes (aWrapperShape);
setFlags (aTShape);
return aTShape;
}
private:
virtual Handle(TopoDS_TShape) createTShape() const = 0;
virtual void addShapes (TopoDS_Shape& theParent) const = 0;
void setFlags (const Handle(TopoDS_TShape)& theTShape) const;
protected:
template <class ShapesArray>
void addShapesT (TopoDS_Shape& theParent) const;
};
private:
template <class Target>
class pTSimple : public pTBase
{ virtual Handle(TopoDS_TShape) createTShape() const; };
template <class Persistent, class ShapesArray>
class pTObject : public Persistent
{
virtual void addShapes (TopoDS_Shape& theParent) const
{
pTBase::addShapesT<ShapesArray> (theParent);
}
};
template <class Persistent, class ShapesArray>
struct tObjectT : Delayed <DelayedBase<TShape, TopoDS_TShape, pTBase>,
pTObject<Persistent, ShapesArray> > {};
protected:
template <class Persistent>
struct tObject : tObjectT<Persistent, StdLPersistent_HArray1::Persistent> {};
template <class Persistent>
struct tObject1 : tObjectT<Persistent, StdPersistent_HArray1::Shape1> {};
public:
typedef tObject <pTSimple<TopoDS_TWire> > TWire;
typedef tObject <pTSimple<TopoDS_TShell> > TShell;
typedef tObject <pTSimple<TopoDS_TSolid> > TSolid;
typedef tObject <pTSimple<TopoDS_TCompSolid> > TCompSolid;
typedef tObject <pTSimple<TopoDS_TCompound> > TCompound;
typedef tObject1 <pTSimple<TopoDS_TWire> > TWire1;
typedef tObject1 <pTSimple<TopoDS_TShell> > TShell1;
typedef tObject1 <pTSimple<TopoDS_TSolid> > TSolid1;
typedef tObject1 <pTSimple<TopoDS_TCompSolid> > TCompSolid1;
typedef tObject1 <pTSimple<TopoDS_TCompound> > TCompound1;
};
#endif