1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 19:55:53 +01:00
GPXSee/src/data/dem.h

50 lines
855 B
C
Raw Normal View History

#ifndef DEM_H
#define DEM_H
#include <QString>
#include <QCache>
#include <QByteArray>
2021-01-10 13:23:43 +01:00
#include "common/config.h"
class QString;
class Coordinates;
class DEM
{
private:
class Key {
public:
Key(int lon, int lat) : _lon(lon), _lat(lat) {}
int lon() const {return _lon;}
int lat() const {return _lat;}
bool operator==(const Key &other) const
{
return (_lon == other._lon && _lat == other._lat);
}
private:
int _lon, _lat;
};
2020-12-31 14:03:30 +01:00
static QString baseName(const Key &key);
static QString fileName(const QString &baseName);
static QString _dir;
static QCache<Key, QByteArray> _data;
public:
static void setDir(const QString &path);
static qreal elevation(const Coordinates &c);
2021-01-10 13:23:43 +01:00
friend HASH_T qHash(const Key &key);
};
2021-01-10 13:23:43 +01:00
inline HASH_T qHash(const DEM::Key &key)
{
2021-01-10 13:23:43 +01:00
return (qHash(key.lon()) ^ qHash(key.lat()));
}
#endif // DEM_H