|
osgEarth 2.1.1
|
Collaboration diagram for osgEarth::TileKey:Public Types | |
| enum | Direction { NORTH, SOUTH, EAST, WEST } |
Public Member Functions | |
| TileKey () | |
| TileKey (unsigned int lod, unsigned int tile_x, unsigned int tile_y, const Profile *profile) | |
| TileKey (const TileKey &rhs) | |
| bool | operator== (const TileKey &rhs) const |
| bool | operator!= (const TileKey &rhs) const |
| bool | operator< (const TileKey &rhs) const |
| std::string | str () const |
| osgTerrain::TileID | getTileId () const |
| const osgEarth::Profile * | getProfile () const |
| const bool | valid () const |
| TileKey | createChildKey (unsigned int quadrant) const |
| TileKey | createParentKey () const |
| TileKey | createAncestorKey (int ancestorLod) const |
| TileKey | createNeighborKey (Direction dir) const |
| unsigned int | getLevelOfDetail () const |
| const GeoExtent & | getExtent () const |
| void | getPixelExtents (unsigned int &out_minx, unsigned int &out_miny, unsigned int &out_maxx, unsigned int &out_maxy, const unsigned int &tile_size) const |
| void | getTileXY (unsigned int &out_tile_x, unsigned int &out_tile_y) const |
| unsigned int | getTileX () const |
| unsigned int | getTileY () const |
Static Public Member Functions | |
| static int | getLOD (const osgTerrain::TileID &id) |
Static Public Attributes | |
| static TileKey | INVALID |
Protected Attributes | |
| std::string | _key |
| unsigned int | _lod |
| unsigned int | _x |
| unsigned int | _y |
| osg::ref_ptr< const Profile > | _profile |
| GeoExtent | _extent |
Uniquely identifies a single tile on the map, relative to a Profile.
| osgEarth::TileKey::TileKey | ( | ) | [inline] |
| TileKey::TileKey | ( | unsigned int | lod, |
| unsigned int | tile_x, | ||
| unsigned int | tile_y, | ||
| const Profile * | profile | ||
| ) |
Creates a new TileKey with the given tile xy at the specified level of detail
| lod | The level of detail (subdivision recursion level) of the tile |
| tile_x | The x index of the tile |
| tile_y | The y index of the tile |
| profile | The profile for the tile |
Definition at line 30 of file TileKey.cpp.
{
_x = tile_x;
_y = tile_y;
_lod = lod;
_profile = profile;
double width, height;
if ( _profile.valid() )
{
_profile->getTileDimensions(lod, width, height);
double xmin = _profile->getExtent().xMin() + (width * (double)_x);
double ymax = _profile->getExtent().yMax() - (height * (double)_y);
double xmax = xmin + width;
double ymin = ymax - height;
_extent = GeoExtent( _profile->getSRS(), xmin, ymin, xmax, ymax );
std::stringstream buf;
buf << _lod << "_" << _x << "_" << _y;
_key = buf.str();
}
else
{
_extent = GeoExtent::INVALID;
_key = "invalid";
}
}
| TileKey::TileKey | ( | const TileKey & | rhs | ) |
| TileKey TileKey::createAncestorKey | ( | int | ancestorLod | ) | const |
Creates and returns a key that represents an ancestor tile corresponding to the specified LOD.
Definition at line 148 of file TileKey.cpp.
{
if ( ancestorLod > (int)_lod ) return TileKey::INVALID;
unsigned int x = _x, y = _y;
for( int i=_lod; i > ancestorLod; i-- )
{
x /= 2;
y /= 2;
}
return TileKey( ancestorLod, x, y, _profile.get() );
}
Here is the call graph for this function:
Here is the caller graph for this function:| TileKey TileKey::createChildKey | ( | unsigned int | quadrant | ) | const |
Gets a reference to the child key of this key in the specified quadrant (0, 1, 2, or 3).
Definition at line 113 of file TileKey.cpp.
{
unsigned int lod = _lod + 1;
unsigned int x = _x * 2;
unsigned int y = _y * 2;
if (quadrant == 1)
{
x+=1;
}
else if (quadrant == 2)
{
y+=1;
}
else if (quadrant == 3)
{
x+=1;
y+=1;
}
return TileKey( lod, x, y, _profile.get());
}
Here is the call graph for this function:
Here is the caller graph for this function:| TileKey TileKey::createNeighborKey | ( | TileKey::Direction | dir | ) | const |
Definition at line 162 of file TileKey.cpp.
{
unsigned int tx, ty;
getProfile()->getNumTiles( _lod, tx, ty );
unsigned int x =
dir == WEST ? _x > 0 ? _x-1 : tx-1 :
dir == EAST ? _x+1 < tx ? _x+1 : 0 :
_x;
unsigned int y =
dir == SOUTH ? _y > 0 ? _y-1 : ty-1 :
dir == NORTH ? _y+1 < ty ? _y+1 : 0 :
_y;
return TileKey( _lod, x, y, _profile.get() );
}
Here is the call graph for this function:| TileKey TileKey::createParentKey | ( | ) | const |
Creates and returns a key that represents the parent tile of this key.
Definition at line 137 of file TileKey.cpp.
{
if (_lod == 0) return TileKey::INVALID;
unsigned int lod = _lod - 1;
unsigned int x = _x / 2;
unsigned int y = _y / 2;
return TileKey( lod, x, y, _profile.get());
}
Here is the call graph for this function:
Here is the caller graph for this function:| const GeoExtent& osgEarth::TileKey::getExtent | ( | ) | const [inline] |
| unsigned int TileKey::getLevelOfDetail | ( | ) | const |
Gets the level of detail of the tile represented by this key.
Definition at line 94 of file TileKey.cpp.
{
return _lod;
}
| static int osgEarth::TileKey::getLOD | ( | const osgTerrain::TileID & | id | ) | [inline, static] |
| void TileKey::getPixelExtents | ( | unsigned int & | out_minx, |
| unsigned int & | out_miny, | ||
| unsigned int & | out_maxx, | ||
| unsigned int & | out_maxy, | ||
| const unsigned int & | tile_size | ||
| ) | const |
Gets the extents of this key's tile, in pixels
Definition at line 100 of file TileKey.cpp.
| const Profile * TileKey::getProfile | ( | ) | const |
Gets the profile within which this key is interpreted.
Definition at line 72 of file TileKey.cpp.
{
return _profile.get();
}
Here is the caller graph for this function:| osgTerrain::TileID TileKey::getTileId | ( | ) | const |
Gets a TileID corresponding to this key.
Definition at line 86 of file TileKey.cpp.
{
//TODO: will this be an issue with multi-face? perhaps not since each face will
// exist within its own scene graph.. ?
return osgTerrain::TileID(_lod, _x, _y);
}
Here is the caller graph for this function:| unsigned int osgEarth::TileKey::getTileX | ( | ) | const [inline] |
| void TileKey::getTileXY | ( | unsigned int & | out_tile_x, |
| unsigned int & | out_tile_y | ||
| ) | const |
Gets the X and Y indexes of this tile at its level of detail.
Definition at line 78 of file TileKey.cpp.
Here is the caller graph for this function:| unsigned int osgEarth::TileKey::getTileY | ( | ) | const [inline] |
| bool osgEarth::TileKey::operator!= | ( | const TileKey & | rhs | ) | const [inline] |
| bool osgEarth::TileKey::operator< | ( | const TileKey & | rhs | ) | const [inline] |
| bool osgEarth::TileKey::operator== | ( | const TileKey & | rhs | ) | const [inline] |
| std::string osgEarth::TileKey::str | ( | ) | const [inline] |
| const bool osgEarth::TileKey::valid | ( | ) | const [inline] |
GeoExtent osgEarth::TileKey::_extent [protected] |
std::string osgEarth::TileKey::_key [protected] |
unsigned int osgEarth::TileKey::_lod [protected] |
osg::ref_ptr<const Profile> osgEarth::TileKey::_profile [protected] |
unsigned int osgEarth::TileKey::_x [protected] |
unsigned int osgEarth::TileKey::_y [protected] |
TileKey TileKey::INVALID [static] |
1.7.3