osgEarth 2.1.1
Public Member Functions | Private Attributes | Friends

osgEarth::MapFrame Class Reference

Collaboration diagram for osgEarth::MapFrame:

List of all members.

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 MapInfogetMapInfo () const
const ProfilegetProfile () const
const ImageLayerVectorimageLayers () const
ImageLayergetImageLayerAt (int index) const
ImageLayergetImageLayerByUID (UID uid) const
ImageLayergetImageLayerByName (const std::string &name) const
const ElevationLayerVectorelevationLayers () const
ElevationLayergetElevationLayerAt (int index) const
ElevationLayergetElevationLayerByUID (UID uid) const
ElevationLayergetElevationLayerByName (const std::string &name) const
const ModelLayerVectormodelLayers () const
ModelLayergetModelLayerAt (int index) const
const MaskLayerVectorterrainMaskLayers () 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

Detailed Description

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.

Definition at line 449 of file Map.


Constructor & Destructor Documentation

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();
}

Here is the call graph for this function:

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();
}

Here is the call graph for this function:

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
}

Member Function Documentation

const ElevationLayerVector& osgEarth::MapFrame::elevationLayers ( ) const [inline]

The elevation layer stack snapshot

Definition at line 488 of file Map.

{ return _elevationLayers; }

Here is the caller graph for this function:

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 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

ImageLayer* osgEarth::MapFrame::getImageLayerAt ( int  index) const [inline]

Definition at line 483 of file Map.

{ return _imageLayers[index].get(); }

Here is the caller graph for this function:

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;
}

Here is the caller graph for this function:

const MapInfo& osgEarth::MapFrame::getMapInfo ( ) const [inline]

Accesses the profile/rendering info about the source map.

Definition at line 476 of file Map.

{ return _mapInfo; }

Here is the caller graph for this function:

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]

Convenience method to access the map's profile

Definition at line 479 of file Map.

{ return _mapInfo.getProfile(); }

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

const ImageLayerVector& osgEarth::MapFrame::imageLayers ( ) const [inline]

The image layer stack snapshot

Definition at line 482 of file Map.

{ return _imageLayers; }

Here is the caller graph for this function:

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;
}

Here is the call graph for this function:

const ModelLayerVector& osgEarth::MapFrame::modelLayers ( ) const [inline]

The model layer set snapshot

Definition at line 494 of file Map.

{ return _modelLayers; }

Here is the caller graph for this function:

bool MapFrame::sync ( )

Synchronizes this frame with the source map model (only if necessary). Returns true is new data was synced; false if nothing changed.

Definition at line 1348 of file Map.cpp.

{
    return _map->sync( *this );
}

Here is the caller graph for this function:

const MaskLayerVector& osgEarth::MapFrame::terrainMaskLayers ( ) const [inline]

The mask layer set snapshot

Definition at line 498 of file Map.

{ return _maskLayers; }

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class Map [friend]

Definition at line 536 of file Map.


Member Data Documentation

Definition at line 530 of file Map.

Definition at line 533 of file Map.

Definition at line 532 of file Map.

Definition at line 525 of file Map.

osg::ref_ptr<const Map> osgEarth::MapFrame::_map [private]

Definition at line 526 of file Map.

Definition at line 531 of file Map.

Definition at line 528 of file Map.

Definition at line 535 of file Map.

Definition at line 534 of file Map.

std::string osgEarth::MapFrame::_name [private]

Definition at line 527 of file Map.

Definition at line 529 of file Map.


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