|
Revision 13041, 1.8 kB
(checked in by robert, 14 months 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 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #ifndef DXF_TABLE |
|---|
| 14 | #define DXF_TABLE 1 |
|---|
| 15 | |
|---|
| 16 | #include <string> |
|---|
| 17 | #include <map> |
|---|
| 18 | |
|---|
| 19 | #include <osg/Referenced> |
|---|
| 20 | #include <osg/ref_ptr> |
|---|
| 21 | |
|---|
| 22 | class dxfFile; |
|---|
| 23 | class codeValue; |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | |
|---|
| 27 | class dxfTable : public osg::Referenced |
|---|
| 28 | { |
|---|
| 29 | public: |
|---|
| 30 | dxfTable() {} |
|---|
| 31 | virtual ~dxfTable() {} |
|---|
| 32 | virtual void assign(dxfFile* , codeValue& ) { } |
|---|
| 33 | }; |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | class dxfLayer : public osg::Referenced |
|---|
| 37 | { |
|---|
| 38 | public: |
|---|
| 39 | dxfLayer(std::string name = "0") : _name(name), _color(7), _frozen(false) {} |
|---|
| 40 | virtual ~dxfLayer() {} |
|---|
| 41 | virtual void assign(dxfFile* dxf, codeValue& cv); |
|---|
| 42 | virtual const std::string& getName() const { return _name; } |
|---|
| 43 | virtual const unsigned short& getColor() const { return _color; } |
|---|
| 44 | virtual void setName(const std::string& name) { _name = name; } |
|---|
| 45 | const bool& getFrozen() const { return _frozen; } |
|---|
| 46 | protected: |
|---|
| 47 | std::string _name; |
|---|
| 48 | unsigned short _color; |
|---|
| 49 | bool _frozen; |
|---|
| 50 | }; |
|---|
| 51 | |
|---|
| 52 | class dxfLayerTable : public dxfTable |
|---|
| 53 | { |
|---|
| 54 | public: |
|---|
| 55 | dxfLayerTable() {} |
|---|
| 56 | virtual ~dxfLayerTable() {} |
|---|
| 57 | virtual void assign(dxfFile* dxf, codeValue& cv); |
|---|
| 58 | |
|---|
| 59 | dxfLayer* findOrCreateLayer(std::string name) |
|---|
| 60 | { |
|---|
| 61 | if (name == "") name = "0"; |
|---|
| 62 | dxfLayer* layer = _layers[name].get(); |
|---|
| 63 | if (!layer) { |
|---|
| 64 | layer = new dxfLayer; |
|---|
| 65 | _layers[name] = layer; |
|---|
| 66 | } |
|---|
| 67 | return layer; |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | protected: |
|---|
| 71 | std::map<std::string, osg::ref_ptr<dxfLayer> > _layers; |
|---|
| 72 | osg::ref_ptr<dxfLayer> _currentLayer; |
|---|
| 73 | }; |
|---|
| 74 | |
|---|
| 75 | #endif |
|---|