1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-03-18 20:47:46 +01:00
GPXSee/src/data/dem.h

66 lines
1.2 KiB
C
Raw Normal View History

#ifndef DEM_H
#define DEM_H
#include <QString>
#include <QCache>
#include <QByteArray>
2024-02-21 08:49:09 +01:00
#include <QMutex>
#include "common/hash.h"
2021-09-23 22:44:21 +02:00
#include "area.h"
class Coordinates;
class DEM
{
public:
class Tile {
public:
Tile(int lon, int lat) : _lon(lon), _lat(lat) {}
int lon() const {return _lon;}
int lat() const {return _lat;}
QString lonStr() const;
QString latStr() const;
QString baseName() const;
bool operator==(const Tile &other) const
{
return (_lon == other._lon && _lat == other._lat);
}
private:
int _lon, _lat;
};
2023-03-01 00:23:01 +01:00
static void setCacheSize(int size);
static void setDir(const QString &path);
2021-09-01 13:08:34 +02:00
static void clearCache();
2024-02-21 08:49:09 +01:00
2024-02-21 18:54:27 +01:00
static double elevation(const Coordinates &c);
2024-02-21 08:49:09 +01:00
static void lock() {_lock.lock();}
static void unlock() {_lock.unlock();}
2021-09-23 22:44:21 +02:00
static QList<Area> tiles();
private:
typedef QCache<DEM::Tile, QByteArray> TileCache;
static QString fileName(const QString &baseName);
static QString _dir;
static TileCache _data;
2024-02-21 08:49:09 +01:00
static QMutex _lock;
};
inline HASH_T qHash(const DEM::Tile &tile)
{
return (qHash(tile.lon()) ^ qHash(tile.lat()));
}
#ifndef QT_NO_DEBUG
QDebug operator<<(QDebug dbg, const DEM::Tile &tile);
#endif // QT_NO_DEBUG
#endif // DEM_H