|
|
|||
File indexing completed on 2026-09-19 09:27:07
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_ShapeSetBase_HeaderFile 0015 #define _BinTools_ShapeSetBase_HeaderFile 0016 0017 #include <Standard.hxx> 0018 #include <Standard_DefineAlloc.hxx> 0019 #include <Standard_Handle.hxx> 0020 0021 #include <Standard_OStream.hxx> 0022 #include <Standard_IStream.hxx> 0023 #include <Message_ProgressRange.hxx> 0024 #include <BinTools_FormatVersion.hxx> 0025 0026 class TopoDS_Shape; 0027 class gp_Pnt; 0028 0029 //! Writes to the stream a gp_Pnt data 0030 Standard_OStream& operator<<(Standard_OStream& OS, const gp_Pnt& P); 0031 0032 //! A base class for all readers/writers of TopoDS_Shape into/from stream. 0033 class BinTools_ShapeSetBase 0034 { 0035 public: 0036 DEFINE_STANDARD_ALLOC 0037 0038 //! A default constructor. 0039 Standard_EXPORT BinTools_ShapeSetBase(); 0040 0041 Standard_EXPORT virtual ~BinTools_ShapeSetBase(); 0042 0043 //! Return true if shape should be stored with triangles. 0044 bool IsWithTriangles() const { return myWithTriangles; } 0045 0046 //! Return true if shape should be stored triangulation with normals. 0047 bool IsWithNormals() const { return myWithNormals; } 0048 0049 //! Define if shape will be stored with triangles. 0050 //! Ignored (always written) if face defines only triangulation (no surface). 0051 void SetWithTriangles(const bool theWithTriangles) { myWithTriangles = theWithTriangles; } 0052 0053 //! Define if shape will be stored triangulation with normals. 0054 //! Ignored (always written) if face defines only triangulation (no surface). 0055 void SetWithNormals(const bool theWithNormals) { myWithNormals = theWithNormals; } 0056 0057 //! Sets the BinTools_FormatVersion. 0058 Standard_EXPORT void SetFormatNb(const int theFormatNb); 0059 0060 //! Returns the BinTools_FormatVersion. 0061 Standard_EXPORT int FormatNb() const { return myFormatNb; } 0062 0063 //! Clears the content of the set. 0064 Standard_EXPORT virtual void Clear() {} 0065 0066 //! Writes the content of me on the stream <OS> in binary 0067 //! format that can be read back by Read. 0068 //! 0069 //! Writes the locations. 0070 //! 0071 //! Writes the geometry calling WriteGeometry. 0072 //! 0073 //! Dumps the shapes from last to first. 0074 //! For each shape: 0075 //! Write the type. 0076 //! calls WriteGeometry(S). 0077 //! Write the flags, the subshapes. 0078 Standard_EXPORT virtual void Write( 0079 Standard_OStream& /*OS*/, 0080 const Message_ProgressRange& /*theRange*/ = Message_ProgressRange()) 0081 { 0082 } 0083 0084 //! Reads the content of me from the binary stream <IS>. me 0085 //! is first cleared. 0086 //! 0087 //! Reads the locations. 0088 //! 0089 //! Reads the geometry calling ReadGeometry. 0090 //! 0091 //! Reads the shapes. 0092 //! For each shape 0093 //! Reads the type. 0094 //! calls ReadGeometry(T,S). 0095 //! Reads the flag, the subshapes. 0096 Standard_EXPORT virtual void Read( 0097 Standard_IStream& /*IS*/, 0098 const Message_ProgressRange& /*theRange*/ = Message_ProgressRange()) 0099 { 0100 } 0101 0102 //! Writes on <OS> the shape <S>. Writes the 0103 //! orientation, the index of the TShape and the index 0104 //! of the Location. 0105 Standard_EXPORT virtual void Write(const TopoDS_Shape& /*theShape*/, 0106 Standard_OStream& /*theStream*/) 0107 { 0108 } 0109 0110 //! An empty virtual method for redefinition in shape-reader. 0111 Standard_EXPORT virtual void Read(Standard_IStream& /*theStream*/, TopoDS_Shape& /*theShape*/) {} 0112 0113 static const char* const THE_ASCII_VERSIONS[BinTools_FormatVersion_UPPER + 1]; 0114 0115 private: 0116 int myFormatNb; 0117 bool myWithTriangles; 0118 bool myWithNormals; 0119 }; 0120 0121 #endif // _BinTools_ShapeSet_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|