mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Compare commits
4 Commits
3b4376cc03
...
7de180d580
Author | SHA1 | Date | |
---|---|---|---|
7de180d580 | |||
bd37521ca0 | |||
4445976cb9 | |||
76b14c23c6 |
@ -727,14 +727,14 @@ QWidget *OptionsDialog::createSystemPage()
|
||||
_enableHTTP2->setChecked(_options.enableHTTP2);
|
||||
|
||||
_pixmapCache = new QSpinBox();
|
||||
_pixmapCache->setMinimum(16);
|
||||
_pixmapCache->setMaximum(2048);
|
||||
_pixmapCache->setMinimum(64);
|
||||
_pixmapCache->setMaximum(4096);
|
||||
_pixmapCache->setSuffix(UNIT_SPACE + tr("MB"));
|
||||
_pixmapCache->setValue(_options.pixmapCache);
|
||||
|
||||
_demCache = new QSpinBox();
|
||||
_demCache->setMinimum(64);
|
||||
_demCache->setMaximum(2048);
|
||||
_demCache->setMaximum(4096);
|
||||
_demCache->setSuffix(UNIT_SPACE + tr("MB"));
|
||||
_demCache->setValue(_options.demCache);
|
||||
|
||||
|
@ -65,7 +65,7 @@ QString DEM::Tile::lonStr() const
|
||||
return QString("%1%2").arg(ew).arg(qAbs(_lon), 3, 10, QChar('0'));
|
||||
}
|
||||
|
||||
QString DEM::Tile::baseName() const
|
||||
QString DEM::Tile::fileName() const
|
||||
{
|
||||
return QString("%1%2.hgt").arg(latStr(), lonStr());
|
||||
}
|
||||
@ -75,7 +75,7 @@ DEM::TileCache DEM::_data;
|
||||
|
||||
void DEM::setCacheSize(int size)
|
||||
{
|
||||
_data.setMaxCost(size * 1024);
|
||||
_data.setMaxCost(size);
|
||||
}
|
||||
|
||||
void DEM::setDir(const QString &path)
|
||||
@ -108,15 +108,15 @@ double DEM::height(const Coordinates &c, const Entry *e)
|
||||
|
||||
DEM::Entry *DEM::loadTile(const Tile &tile)
|
||||
{
|
||||
QString bn(tile.baseName());
|
||||
QString fn(QDir(_dir).absoluteFilePath(bn));
|
||||
QString zn(fn + ".zip");
|
||||
QString fileName(tile.fileName());
|
||||
QString path(QDir(_dir).absoluteFilePath(fileName));
|
||||
QString zipPath(path + ".zip");
|
||||
|
||||
if (QFileInfo::exists(zn)) {
|
||||
QZipReader zip(zn, QIODevice::ReadOnly);
|
||||
return new Entry(zip.fileData(bn));
|
||||
if (QFileInfo::exists(zipPath)) {
|
||||
QZipReader zip(zipPath, QIODevice::ReadOnly);
|
||||
return new Entry(zip.fileData(fileName));
|
||||
} else {
|
||||
QFile file(fn);
|
||||
QFile file(path);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qWarning("%s: %s", qPrintable(file.fileName()),
|
||||
qPrintable(file.errorString()));
|
||||
@ -138,7 +138,7 @@ double DEM::elevation(const Coordinates &c)
|
||||
if (!e) {
|
||||
e = loadTile(tile);
|
||||
ele = height(c, e);
|
||||
_data.insert(tile, e, e->data().size());
|
||||
_data.insert(tile, e, e->data().size() / 1024);
|
||||
} else
|
||||
ele = height(c, e);
|
||||
|
||||
@ -147,15 +147,15 @@ double DEM::elevation(const Coordinates &c)
|
||||
|
||||
QList<Area> DEM::tiles()
|
||||
{
|
||||
static const QRegularExpression re("([NS])([0-9]{2})([EW])([0-9]{3})");
|
||||
static const QRegularExpression re(
|
||||
"^([NS])([0-9]{2})([EW])([0-9]{3})(\\.hgt|\\.hgt\\.zip)$");
|
||||
QDir dir(_dir);
|
||||
QFileInfoList files(dir.entryInfoList(QDir::Files | QDir::Readable));
|
||||
QLocale l(QLocale::system());
|
||||
QList<Area> list;
|
||||
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
QString basename(files.at(i).baseName());
|
||||
QRegularExpressionMatch match(re.match(basename));
|
||||
QRegularExpressionMatch match(re.match(files.at(i).fileName()));
|
||||
if (!match.hasMatch())
|
||||
continue;
|
||||
|
||||
@ -167,7 +167,7 @@ QList<Area> DEM::tiles()
|
||||
lon = -lon;
|
||||
|
||||
Area area(RectC(Coordinates(lon, lat + 1), Coordinates(lon + 1, lat)));
|
||||
area.setName(basename);
|
||||
area.setName(files.at(i).baseName());
|
||||
area.setDescription(files.at(i).suffix().toUpper() + ", "
|
||||
+ l.formattedDataSize(files.at(i).size()));
|
||||
area.setStyle(PolygonStyle(QColor(0xFF, 0, 0, 0x40),
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
|
||||
QString lonStr() const;
|
||||
QString latStr() const;
|
||||
QString baseName() const;
|
||||
QString fileName() const;
|
||||
|
||||
bool operator==(const Tile &other) const
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ QUrl DEMLoader::tileUrl(const DEM::Tile &tile) const
|
||||
|
||||
QString DEMLoader::tileFile(const DEM::Tile &tile) const
|
||||
{
|
||||
return _dir.absoluteFilePath(tile.baseName());
|
||||
return _dir.absoluteFilePath(tile.fileName());
|
||||
}
|
||||
|
||||
void DEMLoader::setAuthorization(const Authorization &authorization)
|
||||
|
Loading…
Reference in New Issue
Block a user