1 // Copyright (c) 2015 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #ifndef _ShapePersistent_BRep_HeaderFile
16 #define _ShapePersistent_BRep_HeaderFile
18 #include <ShapePersistent_TopoDS.hxx>
19 #include <ShapePersistent_Geom.hxx>
20 #include <ShapePersistent_Geom2d.hxx>
21 #include <ShapePersistent_Poly.hxx>
22 #include <StdObject_Location.hxx>
23 #include <StdObject_gp_Vectors.hxx>
25 #include <BRep_ListOfPointRepresentation.hxx>
26 #include <BRep_ListOfCurveRepresentation.hxx>
29 #include <gp_Pnt2d.hxx>
31 class BRep_PointRepresentation;
32 class BRep_CurveRepresentation;
35 class ShapePersistent_BRep : public ShapePersistent_TopoDS
38 class PointRepresentation : public StdObjMgt_Persistent
41 //! Read persistent data from a file.
42 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
44 //! Import transient object from the persistent data.
45 Standard_EXPORT void Import (BRep_ListOfPointRepresentation& thePoints)
49 virtual Handle(BRep_PointRepresentation) import() const;
52 StdObject_Location myLocation;
53 Standard_Real myParameter;
56 Handle(PointRepresentation) myNext;
59 class PointOnCurve : public PointRepresentation
62 virtual void Read (StdObjMgt_ReadData& theReadData);
63 virtual Handle(BRep_PointRepresentation) import() const;
66 Handle(ShapePersistent_Geom::Curve) myCurve;
69 class PointsOnSurface : public PointRepresentation
72 virtual void Read (StdObjMgt_ReadData& theReadData);
75 Handle(ShapePersistent_Geom::Surface) mySurface;
78 class PointOnCurveOnSurface : public PointsOnSurface
81 virtual void Read (StdObjMgt_ReadData& theReadData);
82 virtual Handle(BRep_PointRepresentation) import() const;
85 Handle(ShapePersistent_Geom2d::Curve) myPCurve;
88 class PointOnSurface : public PointsOnSurface
91 virtual void Read (StdObjMgt_ReadData& theReadData);
92 virtual Handle(BRep_PointRepresentation) import() const;
95 Standard_Real myParameter2;
98 class CurveRepresentation : public StdObjMgt_Persistent
101 //! Read persistent data from a file.
102 Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
104 //! Import transient object from the persistent data.
105 Standard_EXPORT void Import (BRep_ListOfCurveRepresentation& theCurves)
109 virtual Handle(BRep_CurveRepresentation) import() const;
112 StdObject_Location myLocation;
115 Handle(CurveRepresentation) myNext;
118 class GCurve : public CurveRepresentation
121 virtual void Read (StdObjMgt_ReadData& theReadData);
124 Standard_Real myFirst;
125 Standard_Real myLast;
128 class Curve3D : public GCurve
131 virtual void Read (StdObjMgt_ReadData& theReadData);
132 virtual Handle(BRep_CurveRepresentation) import() const;
135 Handle(ShapePersistent_Geom::Curve) myCurve3D;
138 class CurveOnSurface : public GCurve
141 virtual void Read (StdObjMgt_ReadData& theReadData);
142 virtual Handle(BRep_CurveRepresentation) import() const;
145 Handle(ShapePersistent_Geom2d::Curve) myPCurve;
146 Handle(ShapePersistent_Geom::Surface) mySurface;
151 class CurveOnClosedSurface : public CurveOnSurface
154 virtual void Read (StdObjMgt_ReadData& theReadData);
155 virtual Handle(BRep_CurveRepresentation) import() const;
158 Handle(ShapePersistent_Geom2d::Curve) myPCurve2;
159 Standard_Integer myContinuity;
164 class Polygon3D : public CurveRepresentation
167 virtual void Read (StdObjMgt_ReadData& theReadData);
168 virtual Handle(BRep_CurveRepresentation) import() const;
171 Handle(ShapePersistent_Poly::Polygon3D) myPolygon3D;
174 class PolygonOnTriangulation : public CurveRepresentation
177 virtual void Read (StdObjMgt_ReadData& theReadData);
178 virtual Handle(BRep_CurveRepresentation) import() const;
181 Handle(ShapePersistent_Poly::PolygonOnTriangulation) myPolygon;
182 Handle(ShapePersistent_Poly::Triangulation) myTriangulation;
185 class PolygonOnClosedTriangulation : public PolygonOnTriangulation
188 virtual void Read (StdObjMgt_ReadData& theReadData);
189 virtual Handle(BRep_CurveRepresentation) import() const;
192 Handle(ShapePersistent_Poly::PolygonOnTriangulation) myPolygon2;
195 class PolygonOnSurface : public CurveRepresentation
198 virtual void Read (StdObjMgt_ReadData& theReadData);
199 virtual Handle(BRep_CurveRepresentation) import() const;
202 Handle(ShapePersistent_Poly::Polygon2D) myPolygon2D;
203 Handle(ShapePersistent_Geom::Surface) mySurface;
206 class PolygonOnClosedSurface : public PolygonOnSurface
209 virtual void Read (StdObjMgt_ReadData& theReadData);
210 virtual Handle(BRep_CurveRepresentation) import() const;
213 Handle(ShapePersistent_Poly::Polygon2D) myPolygon2;
216 class CurveOn2Surfaces : public CurveRepresentation
219 virtual void Read (StdObjMgt_ReadData& theReadData);
220 virtual Handle(BRep_CurveRepresentation) import() const;
223 Handle(ShapePersistent_Geom::Surface) mySurface;
224 Handle(ShapePersistent_Geom::Surface) mySurface2;
225 StdObject_Location myLocation2;
226 Standard_Integer myContinuity;
230 class pTVertex : public pTBase
233 inline void Read (StdObjMgt_ReadData& theReadData)
235 pTBase::Read (theReadData);
236 theReadData >> myTolerance >> myPnt >> myPoints;
240 virtual Handle(TopoDS_TShape) createTShape() const;
243 Standard_Real myTolerance;
245 Handle(PointRepresentation) myPoints;
248 class pTEdge : public pTBase
251 inline void Read (StdObjMgt_ReadData& theReadData)
253 pTBase::Read (theReadData);
254 theReadData >> myTolerance >> myFlags >> myCurves;
258 virtual Handle(TopoDS_TShape) createTShape() const;
261 Standard_Real myTolerance;
262 Standard_Integer myFlags;
263 Handle(CurveRepresentation) myCurves;
266 class pTFace : public pTBase
269 inline void Read (StdObjMgt_ReadData& theReadData)
271 pTBase::Read (theReadData);
272 theReadData >> mySurface >> myTriangulation >> myLocation;
273 theReadData >> myTolerance >> myNaturalRestriction;
277 virtual Handle(TopoDS_TShape) createTShape() const;
280 Handle(ShapePersistent_Geom::Surface) mySurface;
281 Handle(ShapePersistent_Poly::Triangulation) myTriangulation;
282 StdObject_Location myLocation;
283 Standard_Real myTolerance;
284 Standard_Boolean myNaturalRestriction;
288 typedef tObject <pTVertex> TVertex;
289 typedef tObject <pTEdge> TEdge;
290 typedef tObject <pTFace> TFace;
292 typedef tObject1 <pTVertex> TVertex1;
293 typedef tObject1 <pTEdge> TEdge1;
294 typedef tObject1 <pTFace> TFace1;