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