1 /****************************************************************************** 2 ** libDXFrw - Library to read/write DXF files (ascii & binary) ** 3 ** ** 4 ** Copyright (C) 2011-2015 José F. Soriano, rallazz@gmail.com ** 5 ** ** 6 ** This library is free software, licensed under the terms of the GNU ** 7 ** General Public License as published by the Free Software Foundation, ** 8 ** either version 2 of the License, or (at your option) any later version. ** 9 ** You should have received a copy of the GNU General Public License ** 10 ** along with this program. If not, see <http://www.gnu.org/licenses/>. ** 11 ******************************************************************************/ 12 13 #ifndef DWGREADER21_H 14 #define DWGREADER21_H 15 16 #include <map> 17 #include <list> 18 #include "drw_textcodec.h" 19 #include "dwgbuffer.h" 20 #include "dwgreader.h" 21 22 //reader for AC1021 aka v2007, chapter 5 23 class dwgReader21 : public dwgReader 24 { 25 public: dwgReader21(std::ifstream * stream,dwgR * p)26 dwgReader21( std::ifstream *stream, dwgR *p ): dwgReader( stream, p ) 27 { 28 objData = nullptr; 29 dataSize = 0; 30 } ~dwgReader21()31 virtual ~dwgReader21() 32 { 33 if ( objData ) 34 delete[] objData; 35 } 36 bool readMetaData(); 37 bool readFileHeader(); 38 bool readDwgHeader( DRW_Header &hdr ); 39 bool readDwgClasses(); 40 bool readDwgHandles(); 41 bool readDwgTables( DRW_Header &hdr ); 42 bool readDwgBlocks( DRW_Interface &intfa ); readDwgEntities(DRW_Interface & intfa)43 virtual bool readDwgEntities( DRW_Interface &intfa ) 44 { 45 bool ret = true; 46 dwgBuffer dataBuf( objData, dataSize, &decoder ); 47 ret = dwgReader::readDwgEntities( intfa, &dataBuf ); 48 return ret; 49 } readDwgObjects(DRW_Interface & intfa)50 virtual bool readDwgObjects( DRW_Interface &intfa ) 51 { 52 bool ret = true; 53 dwgBuffer dataBuf( objData, dataSize, &decoder ); 54 ret = dwgReader::readDwgObjects( intfa, &dataBuf ); 55 return ret; 56 } 57 //bool readDwgEntity(objHandle& obj, DRW_Interface& intfa){ 58 // return false; 59 //} 60 61 private: 62 bool parseSysPage( duint64 sizeCompressed, duint64 sizeUncompressed, duint64 correctionFactor, duint64 offset, duint8 *decompData ); 63 bool parseDataPage( dwgSectionInfo si, duint8 *dData ); 64 65 duint8 *objData = nullptr; 66 duint64 dataSize; 67 68 }; 69 70 #endif // DWGREADER21_H 71