2019-01-06 18:45:09 +01:00
|
|
|
#ifndef DEM_H
|
|
|
|
#define DEM_H
|
|
|
|
|
2019-01-17 00:47:44 +01:00
|
|
|
#include <QString>
|
2019-01-22 23:00:02 +01:00
|
|
|
#include <QCache>
|
2019-01-06 18:45:09 +01:00
|
|
|
#include <QByteArray>
|
2021-01-10 13:23:43 +01:00
|
|
|
#include "common/config.h"
|
2019-01-06 18:45:09 +01:00
|
|
|
|
2019-01-17 00:47:44 +01:00
|
|
|
class QString;
|
2019-01-06 18:45:09 +01:00
|
|
|
class Coordinates;
|
|
|
|
|
|
|
|
class DEM
|
|
|
|
{
|
|
|
|
private:
|
2019-01-22 23:00:02 +01:00
|
|
|
class Key {
|
|
|
|
public:
|
|
|
|
Key(int lon, int lat) : _lon(lon), _lat(lat) {}
|
2019-01-06 18:45:09 +01:00
|
|
|
|
2019-01-22 23:00:02 +01:00
|
|
|
int lon() const {return _lon;}
|
|
|
|
int lat() const {return _lat;}
|
2019-01-06 18:45:09 +01:00
|
|
|
|
2019-01-22 23:00:02 +01:00
|
|
|
bool operator==(const Key &other) const
|
2019-01-06 18:45:09 +01:00
|
|
|
{
|
2019-01-22 23:00:02 +01:00
|
|
|
return (_lon == other._lon && _lat == other._lat);
|
2019-01-06 18:45:09 +01:00
|
|
|
}
|
2019-01-22 23:00:02 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
int _lon, _lat;
|
2019-01-06 18:45:09 +01:00
|
|
|
};
|
|
|
|
|
2020-12-31 14:03:30 +01:00
|
|
|
static QString baseName(const Key &key);
|
|
|
|
static QString fileName(const QString &baseName);
|
2019-01-06 18:45:09 +01:00
|
|
|
|
2019-01-17 00:47:44 +01:00
|
|
|
static QString _dir;
|
2019-01-22 23:00:02 +01:00
|
|
|
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);
|
2019-01-06 18:45:09 +01:00
|
|
|
};
|
|
|
|
|
2021-01-10 13:23:43 +01:00
|
|
|
inline HASH_T qHash(const DEM::Key &key)
|
2019-01-22 23:00:02 +01:00
|
|
|
{
|
2021-01-10 13:23:43 +01:00
|
|
|
return (qHash(key.lon()) ^ qHash(key.lat()));
|
2019-01-22 23:00:02 +01:00
|
|
|
}
|
|
|
|
|
2019-01-06 18:45:09 +01:00
|
|
|
#endif // DEM_H
|