#ifndef __TN_HEIGHTMAP_TILE_PROVIDER_H__
#define __TN_HEIGHTMAP_TILE_PROVIDER_H__

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

class TnHeightmapTileProvider : public TnTileProvider
{
public:
    TnHeightmapTileProvider(TnMapRasterTileData::eProviderType type);
    
    // 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
    enum eHeightmapResolution
    {
        eHeightmapResolution_32,
        eHeightmapResolution_64,
        eHeightmapResolution_128,
        eHeightmapResolution_256
    };
    
    bool SetHeightmapResolution(eHeightmapResolution res);

protected:
    // Get location of tile heightmap, could be onboard or on network (perhaps through polymorphism)
    std::string GetTileURL(TnMapRasterTileData::ptr const & data) const;
    
private:
    // Background loader for metadata URL
    //void BackgroundLoader();

    // Threaded url use
    Tn::Foundation::shared_ptr<Tn::Foundation::thread> m_Thread;
    Tn::Foundation::mutex m_Mutex;
    
    //Resolution string tagged on to the end of the base URL
    std::string m_resolutionString;
};

#endif // __TN_HEIGHTMAP_TILE_PROVIDER_H__

