1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-06 06:43:22 +02:00

Added missing namespace

This commit is contained in:
Martin Tůma 2018-04-05 21:13:48 +02:00
parent 81b3a517f8
commit c5256b25e9
14 changed files with 39 additions and 42 deletions

View File

@ -123,8 +123,7 @@ HEADERS += src/config.h \
src/map/wmsmap.h \
src/map/wms.h \
src/map/crs.h \
src/map/coordinatesystem.h \
src/map/axisorder.h
src/map/coordinatesystem.h
SOURCES += src/main.cpp \
src/common/coordinates.cpp \
src/common/rectc.cpp \

View File

@ -1,6 +0,0 @@
#ifndef AXISORDER_H
#define AXISORDER_H
enum AxisOrder {Unknown, XY, YX};
#endif // AXISORDER_H

View File

@ -1,11 +1,11 @@
#ifndef COORDINATESYSTEM_H
#define COORDINATESYSTEM_H
#include "axisorder.h"
class CoordinateSystem
{
public:
enum AxisOrder {Unknown, XY, YX};
CoordinateSystem() : _axisOrder(Unknown) {}
CoordinateSystem(int code);

View File

@ -37,7 +37,7 @@ Projection CRS::projection(const QString &crs)
return Projection();
} else if (authority == "OGC") {
if (code == "CRS84")
return Projection(GCS::gcs(4326), AxisOrder::XY);
return Projection(GCS::gcs(4326), CoordinateSystem::XY);
else
return Projection();
} else

View File

@ -15,18 +15,19 @@
MapSource::Config::Config() : type(TMS), zooms(ZOOM_MIN, ZOOM_MAX),
bounds(Coordinates(BOUNDS_LEFT, BOUNDS_TOP), Coordinates(BOUNDS_RIGHT,
BOUNDS_BOTTOM)), format("image/png"), axisOrder(Unknown), rest(false) {}
BOUNDS_BOTTOM)), format("image/png"), axisOrder(CoordinateSystem::Unknown),
rest(false) {}
static AxisOrder axisOrder(QXmlStreamReader &reader)
static CoordinateSystem::AxisOrder axisOrder(QXmlStreamReader &reader)
{
QXmlStreamAttributes attr = reader.attributes();
if (attr.value("axis") == "yx")
return AxisOrder::YX;
return CoordinateSystem::YX;
else if (attr.value("axis") == "xy")
return AxisOrder::XY;
return CoordinateSystem::XY;
else
return AxisOrder::Unknown;
return CoordinateSystem::Unknown;
}
Range MapSource::zooms(QXmlStreamReader &reader)

View File

@ -5,7 +5,7 @@
#include "common/range.h"
#include "common/rectc.h"
#include "downloader.h"
#include "axisorder.h"
#include "coordinatesystem.h"
class Map;
class QXmlStreamReader;
@ -34,7 +34,7 @@ private:
QString set;
QString format;
QString crs;
AxisOrder axisOrder;
CoordinateSystem::AxisOrder axisOrder;
bool rest;
QList<QPair<QString, QString> > dimensions;
Authorization authorization;

View File

@ -74,7 +74,7 @@ Projection::Projection(const PCS *pcs) : _gcs(pcs->gcs()), _units(pcs->units()),
_axisOrder = pcs->coordinateSystem().axisOrder();
}
Projection::Projection(const GCS *gcs, AxisOrder axisOrder)
Projection::Projection(const GCS *gcs, CoordinateSystem::AxisOrder axisOrder)
: _gcs(gcs), _axisOrder(axisOrder), _geographic(true)
{
_ct = new LatLon(gcs->angularUnits());

View File

@ -5,7 +5,7 @@
#include <QDebug>
#include "common/coordinates.h"
#include "linearunits.h"
#include "axisorder.h"
#include "coordinatesystem.h"
class GCS;
class PCS;
@ -73,7 +73,8 @@ public:
Projection() : _gcs(0), _ct(0), _geographic(false) {}
Projection(const Projection &p);
Projection(const PCS *pcs);
Projection(const GCS *gcs, AxisOrder axisOrder = YX);
Projection(const GCS *gcs, CoordinateSystem::AxisOrder axisOrder
= CoordinateSystem::YX);
~Projection();
Projection &operator=(const Projection &p);
@ -86,13 +87,13 @@ public:
Coordinates xy2ll(const QPointF &p) const;
const LinearUnits &units() const {return _units;}
AxisOrder axisOrder() const {return _axisOrder;}
CoordinateSystem::AxisOrder axisOrder() const {return _axisOrder;}
private:
const GCS *_gcs;
const CT *_ct;
LinearUnits _units;
AxisOrder _axisOrder;
CoordinateSystem::AxisOrder _axisOrder;
bool _geographic;
};

View File

@ -7,7 +7,7 @@
#include "common/rectc.h"
#include "projection.h"
#include "downloader.h"
#include "axisorder.h"
#include "coordinatesystem.h"
class QXmlStreamReader;
@ -18,7 +18,8 @@ public:
{
public:
Setup(const QString &url, const QString &layer, const QString &style,
const QString &format, const QString &crs, AxisOrder axisOrder,
const QString &format, const QString &crs,
CoordinateSystem::AxisOrder axisOrder,
const Authorization &authorization = Authorization())
: _url(url), _layer(layer), _style(style), _format(format), _crs(crs),
_axisOrder(axisOrder), _authorization(authorization) {}
@ -29,7 +30,7 @@ public:
const QString &style() const {return _style;}
const QString &format() const {return _format;}
const QString &crs() const {return _crs;}
AxisOrder axisOrder() const {return _axisOrder;}
CoordinateSystem::AxisOrder axisOrder() const {return _axisOrder;}
private:
QString _url;
@ -37,7 +38,7 @@ public:
QString _style;
QString _format;
QString _crs;
AxisOrder _axisOrder;
CoordinateSystem::AxisOrder _axisOrder;
Authorization _authorization;
};

View File

@ -87,12 +87,12 @@ bool WMSMap::loadWMS()
_setup.authorization());
if (wms.version() >= "1.3.0") {
if (_setup.axisOrder() == Unknown)
if (_setup.axisOrder() == CoordinateSystem::Unknown)
_axisOrder = _projection.axisOrder();
else
_axisOrder = _setup.axisOrder();
} else
_axisOrder = XY;
_axisOrder = CoordinateSystem::XY;
computeZooms(wms.scaleDenominator());
updateTransform();
@ -101,8 +101,8 @@ bool WMSMap::loadWMS()
}
WMSMap::WMSMap(const QString &name, const WMS::Setup &setup, QObject *parent)
: Map(parent), _name(name), _setup(setup), _zoom(0), _axisOrder(Unknown),
_block(false), _valid(false)
: Map(parent), _name(name), _setup(setup), _zoom(0), _block(false),
_valid(false)
{
if (!QDir().mkpath(tilesDir())) {
_errorString = "Error creating tiles dir";
@ -221,7 +221,7 @@ void WMSMap::draw(QPainter *painter, const QRectF &rect)
j * TILE_SIZE)));
QPointF tbr(_transform.img2proj(QPointF(i * TILE_SIZE + TILE_SIZE
- 1, j * TILE_SIZE + TILE_SIZE - 1)));
QRectF bbox = (_axisOrder == YX)
QRectF bbox = (_axisOrder == CoordinateSystem::YX)
? QRectF(QPointF(tbr.y(), tbr.x()), QPointF(ttl.y(), ttl.x()))
: QRectF(ttl, tbr);

View File

@ -64,7 +64,7 @@ private:
QVector<qreal> _zooms;
int _zoom;
QRectF _boundingBox;
AxisOrder _axisOrder;
CoordinateSystem::AxisOrder _axisOrder;
bool _block;
bool _valid;

View File

@ -9,7 +9,7 @@
#include "common/rectc.h"
#include "projection.h"
#include "downloader.h"
#include "axisorder.h"
#include "coordinatesystem.h"
class QXmlStreamReader;
@ -21,7 +21,8 @@ public:
public:
Setup(const QString &url, const QString &layer, const QString &set,
const QString &style, const QString &format, bool rest,
AxisOrder axisOrder, const QList<QPair<QString, QString> > &dimensions,
CoordinateSystem::AxisOrder axisOrder,
const QList<QPair<QString, QString> > &dimensions,
const Authorization &authorization = Authorization()) :
_url(url), _layer(layer), _set(set), _style(style), _format(format),
_rest(rest), _axisOrder(axisOrder), _dimensions(dimensions),
@ -34,7 +35,7 @@ public:
const QString &style() const {return _style;}
const QString &format() const {return _format;}
bool rest() const {return _rest;}
AxisOrder axisOrder() const {return _axisOrder;}
CoordinateSystem::AxisOrder axisOrder() const {return _axisOrder;}
const QList<QPair<QString, QString> > &dimensions() const
{return _dimensions;}
@ -45,7 +46,7 @@ public:
QString _style;
QString _format;
bool _rest;
AxisOrder _axisOrder;
CoordinateSystem::AxisOrder _axisOrder;
QList<QPair<QString, QString> > _dimensions;
Authorization _authorization;
};

View File

@ -26,7 +26,7 @@ bool WMTSMap::loadWMTS()
_tileLoader = TileLoader(wmts.tileUrl(), tilesDir(),
_setup.authorization());
if (_setup.axisOrder() == Unknown)
if (_setup.axisOrder() == CoordinateSystem::Unknown)
_axisOrder = _projection.axisOrder();
else
_axisOrder = _setup.axisOrder();
@ -37,8 +37,8 @@ bool WMTSMap::loadWMTS()
}
WMTSMap::WMTSMap(const QString &name, const WMTS::Setup &setup, QObject *parent)
: Map(parent), _name(name), _setup(setup), _zoom(0), _axisOrder(Unknown),
_block(false), _valid(false)
: Map(parent), _name(name), _setup(setup), _zoom(0), _block(false),
_valid(false)
{
if (!QDir().mkpath(tilesDir())) {
_errorString = "Error creating tiles dir";
@ -72,7 +72,7 @@ void WMTSMap::updateTransform()
const WMTS::Zoom &z = _zooms.at(_zoom);
ReferencePoint tl, br;
QPointF topLeft = (_axisOrder == YX)
QPointF topLeft = (_axisOrder == CoordinateSystem::YX)
? QPointF(z.topLeft().y(), z.topLeft().x()) : z.topLeft();
qreal pixelSpan = sd2res(z.scaleDenominator());

View File

@ -61,7 +61,7 @@ private:
Projection _projection;
Transform _transform;
int _zoom;
AxisOrder _axisOrder;
CoordinateSystem::AxisOrder _axisOrder;
bool _block;
bool _valid;