osgEarth 2.1.1
Public Types | Public Member Functions | Public Attributes

CollectTiles Class Reference

List of all members.

Public Types

typedef std::vector
< osg::ref_ptr
< osgTerrain::TerrainTile > > 
TerrainTiles
typedef std::vector
< osg::ref_ptr
< osgTerrain::TerrainTile > > 
TerrainTiles

Public Member Functions

 CollectTiles ()
void reset ()
void apply (osg::Group &group)
osgTerrain::Locator * getLocator ()
bool getRange (double &min_x, double &min_y, double &max_x, double &max_y) const
 CollectTiles ()
void reset ()
void apply (osg::Group &group)
osgTerrain::Locator * getLocator ()
bool getRange (double &min_x, double &min_y, double &max_x, double &max_y) const

Public Attributes

TerrainTiles _terrainTiles

Detailed Description

Definition at line 53 of file Copy of ReaderWriterVPB.cpp.


Member Typedef Documentation

typedef std::vector< osg::ref_ptr<osgTerrain::TerrainTile> > CollectTiles::TerrainTiles

Definition at line 135 of file Copy of ReaderWriterVPB.cpp.

typedef std::vector< osg::ref_ptr<osgTerrain::TerrainTile> > CollectTiles::TerrainTiles

Definition at line 138 of file ReaderWriterVPB.cpp.


Constructor & Destructor Documentation

CollectTiles::CollectTiles ( ) [inline]

Definition at line 57 of file Copy of ReaderWriterVPB.cpp.

                  : 
        osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
    {
    }
CollectTiles::CollectTiles ( ) [inline]

Definition at line 60 of file ReaderWriterVPB.cpp.

                  : 
        osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
    {
    }

Member Function Documentation

void CollectTiles::apply ( osg::Group &  group) [inline]

Definition at line 67 of file Copy of ReaderWriterVPB.cpp.

    {
        osgTerrain::TerrainTile* terrainTile = dynamic_cast<osgTerrain::TerrainTile*>(&group);
        if (terrainTile)
        {
            osg::notify(osg::INFO)<<"Found terrain tile TileID("<<
                                TileKey::getLOD(terrainTile->getTileID())<<", "<<
                terrainTile->getTileID().x<<", "<<
                terrainTile->getTileID().y<<")"<<std::endl;
            
            _terrainTiles.push_back(terrainTile);
        }
        else
        {
            traverse(group);
        }
    }

Here is the call graph for this function:

void CollectTiles::apply ( osg::Group &  group) [inline]

Definition at line 70 of file ReaderWriterVPB.cpp.

    {
        osgTerrain::TerrainTile* terrainTile = dynamic_cast<osgTerrain::TerrainTile*>(&group);
        if (terrainTile)
        {
            OE_DEBUG<<"VPB: Found terrain tile TileID("<<
                                TileKey::getLOD(terrainTile->getTileID())<<", "<<
                terrainTile->getTileID().x<<", "<<
                terrainTile->getTileID().y<<")"<<std::endl;
            
            _terrainTiles.push_back(terrainTile);
        }
        else
        {
            traverse(group);
        }
    }

Here is the call graph for this function:

osgTerrain::Locator* CollectTiles::getLocator ( ) [inline]

Definition at line 88 of file ReaderWriterVPB.cpp.

    {
        for(unsigned int i=0; i<_terrainTiles.size(); ++i)
        {
            osgTerrain::TerrainTile* tile = _terrainTiles[i].get();
            osgTerrain::Locator* locator = tile->getLocator();
            if (locator) return locator;
        }
        return 0;
    }
osgTerrain::Locator* CollectTiles::getLocator ( ) [inline]

Definition at line 85 of file Copy of ReaderWriterVPB.cpp.

    {
        for(unsigned int i=0; i<_terrainTiles.size(); ++i)
        {
            osgTerrain::TerrainTile* tile = _terrainTiles[i].get();
            osgTerrain::Locator* locator = tile->getLocator();
            if (locator) return locator;
        }
        return 0;
    }

Here is the caller graph for this function:

bool CollectTiles::getRange ( double &  min_x,
double &  min_y,
double &  max_x,
double &  max_y 
) const [inline]

Definition at line 96 of file Copy of ReaderWriterVPB.cpp.

    {
        min_x = DBL_MAX;
        max_x = -DBL_MAX;
        min_y = DBL_MAX;
        max_y = -DBL_MAX;
        
        typedef std::vector<osg::Vec3d> Corners;
        Corners corners;
        corners.push_back(osg::Vec3d(0.0f,0.0f,0.0f));
        corners.push_back(osg::Vec3d(1.0f,0.0f,0.0f));
        corners.push_back(osg::Vec3d(1.0f,1.0f,0.0f));
        corners.push_back(osg::Vec3d(1.0f,1.0f,0.0f));
        
        for(unsigned int i=0; i<_terrainTiles.size(); ++i)
        {
            osgTerrain::TerrainTile* tile = _terrainTiles[i].get();
            osgTerrain::Locator* locator = tile->getLocator();
            if (locator)
            {
                for(Corners::iterator itr = corners.begin();
                    itr != corners.end();
                    ++itr)
                {
                    osg::Vec3d& local = *itr;
                    osg::Vec3d projected = local * locator->getTransform();

                    if (projected.x()<min_x) min_x = projected.x();
                    if (projected.x()>max_x) max_x = projected.x();

                    if (projected.y()<min_y) min_y = projected.y();
                    if (projected.y()>max_y) max_y = projected.y();
                }
            }
        }
        
        return min_x <= max_x;
    }

Here is the caller graph for this function:

bool CollectTiles::getRange ( double &  min_x,
double &  min_y,
double &  max_x,
double &  max_y 
) const [inline]

Definition at line 99 of file ReaderWriterVPB.cpp.

    {
        min_x = DBL_MAX;
        max_x = -DBL_MAX;
        min_y = DBL_MAX;
        max_y = -DBL_MAX;
        
        typedef std::vector<osg::Vec3d> Corners;
        Corners corners;
        corners.push_back(osg::Vec3d(0.0f,0.0f,0.0f));
        corners.push_back(osg::Vec3d(1.0f,0.0f,0.0f));
        corners.push_back(osg::Vec3d(1.0f,1.0f,0.0f));
        corners.push_back(osg::Vec3d(1.0f,1.0f,0.0f));
        
        for(unsigned int i=0; i<_terrainTiles.size(); ++i)
        {
            osgTerrain::TerrainTile* tile = _terrainTiles[i].get();
            osgTerrain::Locator* locator = tile->getLocator();
            if (locator)
            {
                for(Corners::iterator itr = corners.begin();
                    itr != corners.end();
                    ++itr)
                {
                    osg::Vec3d& local = *itr;
                    osg::Vec3d projected = local * locator->getTransform();

                    if (projected.x()<min_x) min_x = projected.x();
                    if (projected.x()>max_x) max_x = projected.x();

                    if (projected.y()<min_y) min_y = projected.y();
                    if (projected.y()>max_y) max_y = projected.y();
                }
            }
        }
        
        return min_x <= max_x;
    }
void CollectTiles::reset ( ) [inline]

Definition at line 62 of file Copy of ReaderWriterVPB.cpp.

    {
        _terrainTiles.clear();
    }
void CollectTiles::reset ( ) [inline]

Definition at line 65 of file ReaderWriterVPB.cpp.

    {
        _terrainTiles.clear();
    }

Member Data Documentation

Definition at line 136 of file Copy of ReaderWriterVPB.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines