mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Added support for Geographic 2D projections (coordinate systems) in vector maps
This commit is contained in:
parent
38b62c0121
commit
5f5b391cd9
@ -27,7 +27,7 @@ public:
|
||||
~GraphView();
|
||||
|
||||
bool isEmpty() const {return _graphs.isEmpty();}
|
||||
const QList<KV> &info() const {return _info->info();}
|
||||
const QList<KV<QString, QString> > &info() const {return _info->info();}
|
||||
void clear();
|
||||
|
||||
void plot(QPainter *painter, const QRectF &target, qreal scale);
|
||||
|
@ -1066,7 +1066,7 @@ void GUI::statistics()
|
||||
|
||||
text.append("<tr><th colspan=\"2\">" + tab->label() + "</th></tr>");
|
||||
for (int j = 0; j < tab->info().size(); j++) {
|
||||
const KV &kv = tab->info().at(j);
|
||||
const KV<QString, QString> &kv = tab->info().at(j);
|
||||
text.append("<tr><td>" + kv.key() + ":</td><td>" + kv.value()
|
||||
+ "</td></tr>");
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ void InfoItem::updateBoundingRect()
|
||||
QFontMetrics fm(_font);
|
||||
qreal width = 0;
|
||||
|
||||
for (QList<KV>::const_iterator i = _list.constBegin();
|
||||
for (QList<KV<QString, QString> >::const_iterator i = _list.constBegin();
|
||||
i != _list.constEnd(); i++) {
|
||||
width += fm.width(i->key() + ": ");
|
||||
width += fm.width(i->value()) + ((i == _list.constEnd() - 1)
|
||||
@ -37,7 +37,7 @@ void InfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
painter->setFont(_font);
|
||||
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||
|
||||
for (QList<KV>::const_iterator i = _list.constBegin();
|
||||
for (QList<KV<QString, QString> >::const_iterator i = _list.constBegin();
|
||||
i != _list.constEnd(); i++) {
|
||||
painter->drawText(width, fm.height() - fm.descent(), i->key() + ": ");
|
||||
width += fm.width(i->key() + ": ");
|
||||
@ -61,7 +61,7 @@ void InfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
|
||||
void InfoItem::insert(const QString &key, const QString &value)
|
||||
{
|
||||
KV kv(key, value);
|
||||
KV<QString, QString> kv(key, value);
|
||||
int i;
|
||||
|
||||
prepareGeometryChange();
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget);
|
||||
|
||||
const QList<KV> &info() const {return _list;}
|
||||
const QList<KV<QString, QString> > &info() const {return _list;}
|
||||
|
||||
void insert(const QString &key, const QString &value);
|
||||
void clear();
|
||||
@ -23,7 +23,7 @@ public:
|
||||
private:
|
||||
void updateBoundingRect();
|
||||
|
||||
QList<KV> _list;
|
||||
QList<KV<QString, QString> > _list;
|
||||
QRectF _boundingRect;
|
||||
QFont _font;
|
||||
};
|
||||
|
@ -255,17 +255,18 @@ QPointF MapView::contentCenter() const
|
||||
|
||||
void MapView::updatePOIVisibility()
|
||||
{
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it, jt;
|
||||
|
||||
if (!_showPOI)
|
||||
return;
|
||||
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->show();
|
||||
|
||||
if (!_overlapPOIs) {
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++) {
|
||||
for (jt = _pois.constBegin(); jt != _pois.constEnd(); jt++) {
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++) {
|
||||
for (POIHash::const_iterator jt = _pois.constBegin();
|
||||
jt != _pois.constEnd(); jt++) {
|
||||
if (it.value()->isVisible() && jt.value()->isVisible()
|
||||
&& it != jt && it.value()->collidesWithItem(jt.value()))
|
||||
jt.value()->hide();
|
||||
@ -288,8 +289,8 @@ void MapView::rescale()
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setMap(_map);
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->setMap(_map);
|
||||
|
||||
updatePOIVisibility();
|
||||
@ -339,8 +340,8 @@ void MapView::setMap(Map *map)
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setMap(map);
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->setMap(_map);
|
||||
updatePOIVisibility();
|
||||
|
||||
@ -364,12 +365,10 @@ void MapView::setPOI(POI *poi)
|
||||
|
||||
void MapView::updatePOI()
|
||||
{
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++) {
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
_scene->removeItem(it.value());
|
||||
delete it.value();
|
||||
}
|
||||
qDeleteAll(_pois);
|
||||
_pois.clear();
|
||||
|
||||
if (_showTracks)
|
||||
@ -426,8 +425,8 @@ void MapView::setUnits(Units units)
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setToolTipFormat(_units, _coordinatesFormat);
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->setToolTipFormat(_units, _coordinatesFormat);
|
||||
}
|
||||
|
||||
@ -445,8 +444,8 @@ void MapView::setCoordinatesFormat(CoordinatesFormat format)
|
||||
for (int i = 0; i < _routes.count(); i++)
|
||||
_routes[i]->setCoordinatesFormat(_coordinatesFormat);
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->setToolTipFormat(_units, _coordinatesFormat);
|
||||
}
|
||||
|
||||
@ -461,8 +460,6 @@ void MapView::clearMapCache()
|
||||
|
||||
void MapView::digitalZoom(int zoom)
|
||||
{
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
|
||||
if (zoom) {
|
||||
_digitalZoom += zoom;
|
||||
scale(pow(2, zoom), pow(2, zoom));
|
||||
@ -479,7 +476,8 @@ void MapView::digitalZoom(int zoom)
|
||||
_areas.at(i)->setDigitalZoom(_digitalZoom);
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setDigitalZoom(_digitalZoom);
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->setDigitalZoom(_digitalZoom);
|
||||
|
||||
_mapScale->setDigitalZoom(_digitalZoom);
|
||||
@ -747,8 +745,8 @@ void MapView::showPOI(bool show)
|
||||
{
|
||||
_showPOI = show;
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->setVisible(show);
|
||||
|
||||
updatePOIVisibility();
|
||||
@ -758,8 +756,8 @@ void MapView::showPOILabels(bool show)
|
||||
{
|
||||
_showPOILabels = show;
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->showLabel(show);
|
||||
|
||||
updatePOIVisibility();
|
||||
@ -852,21 +850,19 @@ void MapView::setWaypointColor(const QColor &color)
|
||||
|
||||
void MapView::setPOISize(int size)
|
||||
{
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
|
||||
_poiSize = size;
|
||||
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->setSize(size);
|
||||
}
|
||||
|
||||
void MapView::setPOIColor(const QColor &color)
|
||||
{
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
|
||||
_poiColor = color;
|
||||
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->setColor(color);
|
||||
}
|
||||
|
||||
@ -1003,8 +999,8 @@ void MapView::setDevicePixelRatio(qreal deviceRatio, qreal mapRatio)
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setMap(_map);
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
for (POIHash::const_iterator it = _pois.constBegin();
|
||||
it != _pois.constEnd(); it++)
|
||||
it.value()->setMap(_map);
|
||||
updatePOIVisibility();
|
||||
|
||||
@ -1021,13 +1017,19 @@ void MapView::setDevicePixelRatio(qreal deviceRatio, qreal mapRatio)
|
||||
|
||||
void MapView::setProjection(int id)
|
||||
{
|
||||
Projection projection(PCS::pcs(id));
|
||||
if (!projection.isValid())
|
||||
return;
|
||||
|
||||
_projection = projection;
|
||||
|
||||
Coordinates center = _map->xy2ll(mapToScene(viewport()->rect().center()));
|
||||
|
||||
const PCS *pcs = PCS::pcs(id);
|
||||
if (pcs)
|
||||
_projection = Projection(pcs);
|
||||
else {
|
||||
const GCS *gcs = GCS::gcs(id);
|
||||
if (gcs)
|
||||
_projection = Projection(gcs);
|
||||
else
|
||||
qWarning("%d: Unknown PCS/GCS id", id);
|
||||
}
|
||||
|
||||
_map->setProjection(_projection);
|
||||
rescale();
|
||||
centerOn(_map->ll2xy(center));
|
||||
|
@ -92,6 +92,8 @@ private slots:
|
||||
void reloadMap();
|
||||
|
||||
private:
|
||||
typedef QHash<SearchPointer<Waypoint>, WaypointItem*> POIHash;
|
||||
|
||||
PathItem *addTrack(const Track &track);
|
||||
PathItem *addRoute(const Route &route);
|
||||
void addArea(const Area &area);
|
||||
@ -125,7 +127,7 @@ private:
|
||||
QList<RouteItem*> _routes;
|
||||
QList<WaypointItem*> _waypoints;
|
||||
QList<AreaItem*> _areas;
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*> _pois;
|
||||
POIHash _pois;
|
||||
|
||||
RectC _tr, _rr, _wr, _ar;
|
||||
qreal _res;
|
||||
|
@ -36,15 +36,18 @@ static QFrame *line()
|
||||
}
|
||||
#endif // Q_OS_MAC
|
||||
|
||||
|
||||
QWidget *OptionsDialog::createMapPage()
|
||||
{
|
||||
_projection = new LimitedComboBox(200);
|
||||
QList<PCS::Info> projections(PCS::pcsList());
|
||||
|
||||
QList<KV<int, QString> > projections(GCS::list() + PCS::list());
|
||||
qSort(projections);
|
||||
|
||||
for (int i = 0; i < projections.size(); i++) {
|
||||
QString text = QString::number(projections.at(i).id()) + " - "
|
||||
+ projections.at(i).name();
|
||||
_projection->addItem(text, QVariant(projections.at(i).id()));
|
||||
QString text = QString::number(projections.at(i).key()) + " - "
|
||||
+ projections.at(i).value();
|
||||
_projection->addItem(text, QVariant(projections.at(i).key()));
|
||||
}
|
||||
_projection->setCurrentIndex(_projection->findData(_options->projection));
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
void ToolTip::insert(const QString &key, const QString &value)
|
||||
{
|
||||
_list.append(KV(key, value));
|
||||
_list.append(KV<QString, QString>(key, value));
|
||||
}
|
||||
|
||||
QString ToolTip::toString() const
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
QString toString() const;
|
||||
|
||||
private:
|
||||
QList<KV> _list;
|
||||
QList<KV<QString, QString> > _list;
|
||||
ImageInfo _img;
|
||||
};
|
||||
|
||||
|
@ -1,21 +1,20 @@
|
||||
#ifndef KV_H
|
||||
#define KV_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
template <class KEY, class VALUE>
|
||||
class KV {
|
||||
public:
|
||||
KV(const QString &key, const QString &value) : _key(key), _value(value) {}
|
||||
KV(const KEY &key, const VALUE &value) : _key(key), _value(value) {}
|
||||
|
||||
const QString &key() const {return _key;}
|
||||
const QString &value() const {return _value;}
|
||||
const KEY &key() const {return _key;}
|
||||
const VALUE &value() const {return _value;}
|
||||
|
||||
bool operator==(const KV &other) const
|
||||
{return this->key() == other.key();}
|
||||
bool operator==(const KV &other) const {return _key == other._key;}
|
||||
bool operator<(const KV &other) const {return _key < other._key;}
|
||||
|
||||
private:
|
||||
QString _key;
|
||||
QString _value;
|
||||
KEY _key;
|
||||
VALUE _value;
|
||||
};
|
||||
|
||||
#endif // KV_H
|
||||
|
@ -229,6 +229,18 @@ Coordinates GCS::fromWGS84(const Coordinates &c) const
|
||||
return Coordinates(_primeMeridian.fromGreenwich(ds.lon()), ds.lat());
|
||||
}
|
||||
|
||||
QList<KV<int, QString> > GCS::list()
|
||||
{
|
||||
QList<KV<int, QString> > list;
|
||||
|
||||
for (int i = 0; i < _gcss.size(); i++)
|
||||
if (_gcss.at(i).id())
|
||||
list.append(KV<int, QString>(_gcss.at(i).id(), _gcss.at(i).name()
|
||||
+ " / Geographic 2D"));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const GCS &gcs)
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef GCS_H
|
||||
#define GCS_H
|
||||
|
||||
#include "common/kv.h"
|
||||
#include "datum.h"
|
||||
#include "angularunits.h"
|
||||
#include "primemeridian.h"
|
||||
@ -32,6 +33,7 @@ public:
|
||||
static const GCS &WGS84();
|
||||
|
||||
static void loadList(const QString &path);
|
||||
static QList<KV<int, QString> > list();
|
||||
|
||||
private:
|
||||
class Entry;
|
||||
|
@ -73,12 +73,12 @@ private:
|
||||
};
|
||||
|
||||
|
||||
static Range zooms(12, 28);
|
||||
static const Range zooms(12, 28);
|
||||
|
||||
static QColor shieldColor(Qt::white);
|
||||
static QColor shieldBgColor1("#dd3e3e");
|
||||
static QColor shieldBgColor2("#379947");
|
||||
static QColor shieldBgColor3("#4a7fc1");
|
||||
static const QColor shieldColor(Qt::white);
|
||||
static const QColor shieldBgColor1("#dd3e3e");
|
||||
static const QColor shieldBgColor2("#379947");
|
||||
static const QColor shieldBgColor3("#4a7fc1");
|
||||
|
||||
static QString convertUnits(const QString &str)
|
||||
{
|
||||
@ -259,7 +259,8 @@ void IMGMap::setZoom(int zoom)
|
||||
|
||||
Transform IMGMap::transform(int zoom) const
|
||||
{
|
||||
double scale = (2.0 * M_PI * WGS84_RADIUS) / (1<<zoom);
|
||||
double scale = _projection.isGeographic()
|
||||
? 360.0 / (1<<zoom) : (2.0 * M_PI * WGS84_RADIUS) / (1<<zoom);
|
||||
PointD topLeft(_projection.ll2xy(_img.bounds().topLeft()));
|
||||
return Transform(ReferencePoint(PointD(0, 0), topLeft),
|
||||
PointD(scale, scale));
|
||||
|
@ -196,8 +196,8 @@ void MapSource::map(QXmlStreamReader &reader, Config &config)
|
||||
if (!attr.hasAttribute("id"))
|
||||
reader.raiseError("Missing dimension id");
|
||||
else
|
||||
config.dimensions.append(KV(attr.value("id").toString(),
|
||||
reader.readElementText()));
|
||||
config.dimensions.append(KV<QString, QString>
|
||||
(attr.value("id").toString(), reader.readElementText()));
|
||||
} else if (reader.name() == "crs") {
|
||||
config.coordinateSystem = coordinateSystem(reader);
|
||||
config.crs = reader.readElementText();
|
||||
|
@ -38,7 +38,7 @@ private:
|
||||
QString crs;
|
||||
CoordinateSystem coordinateSystem;
|
||||
bool rest;
|
||||
QList<KV> dimensions;
|
||||
QList<KV<QString, QString> > dimensions;
|
||||
Authorization authorization;
|
||||
qreal tileRatio;
|
||||
int tileSize;
|
||||
|
@ -223,12 +223,12 @@ void PCS::loadList(const QString &path)
|
||||
}
|
||||
}
|
||||
|
||||
QList<PCS::Info> PCS::pcsList()
|
||||
QList<KV<int, QString> > PCS::list()
|
||||
{
|
||||
QList<Info> list;
|
||||
QList<KV<int, QString> > list;
|
||||
|
||||
for (int i = 0; i < _pcss.size(); i++)
|
||||
list.append(Info(_pcss.at(i).id(), _pcss.at(i).name()));
|
||||
list.append(KV<int, QString>(_pcss.at(i).id(), _pcss.at(i).name()));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include <QList>
|
||||
#include "common/kv.h"
|
||||
#include "gcs.h"
|
||||
#include "linearunits.h"
|
||||
#include "coordinatesystem.h"
|
||||
@ -11,20 +12,6 @@
|
||||
class PCS
|
||||
{
|
||||
public:
|
||||
class Info {
|
||||
public:
|
||||
Info(int id, const QString &name) : _id(id), _name(name) {}
|
||||
|
||||
int id() const {return _id;}
|
||||
const QString &name() const {return _name;}
|
||||
|
||||
bool operator<(const Info &other) const {return _id < other._id;}
|
||||
|
||||
private:
|
||||
int _id;
|
||||
QString _name;
|
||||
};
|
||||
|
||||
PCS() : _gcs(0) {}
|
||||
PCS(const GCS *gcs, const Projection::Method &method,
|
||||
const Projection::Setup &setup, const LinearUnits &units,
|
||||
@ -48,7 +35,7 @@ public:
|
||||
static void loadList(const QString &path);
|
||||
static const PCS *pcs(int id);
|
||||
static const PCS *pcs(const GCS *gcs, int proj);
|
||||
static QList<Info> pcsList();
|
||||
static QList<KV<int, QString> > list();
|
||||
|
||||
private:
|
||||
class Entry;
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
public:
|
||||
Setup(const QString &url, const QString &layer, const QString &style,
|
||||
const QString &format, const QString &crs, const CoordinateSystem &cs,
|
||||
const QList<KV> &dimensions,
|
||||
const QList<KV<QString, QString> > &dimensions,
|
||||
const Authorization &authorization = Authorization())
|
||||
: _url(url), _layer(layer), _style(style), _format(format),
|
||||
_crs(crs), _cs(cs), _dimensions(dimensions),
|
||||
@ -33,7 +33,8 @@ public:
|
||||
const QString &format() const {return _format;}
|
||||
const QString &crs() const {return _crs;}
|
||||
const CoordinateSystem &coordinateSystem() const {return _cs;}
|
||||
const QList<KV> &dimensions() const {return _dimensions;}
|
||||
const QList<KV<QString, QString> > &dimensions() const
|
||||
{return _dimensions;}
|
||||
|
||||
private:
|
||||
QString _url;
|
||||
@ -42,7 +43,7 @@ public:
|
||||
QString _format;
|
||||
QString _crs;
|
||||
CoordinateSystem _cs;
|
||||
QList<KV> _dimensions;
|
||||
QList<KV<QString, QString> > _dimensions;
|
||||
Authorization _authorization;
|
||||
};
|
||||
|
||||
|
@ -34,7 +34,7 @@ QString WMSMap::tileUrl(const QString &version) const
|
||||
url.append(QString("&SRS=%1").arg(_setup.crs()));
|
||||
|
||||
for (int i = 0; i < _setup.dimensions().size(); i++) {
|
||||
const KV &dim = _setup.dimensions().at(i);
|
||||
const KV<QString, QString> &dim = _setup.dimensions().at(i);
|
||||
url.append(QString("&%1=%2").arg(dim.key(), dim.value()));
|
||||
}
|
||||
|
||||
|
@ -335,7 +335,7 @@ WMTS::WMTS(const QString &file, const WMTS::Setup &setup) : _valid(false)
|
||||
setup.url().contains('?') ? "&" : "?" , setup.format(),
|
||||
setup.layer(), style, setup.set());
|
||||
for (int i = 0; i < setup.dimensions().size(); i++) {
|
||||
const KV &dim = setup.dimensions().at(i);
|
||||
const KV<QString, QString> &dim = setup.dimensions().at(i);
|
||||
_tileUrl.append(QString("&%1=%2").arg(dim.key(), dim.value()));
|
||||
}
|
||||
} else {
|
||||
@ -345,7 +345,7 @@ WMTS::WMTS(const QString &file, const WMTS::Setup &setup) : _valid(false)
|
||||
_tileUrl.replace("{TileRow}", "$y", Qt::CaseInsensitive);
|
||||
_tileUrl.replace("{TileCol}", "$x", Qt::CaseInsensitive);
|
||||
for (int i = 0; i < setup.dimensions().size(); i++) {
|
||||
const KV &dim = setup.dimensions().at(i);
|
||||
const KV<QString, QString> &dim = setup.dimensions().at(i);
|
||||
_tileUrl.replace(QString("{%1}").arg(dim.key()), dim.value(),
|
||||
Qt::CaseInsensitive);
|
||||
}
|
||||
|
@ -22,7 +22,8 @@ public:
|
||||
public:
|
||||
Setup(const QString &url, const QString &layer, const QString &set,
|
||||
const QString &style, const QString &format, bool rest,
|
||||
const CoordinateSystem &cs, const QList<KV> &dimensions,
|
||||
const CoordinateSystem &cs,
|
||||
const QList<KV<QString, QString> > &dimensions,
|
||||
const Authorization &authorization = Authorization())
|
||||
: _url(url), _layer(layer), _set(set), _style(style),
|
||||
_format(format), _rest(rest), _cs(cs), _dimensions(dimensions),
|
||||
@ -36,7 +37,8 @@ public:
|
||||
const QString &format() const {return _format;}
|
||||
bool rest() const {return _rest;}
|
||||
const CoordinateSystem &coordinateSystem() const {return _cs;}
|
||||
const QList<KV> &dimensions() const {return _dimensions;}
|
||||
const QList<KV<QString, QString> > &dimensions() const
|
||||
{return _dimensions;}
|
||||
|
||||
private:
|
||||
QString _url;
|
||||
@ -46,7 +48,7 @@ public:
|
||||
QString _format;
|
||||
bool _rest;
|
||||
CoordinateSystem _cs;
|
||||
QList<KV> _dimensions;
|
||||
QList<KV<QString, QString> > _dimensions;
|
||||
Authorization _authorization;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user