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

Added missing "other sample dimensions" support for WMS

This commit is contained in:
Martin Tůma 2018-04-08 19:13:16 +02:00
parent ca710b6a22
commit b4cf614f77
3 changed files with 25 additions and 10 deletions

View File

@ -228,7 +228,7 @@ Map *MapSource::loadFile(const QString &path)
else if (config.type == WMS) else if (config.type == WMS)
m = new WMSMap(config.name, WMS::Setup(config.url, config.layer, m = new WMSMap(config.name, WMS::Setup(config.url, config.layer,
config.style, config.format, config.crs, config.coordinateSystem, config.style, config.format, config.crs, config.coordinateSystem,
config.authorization)); config.dimensions, config.authorization));
else else
m = new OnlineMap(config.name, config.url, config.zooms, config.bounds); m = new OnlineMap(config.name, config.url, config.zooms, config.bounds);

View File

@ -19,10 +19,12 @@ public:
public: public:
Setup(const QString &url, const QString &layer, const QString &style, Setup(const QString &url, const QString &layer, const QString &style,
const QString &format, const QString &crs, const QString &format, const QString &crs,
const CoordinateSystem &cs, const Authorization &authorization const CoordinateSystem &cs,
= Authorization()) const QList<QPair<QString, QString> > &dimensions,
const Authorization &authorization = Authorization())
: _url(url), _layer(layer), _style(style), _format(format), : _url(url), _layer(layer), _style(style), _format(format),
_crs(crs), _cs(cs), _authorization(authorization) {} _crs(crs), _cs(cs), _dimensions(dimensions),
_authorization(authorization) {}
const QString &url() const {return _url;} const QString &url() const {return _url;}
const Authorization &authorization() const {return _authorization;} const Authorization &authorization() const {return _authorization;}
@ -31,6 +33,8 @@ public:
const QString &format() const {return _format;} const QString &format() const {return _format;}
const QString &crs() const {return _crs;} const QString &crs() const {return _crs;}
const CoordinateSystem &coordinateSystem() const {return _cs;} const CoordinateSystem &coordinateSystem() const {return _cs;}
const QList<QPair<QString, QString> > &dimensions() const
{return _dimensions;}
private: private:
QString _url; QString _url;
@ -39,6 +43,7 @@ public:
QString _format; QString _format;
QString _crs; QString _crs;
CoordinateSystem _cs; CoordinateSystem _cs;
QList<QPair<QString, QString> > _dimensions;
Authorization _authorization; Authorization _authorization;
}; };

View File

@ -17,15 +17,25 @@ qreal WMSMap::sd2res(qreal scaleDenominator) const
QString WMSMap::tileUrl(const QString &version) const QString WMSMap::tileUrl(const QString &version) const
{ {
QString crs = version >= "1.3.0" QString url;
? QString("CRS=%1").arg(_setup.crs())
: QString("SRS=%1").arg(_setup.crs());
return QString("%1?version=%2&request=GetMap&%3&bbox=$bbox" url = QString("%1?version=%2&request=GetMap&bbox=$bbox"
"&width=%4&height=%5&layers=%6&styles=%7&format=%8&transparent=true") "&width=%3&height=%4&layers=%5&styles=%6&format=%7&transparent=true")
.arg(_setup.url(), version, crs, QString::number(TILE_SIZE), .arg(_setup.url(), version, QString::number(TILE_SIZE),
QString::number(TILE_SIZE), _setup.layer(), _setup.style(), QString::number(TILE_SIZE), _setup.layer(), _setup.style(),
_setup.format()); _setup.format());
if (version >= "1.3.0")
url.append(QString("&CRS=%1").arg(_setup.crs()));
else
url.append(QString("&SRS=%1").arg(_setup.crs()));
for (int i = 0; i < _setup.dimensions().size(); i++) {
const QPair<QString, QString> &dim = _setup.dimensions().at(i);
url.append(QString("&%1=%2").arg(dim.first, dim.second));
}
return url;
} }
QString WMSMap::tilesDir() const QString WMSMap::tilesDir() const