mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-19 04:02:09 +01:00
Added support for WMTS dimensions
This commit is contained in:
parent
49792064d7
commit
8132ff722d
@ -153,6 +153,13 @@ void MapSource::map(QXmlStreamReader &reader, Config &config)
|
|||||||
config.wmts.yx = (reader.attributes().value("axis") == "yx")
|
config.wmts.yx = (reader.attributes().value("axis") == "yx")
|
||||||
? true : false;
|
? true : false;
|
||||||
config.wmts.set = reader.readElementText();
|
config.wmts.set = reader.readElementText();
|
||||||
|
} else if (reader.name() == "dimension") {
|
||||||
|
QXmlStreamAttributes attr = reader.attributes();
|
||||||
|
if (!attr.hasAttribute("id"))
|
||||||
|
reader.raiseError("Missing dimension id");
|
||||||
|
else
|
||||||
|
config.wmts.dimensions.append(QPair<QString, QString>(
|
||||||
|
attr.value("id").toString(), reader.readElementText()));
|
||||||
} else
|
} else
|
||||||
reader.skipCurrentElement();
|
reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
@ -213,7 +220,7 @@ Map *MapSource::loadFile(const QString &path)
|
|||||||
if (config.type == WMTS)
|
if (config.type == WMTS)
|
||||||
m = new WMTSMap(config.name, WMTS::Setup(config.url, config.wmts.layer,
|
m = new WMTSMap(config.name, WMTS::Setup(config.url, config.wmts.layer,
|
||||||
config.wmts.set, config.wmts.style, config.wmts.format,
|
config.wmts.set, config.wmts.style, config.wmts.format,
|
||||||
config.wmts.rest, config.wmts.yx));
|
config.wmts.rest, config.wmts.yx, config.wmts.dimensions));
|
||||||
else
|
else
|
||||||
m = new OnlineMap(config.name, config.url, config.tms.zooms,
|
m = new OnlineMap(config.name, config.url, config.tms.zooms,
|
||||||
config.tms.bounds);
|
config.tms.bounds);
|
||||||
|
@ -34,6 +34,7 @@ private:
|
|||||||
QString format;
|
QString format;
|
||||||
bool rest;
|
bool rest;
|
||||||
bool yx;
|
bool yx;
|
||||||
|
QList<QPair<QString, QString> > dimensions;
|
||||||
|
|
||||||
WMTSConfig() : format("image/png"), rest(false), yx(false) {}
|
WMTSConfig() : format("image/png"), rest(false), yx(false) {}
|
||||||
};
|
};
|
||||||
|
@ -357,17 +357,25 @@ bool WMTS::load(const QString &file, const WMTS::Setup &setup)
|
|||||||
if (!parseCapabilities(file, setup))
|
if (!parseCapabilities(file, setup))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!setup.rest)
|
if (!setup.rest) {
|
||||||
_tileUrl = QString("%1?service=WMTS&Version=1.0.0&request=GetTile"
|
_tileUrl = QString("%1?service=WMTS&Version=1.0.0&request=GetTile"
|
||||||
"&Format=%2&Layer=%3&Style=%4&TileMatrixSet=%5&TileMatrix=$z"
|
"&Format=%2&Layer=%3&Style=%4&TileMatrixSet=%5&TileMatrix=$z"
|
||||||
"&TileRow=$y&TileCol=$x").arg(setup.url).arg(setup.format)
|
"&TileRow=$y&TileCol=$x").arg(setup.url).arg(setup.format)
|
||||||
.arg(setup.layer).arg(setup.style).arg(setup.set);
|
.arg(setup.layer).arg(setup.style).arg(setup.set);
|
||||||
else {
|
for (int i = 0; i < setup.dimensions.size(); i++) {
|
||||||
|
const QPair<QString, QString> &dim = setup.dimensions.at(i);
|
||||||
|
_tileUrl.append(QString("&%1=%2").arg(dim.first).arg(dim.second));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
_tileUrl.replace("{Style}", setup.style);
|
_tileUrl.replace("{Style}", setup.style);
|
||||||
_tileUrl.replace("{TileMatrixSet}", setup.set);
|
_tileUrl.replace("{TileMatrixSet}", setup.set);
|
||||||
_tileUrl.replace("{TileMatrix}", "$z");
|
_tileUrl.replace("{TileMatrix}", "$z");
|
||||||
_tileUrl.replace("{TileRow}", "$y");
|
_tileUrl.replace("{TileRow}", "$y");
|
||||||
_tileUrl.replace("{TileCol}", "$x");
|
_tileUrl.replace("{TileCol}", "$x");
|
||||||
|
for (int i = 0; i < setup.dimensions.size(); i++) {
|
||||||
|
const QPair<QString, QString> &dim = setup.dimensions.at(i);
|
||||||
|
_tileUrl.replace(QString("{%1}").arg(dim.first), dim.second);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -23,11 +23,13 @@ public:
|
|||||||
QString format;
|
QString format;
|
||||||
bool rest;
|
bool rest;
|
||||||
bool yx;
|
bool yx;
|
||||||
|
QList<QPair<QString, QString> > dimensions;
|
||||||
|
|
||||||
Setup(const QString &url, const QString &layer, const QString &set,
|
Setup(const QString &url, const QString &layer, const QString &set,
|
||||||
const QString &style, const QString &format, bool rest, bool yx) :
|
const QString &style, const QString &format, bool rest, bool yx,
|
||||||
|
const QList<QPair<QString, QString> > &dimensions) :
|
||||||
url(url), layer(layer), set(set), style(style), format(format),
|
url(url), layer(layer), set(set), style(style), format(format),
|
||||||
rest(rest), yx(yx) {}
|
rest(rest), yx(yx), dimensions(dimensions) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Zoom {
|
struct Zoom {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user