1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-03-01 21:40:48 +01:00

Compare commits

...

4 Commits

Author SHA1 Message Date
11ac5da640 Increase the default pixmap cache size on Android to 384MB
We need at least 4 * 4096x4096x4 for overzoomed vector tiles + additional
memory for remaining pixmaps (GUI icons, ...)
2023-12-18 21:18:50 +01:00
112dc59cf2 Fixed broken map scale (ruler) on HiDPI maps 2023-12-18 20:35:55 +01:00
aa892f6c3f Limit the overzoom by the resulting tile size rather than number of levels
Huge sizes may cause broken rendering and cache ping-pong. Do not allow
resulting tile sizes > 4096x4096px.
2023-12-18 20:32:00 +01:00
4e1b696869 Version++ 2023-12-18 20:27:10 +01:00
11 changed files with 36 additions and 33 deletions

View File

@ -1,4 +1,4 @@
version: 13.12.{build}
version: 13.13.{build}
configuration:
- Release

View File

@ -3,7 +3,7 @@ unix:!macx:!android {
} else {
TARGET = GPXSee
}
VERSION = 13.12
VERSION = 13.13
QT += core \

View File

@ -37,7 +37,7 @@ Unicode true
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "13.12"
!define VERSION "13.13"
; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"

View File

@ -33,7 +33,7 @@
: QPageSize::PageSizeId::A4)
#ifdef Q_OS_ANDROID
#define PIXMAP_CACHE 256
#define PIXMAP_CACHE 384
#define DEM_CACHE 128
#else // Q_OS_ANDROID
#define PIXMAP_CACHE 512

View File

@ -295,7 +295,7 @@ int AQMMap::zoomFit(const QSize &size, const RectC &rect)
qreal AQMMap::resolution(const QRectF &rect)
{
const Zoom &z = _zooms.at(_zoom);
return OSM::resolution(rect.center(), z.zoom, z.tileSize);
return OSM::resolution(rect.center(), z.zoom, tileSize());
}
int AQMMap::zoomIn()

View File

@ -128,7 +128,7 @@ GEMFMap::GEMFMap(const QString &fileName, QObject *parent)
qreal GEMFMap::resolution(const QRectF &rect)
{
return OSM::resolution(rect.center(), _zooms.at(_zi).level, _tileSize);
return OSM::resolution(rect.center(), _zooms.at(_zi).level, tileSize());
}
int GEMFMap::zoomFit(const QSize &size, const RectC &rect)

View File

@ -9,7 +9,7 @@
#include "osm.h"
#include "mbtilesmap.h"
#define MAX_OVERZOOM 3
#define MAX_TILE_SIZE 4096
#define META_TYPE(type) static_cast<QMetaType::Type>(type)
static RectC str2bounds(const QString &str)
@ -79,24 +79,15 @@ bool MBTilesMap::getZooms()
" WHERE zoom_level = %1 LIMIT 1").arg(i);
QSqlQuery query(sql, _db);
if (query.first())
_zooms.append(Zoom(i, i));
_zoomsBase.append(Zoom(i, i));
}
if (!_zooms.size()) {
if (!_zoomsBase.size()) {
_errorString = "Empty tile set";
return false;
}
if (_scalable) {
for (int i = _zooms.last().base + 1; i <= OSM::ZOOMS.max(); i++) {
Zoom z(i, _zooms.last().base);
if (z.z - z.base > MAX_OVERZOOM)
break;
_zooms.append(Zoom(i, _zooms.last().base));
}
}
_zi = _zooms.size() - 1;
_zi = _zoomsBase.size() - 1;
return true;
}
@ -114,7 +105,7 @@ bool MBTilesMap::getBounds()
} else {
qWarning("%s: missing bounds metadata", qPrintable(path()));
int z = _zooms.first().z;
int z = _zoomsBase.first().z;
QString sql = QString("SELECT min(tile_column), min(tile_row), "
"max(tile_column), max(tile_row) FROM tiles WHERE zoom_level = %1")
.arg(z);
@ -222,12 +213,12 @@ MBTilesMap::MBTilesMap(const QString &fileName, QObject *parent)
}
getTileFormat();
if (!getTileSize())
return;
if (!getZooms())
return;
if (!getBounds())
return;
if (!getTileSize())
return;
getTilePixelRatio();
getName();
@ -243,10 +234,18 @@ void MBTilesMap::load(const Projection &in, const Projection &out,
Q_UNUSED(out);
_mapRatio = hidpi ? deviceRatio : 1.0;
_zooms = _zoomsBase;
if (_scalable) {
_scaledSize = _tileSize * deviceRatio;
_tileRatio = deviceRatio;
for (int i = _zooms.last().base + 1; i <= OSM::ZOOMS.max(); i++) {
Zoom z(i, _zooms.last().base);
if (_tileSize * _tileRatio * (1U<<(z.z - z.base)) > MAX_TILE_SIZE)
break;
_zooms.append(Zoom(i, _zooms.last().base));
}
}
_db.open();
@ -286,7 +285,7 @@ int MBTilesMap::zoomFit(const QSize &size, const RectC &rect)
qreal MBTilesMap::resolution(const QRectF &rect)
{
return OSM::resolution(rect.center(), _zooms.at(_zi).z, _tileSize);
return OSM::resolution(rect.center(), _zooms.at(_zi).z, tileSize());
}
int MBTilesMap::zoomIn()

View File

@ -146,7 +146,7 @@ private:
QString _name;
RectC _bounds;
QVector<Zoom> _zooms;
QVector<Zoom> _zooms, _zoomsBase;
int _zi;
int _tileSize;
qreal _mapRatio, _tileRatio;

View File

@ -8,7 +8,7 @@
#include "onlinemap.h"
#define MAX_OVERZOOM 3
#define MAX_TILE_SIZE 4096
OnlineMap::OnlineMap(const QString &fileName, const QString &name,
const QString &url, const Range &zooms, const RectC &bounds, qreal tileRatio,
@ -24,10 +24,7 @@ OnlineMap::OnlineMap(const QString &fileName, const QString &name,
_tileLoader->setHeaders(headers);
connect(_tileLoader, &TileLoader::finished, this, &OnlineMap::tilesLoaded);
if (_scalable) {
_baseZoom = _zooms.max();
_zooms.setMax(qMin(_zooms.max() + MAX_OVERZOOM, OSM::ZOOMS.max()));
}
_baseZoom = _zooms.max();
}
QRectF OnlineMap::bounds()
@ -61,7 +58,7 @@ int OnlineMap::zoomFit(const QSize &size, const RectC &rect)
qreal OnlineMap::resolution(const QRectF &rect)
{
return OSM::resolution(rect.center(), _zoom, _tileSize);
return OSM::resolution(rect.center(), _zoom, tileSize());
}
int OnlineMap::zoomIn()
@ -87,10 +84,17 @@ void OnlineMap::load(const Projection &in, const Projection &out,
Q_UNUSED(out);
_mapRatio = hidpi ? deviceRatio : 1.0;
_zooms.setMax(_baseZoom);
if (_scalable) {
_scaledSize = _tileSize * deviceRatio;
_tileRatio = deviceRatio;
for (int i = _baseZoom + 1; i <= OSM::ZOOMS.max(); i++) {
if (_tileSize * _tileRatio * (1U<<(i - _baseZoom)) > MAX_TILE_SIZE)
break;
_zooms.setMax(i);
}
}
}
@ -168,7 +172,7 @@ void OnlineMap::cancelJobs(bool wait)
void OnlineMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
{
int baseZoom = _scalable ? qMin(_baseZoom, _zoom) : _zoom;
int baseZoom = qMin(_baseZoom, _zoom);
unsigned overzoom = _zoom - baseZoom;
unsigned f = 1U<<overzoom;

View File

@ -198,7 +198,7 @@ int OsmdroidMap::zoomFit(const QSize &size, const RectC &rect)
qreal OsmdroidMap::resolution(const QRectF &rect)
{
return OSM::resolution(rect.center(), _zoom, _tileSize);
return OSM::resolution(rect.center(), _zoom, tileSize());
}
int OsmdroidMap::zoomIn()

View File

@ -146,7 +146,7 @@ int SqliteMap::zoomFit(const QSize &size, const RectC &rect)
qreal SqliteMap::resolution(const QRectF &rect)
{
return OSM::resolution(rect.center(), _zoom, _tileSize);
return OSM::resolution(rect.center(), _zoom, tileSize());
}
int SqliteMap::zoomIn()