From 9dd4e117f6db6aac2b1d971bf4dc8852b25d498c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sat, 29 Feb 2020 13:47:27 +0100 Subject: [PATCH] Added missing WMS 1.1 ScaleHint handling --- src/map/wms.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/map/wms.cpp b/src/map/wms.cpp index fafc3fe3..0567f908 100644 --- a/src/map/wms.cpp +++ b/src/map/wms.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -7,6 +8,11 @@ #include "wms.h" +static inline double hint2denominator(double h) +{ + return sqrt((h * h) / 2.0) / 0.28e-3; +} + WMS::CTX::CTX(const Setup &setup) : setup(setup), formatSupported(false) { QStringList ll = setup.layer().split(','); @@ -97,7 +103,13 @@ void WMS::layer(QXmlStreamReader &reader, CTX &ctx, CRSs.append(reader.readElementText()); else if (reader.name() == "Style") styles.append(style(reader)); - else if (reader.name() == "MinScaleDenominator") { + else if (reader.name() == "ScaleHint") { + QXmlStreamAttributes attr = reader.attributes(); + double minHint = attr.value("min").toString().toDouble(); + double maxHint = attr.value("max").toString().toDouble(); + scaleDenominator.setMin(hint2denominator(minHint)); + scaleDenominator.setMax(hint2denominator(maxHint)); + } else if (reader.name() == "MinScaleDenominator") { double sd = reader.readElementText().toDouble(); if (sd > 0) scaleDenominator.setMin(sd);