mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-07 12:05:14 +01:00
Fixed storing of WMTS tiles with file system incompatible tile matrix names
This commit is contained in:
parent
a281a68cbd
commit
0531389cd8
@ -6,6 +6,7 @@
|
|||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#include "tileloader.h"
|
#include "tileloader.h"
|
||||||
|
|
||||||
|
#define SUBSTITUTE_CHAR '$'
|
||||||
|
|
||||||
class TileImage
|
class TileImage
|
||||||
{
|
{
|
||||||
@ -34,6 +35,27 @@ private:
|
|||||||
int _scaledSize;
|
int _scaledSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static QString fsSafeStr(const QString &str)
|
||||||
|
{
|
||||||
|
QString ret(str);
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
ret.replace('<', SUBSTITUTE_CHAR);
|
||||||
|
ret.replace('>', SUBSTITUTE_CHAR);
|
||||||
|
ret.replace(':', SUBSTITUTE_CHAR);
|
||||||
|
ret.replace('"', SUBSTITUTE_CHAR);
|
||||||
|
ret.replace('/', SUBSTITUTE_CHAR);
|
||||||
|
ret.replace('\\', SUBSTITUTE_CHAR);
|
||||||
|
ret.replace('|', SUBSTITUTE_CHAR);
|
||||||
|
ret.replace('?', SUBSTITUTE_CHAR);
|
||||||
|
ret.replace('*', SUBSTITUTE_CHAR);
|
||||||
|
#else // Q_OS_WIN32
|
||||||
|
ret.replace('/', SUBSTITUTE_CHAR);
|
||||||
|
#endif // Q_OS_WIN32
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static QString quadKey(const QPoint &xy, int zoom)
|
static QString quadKey(const QPoint &xy, int zoom)
|
||||||
{
|
{
|
||||||
QString qk;
|
QString qk;
|
||||||
@ -198,7 +220,10 @@ QUrl TileLoader::tileUrl(const FetchTile &tile) const
|
|||||||
|
|
||||||
QString TileLoader::tileFile(const FetchTile &tile) const
|
QString TileLoader::tileFile(const FetchTile &tile) const
|
||||||
{
|
{
|
||||||
return _dir + QLatin1Char('/') + tile.zoom().toString() + QLatin1Char('-')
|
QString zoom(((QMetaType::Type)(tile.zoom().type()) == QMetaType::Int)
|
||||||
|
? tile.zoom().toString() : fsSafeStr(tile.zoom().toString()));
|
||||||
|
|
||||||
|
return _dir + QLatin1Char('/') + zoom + QLatin1Char('-')
|
||||||
+ QString::number(tile.xy().x()) + QLatin1Char('-')
|
+ QString::number(tile.xy().x()) + QLatin1Char('-')
|
||||||
+ QString::number(tile.xy().y());
|
+ QString::number(tile.xy().y());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user