Added use of typedef to help clean up the readability a little and replaced a copy list with a reference.

This commit is contained in:
Robert Osfield
2006-12-05 15:41:03 +00:00
parent d70cf68ae6
commit 905857acd7
4 changed files with 10 additions and 7 deletions

View File

@@ -25,6 +25,8 @@ class dxfFile;
class codeValue;
class dxfEntity;
typedef std::vector<osg::ref_ptr<dxfEntity> > EntityList;
class dxfBlock : public osg::Referenced
{
public:
@@ -32,10 +34,11 @@ public:
virtual ~dxfBlock() {}
inline const std::string& getName() const { return _name; }
virtual void assign(dxfFile* dxf, codeValue& cv);
std::vector<osg::ref_ptr<dxfEntity> > & getEntityList() { return _entityList; }
EntityList& getEntityList() { return _entityList; }
const osg::Vec3d& getPosition() const;
protected:
std::vector<osg::ref_ptr<dxfEntity> > _entityList;
EntityList _entityList;
dxfEntity* _currentEntity;
std::string _name;
osg::Vec3d _position;

View File

@@ -751,8 +751,8 @@ dxfInsert::drawScene(scene* sc)
sc->pushMatrix(m);
sc->pushMatrix(back);
std::vector<osg::ref_ptr<dxfEntity> > l = _block->getEntityList();
for (std::vector<osg::ref_ptr<dxfEntity> >::iterator itr = l.begin(); itr != l.end(); ++itr) {
EntityList& l = _block->getEntityList();
for (EntityList::iterator itr = l.begin(); itr != l.end(); ++itr) {
dxfBasicEntity* e = (*itr)->getEntity();
if (e) {
e->drawScene(sc);

View File

@@ -78,7 +78,7 @@ void dxfEntities::assign(dxfFile* dxf, codeValue& cv)
void
dxfEntities::drawScene(scene* sc)
{
for (std::vector<osg::ref_ptr<dxfEntity> >::iterator itr = _entityList.begin();
for (EntityList::iterator itr = _entityList.begin();
itr != _entityList.end(); ++itr)
(*itr)->drawScene(sc);
}

View File

@@ -85,8 +85,8 @@ public:
virtual void drawScene(scene* sc);
protected:
dxfEntity* _currentEntity;
std::vector<osg::ref_ptr<dxfEntity> > _entityList;
dxfEntity* _currentEntity;
EntityList _entityList;
};