| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | #ifndef DXF_SECTION |
|---|
| 20 | #define DXF_SECTION 1 |
|---|
| 21 | |
|---|
| 22 | #include "dxfDataTypes.h" |
|---|
| 23 | #include "dxfSectionBase.h" |
|---|
| 24 | #include "dxfTable.h" |
|---|
| 25 | #include "codeValue.h" |
|---|
| 26 | #include "scene.h" |
|---|
| 27 | #include "dxfEntity.h" |
|---|
| 28 | #include "dxfBlock.h" |
|---|
| 29 | |
|---|
| 30 | #include <map> |
|---|
| 31 | #include <vector> |
|---|
| 32 | #include <iostream> |
|---|
| 33 | #include <string> |
|---|
| 34 | |
|---|
| 35 | class dxfFile; |
|---|
| 36 | |
|---|
| 37 | |
|---|
| 38 | class dxfSection : public dxfSectionBase |
|---|
| 39 | { |
|---|
| 40 | public: |
|---|
| 41 | dxfSection() {} |
|---|
| 42 | virtual ~dxfSection() {} |
|---|
| 43 | }; |
|---|
| 44 | |
|---|
| 45 | class dxfHeader : public dxfSection |
|---|
| 46 | { |
|---|
| 47 | public: |
|---|
| 48 | dxfHeader() : _inVariable(false) {} |
|---|
| 49 | virtual ~dxfHeader() {} |
|---|
| 50 | virtual void assign(dxfFile* dxf, codeValue& cv); |
|---|
| 51 | VariableList& getVariable(std::string inVar) { return _variables[inVar]; } |
|---|
| 52 | protected: |
|---|
| 53 | std::map<std::string, VariableList> _variables; |
|---|
| 54 | bool _inVariable; |
|---|
| 55 | std::string _currentVariable; |
|---|
| 56 | }; |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | class dxfTables : public dxfSection |
|---|
| 60 | { |
|---|
| 61 | public: |
|---|
| 62 | dxfTables() : _inLayerTable(false) {} |
|---|
| 63 | virtual ~dxfTables() {} |
|---|
| 64 | virtual void assign(dxfFile* dxf, codeValue& cv); |
|---|
| 65 | dxfLayerTable* getOrCreateLayerTable() |
|---|
| 66 | { |
|---|
| 67 | if (!_layerTable.get()) |
|---|
| 68 | _layerTable = new dxfLayerTable; |
|---|
| 69 | return _layerTable.get(); |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | protected: |
|---|
| 73 | bool _inLayerTable; |
|---|
| 74 | osg::ref_ptr<dxfLayerTable> _layerTable; |
|---|
| 75 | std::vector<osg::ref_ptr<dxfTable> > _others; |
|---|
| 76 | osg::ref_ptr<dxfTable> _currentTable; |
|---|
| 77 | }; |
|---|
| 78 | |
|---|
| 79 | class dxfEntities : public dxfSection |
|---|
| 80 | { |
|---|
| 81 | public: |
|---|
| 82 | dxfEntities() : _currentEntity(NULL) {} |
|---|
| 83 | virtual ~dxfEntities() {} |
|---|
| 84 | virtual void assign(dxfFile* dxf, codeValue& cv); |
|---|
| 85 | virtual void drawScene(scene* sc); |
|---|
| 86 | |
|---|
| 87 | protected: |
|---|
| 88 | dxfEntity* _currentEntity; |
|---|
| 89 | EntityList _entityList; |
|---|
| 90 | |
|---|
| 91 | }; |
|---|
| 92 | |
|---|
| 93 | class dxfBlocks : public dxfSection |
|---|
| 94 | { |
|---|
| 95 | public: |
|---|
| 96 | dxfBlocks() : _currentBlock(NULL) {} |
|---|
| 97 | virtual ~dxfBlocks() {} |
|---|
| 98 | virtual void assign(dxfFile* dxf, codeValue& cv); |
|---|
| 99 | dxfBlock* findBlock(std::string s); |
|---|
| 100 | |
|---|
| 101 | protected: |
|---|
| 102 | dxfBlock* _currentBlock; |
|---|
| 103 | std::map<std::string, dxfBlock*> _blockNameList; |
|---|
| 104 | std::vector<osg::ref_ptr<dxfBlock> > _blockList; |
|---|
| 105 | }; |
|---|
| 106 | |
|---|
| 107 | #endif |
|---|