osgEarth 2.1.1
|
Public Member Functions | |
VPBSource (VPBDatabase *vpbDatabase, const PluginOptions *in_options) | |
void | initialize (const std::string &referenceURI, const Profile *overrideProfile) |
osg::Image * | createImage (const TileKey *key, ProgressCallback *progress) |
osg::HeightField * | createHeightField (const TileKey *key, ProgressCallback *progress) |
virtual std::string | getExtension () const |
VPBSource (VPBDatabase *vpbDatabase, const VPBOptions &in_options) | |
void | initialize (const std::string &referenceURI, const Profile *overrideProfile) |
osg::Image * | createImage (const TileKey &key, ProgressCallback *progress) |
osg::HeightField * | createHeightField (const TileKey &key, ProgressCallback *progress) |
virtual std::string | getExtension () const |
Private Attributes | |
osg::ref_ptr< VPBDatabase > | _vpbDatabase |
unsigned int | _layerNum |
osg::ref_ptr< PluginOptions > | _options |
const VPBOptions | _options |
std::string | _referenceUri |
Definition at line 546 of file Copy of ReaderWriterVPB.cpp.
VPBSource::VPBSource | ( | VPBDatabase * | vpbDatabase, |
const PluginOptions * | in_options | ||
) | [inline] |
Definition at line 549 of file Copy of ReaderWriterVPB.cpp.
: TileSource(in_options), _vpbDatabase(vpbDatabase), _layerNum(0) { if ( in_options ) { _layerNum = in_options->config().value<int>( PROPERTY_LAYER_NUM, _layerNum ); } }
VPBSource::VPBSource | ( | VPBDatabase * | vpbDatabase, |
const VPBOptions & | in_options | ||
) | [inline] |
Definition at line 520 of file ReaderWriterVPB.cpp.
: TileSource(in_options), _vpbDatabase(vpbDatabase), _options( in_options ), _referenceUri() { //nop }
osg::HeightField* VPBSource::createHeightField | ( | const TileKey * | key, |
ProgressCallback * | progress | ||
) | [inline] |
Definition at line 593 of file Copy of ReaderWriterVPB.cpp.
{ osg::ref_ptr<osgTerrain::TerrainTile> tile = _vpbDatabase->getTerrainTile(key, progress); if (tile.valid()) { osgTerrain::Layer* elevationLayer = tile->getElevationLayer(); osgTerrain::HeightFieldLayer* hfLayer = dynamic_cast<osgTerrain::HeightFieldLayer*>(elevationLayer); if (hfLayer) { return hfLayer->getHeightField(); } } return 0; }
osg::HeightField* VPBSource::createHeightField | ( | const TileKey & | key, |
ProgressCallback * | progress | ||
) | [inline, virtual] |
Creates a heightfield for the given TileKey The returned object is new and is the responsibility of the caller.
Reimplemented from osgEarth::TileSource.
Definition at line 601 of file ReaderWriterVPB.cpp.
{ osg::ref_ptr<osgTerrain::TerrainTile> tile; _vpbDatabase->getTerrainTile(key, progress, tile); if (tile.valid()) { osgTerrain::Layer* elevationLayer = tile->getElevationLayer(); osgTerrain::HeightFieldLayer* hfLayer = dynamic_cast<osgTerrain::HeightFieldLayer*>(elevationLayer); if (hfLayer) { //return hfLayer->getHeightField(); return new osg::HeightField(*hfLayer->getHeightField()); } } return 0; }
osg::Image* VPBSource::createImage | ( | const TileKey * | key, |
ProgressCallback * | progress | ||
) | [inline] |
Definition at line 572 of file Copy of ReaderWriterVPB.cpp.
{ //TODO: Make VPB driver use progress callback osg::ref_ptr<osgTerrain::TerrainTile> tile = _vpbDatabase->getTerrainTile(key, progress); if (tile.valid()) { if (_layerNum < tile->getNumColorLayers()) { osgTerrain::Layer* layer = tile->getColorLayer(_layerNum); osgTerrain::ImageLayer* imageLayer = dynamic_cast<osgTerrain::ImageLayer*>(layer); if (imageLayer) { return imageLayer->getImage(); } } } return 0; }
osg::Image* VPBSource::createImage | ( | const TileKey & | key, |
ProgressCallback * | progress | ||
) | [inline, virtual] |
Creates an image for the given TileKey. The returned object is new and is the responsibility of the caller.
Implements osgEarth::TileSource.
Definition at line 545 of file ReaderWriterVPB.cpp.
{ osg::Image * ret = NULL; //TODO: Make VPB driver use progress callback osg::ref_ptr<osgTerrain::TerrainTile> tile; _vpbDatabase->getTerrainTile(key, progress, tile); if (tile.valid()) { int layerNum = _options.layer().value(); const optional<std::string> & layerSetName = _options.layerSetName(); int numColorLayers = (int)tile->getNumColorLayers(); if(layerNum > numColorLayers) layerNum = 0; if (layerNum < numColorLayers) { osgTerrain::Layer* layer = tile->getColorLayer(layerNum); osgTerrain::ImageLayer* imageLayer = dynamic_cast<osgTerrain::ImageLayer*>(layer); if (imageLayer) { OE_DEBUG << LC << "createImage(" << key.str() << " layerNum=" << layerNum << ") successful." <<std::endl; ret = new osg::Image( *imageLayer->getImage() ); } else { osgTerrain::SwitchLayer* switchLayer = dynamic_cast<osgTerrain::SwitchLayer*>(layer); if (switchLayer && layerSetName.isSet()) { for(unsigned int si=0; !imageLayer && si<switchLayer->getNumLayers(); ++si) { if(switchLayer->getSetName(si) == layerSetName.value()) { imageLayer = dynamic_cast<osgTerrain::ImageLayer*>(switchLayer->getLayer(si)); } } } if(imageLayer) { OE_DEBUG << LC << "createImage(" << key.str() << " layerSet=" << layerSetName.value() << ") successful." <<std::endl; ret = new osg::Image( *imageLayer->getImage() ); } } } if(!ret) { OE_DEBUG << LC << "createImage(" << key.str() << " layerSet=" << layerSetName.value() << " layerNum=" << layerNum << "/" << numColorLayers << ") failed." <<std::endl; } } else { OE_DEBUG << LC << "createImage(" << key.str() << ") database retrieval failed." <<std::endl; } return ret; }
virtual std::string VPBSource::getExtension | ( | ) | const [inline, virtual] |
Gets the preferred extension for this TileSource
Reimplemented from osgEarth::TileSource.
Definition at line 611 of file Copy of ReaderWriterVPB.cpp.
{ //All VPB tiles are in IVE format return _vpbDatabase->getExtension(); }
virtual std::string VPBSource::getExtension | ( | ) | const [inline, virtual] |
Gets the preferred extension for this TileSource
Reimplemented from osgEarth::TileSource.
Definition at line 621 of file ReaderWriterVPB.cpp.
{ //All VPB tiles are in IVE format return _vpbDatabase->_extension; }
void VPBSource::initialize | ( | const std::string & | referenceURI, |
const Profile * | overrideProfile | ||
) | [inline, virtual] |
Initialize the TileSource. The profile should be computed and set here using setProfile()
Implements osgEarth::TileSource.
Definition at line 560 of file Copy of ReaderWriterVPB.cpp.
{ if ( overrideProfile) { setProfile( overrideProfile ); } else { setProfile( _vpbDatabase->getProfile() ); //profile.get() ); } }
void VPBSource::initialize | ( | const std::string & | referenceURI, |
const Profile * | overrideProfile | ||
) | [inline, virtual] |
Initialize the TileSource. The profile should be computed and set here using setProfile()
Implements osgEarth::TileSource.
Definition at line 529 of file ReaderWriterVPB.cpp.
{ _referenceUri = referenceURI; _vpbDatabase->initialize(referenceURI); if ( overrideProfile) { setProfile( overrideProfile ); } else { setProfile(_vpbDatabase->_profile.get()); } }
unsigned int VPBSource::_layerNum [private] |
Definition at line 619 of file Copy of ReaderWriterVPB.cpp.
const VPBOptions VPBSource::_options [private] |
Reimplemented from osgEarth::TileSource.
Definition at line 629 of file ReaderWriterVPB.cpp.
osg::ref_ptr<PluginOptions> VPBSource::_options [private] |
Reimplemented from osgEarth::TileSource.
Definition at line 620 of file Copy of ReaderWriterVPB.cpp.
std::string VPBSource::_referenceUri [private] |
Definition at line 630 of file ReaderWriterVPB.cpp.
osg::ref_ptr< VPBDatabase > VPBSource::_vpbDatabase [private] |
Definition at line 618 of file Copy of ReaderWriterVPB.cpp.