1 // Copyright (c) 2021 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.
14 #ifndef _BinTools_ShapeReader_HeaderFile
15 #define _BinTools_ShapeReader_HeaderFile
17 #include <BinTools_ShapeSetBase.hxx>
18 #include <BinTools_IStream.hxx>
19 #include <NCollection_DataMap.hxx>
20 #include <TopLoc_Location.hxx>
21 #include <TopoDS_Shape.hxx>
27 class Poly_PolygonOnTriangulation;
28 class Poly_Triangulation;
30 //! Reads topology from IStream in binary format without grouping of objects by types
31 //! and using relative positions in a file as references.
32 class BinTools_ShapeReader : public BinTools_ShapeSetBase
38 //! Initializes a shape reader.
39 Standard_EXPORT BinTools_ShapeReader();
41 Standard_EXPORT virtual ~BinTools_ShapeReader();
43 //! Clears the content of the set.
44 Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
46 //! Reads the shape from stream using previously restored shapes and objects by references.
47 Standard_EXPORT void Read (Standard_IStream& theStream, TopoDS_Shape& theShape) Standard_OVERRIDE;
49 //! Reads location from the stream.
50 Standard_EXPORT const TopLoc_Location* ReadLocation (BinTools_IStream& theStream);
53 //! Reads the shape from stream using previously restored shapes and objects by references.
54 TopoDS_Shape ReadShape (BinTools_IStream& theStream);
55 //! Reads curve from the stream.
56 Handle(Geom_Curve) ReadCurve (BinTools_IStream& theStream);
57 //! Reads curve2d from the stream.
58 Handle(Geom2d_Curve) ReadCurve2d (BinTools_IStream& theStream);
59 //! Reads surface from the stream.
60 Handle(Geom_Surface) ReadSurface (BinTools_IStream& theStream);
61 //! Reads ploygon3d from the stream.
62 Handle(Poly_Polygon3D) ReadPolygon3d (BinTools_IStream& theStream);
63 //! Reads polygon on triangulation from the stream.
64 Handle(Poly_PolygonOnTriangulation) ReadPolygon (BinTools_IStream& theStream);
65 //! Reads triangulation from the stream.
66 Handle(Poly_Triangulation) ReadTriangulation (BinTools_IStream& theStream);
68 /// position of the shape previously restored
69 NCollection_DataMap<uint64_t, TopoDS_Shape> myShapePos;
70 NCollection_DataMap<uint64_t, TopLoc_Location> myLocationPos;
71 NCollection_DataMap<uint64_t, Handle(Geom_Curve)> myCurvePos;
72 NCollection_DataMap<uint64_t, Handle(Geom2d_Curve)> myCurve2dPos;
73 NCollection_DataMap<uint64_t, Handle(Geom_Surface)> mySurfacePos;
74 NCollection_DataMap<uint64_t, Handle(Poly_Polygon3D)> myPolygon3dPos;
75 NCollection_DataMap<uint64_t, Handle(Poly_PolygonOnTriangulation)> myPolygonPos;
76 NCollection_DataMap<uint64_t, Handle(Poly_Triangulation)> myTriangulationPos;
79 #endif // _BinTools_ShapeReader_HeaderFile