1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Fixed broken PDF/PNG export of MApsforge maps

This commit is contained in:
Martin Tůma 2022-05-25 23:04:20 +02:00
parent c3ba8f1f0d
commit e701ad0ed0

View File

@ -164,8 +164,6 @@ void MapsforgeMap::cancelJobs()
void MapsforgeMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
{
Q_UNUSED(flags);
QPointF tl(floor(rect.left() / _data.tileSize()) * _data.tileSize(),
floor(rect.top() / _data.tileSize()) * _data.tileSize());
QSizeF s(rect.right() - tl.x(), rect.bottom() - tl.y());
@ -215,8 +213,20 @@ void MapsforgeMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
}
}
if (!tiles.isEmpty())
runJob(new MapsforgeMapJob(tiles));
if (!tiles.isEmpty()) {
if (flags & Map::Block) {
QFuture<void> future = QtConcurrent::map(tiles, &RasterTile::render);
future.waitForFinished();
for (int i = 0; i < tiles.size(); i++) {
const RasterTile &mt = tiles.at(i);
const QPixmap &pm = mt.pixmap();
painter->drawPixmap(mt.xy(), pm);
QPixmapCache::insert(key(mt.zoom(), mt.xy()), pm);
}
} else
runJob(new MapsforgeMapJob(tiles));
}
}
void MapsforgeMap::setDevicePixelRatio(qreal deviceRatio, qreal mapRatio)