osgEarth 2.1.1
Public Member Functions | Private Attributes

TileServiceSource Class Reference

Inheritance diagram for TileServiceSource:
Collaboration diagram for TileServiceSource:

List of all members.

Public Member Functions

 TileServiceSource (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)
std::string createURI (const TileKey &key) const
virtual std::string getExtension () const

Private Attributes

std::string _formatToUse
const TileServiceOptions _options

Detailed Description

Definition at line 40 of file ReaderWriterTileService.cpp.


Constructor & Destructor Documentation

TileServiceSource::TileServiceSource ( const TileSourceOptions options) [inline]

Definition at line 43 of file ReaderWriterTileService.cpp.

                                                              : TileSource( options ), _options(options)
    {        
        _formatToUse =
            _options.format()->empty() ? "png" : _options.format().value();
    }

Member Function Documentation

osg::HeightField* TileServiceSource::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 72 of file ReaderWriterTileService.cpp.

    {
        //NOP
        return NULL;
    }
osg::Image* TileServiceSource::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 65 of file ReaderWriterTileService.cpp.

    {        
        osg::ref_ptr<osg::Image> image;
        HTTPClient::readImageFile( createURI( key ), image, 0L, progress ); //getOptions(), progress );
        return image.release();
    }

Here is the call graph for this function:

std::string TileServiceSource::createURI ( const TileKey key) const [inline]

Definition at line 79 of file ReaderWriterTileService.cpp.

    {
        unsigned int x, y;
        key.getTileXY(x, y);

        unsigned int lod = key.getLevelOfDetail()+1;

        std::stringstream buf;
        //http://s0.tileservice.worldwindcentral.com/getTile?interface=map&version=1&dataset=bmng.topo.bathy.200401&level=0&x=0&y=0
        buf << _options.url()->full() << "interface=map&version=1"
            << "&dataset=" << _options.dataset().value()
            << "&level=" << lod
            << "&x=" << x
            << "&y=" << y
            << "&." << _formatToUse; //Add this to trick osg into using the correct loader.
        std::string bufStr;
                bufStr = buf.str();
                return bufStr;
    }

Here is the call graph for this function:

virtual std::string TileServiceSource::getExtension ( ) const [inline, virtual]

Gets the preferred extension for this TileSource

Reimplemented from osgEarth::TileSource.

Definition at line 99 of file ReaderWriterTileService.cpp.

    {
        return _formatToUse;
    }
void TileServiceSource::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 50 of file ReaderWriterTileService.cpp.

    {
                //Take on the override profile if one is given.
                if (overrideProfile)
                {
                        setProfile( overrideProfile );
                }
                else
                {
                        //Assume it is global geodetic
                        setProfile( osgEarth::Registry::instance()->getGlobalGeodeticProfile() );
                }
    }

Here is the call graph for this function:


Member Data Documentation

std::string TileServiceSource::_formatToUse [private]

Definition at line 105 of file ReaderWriterTileService.cpp.

Reimplemented from osgEarth::TileSource.

Definition at line 106 of file ReaderWriterTileService.cpp.


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