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

Added missing WMS 1.1 ScaleHint handling

This commit is contained in:
Martin Tůma 2020-02-29 13:47:27 +01:00
parent 92deaaaf2b
commit 9dd4e117f6

View File

@ -1,3 +1,4 @@
#include <cmath>
#include <QFileInfo>
#include <QEventLoop>
#include <QXmlStreamReader>
@ -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);