Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:56:59

0001 // Copyright (c) 2021 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _BinTools_ShapeReader_HeaderFile
0015 #define _BinTools_ShapeReader_HeaderFile
0016 
0017 #include <BinTools_ShapeSetBase.hxx>
0018 #include <BinTools_IStream.hxx>
0019 #include <NCollection_DataMap.hxx>
0020 #include <TopLoc_Location.hxx>
0021 #include <TopoDS_Shape.hxx>
0022 
0023 class Geom_Curve;
0024 class Geom_Surface;
0025 class Geom2d_Curve;
0026 class Poly_Polygon3D;
0027 class Poly_PolygonOnTriangulation;
0028 class Poly_Triangulation;
0029 
0030 //! Reads topology from IStream in binary format without grouping of objects by types
0031 //! and using relative positions in a file as references.
0032 class BinTools_ShapeReader : public BinTools_ShapeSetBase
0033 {
0034 public:
0035   DEFINE_STANDARD_ALLOC
0036 
0037   //! Initializes a shape reader.
0038   Standard_EXPORT BinTools_ShapeReader();
0039 
0040   Standard_EXPORT ~BinTools_ShapeReader() override;
0041 
0042   //! Clears the content of the set.
0043   Standard_EXPORT void Clear() override;
0044 
0045   //! Reads the shape from stream using previously restored shapes and objects by references.
0046   Standard_EXPORT void Read(Standard_IStream& theStream, TopoDS_Shape& theShape) override;
0047 
0048   //! Reads location from the stream.
0049   Standard_EXPORT const TopLoc_Location* ReadLocation(BinTools_IStream& theStream);
0050 
0051 private:
0052   //! Reads the shape from stream using previously restored shapes and objects by references.
0053   TopoDS_Shape ReadShape(BinTools_IStream& theStream);
0054   //! Reads curve from the stream.
0055   occ::handle<Geom_Curve> ReadCurve(BinTools_IStream& theStream);
0056   //! Reads curve2d from the stream.
0057   occ::handle<Geom2d_Curve> ReadCurve2d(BinTools_IStream& theStream);
0058   //! Reads surface from the stream.
0059   occ::handle<Geom_Surface> ReadSurface(BinTools_IStream& theStream);
0060   //! Reads ploygon3d from the stream.
0061   occ::handle<Poly_Polygon3D> ReadPolygon3d(BinTools_IStream& theStream);
0062   //! Reads polygon on triangulation from the stream.
0063   occ::handle<Poly_PolygonOnTriangulation> ReadPolygon(BinTools_IStream& theStream);
0064   //! Reads triangulation from the stream.
0065   occ::handle<Poly_Triangulation> ReadTriangulation(BinTools_IStream& theStream);
0066 
0067   /// position of the shape previously restored
0068   NCollection_DataMap<uint64_t, TopoDS_Shape>                             myShapePos;
0069   NCollection_DataMap<uint64_t, TopLoc_Location>                          myLocationPos;
0070   NCollection_DataMap<uint64_t, occ::handle<Geom_Curve>>                  myCurvePos;
0071   NCollection_DataMap<uint64_t, occ::handle<Geom2d_Curve>>                myCurve2dPos;
0072   NCollection_DataMap<uint64_t, occ::handle<Geom_Surface>>                mySurfacePos;
0073   NCollection_DataMap<uint64_t, occ::handle<Poly_Polygon3D>>              myPolygon3dPos;
0074   NCollection_DataMap<uint64_t, occ::handle<Poly_PolygonOnTriangulation>> myPolygonPos;
0075   NCollection_DataMap<uint64_t, occ::handle<Poly_Triangulation>>          myTriangulationPos;
0076 };
0077 
0078 #endif // _BinTools_ShapeReader_HeaderFile