osgEarth 2.1.1
|
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 |
Definition at line 113 of file SpatialData.
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 ); } } } }
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; } }
unsigned osgEarth::Util::GeoGraph::_rootHeight [private] |
Definition at line 129 of file SpatialData.
unsigned osgEarth::Util::GeoGraph::_rootWidth [private] |
Definition at line 129 of file SpatialData.