osgEarth 2.1.1
Public Member Functions | Private Attributes

osgEarth::Util::GeoGraph Class Reference

Inheritance diagram for osgEarth::Util::GeoGraph:
Collaboration diagram for osgEarth::Util::GeoGraph:

List of all members.

Public Member Functions

 GeoGraph (const GeoExtent &extent, float maxRange, unsigned maxObjects=500, unsigned splitDim=2, float splitRangeFactor=0.5f, unsigned rootWidth=2, unsigned rootHeight=2)
bool insertObject (GeoObject *object)

Private Attributes

unsigned _rootWidth
unsigned _rootHeight

Detailed Description

Definition at line 113 of file SpatialData.


Constructor & Destructor Documentation

GeoGraph::GeoGraph ( const GeoExtent extent,
float  maxRange,
unsigned  maxObjects = 500,
unsigned  splitDim = 2,
float  splitRangeFactor = 0.5f,
unsigned  rootWidth = 2,
unsigned  rootHeight = 2 
)

Definition at line 113 of file SpatialData.cpp.

                                                             :
GeoCell( extent, maxRange, maxObjects, splitDim, splitRangeFactor, 0 )
{
    _rootWidth = osg::maximum( rootWidth, (unsigned)2 );
    _rootHeight = osg::maximum( rootHeight, (unsigned)2 );

    if ( _depth == 0 )
    {
        double xinterval = extent.width() / (double)_rootWidth;
        double yinterval = extent.height() / (double)_rootHeight;

        for( unsigned y=0; y<_rootHeight; ++y )
        {
            for( unsigned x=0; x<_rootWidth; ++x )
            {
                GeoExtent cellExtent(
                    _extent.getSRS(),
                    _extent.xMin() + xinterval*(double)x,
                    _extent.yMin() + yinterval*(double)y,
                    _extent.xMin() + xinterval*(double)(x+1),
                    _extent.yMin() + yinterval*(double)(y+1) );

                GeoCell * child = new GeoCell(
                    cellExtent,
                    _maxRange,
                    _maxObjects,
                    _splitDim,
                    _splitRangeFactor,
                    1 );

                this->addChild( child, 0, maxRange ); //FLT_MAX );
            }
        }                    
    }
}

Here is the call graph for this function:


Member Function Documentation

bool GeoGraph::insertObject ( GeoObject object) [virtual]

Adds an object to this geocell graph.

Reimplemented from osgEarth::Util::GeoCell.

Definition at line 152 of file SpatialData.cpp.

{
    osg::Vec3d loc;
    if ( object->getLocation(loc) )
    {
        unsigned index = getIndex( _extent, loc, _rootWidth, _rootHeight );
        return static_cast<GeoCell*>(getChild(index))->insertObject( object );
    }
    else
    {
        return false;
    }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 129 of file SpatialData.

Definition at line 129 of file SpatialData.


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