From 0ef28cda0fc15eff9cebb677539ee162052eec59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 5 Aug 2022 08:34:16 +0200 Subject: [PATCH] Fixed map calibration --- src/map/oruxmap.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/map/oruxmap.cpp b/src/map/oruxmap.cpp index e7e409ac..19672bc9 100644 --- a/src/map/oruxmap.cpp +++ b/src/map/oruxmap.cpp @@ -206,7 +206,7 @@ void OruxMap::calibrationPoints(QXmlStreamReader &reader, const QSize &size, void OruxMap::mapCalibration(QXmlStreamReader &reader, int level) { int zoom; - QSize tileSize, size; + QSize tileSize, size, calibrationSize; QString datum, projection; QList points; Projection proj; @@ -241,6 +241,8 @@ void OruxMap::mapCalibration(QXmlStreamReader &reader, int level) tileSize = QSize(width, height); size = QSize(xMax * width, yMax * height); + calibrationSize = size; + GCS gcs(createGCS(datum)); if (!gcs.isValid()) { reader.raiseError(QString("%1: invalid/unknown datum") @@ -254,9 +256,22 @@ void OruxMap::mapCalibration(QXmlStreamReader &reader, int level) return; } + reader.readElementText(); + + } else if (reader.name() == QLatin1String("MapDimensions")) { + int height, width; + + QXmlStreamAttributes attr = reader.attributes(); + if (!intAttr(reader, attr, "height", height)) + return; + if (!intAttr(reader, attr, "width", width)) + return; + + calibrationSize = QSize(width, height); + reader.readElementText(); } else if (reader.name() == QLatin1String("CalibrationPoints")) - calibrationPoints(reader, size, points); + calibrationPoints(reader, calibrationSize, points); else reader.skipCurrentElement(); }