1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Compare commits

..

3 Commits

Author SHA1 Message Date
c9330bf273 Enable localization on Android 2022-07-06 19:43:56 +02:00
53f1c66ab0 Translated missing CZ and DE strings 2022-07-06 19:32:00 +02:00
97fdcfdd74 Code cleanup 2022-07-06 14:58:41 +02:00
13 changed files with 115 additions and 153 deletions

View File

@ -565,5 +565,7 @@ android {
csv.path = /assets/csv
symbols.files = $$files(icons/symbols/*.png)
symbols.path = /assets/symbols
INSTALLS += maps csv symbols
translations.files = $$files(lang/*.qm)
translations.path = /assets/translations
INSTALLS += maps csv symbols translations
}

View File

@ -30,12 +30,12 @@
<message>
<location filename="../src/GUI/cadencegraph.cpp" line="28"/>
<source>Avg</source>
<translation type="unfinished"></translation>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/GUI/cadencegraph.cpp" line="30"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/cadencegraph.cpp" line="33"/>
@ -210,25 +210,25 @@
<location filename="../src/GUI/elevationgraph.cpp" line="60"/>
<source>Up</source>
<extracomment>Use an Unicode arrow (U+2B08) when there is no abbreviation or extremly short term for &quot;Up&quot; in your language</extracomment>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/GUI/elevationgraph.cpp" line="64"/>
<source>Down</source>
<extracomment>Use an Unicode arrow (U+2B0A) when there is no abbreviation or extremly short term for &quot;Down&quot; in your language</extracomment>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/GUI/elevationgraph.cpp" line="68"/>
<source>Max</source>
<extracomment>Use an Unicode arrow (U+2912) when there is no abbreviation or extremly short term for &quot;Max&quot; in your language</extracomment>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/elevationgraph.cpp" line="72"/>
<source>Min</source>
<extracomment>Use an Unicode arrow (U+2913) when there is no abbreviation or extremly short term for &quot;Min&quot; in your language</extracomment>
<translation type="unfinished"></translation>
<translation>Min.</translation>
</message>
<message>
<location filename="../src/GUI/elevationgraph.cpp" line="77"/>
@ -424,7 +424,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="219"/>
<source>Open directory...</source>
<translation type="unfinished"></translation>
<translation>Otevřít adresář...</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="238"/>
@ -780,7 +780,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="945"/>
<source>Open directory</source>
<translation type="unfinished"></translation>
<translation>Otevřít adresář</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="1324"/>
@ -1024,17 +1024,17 @@
<message>
<location filename="../src/GUI/gearratiograph.cpp" line="28"/>
<source>Top</source>
<translation type="unfinished"></translation>
<translation>Nej.</translation>
</message>
<message>
<location filename="../src/GUI/gearratiograph.cpp" line="30"/>
<source>Min</source>
<translation type="unfinished"></translation>
<translation>Min.</translation>
</message>
<message>
<location filename="../src/GUI/gearratiograph.cpp" line="32"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/gearratiograph.cpp" line="35"/>
@ -1146,12 +1146,12 @@
<message>
<location filename="../src/GUI/heartrategraph.cpp" line="28"/>
<source>Avg</source>
<translation type="unfinished"></translation>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/GUI/heartrategraph.cpp" line="30"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/heartrategraph.cpp" line="33"/>
@ -1251,7 +1251,7 @@
<message>
<location filename="../src/map/maplist.cpp" line="164"/>
<source>Osmdroid SQLite maps</source>
<translation type="unfinished"></translation>
<translation>Osmdroid SQLite mapy</translation>
</message>
<message>
<location filename="../src/map/maplist.cpp" line="167"/>
@ -2126,12 +2126,12 @@
<message>
<location filename="../src/GUI/powergraph.cpp" line="28"/>
<source>Avg</source>
<translation type="unfinished"></translation>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/GUI/powergraph.cpp" line="30"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/powergraph.cpp" line="33"/>
@ -2256,12 +2256,12 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="35"/>
<source>Avg</source>
<translation type="unfinished"></translation>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="37"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="42"/>
@ -2343,17 +2343,17 @@
<message>
<location filename="../src/GUI/temperaturegraph.cpp" line="28"/>
<source>Avg</source>
<translation type="unfinished"></translation>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/GUI/temperaturegraph.cpp" line="30"/>
<source>Min</source>
<translation type="unfinished"></translation>
<translation>Min.</translation>
</message>
<message>
<location filename="../src/GUI/temperaturegraph.cpp" line="32"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/temperaturegraph.cpp" line="35"/>

View File

@ -30,12 +30,12 @@
<message>
<location filename="../src/GUI/cadencegraph.cpp" line="28"/>
<source>Avg</source>
<translation type="unfinished"></translation>
<translation>Ø</translation>
</message>
<message>
<location filename="../src/GUI/cadencegraph.cpp" line="30"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/cadencegraph.cpp" line="33"/>
@ -210,25 +210,25 @@
<location filename="../src/GUI/elevationgraph.cpp" line="60"/>
<source>Up</source>
<extracomment>Use an Unicode arrow (U+2B08) when there is no abbreviation or extremly short term for &quot;Up&quot; in your language</extracomment>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/GUI/elevationgraph.cpp" line="64"/>
<source>Down</source>
<extracomment>Use an Unicode arrow (U+2B0A) when there is no abbreviation or extremly short term for &quot;Down&quot; in your language</extracomment>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<location filename="../src/GUI/elevationgraph.cpp" line="68"/>
<source>Max</source>
<extracomment>Use an Unicode arrow (U+2912) when there is no abbreviation or extremly short term for &quot;Max&quot; in your language</extracomment>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/elevationgraph.cpp" line="72"/>
<source>Min</source>
<extracomment>Use an Unicode arrow (U+2913) when there is no abbreviation or extremly short term for &quot;Min&quot; in your language</extracomment>
<translation type="unfinished"></translation>
<translation>Min.</translation>
</message>
<message>
<location filename="../src/GUI/elevationgraph.cpp" line="77"/>
@ -436,7 +436,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="219"/>
<source>Open directory...</source>
<translation type="unfinished"></translation>
<translation>Verzeichnis öffnen...</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="238"/>
@ -792,7 +792,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="945"/>
<source>Open directory</source>
<translation type="unfinished"></translation>
<translation>Verzeichnis öffnen</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="1324"/>
@ -1023,17 +1023,17 @@
<message>
<location filename="../src/GUI/gearratiograph.cpp" line="28"/>
<source>Top</source>
<translation type="unfinished"></translation>
<translation>Mst.</translation>
</message>
<message>
<location filename="../src/GUI/gearratiograph.cpp" line="30"/>
<source>Min</source>
<translation type="unfinished"></translation>
<translation>Min.</translation>
</message>
<message>
<location filename="../src/GUI/gearratiograph.cpp" line="32"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/gearratiograph.cpp" line="35"/>
@ -1145,12 +1145,12 @@
<message>
<location filename="../src/GUI/heartrategraph.cpp" line="28"/>
<source>Avg</source>
<translation type="unfinished"></translation>
<translation>Ø</translation>
</message>
<message>
<location filename="../src/GUI/heartrategraph.cpp" line="30"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/heartrategraph.cpp" line="33"/>
@ -1250,7 +1250,7 @@
<message>
<location filename="../src/map/maplist.cpp" line="164"/>
<source>Osmdroid SQLite maps</source>
<translation type="unfinished"></translation>
<translation>Osmdroid SQLite-Karten</translation>
</message>
<message>
<location filename="../src/map/maplist.cpp" line="167"/>
@ -2125,12 +2125,12 @@
<message>
<location filename="../src/GUI/powergraph.cpp" line="28"/>
<source>Avg</source>
<translation type="unfinished"></translation>
<translation>Ø</translation>
</message>
<message>
<location filename="../src/GUI/powergraph.cpp" line="30"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/powergraph.cpp" line="33"/>
@ -2255,12 +2255,12 @@
<message>
<location filename="../src/GUI/speedgraph.cpp" line="35"/>
<source>Avg</source>
<translation type="unfinished"></translation>
<translation>Ø</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="37"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/speedgraph.cpp" line="42"/>
@ -2342,17 +2342,17 @@
<message>
<location filename="../src/GUI/temperaturegraph.cpp" line="28"/>
<source>Avg</source>
<translation type="unfinished"></translation>
<translation>Ø</translation>
</message>
<message>
<location filename="../src/GUI/temperaturegraph.cpp" line="30"/>
<source>Min</source>
<translation type="unfinished"></translation>
<translation>Min.</translation>
</message>
<message>
<location filename="../src/GUI/temperaturegraph.cpp" line="32"/>
<source>Max</source>
<translation type="unfinished"></translation>
<translation>Max.</translation>
</message>
<message>
<location filename="../src/GUI/temperaturegraph.cpp" line="35"/>

View File

@ -120,8 +120,13 @@ QString ProgramPaths::tilesDir()
QString ProgramPaths::translationsDir()
{
#ifdef Q_OS_ANDROID
return assetsPath(QStandardPaths::locate(DATA_LOCATION, TRANSLATIONS_DIR,
QStandardPaths::LocateDirectory), TRANSLATIONS_DIR);
#else // Q_OS_ANDROID
return QStandardPaths::locate(DATA_LOCATION, TRANSLATIONS_DIR,
QStandardPaths::LocateDirectory);
#endif // Q_OS_ANDROID
}
QString ProgramPaths::ellipsoidsFile()

View File

@ -5,31 +5,12 @@
#include <QBuffer>
#include <QtConcurrent>
#include "osm.h"
#include "tile.h"
#include "aqmmap.h"
#define MAGIC "FLATPACK1"
class AQTile
{
public:
AQTile(const QPoint &xy, const QByteArray &data, const QString &key)
: _xy(xy), _data(data), _key(key) {}
const QPoint &xy() const {return _xy;}
const QString &key() const {return _key;}
const QPixmap &pixmap() const {return _pixmap;}
void load() {_pixmap.loadFromData(_data);}
private:
QPoint _xy;
QByteArray _data;
QString _key;
QPixmap _pixmap;
};
static bool parseHeader(const QByteArray &data, QString &name)
{
QList<QByteArray> lines = data.split('\n');
@ -380,7 +361,7 @@ void AQMMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
int height = ceil(s.height() / tileSize());
QList<AQTile> tiles;
QList<RenderTile> tiles;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
@ -395,16 +376,16 @@ void AQMMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
* tileSize());
drawTile(painter, pm, tp);
} else {
tiles.append(AQTile(t, tileData(t), key));
tiles.append(RenderTile(t, tileData(t), key));
}
}
}
QFuture<void> future = QtConcurrent::map(tiles, &AQTile::load);
QFuture<void> future = QtConcurrent::map(tiles, &RenderTile::load);
future.waitForFinished();
for (int i = 0; i < tiles.size(); i++) {
const AQTile &mt = tiles.at(i);
const RenderTile &mt = tiles.at(i);
QPixmap pm(mt.pixmap());
if (pm.isNull())
continue;

View File

@ -108,11 +108,11 @@ void OnlineMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
int width = _zoom ? qCeil(s.width() / tileSize()) : 1;
int height = _zoom ? qCeil(s.height() / tileSize()) : 1;
QVector<Tile> tiles;
QVector<FetchTile> tiles;
tiles.reserve(width * height);
for (int i = 0; i < width; i++)
for (int j = 0; j < height; j++)
tiles.append(Tile(QPoint(tile.x() + i, _invertY ? (1<<_zoom)
tiles.append(FetchTile(QPoint(tile.x() + i, _invertY ? (1<<_zoom)
- (tile.y() + j) - 1 : tile.y() + j), _zoom));
if (flags & Map::Block)
@ -121,7 +121,7 @@ void OnlineMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
_tileLoader->loadTilesAsync(tiles);
for (int i = 0; i < tiles.count(); i++) {
Tile &t = tiles[i];
FetchTile &t = tiles[i];
QPointF tp = _zoom ? QPointF(tl.x() + (t.xy().x() - tile.x())
* tileSize(), tl.y() + ((_invertY ? (1<<_zoom) - t.xy().y() - 1 :
t.xy().y()) - tile.y()) * tileSize())

View File

@ -7,31 +7,12 @@
#include <QBuffer>
#include <QtConcurrent>
#include "osm.h"
#include "tile.h"
#include "osmdroidmap.h"
#define META_TYPE(type) static_cast<QMetaType::Type>(type)
class OsmdroidTile
{
public:
OsmdroidTile(const QPoint &xy, const QByteArray &data, const QString &key)
: _xy(xy), _data(data), _key(key) {}
const QPoint &xy() const {return _xy;}
const QString &key() const {return _key;}
const QPixmap &pixmap() const {return _pixmap;}
void load() {_pixmap.loadFromData(_data);}
private:
QPoint _xy;
QByteArray _data;
QString _key;
QPixmap _pixmap;
};
OsmdroidMap::OsmdroidMap(const QString &fileName, QObject *parent)
: Map(fileName, parent), _mapRatio(1.0), _valid(false)
{
@ -268,7 +249,7 @@ void OsmdroidMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
int height = ceil(s.height() / tileSize());
QList<OsmdroidTile> tiles;
QList<RenderTile> tiles;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
@ -283,16 +264,16 @@ void OsmdroidMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
* tileSize());
drawTile(painter, pm, tp);
} else {
tiles.append(OsmdroidTile(t, tileData(_zoom, t), key));
tiles.append(RenderTile(t, tileData(_zoom, t), key));
}
}
}
QFuture<void> future = QtConcurrent::map(tiles, &OsmdroidTile::load);
QFuture<void> future = QtConcurrent::map(tiles, &RenderTile::load);
future.waitForFinished();
for (int i = 0; i < tiles.size(); i++) {
const OsmdroidTile &mt = tiles.at(i);
const RenderTile &mt = tiles.at(i);
QPixmap pm(mt.pixmap());
if (pm.isNull())
continue;

View File

@ -7,31 +7,12 @@
#include <QBuffer>
#include <QtConcurrent>
#include "osm.h"
#include "tile.h"
#include "sqlitemap.h"
#define META_TYPE(type) static_cast<QMetaType::Type>(type)
class SqliteTile
{
public:
SqliteTile(const QPoint &xy, const QByteArray &data, const QString &key)
: _xy(xy), _data(data), _key(key) {}
const QPoint &xy() const {return _xy;}
const QString &key() const {return _key;}
const QPixmap &pixmap() const {return _pixmap;}
void load() {_pixmap.loadFromData(_data);}
private:
QPoint _xy;
QByteArray _data;
QString _key;
QPixmap _pixmap;
};
SqliteMap::SqliteMap(const QString &fileName, QObject *parent)
: Map(fileName, parent), _mapRatio(1.0), _valid(false)
{
@ -215,7 +196,7 @@ void SqliteMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
int height = ceil(s.height() / tileSize());
QList<SqliteTile> tiles;
QList<RenderTile> tiles;
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
@ -230,16 +211,16 @@ void SqliteMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
* tileSize());
drawTile(painter, pm, tp);
} else {
tiles.append(SqliteTile(t, tileData(_zoom, t), key));
tiles.append(RenderTile(t, tileData(_zoom, t), key));
}
}
}
QFuture<void> future = QtConcurrent::map(tiles, &SqliteTile::load);
QFuture<void> future = QtConcurrent::map(tiles, &RenderTile::load);
future.waitForFinished();
for (int i = 0; i < tiles.size(); i++) {
const SqliteTile &mt = tiles.at(i);
const RenderTile &mt = tiles.at(i);
QPixmap pm(mt.pixmap());
if (pm.isNull())
continue;

View File

@ -7,11 +7,11 @@
#include <QDebug>
#include "rectd.h"
class Tile
class FetchTile
{
public:
Tile() {}
Tile(const QPoint &xy, const QVariant &zoom, const RectD &bbox = RectD())
FetchTile() {}
FetchTile(const QPoint &xy, const QVariant &zoom, const RectD &bbox = RectD())
: _xy(xy), _zoom(zoom), _bbox(bbox) {}
const QVariant &zoom() const {return _zoom;}
@ -26,8 +26,27 @@ private:
QPixmap _pixmap;
};
class RenderTile
{
public:
RenderTile(const QPoint &xy, const QByteArray &data, const QString &key)
: _xy(xy), _data(data), _key(key) {}
const QPoint &xy() const {return _xy;}
const QString &key() const {return _key;}
const QPixmap &pixmap() const {return _pixmap;}
void load() {_pixmap.loadFromData(_data);}
private:
QPoint _xy;
QByteArray _data;
QString _key;
QPixmap _pixmap;
};
#ifndef QT_NO_DEBUG
inline QDebug operator<<(QDebug dbg, const Tile &tile)
inline QDebug operator<<(QDebug dbg, const FetchTile &tile)
{
dbg.nospace() << "Tile(" << tile.zoom() << ", " << tile.xy() << ", "
<< tile.bbox() << ")";

View File

@ -11,30 +11,27 @@ class TileImage
{
public:
TileImage() : _tile(0), _scaledSize(0) {}
TileImage(const QString &file, Tile *tile, int scaledSize)
TileImage(const QString &file, FetchTile *tile, int scaledSize)
: _file(file), _tile(tile), _scaledSize(scaledSize) {}
void createPixmap()
{
_tile->pixmap().convertFromImage(_image);
}
void load()
{
QImage img;
QByteArray z(_tile->zoom().toString().toLatin1());
QImageReader reader(_file, z);
if (_scaledSize)
reader.setScaledSize(QSize(_scaledSize, _scaledSize));
reader.read(&_image);
reader.read(&img);
_tile->pixmap().convertFromImage(img);
}
const QString &file() const {return _file;}
Tile *tile() {return _tile;}
FetchTile *tile() {return _tile;}
private:
QString _file;
Tile *_tile;
FetchTile *_tile;
int _scaledSize;
QImage _image;
};
static QString quadKey(const QPoint &xy, int zoom)
@ -64,13 +61,13 @@ TileLoader::TileLoader(const QString &dir, QObject *parent)
connect(_downloader, &Downloader::finished, this, &TileLoader::finished);
}
void TileLoader::loadTilesAsync(QVector<Tile> &list)
void TileLoader::loadTilesAsync(QVector<FetchTile> &list)
{
QList<Download> dl;
QList<TileImage> imgs;
for (int i = 0; i < list.size(); i++) {
Tile &t = list[i];
FetchTile &t = list[i];
QString file(tileFile(t));
if (QPixmapCache::find(file, &t.pixmap()))
@ -97,19 +94,18 @@ void TileLoader::loadTilesAsync(QVector<Tile> &list)
for (int i = 0; i < imgs.size(); i++) {
TileImage &ti = imgs[i];
ti.createPixmap();
QPixmapCache::insert(ti.file(), ti.tile()->pixmap());
}
}
void TileLoader::loadTilesSync(QVector<Tile> &list)
void TileLoader::loadTilesSync(QVector<FetchTile> &list)
{
QList<Download> dl;
QList<Tile *> tl;
QList<FetchTile *> tl;
QList<TileImage> imgs;
for (int i = 0; i < list.size(); i++) {
Tile &t = list[i];
FetchTile &t = list[i];
QString file(tileFile(t));
if (QPixmapCache::find(file, &t.pixmap()))
@ -137,7 +133,7 @@ void TileLoader::loadTilesSync(QVector<Tile> &list)
wait.exec();
for (int i = 0; i < tl.size(); i++) {
Tile *t = tl[i];
FetchTile *t = tl[i];
QString file = tileFile(*t);
if (QFileInfo(file).exists())
imgs.append(TileImage(file, t, _scaledSize));
@ -146,9 +142,6 @@ void TileLoader::loadTilesSync(QVector<Tile> &list)
QFuture<void> future = QtConcurrent::map(imgs, &TileImage::load);
future.waitForFinished();
for (int i = 0; i < imgs.size(); i++)
imgs[i].createPixmap();
}
void TileLoader::clearCache()
@ -173,7 +166,7 @@ void TileLoader::setScaledSize(int size)
QPixmapCache::clear();
}
QUrl TileLoader::tileUrl(const Tile &tile) const
QUrl TileLoader::tileUrl(const FetchTile &tile) const
{
QString url(_url);
@ -195,7 +188,7 @@ QUrl TileLoader::tileUrl(const Tile &tile) const
return QUrl(url);
}
QString TileLoader::tileFile(const Tile &tile) const
QString TileLoader::tileFile(const FetchTile &tile) const
{
return _dir + QLatin1Char('/') + tile.zoom().toString() + QLatin1Char('-')
+ QString::number(tile.xy().x()) + QLatin1Char('-')

View File

@ -19,16 +19,16 @@ public:
void setScaledSize(int size);
void setQuadTiles(bool quadTiles) {_quadTiles = quadTiles;}
void loadTilesAsync(QVector<Tile> &list);
void loadTilesSync(QVector<Tile> &list);
void loadTilesAsync(QVector<FetchTile> &list);
void loadTilesSync(QVector<FetchTile> &list);
void clearCache();
signals:
void finished();
private:
QUrl tileUrl(const Tile &tile) const;
QString tileFile(const Tile &tile) const;
QUrl tileUrl(const FetchTile &tile) const;
QString tileFile(const FetchTile &tile) const;
Downloader *_downloader;
QString _url;

View File

@ -174,7 +174,7 @@ void WMSMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
QPoint br = QPoint(qCeil(rect.right() / tileSize()),
qCeil(rect.bottom() / tileSize()));
QVector<Tile> tiles;
QVector<FetchTile> tiles;
tiles.reserve((br.x() - tl.x()) * (br.y() - tl.y()));
for (int i = tl.x(); i < br.x(); i++) {
for (int j = tl.y(); j < br.y(); j++) {
@ -186,7 +186,7 @@ void WMSMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
? RectD(PointD(tbr.y(), tbr.x()), PointD(ttl.y(), ttl.x()))
: RectD(ttl, tbr);
tiles.append(Tile(QPoint(i, j), _zoom, bbox));
tiles.append(FetchTile(QPoint(i, j), _zoom, bbox));
}
}
@ -196,7 +196,7 @@ void WMSMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
_tileLoader->loadTilesAsync(tiles);
for (int i = 0; i < tiles.count(); i++) {
Tile &t = tiles[i];
FetchTile &t = tiles[i];
QPointF tp(t.xy().x() * tileSize(), t.xy().y() * tileSize());
if (!t.pixmap().isNull()) {
t.pixmap().setDevicePixelRatio(_mapRatio);

View File

@ -180,11 +180,11 @@ void WMTSMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
QPoint br = QPoint(qCeil(rect.right() / ts.width()),
qCeil(rect.bottom() / ts.height()));
QVector<Tile> tiles;
QVector<FetchTile> tiles;
tiles.reserve((br.x() - tl.x()) * (br.y() - tl.y()));
for (int i = tl.x(); i < br.x(); i++)
for (int j = tl.y(); j < br.y(); j++)
tiles.append(Tile(QPoint(i, j), z.id()));
tiles.append(FetchTile(QPoint(i, j), z.id()));
if (flags & Map::Block)
_tileLoader->loadTilesSync(tiles);
@ -192,7 +192,7 @@ void WMTSMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
_tileLoader->loadTilesAsync(tiles);
for (int i = 0; i < tiles.count(); i++) {
Tile &t = tiles[i];
FetchTile &t = tiles[i];
QPointF tp(t.xy().x() * ts.width(), t.xy().y() * ts.height());
if (!t.pixmap().isNull()) {
t.pixmap().setDevicePixelRatio(imageRatio());