1 /* 2 Open Asset Import Library (assimp) 3 ---------------------------------------------------------------------- 4 5 Copyright (c) 2006-2016, assimp team 6 All rights reserved. 7 8 Redistribution and use of this software in source and binary forms, 9 with or without modification, are permitted provided that the 10 following conditions are met: 11 12 * Redistributions of source code must retain the above 13 copyright notice, this list of conditions and the 14 following disclaimer. 15 16 * Redistributions in binary form must reproduce the above 17 copyright notice, this list of conditions and the 18 following disclaimer in the documentation and/or other 19 materials provided with the distribution. 20 21 * Neither the name of the assimp team, nor the names of its 22 contributors may be used to endorse or promote products 23 derived from this software without specific prior 24 written permission of the assimp team. 25 26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 38 ---------------------------------------------------------------------- 39 */ 40 41 /** @file DXFLoader.h 42 * @brief Declaration of the .dxf importer class. 43 */ 44 #ifndef AI_DXFLOADER_H_INCLUDED 45 #define AI_DXFLOADER_H_INCLUDED 46 47 #include "BaseImporter.h" 48 49 namespace Assimp { 50 namespace DXF { 51 52 class LineReader; 53 struct FileData; 54 struct PolyLine; 55 struct Block; 56 struct InsertBlock; 57 58 typedef std::map<std::string, const DXF::Block*> BlockMap; 59 } 60 61 62 // --------------------------------------------------------------------------- 63 /** DXF importer implementation. 64 * 65 */ 66 class DXFImporter : public BaseImporter 67 { 68 public: 69 DXFImporter(); 70 ~DXFImporter(); 71 72 73 74 public: 75 76 // ------------------------------------------------------------------- 77 /** Returns whether the class can handle the format of the given file. 78 * See BaseImporter::CanRead() for details. */ 79 bool CanRead( const std::string& pFile, IOSystem* pIOHandler, 80 bool checkSig) const; 81 82 protected: 83 84 // ------------------------------------------------------------------- 85 /** Return importer meta information. 86 * See #BaseImporter::GetInfo for the details*/ 87 const aiImporterDesc* GetInfo () const; 88 89 // ------------------------------------------------------------------- 90 /** Imports the given file into the given scene structure. 91 * See BaseImporter::InternReadFile() for details */ 92 void InternReadFile( const std::string& pFile, 93 aiScene* pScene, 94 IOSystem* pIOHandler); 95 96 private: 97 98 // ----------------------------------------------------- 99 void SkipSection(DXF::LineReader& reader); 100 101 // ----------------------------------------------------- 102 void ParseHeader(DXF::LineReader& reader, 103 DXF::FileData& output); 104 105 // ----------------------------------------------------- 106 void ParseEntities(DXF::LineReader& reader, 107 DXF::FileData& output); 108 109 // ----------------------------------------------------- 110 void ParseBlocks(DXF::LineReader& reader, 111 DXF::FileData& output); 112 113 // ----------------------------------------------------- 114 void ParseBlock(DXF::LineReader& reader, 115 DXF::FileData& output); 116 117 // ----------------------------------------------------- 118 void ParseInsertion(DXF::LineReader& reader, 119 DXF::FileData& output); 120 121 // ----------------------------------------------------- 122 void ParsePolyLine(DXF::LineReader& reader, 123 DXF::FileData& output); 124 125 // ----------------------------------------------------- 126 void ParsePolyLineVertex(DXF::LineReader& reader, 127 DXF::PolyLine& line); 128 129 // ----------------------------------------------------- 130 void Parse3DFace(DXF::LineReader& reader, 131 DXF::FileData& output); 132 133 // ----------------------------------------------------- 134 void ConvertMeshes(aiScene* pScene, 135 DXF::FileData& output); 136 137 // ----------------------------------------------------- 138 void GenerateHierarchy(aiScene* pScene, 139 DXF::FileData& output); 140 141 // ----------------------------------------------------- 142 void GenerateMaterials(aiScene* pScene, 143 DXF::FileData& output); 144 145 // ----------------------------------------------------- 146 void ExpandBlockReferences(DXF::Block& bl, 147 const DXF::BlockMap& blocks_by_name); 148 }; 149 150 } // end of namespace Assimp 151 152 #endif // AI_3DSIMPORTER_H_INC 153