Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:00

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 
0036   DEFINE_STANDARD_ALLOC
0037   
0038   //! Initializes a shape reader.
0039   Standard_EXPORT BinTools_ShapeReader();
0040   
0041   Standard_EXPORT virtual ~BinTools_ShapeReader();
0042 
0043   //! Clears the content of the set.
0044   Standard_EXPORT virtual void Clear() Standard_OVERRIDE;
0045   
0046   //! Reads the shape from stream using previously restored shapes and objects by references.
0047   Standard_EXPORT void Read (Standard_IStream& theStream, TopoDS_Shape& theShape) Standard_OVERRIDE;
0048 
0049   //! Reads location from the stream.
0050   Standard_EXPORT const TopLoc_Location* ReadLocation (BinTools_IStream& theStream);
0051 
0052 private:
0053   //! Reads the shape from stream using previously restored shapes and objects by references.
0054   TopoDS_Shape ReadShape (BinTools_IStream& theStream);
0055   //! Reads curve from the stream.
0056   Handle(Geom_Curve) ReadCurve (BinTools_IStream& theStream);
0057   //! Reads curve2d from the stream.
0058   Handle(Geom2d_Curve) ReadCurve2d (BinTools_IStream& theStream);
0059   //! Reads surface from the stream.
0060   Handle(Geom_Surface) ReadSurface (BinTools_IStream& theStream);
0061   //! Reads ploygon3d from the stream.
0062   Handle(Poly_Polygon3D) ReadPolygon3d (BinTools_IStream& theStream);
0063   //! Reads polygon on triangulation from the stream.
0064   Handle(Poly_PolygonOnTriangulation) ReadPolygon (BinTools_IStream& theStream);
0065   //! Reads triangulation from the stream.
0066   Handle(Poly_Triangulation) ReadTriangulation (BinTools_IStream& theStream);
0067 
0068   /// position of the shape previously restored
0069   NCollection_DataMap<uint64_t, TopoDS_Shape> myShapePos;
0070   NCollection_DataMap<uint64_t, TopLoc_Location> myLocationPos;
0071   NCollection_DataMap<uint64_t, Handle(Geom_Curve)> myCurvePos;
0072   NCollection_DataMap<uint64_t, Handle(Geom2d_Curve)> myCurve2dPos;
0073   NCollection_DataMap<uint64_t, Handle(Geom_Surface)> mySurfacePos;
0074   NCollection_DataMap<uint64_t, Handle(Poly_Polygon3D)> myPolygon3dPos;
0075   NCollection_DataMap<uint64_t, Handle(Poly_PolygonOnTriangulation)> myPolygonPos;
0076   NCollection_DataMap<uint64_t, Handle(Poly_Triangulation)> myTriangulationPos;
0077 };
0078 
0079 #endif // _BinTools_ShapeReader_HeaderFile