/*
 *  TnMapRasterTileData.h
 *  OpenGL Map Engine
 *
 */

#ifndef TN_MAP_RASTER_TILE_DATA_H
#define TN_MAP_RASTER_TILE_DATA_H

#include <string>

#include <foundation/SharedPtr.h>
#include <foundation/WeakPtr.h>

#include <foundation/TnTypes.h>
#include <RenderEngine/TnMapTileDataRequest.h>

/*! Engine implements this and passes an instance to the client as an
 *  argument to the asynchronous request. The client populates the
 *  data and calls the appropriate method to complete the response. */


class TnMapRasterTileData : public TnMapTileDataRequest
{
public:
    // Tile provider type
    enum eProviderType
    {
        BEGIN = 0, 
        AERIAL_PHOTOS = BEGIN,
        AERIAL_PHOTOS_WITH_LABELS,
        RASTER_ROAD,
        TERRAIN_HEIGHT_MAP,
        COUNT
    };
    
    static char const * toString(eProviderType);
    static char const * toCacheName(eProviderType);

    typedef Tn::Foundation::shared_ptr<TnMapRasterTileData> ptr;
    typedef Tn::Foundation::weak_ptr<TnMapRasterTileData> wptr;

    //pure virtual interface
    
    virtual ~TnMapRasterTileData() {}
    
    virtual eProviderType GetProviderType() const = 0;
    virtual void GetTileBounds(double & degreesLatitudeN, double & degreesLongitudeE, double & degreesLatitudeS, double & degreesLongitudeW) const = 0;
    virtual uint32_t GetTileZoomLevel() const = 0;

    virtual void AddRasterTile(std::string const & url, double degreesLatitudeN, double degreesLongitudeE, double degreesLatitudeS, double degreesLongitudeW) = 0;

	virtual bool GetTileURL(std::string & url, int32_t index) = 0;

	virtual void AddTexture(std::string const & url, Tn::Foundation::shared_array<uint8_t>& data, uint32_t size) = 0;
    
    static std::string const & DefaultRasterCacheName();
    static std::string const & DefaultHeightmapCacheName();

protected:
    static std::string const m_defaultRasterCacheName;
    static std::string const m_defaultHeightmapCacheName;
    
    TnMapRasterTileData();
};

#endif
