osgEarth 2.1.1
|
Public Member Functions | |
MapFrame (const Map *map, Map::ModelParts parts=Map::TERRAIN_LAYERS, const std::string &name="") | |
MapFrame (const Map *map, bool copyValidDataOnly, Map::ModelParts parts=Map::TERRAIN_LAYERS, const std::string &name="") | |
MapFrame (const MapFrame &frame, const std::string &name="") | |
bool | sync () |
const MapInfo & | getMapInfo () const |
const Profile * | getProfile () const |
const ImageLayerVector & | imageLayers () const |
ImageLayer * | getImageLayerAt (int index) const |
ImageLayer * | getImageLayerByUID (UID uid) const |
ImageLayer * | getImageLayerByName (const std::string &name) const |
const ElevationLayerVector & | elevationLayers () const |
ElevationLayer * | getElevationLayerAt (int index) const |
ElevationLayer * | getElevationLayerByUID (UID uid) const |
ElevationLayer * | getElevationLayerByName (const std::string &name) const |
const ModelLayerVector & | modelLayers () const |
ModelLayer * | getModelLayerAt (int index) const |
const MaskLayerVector & | terrainMaskLayers () const |
int | indexOf (ImageLayer *layer) const |
int | indexOf (ElevationLayer *layer) const |
int | indexOf (ModelLayer *layer) const |
Revision | getRevision () const |
bool | isCached (const TileKey &key) const |
bool | getHeightField (const TileKey &key, bool fallback, osg::ref_ptr< osg::HeightField > &out_hf, bool *out_isFallback=0L, ElevationInterpolation interpolation=INTERP_AVERAGE, ElevationSamplePolicy samplePolicy=SAMPLE_FIRST_VALID, ProgressCallback *progress=0) const |
Private Attributes | |
bool | _initialized |
osg::ref_ptr< const Map > | _map |
std::string | _name |
MapInfo | _mapInfo |
Map::ModelParts | _parts |
bool | _copyValidDataOnly |
Revision | _mapDataModelRevision |
ImageLayerVector | _imageLayers |
ElevationLayerVector | _elevationLayers |
ModelLayerVector | _modelLayers |
MaskLayerVector | _maskLayers |
Friends | |
class | Map |
A "snapshot in time" of a Map model revision. Use this class to get a safe "copy" of the map model lists that you can use without worrying about the model changing underneath you from another thread.
MapFrame::MapFrame | ( | const Map * | map, |
Map::ModelParts | parts = Map::TERRAIN_LAYERS , |
||
const std::string & | name = "" |
||
) |
Constructs a new map frame.
Definition at line 1309 of file Map.cpp.
: _initialized( false ), _map( map ), _name( name ), _mapInfo( map ), _parts( parts ), _copyValidDataOnly( false ) { sync(); }
MapFrame::MapFrame | ( | const Map * | map, |
bool | copyValidDataOnly, | ||
Map::ModelParts | parts = Map::TERRAIN_LAYERS , |
||
const std::string & | name = "" |
||
) |
Constructs a map frame that only makes a copy of "valid" data items. Warning: if you ask to copyValidDataOnly, the indexOf() methods may not return values that correspond to the source data model!
Definition at line 1320 of file Map.cpp.
: _initialized( false ), _map( map ), _name( name ), _mapInfo( map ), _parts( parts ), _copyValidDataOnly( copyValidDataOnly ) { sync(); }
MapFrame::MapFrame | ( | const MapFrame & | frame, |
const std::string & | name = "" |
||
) |
A copy constructor with a new name (no sync happens)
Definition at line 1331 of file Map.cpp.
: _initialized( src._initialized ), _map( src._map.get() ), _name( name ), _mapInfo( src._mapInfo ), // src._map.get() ), _parts( src._parts ), _copyValidDataOnly( src._copyValidDataOnly ), _mapDataModelRevision( src._mapDataModelRevision ), _imageLayers( src._imageLayers ), _elevationLayers( src._elevationLayers ), _modelLayers( src._modelLayers ), _maskLayers( src._maskLayers ) { //no sync required here; we copied the arrays etc }
const ElevationLayerVector& osgEarth::MapFrame::elevationLayers | ( | ) | const [inline] |
The elevation layer stack snapshot
Definition at line 488 of file Map.
{ return _elevationLayers; }
ElevationLayer* osgEarth::MapFrame::getElevationLayerAt | ( | int | index | ) | const [inline] |
Definition at line 489 of file Map.
{ return _elevationLayers[index].get(); }
ElevationLayer* osgEarth::MapFrame::getElevationLayerByName | ( | const std::string & | name | ) | const |
ElevationLayer* osgEarth::MapFrame::getElevationLayerByUID | ( | UID | uid | ) | const |
bool MapFrame::getHeightField | ( | const TileKey & | key, |
bool | fallback, | ||
osg::ref_ptr< osg::HeightField > & | out_hf, | ||
bool * | out_isFallback = 0L , |
||
ElevationInterpolation | interpolation = INTERP_AVERAGE , |
||
ElevationSamplePolicy | samplePolicy = SAMPLE_FIRST_VALID , |
||
ProgressCallback * | progress = 0 |
||
) | const |
Equivalent to the Map::createHeightField() method, but operates on the elevation stack snapshot in this MapFrame.
Definition at line 1354 of file Map.cpp.
{ return s_getHeightField( key, _elevationLayers, _mapInfo.getProfile(), fallback, interpolation, samplePolicy, out_hf, out_isFallback, progress ); }
ImageLayer* osgEarth::MapFrame::getImageLayerAt | ( | int | index | ) | const [inline] |
Definition at line 483 of file Map.
{ return _imageLayers[index].get(); }
ImageLayer * MapFrame::getImageLayerByName | ( | const std::string & | name | ) | const |
Definition at line 1396 of file Map.cpp.
{ for(ImageLayerVector::const_iterator i = _imageLayers.begin(); i != _imageLayers.end(); ++i ) if ( i->get()->getName() == name ) return i->get(); return 0L; }
ImageLayer * MapFrame::getImageLayerByUID | ( | UID | uid | ) | const |
Definition at line 1387 of file Map.cpp.
{ for(ImageLayerVector::const_iterator i = _imageLayers.begin(); i != _imageLayers.end(); ++i ) if ( i->get()->getUID() == uid ) return i->get(); return 0L; }
const MapInfo& osgEarth::MapFrame::getMapInfo | ( | ) | const [inline] |
ModelLayer* osgEarth::MapFrame::getModelLayerAt | ( | int | index | ) | const [inline] |
Definition at line 495 of file Map.
{ return _modelLayers[index].get(); }
const Profile* osgEarth::MapFrame::getProfile | ( | ) | const [inline] |
Revision osgEarth::MapFrame::getRevision | ( | ) | const [inline] |
Gets the map data model revision with which this frame is currently sync'd
Definition at line 506 of file Map.
{ return _mapDataModelRevision; }
const ImageLayerVector& osgEarth::MapFrame::imageLayers | ( | ) | const [inline] |
The image layer stack snapshot
Definition at line 482 of file Map.
{ return _imageLayers; }
int MapFrame::indexOf | ( | ModelLayer * | layer | ) | const |
Definition at line 1380 of file Map.cpp.
{ ModelLayerVector::const_iterator i = std::find( _modelLayers.begin(), _modelLayers.end(), layer ); return i != _modelLayers.end() ? i - _modelLayers.begin() : -1; }
int MapFrame::indexOf | ( | ElevationLayer * | layer | ) | const |
Definition at line 1373 of file Map.cpp.
{ ElevationLayerVector::const_iterator i = std::find( _elevationLayers.begin(), _elevationLayers.end(), layer ); return i != _elevationLayers.end() ? i - _elevationLayers.begin() : -1; }
int MapFrame::indexOf | ( | ImageLayer * | layer | ) | const |
Gets the index of the layer in the layer stack snapshot.
Definition at line 1366 of file Map.cpp.
{ ImageLayerVector::const_iterator i = std::find( _imageLayers.begin(), _imageLayers.end(), layer ); return i != _imageLayers.end() ? i - _imageLayers.begin() : -1; }
bool MapFrame::isCached | ( | const TileKey & | key | ) | const |
Checks whether all the data for the specified key is cached.
Definition at line 1405 of file Map.cpp.
{ const Profile* mapProfile = getProfile(); //Check the imagery layers for( ImageLayerVector::const_iterator i = imageLayers().begin(); i != imageLayers().end(); i++ ) { ImageLayer* layer = i->get(); osg::ref_ptr< Cache > cache = layer->getCache(); if ( !cache.valid() || !layer->getProfile() ) return false; std::vector< TileKey > keys; if ( mapProfile->isEquivalentTo( layer->getProfile() ) ) { keys.push_back( key ); } else { layer->getProfile()->getIntersectingTiles( key, keys ); } for (unsigned int j = 0; j < keys.size(); ++j) { if ( layer->isKeyValid( keys[j] ) ) { if ( !cache->isCached( keys[j], layer->getCacheSpec() ) ) { return false; } } } } for( ElevationLayerVector::const_iterator i = elevationLayers().begin(); i != elevationLayers().end(); ++i ) { ElevationLayer* layer = i->get(); osg::ref_ptr< Cache > cache = layer->getCache(); if ( !cache.valid() || !layer->getProfile() ) return false; std::vector<TileKey> keys; if ( mapProfile->isEquivalentTo( layer->getProfile() ) ) { keys.push_back( key ); } else { layer->getProfile()->getIntersectingTiles( key, keys ); } for (unsigned int j = 0; j < keys.size(); ++j) { if ( layer->isKeyValid( keys[j] ) ) { if ( !cache->isCached( keys[j], layer->getCacheSpec() ) ) { return false; } } } } return true; }
const ModelLayerVector& osgEarth::MapFrame::modelLayers | ( | ) | const [inline] |
The model layer set snapshot
Definition at line 494 of file Map.
{ return _modelLayers; }
bool MapFrame::sync | ( | ) |
const MaskLayerVector& osgEarth::MapFrame::terrainMaskLayers | ( | ) | const [inline] |
The mask layer set snapshot
Definition at line 498 of file Map.
{ return _maskLayers; }
bool osgEarth::MapFrame::_copyValidDataOnly [private] |
bool osgEarth::MapFrame::_initialized [private] |
osg::ref_ptr<const Map> osgEarth::MapFrame::_map [private] |
MapInfo osgEarth::MapFrame::_mapInfo [private] |
std::string osgEarth::MapFrame::_name [private] |
Map::ModelParts osgEarth::MapFrame::_parts [private] |