mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Provide the zoom level to QImageReader when fetching the tile size
Although technically not needed here, it workarounds the issue with the broken Qt SVG imageformat plugin (QTBUG-119910).
This commit is contained in:
parent
eee4f31369
commit
63d3558b14
@ -129,15 +129,14 @@ bool MBTilesMap::getBounds()
|
|||||||
|
|
||||||
bool MBTilesMap::getTileSize()
|
bool MBTilesMap::getTileSize()
|
||||||
{
|
{
|
||||||
QString sql("SELECT tile_data FROM tiles LIMIT 1");
|
QString sql("SELECT zoom_level, tile_data FROM tiles LIMIT 1");
|
||||||
QSqlQuery query(sql, _db);
|
QSqlQuery query(sql, _db);
|
||||||
query.first();
|
query.first();
|
||||||
|
|
||||||
QByteArray data = query.value(0).toByteArray();
|
QByteArray z(QByteArray::number(query.value(0).toInt()));
|
||||||
|
QByteArray data = query.value(1).toByteArray();
|
||||||
QBuffer buffer(&data);
|
QBuffer buffer(&data);
|
||||||
/* Explicitly specify the image plugin in case of vector tiles
|
QImageReader reader(&buffer, z);
|
||||||
(QTBUG-119910 workaround) */
|
|
||||||
QImageReader reader(&buffer, _scalable ? QByteArray("mvt") : QByteArray());
|
|
||||||
QSize tileSize(reader.size());
|
QSize tileSize(reader.size());
|
||||||
|
|
||||||
if (!tileSize.isValid() || tileSize.width() != tileSize.height()) {
|
if (!tileSize.isValid() || tileSize.width() != tileSize.height()) {
|
||||||
@ -217,9 +216,9 @@ MBTilesMap::MBTilesMap(const QString &fileName, QObject *parent)
|
|||||||
return;
|
return;
|
||||||
if (!getBounds())
|
if (!getBounds())
|
||||||
return;
|
return;
|
||||||
getTileFormat();
|
|
||||||
if (!getTileSize())
|
if (!getTileSize())
|
||||||
return;
|
return;
|
||||||
|
getTileFormat();
|
||||||
getTilePixelRatio();
|
getTilePixelRatio();
|
||||||
getName();
|
getName();
|
||||||
|
|
||||||
|
@ -21,10 +21,8 @@ public:
|
|||||||
const QPixmap &pixmap() const {return _pixmap;}
|
const QPixmap &pixmap() const {return _pixmap;}
|
||||||
|
|
||||||
void load() {
|
void load() {
|
||||||
QByteArray z(QString::number(_zoom).toLatin1());
|
|
||||||
|
|
||||||
QBuffer buffer(&_data);
|
QBuffer buffer(&_data);
|
||||||
QImageReader reader(&buffer, z);
|
QImageReader reader(&buffer, QByteArray::number(_zoom));
|
||||||
if (_scaledSize)
|
if (_scaledSize)
|
||||||
reader.setScaledSize(QSize(_scaledSize, _scaledSize));
|
reader.setScaledSize(QSize(_scaledSize, _scaledSize));
|
||||||
_pixmap = QPixmap::fromImage(reader.read());
|
_pixmap = QPixmap::fromImage(reader.read());
|
||||||
|
Loading…
Reference in New Issue
Block a user