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

Revision 13041, 1.8 kB (checked in by robert, 3 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#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
22class dxfFile;
23class codeValue;
24
25// special case: the layer table
26
27class dxfTable : public osg::Referenced
28{
29public:
30        dxfTable() {}
31        virtual ~dxfTable() {}
32        virtual void assign(dxfFile* , codeValue& ) { }
33};
34
35
36class dxfLayer : public osg::Referenced
37{
38public:
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; }
46protected:
47        std::string     _name;
48        unsigned short _color;
49        bool                    _frozen;
50};
51
52class dxfLayerTable : public dxfTable
53{
54public:
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"; // nowhere it is said "" is invalid, but...
62                dxfLayer* layer = _layers[name].get();
63                if (!layer) {
64                        layer = new dxfLayer;
65                        _layers[name] = layer;
66                }
67                return layer;
68        }
69
70protected:
71        std::map<std::string, osg::ref_ptr<dxfLayer> > _layers;
72        osg::ref_ptr<dxfLayer> _currentLayer;
73};
74
75#endif
Note: See TracBrowser for help on using the browser.