root/OpenSceneGraph/trunk/src/osgPlugins/dxf/dxfSection.h @ 13041

Revision 13041, 2.6 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* dxfReader for OpenSceneGraph  Copyright (C) 2005 by GraphArchitecture ( grapharchitecture.com )
2 * Programmed by Paul de Repentigny <pdr@grapharchitecture.com>
3 *
4 * OpenSceneGraph is (C) 2004 Robert Osfield
5 *
6 * This library is provided as-is, without support of any kind.
7 *
8 * Read DXF docs or OSG docs for any related questions.
9 *
10 * You may contact the author if you have suggestions/corrections/enhancements.
11 */
12
13/**
14    Classes used to parse each section of a DXF file. Not all
15    types of section has been defined here, just the ones
16    I found of interest, ie HEADER, TABLES, BLOCKS, and ENTITIES.
17    Yet to be implemented: CLASSES, OBJECTS, and THUMBNAILIMAGE.
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
35class dxfFile;
36
37
38class dxfSection : public dxfSectionBase
39{
40public:
41    dxfSection() {}
42    virtual ~dxfSection() {}
43};
44
45class dxfHeader : public dxfSection
46{
47public:
48    dxfHeader() : _inVariable(false) {}
49    virtual ~dxfHeader() {}
50    virtual void assign(dxfFile* dxf, codeValue& cv);
51    VariableList& getVariable(std::string inVar) { return _variables[inVar]; }
52protected:
53    std::map<std::string, VariableList> _variables;
54    bool _inVariable;
55    std::string _currentVariable;
56};
57
58
59class dxfTables : public dxfSection
60{
61public:
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
72protected:
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
79class dxfEntities : public dxfSection
80{
81public:
82    dxfEntities() : _currentEntity(NULL) {}
83    virtual ~dxfEntities() {}
84    virtual void assign(dxfFile* dxf, codeValue& cv);
85    virtual void drawScene(scene* sc);
86
87protected:
88    dxfEntity*              _currentEntity;
89    EntityList              _entityList;
90
91};
92
93class dxfBlocks : public dxfSection
94{
95public:
96    dxfBlocks() : _currentBlock(NULL) {}
97    virtual ~dxfBlocks() {}
98    virtual void assign(dxfFile* dxf, codeValue& cv);
99    dxfBlock* findBlock(std::string s);
100
101protected:
102    dxfBlock*    _currentBlock;
103    std::map<std::string, dxfBlock*> _blockNameList;
104    std::vector<osg::ref_ptr<dxfBlock> > _blockList;
105};
106
107#endif
Note: See TracBrowser for help on using the browser.