mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-20 09:40:49 +01:00
Compare commits
3 Commits
f026387d76
...
267094dc6c
Author | SHA1 | Date | |
---|---|---|---|
267094dc6c | |||
7be3a27196 | |||
00a349575c |
@ -56,6 +56,7 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
|
||||
"QThreadStorage: Thread X exited after QThreadStorage Y destroyed" */
|
||||
Downloader::setNetworkManager(new QNetworkAccessManager(this));
|
||||
DEM::setDir(ProgramPaths::demDir());
|
||||
DEM::setCacheSize(536870912/*512MB*/);
|
||||
QSurfaceFormat fmt;
|
||||
fmt.setStencilBufferSize(8);
|
||||
fmt.setSamples(4);
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include "common/rectc.h"
|
||||
#include "dem.h"
|
||||
|
||||
|
||||
#define SRTM3_SAMPLES 1201
|
||||
#define SRTM1_SAMPLES 3601
|
||||
#define SRTM3_SAMPLES 1201
|
||||
#define SRTM1_SAMPLES 3601
|
||||
#define SRTM05_SAMPLES 7201
|
||||
|
||||
#define SRTM_SIZE(samples) \
|
||||
((samples) * (samples) * 2)
|
||||
@ -51,6 +51,8 @@ static qreal height(const Coordinates &c, const QByteArray *data)
|
||||
samples = SRTM3_SAMPLES;
|
||||
else if (data->size() == SRTM_SIZE(SRTM1_SAMPLES))
|
||||
samples = SRTM1_SAMPLES;
|
||||
else if (data->size() == SRTM_SIZE(SRTM05_SAMPLES))
|
||||
samples = SRTM05_SAMPLES;
|
||||
else
|
||||
return NAN;
|
||||
|
||||
@ -85,13 +87,18 @@ QString DEM::Tile::baseName() const
|
||||
}
|
||||
|
||||
QString DEM::_dir;
|
||||
QCache<DEM::Tile, QByteArray> DEM::_data;
|
||||
DEM::TileCache DEM::_data;
|
||||
|
||||
QString DEM::fileName(const QString &baseName)
|
||||
{
|
||||
return QDir(_dir).absoluteFilePath(baseName);
|
||||
}
|
||||
|
||||
void DEM::setCacheSize(int size)
|
||||
{
|
||||
_data.setMaxCost(size);
|
||||
}
|
||||
|
||||
void DEM::setDir(const QString &path)
|
||||
{
|
||||
_dir = path;
|
||||
@ -119,7 +126,7 @@ qreal DEM::elevation(const Coordinates &c)
|
||||
QZipReader zip(zn, QIODevice::ReadOnly);
|
||||
ba = new QByteArray(zip.fileData(bn));
|
||||
qreal ele = height(c, ba);
|
||||
_data.insert(tile, ba);
|
||||
_data.insert(tile, ba, ba->size());
|
||||
return ele;
|
||||
} else {
|
||||
QFile file(fn);
|
||||
@ -131,7 +138,7 @@ qreal DEM::elevation(const Coordinates &c)
|
||||
} else {
|
||||
ba = new QByteArray(file.readAll());
|
||||
qreal ele = height(c, ba);
|
||||
_data.insert(tile, ba);
|
||||
_data.insert(tile, ba, ba->size());
|
||||
return ele;
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
int _lon, _lat;
|
||||
};
|
||||
|
||||
static void setCacheSize(int size);
|
||||
static void setDir(const QString &path);
|
||||
static void clearCache();
|
||||
static qreal elevation(const Coordinates &c);
|
||||
@ -41,10 +42,12 @@ public:
|
||||
static QList<Area> tiles();
|
||||
|
||||
private:
|
||||
typedef QCache<DEM::Tile, QByteArray> TileCache;
|
||||
|
||||
static QString fileName(const QString &baseName);
|
||||
|
||||
static QString _dir;
|
||||
static QCache<Tile, QByteArray> _data;
|
||||
static TileCache _data;
|
||||
};
|
||||
|
||||
inline HASH_T qHash(const DEM::Tile &tile)
|
||||
|
@ -279,9 +279,8 @@ void Style::defaultPolygonStyle()
|
||||
// Draw order
|
||||
_drawOrder
|
||||
<< TYPE(0x4b) << 0x10d01 << 0x10104 << TYPE(0x4a)
|
||||
<< 0x10101 << 0x10102 << 0x10301 << 0x10302 << 0x10303
|
||||
<< 0x10304 << 0x10305 << 0x10306 << 0x10613 << 0x10105
|
||||
<< 0x10409 << 0x10503 << 0x10601 << 0x1060a
|
||||
<< 0x10101 << 0x10102 << 0x10301 << 0x10302 << 0x10303 << 0x10304
|
||||
<< 0x10305 << 0x10306
|
||||
<< TYPE(0x01) << 0x10800 << TYPE(0x02) << 0x10801 << TYPE(0x03) << 0x10802
|
||||
<< TYPE(0x17) << 0x10a04 << TYPE(0x18) << 0x1090c << TYPE(0x1a) << 0x1090e
|
||||
<< TYPE(0x28) << 0x10b01 << TYPE(0x32) << 0x10b02 << TYPE(0x3c) << 0x10b03
|
||||
@ -298,7 +297,8 @@ void Style::defaultPolygonStyle()
|
||||
<< TYPE(0x0a) << 0x10907 << TYPE(0x0b) << 0x10908 << TYPE(0x0c) << 0x10909
|
||||
<< TYPE(0x0d) << 0x1090a << TYPE(0x0e) << 0x1090b << TYPE(0x0f)
|
||||
<< TYPE(0x10) << TYPE(0x11) << TYPE(0x12) << TYPE(0x19) << 0x1090d
|
||||
<< TYPE(0x13) << 0x10900;
|
||||
<< TYPE(0x13) << 0x10900 << 0x10613 << 0x10105 << 0x10409 << 0x10503
|
||||
<< 0x10601 << 0x1060a;
|
||||
}
|
||||
|
||||
void Style::defaultLineStyle()
|
||||
|
Loading…
x
Reference in New Issue
Block a user