1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2018-09-30 12:16:41 +02:00
parent 076a091a5b
commit 254deae04a
11 changed files with 26 additions and 28 deletions

View File

@ -21,6 +21,7 @@ HEADERS += src/config.h \
src/common/wgs84.h \
src/common/str2int.h \
src/common/rtree.h \
src/common/kv.h \
src/GUI/app.h \
src/GUI/icons.h \
src/GUI/gui.h \
@ -138,7 +139,6 @@ HEADERS += src/config.h \
src/map/mercator.h \
src/map/jnxmap.h \
src/map/krovak.h \
src/GUI/kv.h \
src/data/locparser.h \
src/data/slfparser.h \
src/map/geotiffmap.h \

View File

@ -3,7 +3,7 @@
#include <QGraphicsItem>
#include <QList>
#include "kv.h"
#include "common/kv.h"
class InfoItem : public QGraphicsItem
{

View File

@ -2,8 +2,7 @@
void ToolTip::insert(const QString &key, const QString &value)
{
QPair<QString, QString> entry(key, value);
_list.append(entry);
_list.append(KV(key, value));
}
QString ToolTip::toString()
@ -11,8 +10,8 @@ QString ToolTip::toString()
QString ret = "<table>";
for (int i = 0; i < _list.count(); i++)
ret += "<tr><td align=\"right\"><b>" + _list.at(i).first
+ ":&nbsp;</b></td><td>" + _list.at(i).second + "</td></tr>";
ret += "<tr><td align=\"right\"><b>" + _list.at(i).key()
+ ":&nbsp;</b></td><td>" + _list.at(i).value() + "</td></tr>";
ret += "</table>";

View File

@ -3,7 +3,7 @@
#include <QString>
#include <QList>
#include <QPair>
#include "common/kv.h"
class ToolTip
{
@ -12,7 +12,7 @@ public:
QString toString();
private:
QList<QPair<QString, QString> > _list;
QList<KV> _list;
};
#endif // TOOLTIP_H

View File

@ -156,8 +156,8 @@ void MapSource::map(QXmlStreamReader &reader, Config &config)
if (!attr.hasAttribute("id"))
reader.raiseError("Missing dimension id");
else
config.dimensions.append(QPair<QString, QString>(
attr.value("id").toString(), reader.readElementText()));
config.dimensions.append(KV(attr.value("id").toString(),
reader.readElementText()));
} else if (reader.name() == "crs") {
config.coordinateSystem = coordinateSystem(reader);
config.crs = reader.readElementText();

View File

@ -4,6 +4,7 @@
#include <QList>
#include "common/range.h"
#include "common/rectc.h"
#include "common/kv.h"
#include "downloader.h"
#include "coordinatesystem.h"
@ -36,7 +37,7 @@ private:
QString crs;
CoordinateSystem coordinateSystem;
bool rest;
QList<QPair<QString, QString> > dimensions;
QList<KV> dimensions;
Authorization authorization;
qreal tileRatio;

View File

@ -5,6 +5,7 @@
#include <QRectF>
#include "common/range.h"
#include "common/rectc.h"
#include "common/kv.h"
#include "projection.h"
#include "downloader.h"
#include "coordinatesystem.h"
@ -18,9 +19,8 @@ public:
{
public:
Setup(const QString &url, const QString &layer, const QString &style,
const QString &format, const QString &crs,
const CoordinateSystem &cs,
const QList<QPair<QString, QString> > &dimensions,
const QString &format, const QString &crs, const CoordinateSystem &cs,
const QList<KV> &dimensions,
const Authorization &authorization = Authorization())
: _url(url), _layer(layer), _style(style), _format(format),
_crs(crs), _cs(cs), _dimensions(dimensions),
@ -33,8 +33,7 @@ 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;}
const QList<KV> &dimensions() const {return _dimensions;}
private:
QString _url;
@ -43,7 +42,7 @@ public:
QString _format;
QString _crs;
CoordinateSystem _cs;
QList<QPair<QString, QString> > _dimensions;
QList<KV> _dimensions;
Authorization _authorization;
};

View File

@ -32,8 +32,8 @@ 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 QPair<QString, QString> &dim = _setup.dimensions().at(i);
url.append(QString("&%1=%2").arg(dim.first, dim.second));
const KV &dim = _setup.dimensions().at(i);
url.append(QString("&%1=%2").arg(dim.key(), dim.value()));
}
return url;

View File

@ -318,8 +318,8 @@ 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 QPair<QString, QString> &dim = setup.dimensions().at(i);
_tileUrl.append(QString("&%1=%2").arg(dim.first, dim.second));
const KV &dim = setup.dimensions().at(i);
_tileUrl.append(QString("&%1=%2").arg(dim.key(), dim.value()));
}
} else {
_tileUrl.replace("{Style}", style, Qt::CaseInsensitive);
@ -328,8 +328,8 @@ 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 QPair<QString, QString> &dim = setup.dimensions().at(i);
_tileUrl.replace(QString("{%1}").arg(dim.first), dim.second,
const KV &dim = setup.dimensions().at(i);
_tileUrl.replace(QString("{%1}").arg(dim.key()), dim.value(),
Qt::CaseInsensitive);
}
}

View File

@ -7,6 +7,7 @@
#include <QList>
#include <QHash>
#include "common/rectc.h"
#include "common/kv.h"
#include "projection.h"
#include "downloader.h"
#include "coordinatesystem.h"
@ -21,8 +22,7 @@ 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<QPair<QString, QString> > &dimensions,
const CoordinateSystem &cs, const QList<KV> &dimensions,
const Authorization &authorization = Authorization())
: _url(url), _layer(layer), _set(set), _style(style),
_format(format), _rest(rest), _cs(cs), _dimensions(dimensions),
@ -36,8 +36,7 @@ public:
const QString &format() const {return _format;}
bool rest() const {return _rest;}
const CoordinateSystem &coordinateSystem() const {return _cs;}
const QList<QPair<QString, QString> > &dimensions() const
{return _dimensions;}
const QList<KV> &dimensions() const {return _dimensions;}
private:
QString _url;
@ -47,7 +46,7 @@ public:
QString _format;
bool _rest;
CoordinateSystem _cs;
QList<QPair<QString, QString> > _dimensions;
QList<KV> _dimensions;
Authorization _authorization;
};