osgEarth 2.1.1
Public Member Functions | Private Attributes

AGSMapCacheSource Class Reference

Inheritance diagram for AGSMapCacheSource:
Collaboration diagram for AGSMapCacheSource:

List of all members.

Public Member Functions

 AGSMapCacheSource (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

Private Attributes

std::string _url
std::string _map
std::string _layer
std::string _format

Detailed Description

Definition at line 39 of file ReaderWriterArcGISMapCache.cpp.


Constructor & Destructor Documentation

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

Definition at line 42 of file ReaderWriterArcGISMapCache.cpp.

                                                          :
      TileSource( options )
    {
        const Config& conf = options.getConfig();

        // this is the AGS virtual directory pointing to the map cache
        _url = conf.value( PROPERTY_URL );

        // the name of the map service cache
        _map = conf.value( PROPERTY_MAP );

        // the layer, or null to use the fused "_alllayers" cache
        _layer = conf.value( PROPERTY_LAYER );

        // the image format (defaults to "png")
        // TODO: read this from the XML tile schema file
        _format = conf.value( PROPERTY_FORMAT );

        // validate dataset
        if ( _layer.empty() )
            _layer = "_alllayers"; // default to the AGS "fused view"

        if ( _format.empty() )
            _format = "png";
    }

Here is the call graph for this function:


Member Function Documentation

osg::HeightField* AGSMapCacheSource::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 110 of file ReaderWriterArcGISMapCache.cpp.

    {
        //TODO
        return NULL;
    }
osg::Image* AGSMapCacheSource::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 75 of file ReaderWriterArcGISMapCache.cpp.

    {
        //If we are given a PlateCarreTileKey, use the MercatorTileConverter to create the image
        //if ( dynamic_cast<const PlateCarreTileKey&>( key ) )
        //{
        //    MercatorTileConverter converter( this );
        //    return converter.createImage( static_cast<const PlateCarreTileKey&>( key ) );
        //}

        std::stringstream buf;

        //int level = key.getLevelOfDetail();
        int level = key.getLevelOfDetail()-1;

        unsigned int tile_x, tile_y;
        key.getTileXY( tile_x, tile_y );

        buf << _url << "/" << _map 
            << "/Layers/" << _layer
            << "/L" << std::hex << std::setw(2) << std::setfill('0') << level
            << "/R" << std::hex << std::setw(8) << std::setfill('0') << tile_y
            << "/C" << std::hex << std::setw(8) << std::setfill('0') << tile_x << "." << _format;

        //OE_NOTICE << "Key = " << key.str() << ", URL = " << buf.str() << std::endl;
        //return osgDB::readImageFile( buf.str(), getOptions() );
        //return HTTPClient::readImageFile( buf.str(), getOptions(), progress);
        
        osg::ref_ptr<osg::Image> image;
                std::string bufStr;
                bufStr = buf.str();
        HTTPClient::readImageFile( bufStr, image, 0L, progress ); //getOptions(), progress );
        return image.release();
    }

Here is the call graph for this function:

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

Gets the preferred extension for this TileSource

Reimplemented from osgEarth::TileSource.

Definition at line 118 of file ReaderWriterArcGISMapCache.cpp.

    {
        return _format;
    }
void AGSMapCacheSource::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 68 of file ReaderWriterArcGISMapCache.cpp.

    {
        //Set the profile to global geodetic.
        setProfile(osgEarth::Registry::instance()->getGlobalGeodeticProfile());
    }

Here is the call graph for this function:


Member Data Documentation

std::string AGSMapCacheSource::_format [private]

Definition at line 127 of file ReaderWriterArcGISMapCache.cpp.

std::string AGSMapCacheSource::_layer [private]

Definition at line 126 of file ReaderWriterArcGISMapCache.cpp.

std::string AGSMapCacheSource::_map [private]

Definition at line 125 of file ReaderWriterArcGISMapCache.cpp.

std::string AGSMapCacheSource::_url [private]

Definition at line 124 of file ReaderWriterArcGISMapCache.cpp.


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