osgEarth 2.1.1
|
Public Member Functions | |
YahooSource (const TileSourceOptions &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 |
virtual bool | supportsPersistentCaching () const |
Private Attributes | |
const YahooOptions | _options |
Definition at line 36 of file ReaderWriterYahoo.cpp.
YahooSource::YahooSource | ( | const TileSourceOptions & | options | ) | [inline] |
Definition at line 39 of file ReaderWriterYahoo.cpp.
: TileSource( options ), _options(options) { //nop }
osg::HeightField* YahooSource::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 101 of file ReaderWriterYahoo.cpp.
osg::Image* YahooSource::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 50 of file ReaderWriterYahoo.cpp.
{ //Return NULL if we are given a non global-mercator key if ( !key.getProfile()->getProfileType() == Profile::TYPE_MERCATOR ) return 0; std::stringstream buf; std::string dataset = _options.dataset().isSet() ? _options.dataset().value() : "roads"; if ( dataset == "roads" || dataset == "map" ) { // http://us.maps1.yimg.com/us.tile.maps.yimg.com/tl?v=4.1&md=2&x=0&y=0&z=2&r=1 unsigned int tile_x, tile_y; key.getTileXY( tile_x, tile_y ); unsigned int zoom = key.getLevelOfDetail(); unsigned int size_x, size_y; key.getProfile()->getNumTiles( zoom, size_x, size_y ); buf << "http://us.maps1.yimg.com/us.tile.maps.yimg.com/tl" << "?v=4.1&md=2&r=1" << "&x=" << (int)tile_x << "&y=" << ((int)size_y-1-(int)tile_y) - (int)size_y/2 << "&z=" << zoom + 2; } else if ( dataset == "aerial" || dataset == "satellite" ) { unsigned int tile_x, tile_y; key.getTileXY( tile_x, tile_y ); unsigned int zoom = key.getLevelOfDetail(); unsigned int size_x, size_y; key.getProfile()->getNumTiles( zoom, size_x, size_y ); buf << "http://us.maps3.yimg.com/aerial.maps.yimg.com/ximg" << "?v=1.8&s=256&t=a&r=1" << "&x=" << (int)tile_x << "&y=" << ((int)size_y-1-(int)tile_y) - (int)size_y/2 << "&z=" << zoom + 2; } std::string base; base = buf.str(); OE_DEBUG << key.str() << "=" << base << std::endl; osg::ref_ptr<osg::Image> image; HTTPClient::readImageFile( base, image, 0L, progress ); //getOptions(), progress ); return image.release(); }
virtual std::string YahooSource::getExtension | ( | ) | const [inline, virtual] |
Gets the preferred extension for this TileSource
Reimplemented from osgEarth::TileSource.
Definition at line 109 of file ReaderWriterYahoo.cpp.
{ //All Yahoo tiles are in JPEG format return "jpg"; }
void YahooSource::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 45 of file ReaderWriterYahoo.cpp.
{ setProfile( Profile::create( "spherical-mercator", "", 2, 2 ) ); }
virtual bool YahooSource::supportsPersistentCaching | ( | ) | const [inline, virtual] |
Returns true if data from this source can be cached to disk
Reimplemented from osgEarth::TileSource.
Definition at line 115 of file ReaderWriterYahoo.cpp.
{ return false; }
const YahooOptions YahooSource::_options [private] |
Reimplemented from osgEarth::TileSource.
Definition at line 121 of file ReaderWriterYahoo.cpp.