|
osgEarth 2.1.1
|
Inheritance diagram for Tile:
Collaboration diagram for Tile:Public Member Functions | |
| Tile (const TileKey &key, GeoLocator *keyLocator, bool quickReleaseGLObjects) | |
| const TileKey & | getKey () const |
| class Terrain * | getTerrain () |
| class Terrain * | getTerrain () const |
| void | attachToTerrain (Terrain *terrain) |
| void | init () |
| const MaskLayerVector & | getTerrainMasks () |
| void | setTerrainMasks (const MaskLayerVector &terrainMask) |
| bool | getHasBeenTraversed () const |
| Threading::ReadWriteMutex & | getTileLayersMutex () |
| virtual void | queueTileUpdate (TileUpdate::Action action, int index=-1) |
| void | applyImmediateTileUpdate (TileUpdate::Action action, int index=-1) |
| virtual bool | cancelActiveTasks () |
| float | getVerticalScale () const |
| void | setVerticalScale (float verticalScale) |
| osgTerrain::Locator * | getLocator () const |
| const osgTerrain::TileID & | getTileId () const |
| bool | getDirty () const |
| void | setDirty (bool value) |
| void | setTerrainTechnique (TerrainTechnique *value) |
| TerrainTechnique * | getTerrainTechnique () const |
| void | removeCustomColorLayer (UID layerUID, bool writeLock=true) |
| bool | getCustomColorLayer (UID layerUID, CustomColorLayer &output, bool readLock=true) const |
| void | getCustomColorLayers (ColorLayersByUID &out, bool readLock=true) const |
| void | setCustomColorLayers (const ColorLayersByUID &in, bool writeLock=true) |
| void | setCustomColorLayer (const CustomColorLayer &colorLayer, bool writeLock=true) |
| osgTerrain::HeightFieldLayer * | getElevationLayer () const |
| void | setElevationLayer (osgTerrain::HeightFieldLayer *value) |
| virtual void | traverse (class osg::NodeVisitor &nv) |
| virtual void | releaseGLObjects (osg::State *=0) const |
| virtual osg::BoundingSphere | computeBound () const |
Protected Member Functions | |
| virtual | ~Tile () |
Protected Attributes | |
| bool | _hasBeenTraversed |
| bool | _quickReleaseGLObjects |
| bool | _parentTileSet |
| bool | _dirty |
| TileKey | _key |
| osgTerrain::TileID | _tileId |
| osg::ref_ptr< GeoLocator > | _locator |
| osg::observer_ptr< Terrain > | _terrain |
| MaskLayerVector | _masks |
| Threading::ReadWriteMutex | _tileLayersMutex |
| ColorLayersByUID | _colorLayers |
| float | _verticalScale |
| osg::ref_ptr < osgTerrain::HeightFieldLayer > | _elevationLayer |
| osg::ref_ptr< TerrainTechnique > | _tech |
Friends | |
| class | TileFrame |
| Tile::Tile | ( | const TileKey & | key, |
| GeoLocator * | keyLocator, | ||
| bool | quickReleaseGLObjects | ||
| ) |
Definition at line 45 of file Tile.cpp.
: _key( key ), _locator( keyLocator ), _quickReleaseGLObjects( quickReleaseGLObjects ), _hasBeenTraversed( false ), _verticalScale( 1.0f ), _parentTileSet( false ), _tileId( key.getTileId() ), _dirty( true ) { this->setThreadSafeRefUnref( true ); this->setName( key.str() ); // initially bump the update requirement so that this tile will receive an update // traversal the first time through. It is on the first update traversal that we // know the tile is in the scene graph and that it can be registered with the terrain. ADJUST_UPDATE_TRAV_COUNT( this, 1 ); }
Here is the call graph for this function:| void Tile::applyImmediateTileUpdate | ( | TileUpdate::Action | action, |
| int | index = -1 |
||
| ) |
Reimplemented in StreamingTile.
Definition at line 267 of file Tile.cpp.
{
CustomTerrainTechnique* tech = dynamic_cast<CustomTerrainTechnique*>( _tech.get() );
if ( tech )
{
tech->compile( TileUpdate(action, value), 0L );
tech->applyTileUpdates();
}
else
{
queueTileUpdate( action, value );
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| void Tile::attachToTerrain | ( | Terrain * | terrain | ) |
Definition at line 88 of file Tile.cpp.
{
_terrain = terrain;
if ( terrain )
terrain->registerTile( this );
}
Here is the call graph for this function:
Here is the caller graph for this function:| virtual bool Tile::cancelActiveTasks | ( | ) | [inline, virtual] |
Reimplemented in StreamingTile.
Definition at line 107 of file Tile.
{ return true; }
Here is the caller graph for this function:| osg::BoundingSphere Tile::computeBound | ( | ) | const [virtual] |
Definition at line 210 of file Tile.cpp.
{
//Overriden computeBound that takes into account the vertical scale.
//OE_NOTICE << "Tile::computeBound verticalScale = " << _verticalScale << std::endl;
osg::BoundingSphere bs;
if (_elevationLayer.valid())
{
if (!_elevationLayer->getLocator()) return bs;
osg::BoundingBox bb;
unsigned int numColumns = _elevationLayer->getNumColumns();
unsigned int numRows = _elevationLayer->getNumRows();
for(unsigned int r=0;r<numRows;++r)
{
for(unsigned int c=0;c<numColumns;++c)
{
float value = 0.0f;
bool validValue = _elevationLayer->getValidValue(c,r, value);
if (validValue)
{
//Multiply by the vertical scale.
value *= _verticalScale;
osg::Vec3d ndc, v;
ndc.x() = ((double)c)/(double)(numColumns-1),
ndc.y() = ((double)r)/(double)(numRows-1);
ndc.z() = value;
if (_elevationLayer->getLocator()->convertLocalToModel(ndc, v))
{
bb.expandBy(v);
}
}
}
}
bs.expandBy(bb);
}
else
{
for(ColorLayersByUID::const_iterator i = _colorLayers.begin(); i != _colorLayers.end(); ++i )
{
bs.expandBy( i->second.computeBound() );
}
}
return bs;
}
| bool Tile::getCustomColorLayer | ( | UID | layerUID, |
| CustomColorLayer & | output, | ||
| bool | readLock = true |
||
| ) | const |
Definition at line 152 of file Tile.cpp.
{
if ( readLock )
{
Threading::ScopedReadLock sharedTileLock( const_cast<Tile*>(this)->_tileLayersMutex );
return getCustomColorLayer( layerUID, out, false );
}
else
{
ColorLayersByUID::const_iterator i = _colorLayers.find( layerUID );
if ( i != _colorLayers.end() )
{
out = i->second;
return true;
}
}
return false;
}
Here is the caller graph for this function:| void Tile::getCustomColorLayers | ( | ColorLayersByUID & | out, |
| bool | readLock = true |
||
| ) | const |
Definition at line 172 of file Tile.cpp.
{
if ( readLock )
{
Threading::ScopedReadLock sharedTileLock( const_cast<Tile*>(this)->_tileLayersMutex );
return getCustomColorLayers( out, false );
}
else
out = _colorLayers;
}
Here is the caller graph for this function:| bool Tile::getDirty | ( | ) | const [inline] |
| osgTerrain::HeightFieldLayer* Tile::getElevationLayer | ( | ) | const [inline] |
Definition at line 130 of file Tile.
{ return _elevationLayer.get(); }
Here is the caller graph for this function:| bool Tile::getHasBeenTraversed | ( | ) | const [inline] |
Whether OSG has traversed the tile at least once.
Definition at line 97 of file Tile.
{ return _hasBeenTraversed; }
Here is the caller graph for this function:| const TileKey& Tile::getKey | ( | ) | const [inline] |
| osgTerrain::Locator* Tile::getLocator | ( | ) | const [inline] |
| class Terrain* Tile::getTerrain | ( | ) | [inline] |
| class Terrain* Tile::getTerrain | ( | ) | const [inline] |
| const MaskLayerVector& Tile::getTerrainMasks | ( | ) | [inline] |
| TerrainTechnique* Tile::getTerrainTechnique | ( | ) | const [inline] |
| const osgTerrain::TileID& Tile::getTileId | ( | ) | const [inline] |
| Threading::ReadWriteMutex& Tile::getTileLayersMutex | ( | ) | [inline] |
Mutex that protects access to the tile contents.
Definition at line 100 of file Tile.
{ return _tileLayersMutex; }
Here is the caller graph for this function:| float Tile::getVerticalScale | ( | ) | const [inline] |
The scale factor for elevation heights
Definition at line 110 of file Tile.
{ return _verticalScale; }
Here is the caller graph for this function:| void Tile::init | ( | ) |
| void Tile::queueTileUpdate | ( | TileUpdate::Action | action, |
| int | index = -1 |
||
| ) | [virtual] |
Reimplemented in StreamingTile.
Definition at line 261 of file Tile.cpp.
{
_dirty = true;
}
Here is the caller graph for this function:| void Tile::releaseGLObjects | ( | osg::State * | state = 0 | ) | const [virtual] |
If State is non-zero, this function releases any associated OpenGL objects for the specified graphics context. Otherwise, releases OpenGL objects for all graphics contexts.
Definition at line 342 of file Tile.cpp.
{
osg::Node::releaseGLObjects( state );
if ( _tech.valid() )
{
//NOTE: crashes sometimes if OSG_RELEASE_DELAY is set -gw
_tech->releaseGLObjects( state );
}
}
| void Tile::removeCustomColorLayer | ( | UID | layerUID, |
| bool | writeLock = true |
||
| ) |
Tile contents. We don't use the TerrainTile color layer list, we use our own
Definition at line 131 of file Tile.cpp.
{
if ( writeLock )
{
Threading::ScopedWriteLock exclusiveTileLock( _tileLayersMutex );
removeCustomColorLayer( layerUID, false );
}
else
{
ColorLayersByUID::iterator i = _colorLayers.find(layerUID);
if ( i != _colorLayers.end() )
{
if ( i->second.getMapLayer()->isDynamic() )
ADJUST_UPDATE_TRAV_COUNT( this, -1 );
_colorLayers.erase( i );
}
}
}
Here is the caller graph for this function:| void Tile::setCustomColorLayer | ( | const CustomColorLayer & | colorLayer, |
| bool | writeLock = true |
||
| ) |
Definition at line 106 of file Tile.cpp.
{
if ( writeLock )
{
Threading::ScopedWriteLock exclusiveTileLock( _tileLayersMutex );
setCustomColorLayer( layer, false );
}
else
{
int delta = 0;
ColorLayersByUID::const_iterator i = _colorLayers.find( layer.getUID() );
if ( i != _colorLayers.end() && i->second.getMapLayer()->isDynamic() )
--delta;
_colorLayers[layer.getUID()] = layer;
if ( layer.getMapLayer()->isDynamic() )
++delta;
if ( delta != 0 )
ADJUST_UPDATE_TRAV_COUNT( this, delta );
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| void Tile::setCustomColorLayers | ( | const ColorLayersByUID & | in, |
| bool | writeLock = true |
||
| ) |
Definition at line 184 of file Tile.cpp.
{
if ( writeLock )
{
Threading::ScopedWriteLock exclusiveLock( _tileLayersMutex );
setCustomColorLayers( in, false );
}
else
{
int delta = 0;
for( ColorLayersByUID::const_iterator i = _colorLayers.begin(); i != _colorLayers.end(); ++i )
if ( i->second.getMapLayer()->isDynamic() )
--delta;
_colorLayers = in;
for( ColorLayersByUID::const_iterator i = _colorLayers.begin(); i != _colorLayers.end(); ++i )
if ( i->second.getMapLayer()->isDynamic() )
++delta;
if ( delta != 0 )
ADJUST_UPDATE_TRAV_COUNT( this, delta );
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| void Tile::setDirty | ( | bool | value | ) | [inline] |
| void Tile::setElevationLayer | ( | osgTerrain::HeightFieldLayer * | value | ) | [inline] |
Definition at line 131 of file Tile.
{ _elevationLayer = value; }
Here is the caller graph for this function:| void Tile::setTerrainMasks | ( | const MaskLayerVector & | terrainMask | ) | [inline] |
| void Tile::setTerrainTechnique | ( | TerrainTechnique * | value | ) |
| void Tile::setVerticalScale | ( | float | verticalScale | ) |
Definition at line 96 of file Tile.cpp.
{
if (_verticalScale != verticalScale)
{
_verticalScale = verticalScale;
dirtyBound();
}
}
Here is the caller graph for this function:| void Tile::traverse | ( | class osg::NodeVisitor & | nv | ) | [virtual] |
Definition at line 282 of file Tile.cpp.
{
// set the parent tile in the technique:
if ( !_parentTileSet && _terrain.valid() )
{
osg::ref_ptr<Tile> parentTile;
//Take a reference
osg::ref_ptr< Terrain > terrain = _terrain.get();
if (terrain.valid())
{
terrain->getTile( _key.createParentKey().getTileId(), parentTile );
CustomTerrainTechnique* tech = dynamic_cast<CustomTerrainTechnique*>( _tech.get() );
if ( tech )
tech->setParentTile( parentTile.get() );
_parentTileSet = true;
}
}
// this block runs the first time the tile is traversed while in the scene graph.
if ( !_hasBeenTraversed )
{
if ( nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR )
{
Threading::ScopedWriteLock lock( this->_tileLayersMutex );
{
if ( !_hasBeenTraversed && _terrain.valid() )
{
_hasBeenTraversed = true;
// we constructed this tile with an update traversal count of 1 so it would get
// here and we could register the tile. Now we can decrement it back to normal.
// this MUST be called from the UPDATE traversal.
ADJUST_UPDATE_TRAV_COUNT( this, -1 );
}
}
}
}
// code copied from osgTerrain::TerrainTile... TODO: evaluate this... -gw
if ( nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR )
{
osg::ClusterCullingCallback* ccc = dynamic_cast<osg::ClusterCullingCallback*>(getCullCallback());
if (ccc)
{
if (ccc->cull(&nv,0,static_cast<osg::State *>(0))) return;
}
}
if ( _dirty )
{
init();
}
if ( _tech.valid() )
{
_tech->traverse( nv );
}
}
Here is the call graph for this function:ColorLayersByUID Tile::_colorLayers [protected] |
bool Tile::_dirty [protected] |
osg::ref_ptr<osgTerrain::HeightFieldLayer> Tile::_elevationLayer [protected] |
bool Tile::_hasBeenTraversed [protected] |
TileKey Tile::_key [protected] |
osg::ref_ptr<GeoLocator> Tile::_locator [protected] |
MaskLayerVector Tile::_masks [protected] |
bool Tile::_parentTileSet [protected] |
bool Tile::_quickReleaseGLObjects [protected] |
osg::ref_ptr<TerrainTechnique> Tile::_tech [protected] |
osg::observer_ptr<Terrain> Tile::_terrain [protected] |
osgTerrain::TileID Tile::_tileId [protected] |
Threading::ReadWriteMutex Tile::_tileLayersMutex [protected] |
float Tile::_verticalScale [protected] |
1.7.3