#ifndef __TN_TERRAIN_TEXTURE_TILE_PROVIDER_H__
#define __TN_TERRAIN_TEXTURE_TILE_PROVIDER_H__

#include "foundation/Thread.h"
#include "foundation/Mutex.h"
#include "TnTileProvider.h"

class TnTerrainTextureTileProvider : public TnTileProvider
{
public:

    TnTerrainTextureTileProvider(TnMapRasterTileData::eProviderType type, std::string baseURL);
    
    // Fill in RasterTileImageData, and set the request result
    virtual void GetTilesFor(TnMapRasterTileData::ptr const & data, int zoomBias);// The more negative, the more blurry.    
                                                                                    // Default in json should be -1

    
protected:
    
    std::string const & BaseURL() const;
    
    virtual std::string GetTileURL(TnMapRasterTileData::ptr const & data) const;
    
private:
    std::string m_baseURL;
    
    // Background loader for metadata URL
    //void BackgroundLoader();

    // Threaded url use
    Tn::Foundation::shared_ptr<Tn::Foundation::thread> m_Thread;
    Tn::Foundation::mutex m_Mutex;
};

//Just has a different URL generation
class TnTerrainTextureTileProviderEx : public TnTerrainTextureTileProvider
{
public:
    
    TnTerrainTextureTileProviderEx(TnMapRasterTileData::eProviderType type, std::string baseURL) : TnTerrainTextureTileProvider(type,baseURL){}
    
protected:
    virtual std::string GetTileURL(TnMapRasterTileData::ptr const & data) const;
};

#endif // __TN_TERRAIN_TEXTURE_TILE_PROVIDER_H__

