1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Enable specifiing of format parameters

This commit is contained in:
Martin Tůma 2020-03-03 09:29:16 +01:00
parent bb6d6a4044
commit c85f404d28
2 changed files with 12 additions and 2 deletions

View File

@ -8,6 +8,11 @@
#include "wms.h" #include "wms.h"
static QString bareFormat(const QString &format)
{
return format.left(format.indexOf(';')).trimmed();
}
static inline double hint2denominator(double h) static inline double hint2denominator(double h)
{ {
/* Some WMS 1.1.1 servers use a 72dpi resolution by default. Using the usual /* Some WMS 1.1.1 servers use a 72dpi resolution by default. Using the usual
@ -38,7 +43,7 @@ void WMS::getMap(QXmlStreamReader &reader, CTX &ctx)
while (reader.readNextStartElement()) { while (reader.readNextStartElement()) {
if (reader.name() == "Format") { if (reader.name() == "Format") {
QString format(reader.readElementText()); QString format(reader.readElementText());
if (format.left(format.indexOf(';')) == ctx.setup.format()) if (bareFormat(format) == bareFormat(ctx.setup.format()))
ctx.formatSupported = true; ctx.formatSupported = true;
} else } else
reader.skipCurrentElement(); reader.skipCurrentElement();

View File

@ -12,6 +12,11 @@
#include "wmts.h" #include "wmts.h"
static QString bareFormat(const QString &format)
{
return format.left(format.indexOf(';')).trimmed();
}
static void skipParentElement(QXmlStreamReader &reader) static void skipParentElement(QXmlStreamReader &reader)
{ {
while (reader.readNextStartElement()) while (reader.readNextStartElement())
@ -183,7 +188,7 @@ void WMTS::layer(QXmlStreamReader &reader, CTX &ctx)
ctx.hasStyle = true; ctx.hasStyle = true;
} else if (reader.name() == "Format") { } else if (reader.name() == "Format") {
QString format(reader.readElementText()); QString format(reader.readElementText());
if (format.left(format.indexOf(';')) == ctx.setup.format()) if (bareFormat(format) == bareFormat(ctx.setup.format()))
ctx.hasFormat = true; ctx.hasFormat = true;
} else } else
reader.skipCurrentElement(); reader.skipCurrentElement();