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"
|
2021-09-23 22:44:21 +02:00
|
|
|
#include "area.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;
|
2021-08-30 20:31:33 +02:00
|
|
|
class RectC;
|
2019-01-06 18:45:09 +01:00
|
|
|
|
|
|
|
class DEM
|
|
|
|
{
|
2021-08-30 20:31:33 +02:00
|
|
|
public:
|
|
|
|
class Tile {
|
2019-01-22 23:00:02 +01:00
|
|
|
public:
|
2021-08-30 20:31:33 +02:00
|
|
|
Tile(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
|
|
|
|
2021-08-30 20:31:33 +02:00
|
|
|
QString lonStr() const;
|
|
|
|
QString latStr() const;
|
|
|
|
QString baseName() const;
|
|
|
|
|
|
|
|
bool operator==(const Tile &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
|
|
|
};
|
|
|
|
|
2019-01-22 23:00:02 +01:00
|
|
|
static void setDir(const QString &path);
|
2021-09-01 13:08:34 +02:00
|
|
|
static void clearCache();
|
2019-01-22 23:00:02 +01:00
|
|
|
static qreal elevation(const Coordinates &c);
|
|
|
|
|
2021-09-23 22:44:21 +02:00
|
|
|
static QList<Area> tiles();
|
|
|
|
|
2021-08-30 20:31:33 +02:00
|
|
|
private:
|
|
|
|
static QString fileName(const QString &baseName);
|
|
|
|
|
|
|
|
static QString _dir;
|
|
|
|
static QCache<Tile, QByteArray> _data;
|
2019-01-06 18:45:09 +01:00
|
|
|
};
|
|
|
|
|
2021-08-30 20:31:33 +02:00
|
|
|
inline HASH_T qHash(const DEM::Tile &tile)
|
2019-01-22 23:00:02 +01:00
|
|
|
{
|
2021-08-30 20:31:33 +02:00
|
|
|
return (qHash(tile.lon()) ^ qHash(tile.lat()));
|
2019-01-22 23:00:02 +01:00
|
|
|
}
|
|
|
|
|
2021-08-30 20:31:33 +02:00
|
|
|
#ifndef QT_NO_DEBUG
|
|
|
|
QDebug operator<<(QDebug dbg, const DEM::Tile &tile);
|
|
|
|
#endif // QT_NO_DEBUG
|
|
|
|
|
2019-01-06 18:45:09 +01:00
|
|
|
#endif // DEM_H
|