1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24: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)
m = new WMSMap(config.name, WMS::Setup(config.url, config.layer,
config.style, config.format, config.crs, config.coordinateSystem,
config.authorization));
config.dimensions, config.authorization));
else
m = new OnlineMap(config.name, config.url, config.zooms, config.bounds);

View File

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

View File

@ -17,15 +17,25 @@ qreal WMSMap::sd2res(qreal scaleDenominator) const
QString WMSMap::tileUrl(const QString &version) const
{
QString crs = version >= "1.3.0"
? QString("CRS=%1").arg(_setup.crs())
: QString("SRS=%1").arg(_setup.crs());
QString url;
return QString("%1?version=%2&request=GetMap&%3&bbox=$bbox"
"&width=%4&height=%5&layers=%6&styles=%7&format=%8&transparent=true")
.arg(_setup.url(), version, crs, QString::number(TILE_SIZE),
url = QString("%1?version=%2&request=GetMap&bbox=$bbox"
"&width=%3&height=%4&layers=%5&styles=%6&format=%7&transparent=true")
.arg(_setup.url(), version, QString::number(TILE_SIZE),
QString::number(TILE_SIZE), _setup.layer(), _setup.style(),
_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