1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Allow arbitrary zoom levels

Closes #244
This commit is contained in:
Martin Tůma 2019-11-10 18:38:47 +01:00
parent 65e04ce08b
commit e38e12f89b

View File

@ -32,7 +32,7 @@ Range MapSource::zooms(QXmlStreamReader &reader)
if (attr.hasAttribute("min")) { if (attr.hasAttribute("min")) {
min = attr.value("min").toString().toInt(&res); min = attr.value("min").toString().toInt(&res);
if (!res || !OSM::ZOOMS.contains(min)) { if (!res || min < 0) {
reader.raiseError("Invalid minimal zoom level"); reader.raiseError("Invalid minimal zoom level");
return Range(); return Range();
} }
@ -41,18 +41,13 @@ Range MapSource::zooms(QXmlStreamReader &reader)
if (attr.hasAttribute("max")) { if (attr.hasAttribute("max")) {
max = attr.value("max").toString().toInt(&res); max = attr.value("max").toString().toInt(&res);
if (!res || !OSM::ZOOMS.contains(max)) { if (!res || max < min) {
reader.raiseError("Invalid maximal zoom level"); reader.raiseError("Invalid maximal zoom level");
return Range(); return Range();
} }
} else } else
max = OSM::ZOOMS.max(); max = OSM::ZOOMS.max();
if (min > max) {
reader.raiseError("Invalid maximal/minimal zoom level combination");
return Range();
}
return Range(min, max); return Range(min, max);
} }