Fixed build with older Qt versions
[GPXSee.git] / src / data / dem.h
blob727fe6ee989a49375ed88e4b221982593e359716
1 #ifndef DEM_H
2 #define DEM_H
4 #include <QString>
5 #include <QCache>
6 #include <QByteArray>
7 #include "common/hash.h"
8 #include "area.h"
10 class QString;
11 class Coordinates;
12 class RectC;
14 class DEM
16 public:
17 class Tile {
18 public:
19 Tile(int lon, int lat) : _lon(lon), _lat(lat) {}
21 int lon() const {return _lon;}
22 int lat() const {return _lat;}
24 QString lonStr() const;
25 QString latStr() const;
26 QString baseName() const;
28 bool operator==(const Tile &other) const
30 return (_lon == other._lon && _lat == other._lat);
33 private:
34 int _lon, _lat;
37 static void setCacheSize(int size);
38 static void setDir(const QString &path);
39 static void clearCache();
40 static qreal elevation(const Coordinates &c);
42 static QList<Area> tiles();
44 private:
45 typedef QCache<DEM::Tile, QByteArray> TileCache;
47 static QString fileName(const QString &baseName);
49 static QString _dir;
50 static TileCache _data;
53 inline HASH_T qHash(const DEM::Tile &tile)
55 return (qHash(tile.lon()) ^ qHash(tile.lat()));
58 #ifndef QT_NO_DEBUG
59 QDebug operator<<(QDebug dbg, const DEM::Tile &tile);
60 #endif // QT_NO_DEBUG
62 #endif // DEM_H