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

Missing file changes...

This commit is contained in:
Martin Tůma 2017-04-01 16:55:46 +02:00
parent 60f107d7cd
commit 8f815a6af0
5 changed files with 30 additions and 9 deletions

View File

@ -151,7 +151,8 @@ SOURCES += src/main.cpp \
src/tar.cpp \
src/atlas.cpp \
src/mercator.cpp \
src/transversemercator.cpp
src/transversemercator.cpp \
src/utm.cpp
RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts \
lang/gpxsee_sv.ts

View File

@ -128,6 +128,12 @@ int OfflineMap::parseMapFile(QIODevice &device, QList<ReferencePoint> &points,
bool OfflineMap::createProjection(const QString &projection,
const ProjectionSetup &setup, QList<ReferencePoint> &points)
{
if (points.count() < 2) {
qWarning("%s: insufficient number of reference points",
qPrintable(_name));
return false;
}
if (projection == "Mercator")
_projection = new Mercator();
else if (projection == "Transverse Mercator")
@ -135,9 +141,16 @@ bool OfflineMap::createProjection(const QString &projection,
setup.falseEasting, setup.falseNorthing);
else if (projection == "Latitude/Longitude")
_projection = new LatLon();
else if (projection == "(UTM) Universal Transverse Mercator")
else if (projection == "(UTM) Universal Transverse Mercator") {
if (setup.zone)
_projection = new UTM(setup.zone);
else if (!points.first().ll.isNull())
_projection = new UTM(points.first().ll);
else {
qWarning("%s: Can not determine UTM zone", qPrintable(_name));
return false;
}
} else {
qWarning("%s: %s: unsupported map projection", qPrintable(_name),
qPrintable(projection));
return false;
@ -152,11 +165,7 @@ bool OfflineMap::createProjection(const QString &projection,
bool OfflineMap::computeTransformation(const QList<ReferencePoint> &points)
{
if (points.count() < 2) {
qWarning("%s: insufficient number of reference points",
qPrintable(_name));
return false;
}
Q_ASSERT(points.count() >= 2);
Matrix c(3, 2);
c.zeroize();

View File

@ -3,6 +3,15 @@
#include "wgs84.h"
#include "transversemercator.h"
TransverseMercator::TransverseMercator()
{
_centralMeridian = 0;
_scale = 1.0;
_falseEasting = 0;
_falseNorthing = 0;
}
TransverseMercator::TransverseMercator(double centralMeridian, double scale,
double falseEasting, double falseNorthing)
{

View File

@ -6,6 +6,7 @@
class TransverseMercator : public Projection
{
public:
TransverseMercator();
TransverseMercator(double centralMeridian, double scale,
double falseEasting, double falseNorthing);

View File

@ -9,6 +9,7 @@ class UTM : public Projection
public:
UTM(int zone) : _tm((qAbs(zone) - 1)*6 - 180 + 3, 0.9996, 500000,
zone < 0 ? 10000000 : 0) {}
UTM(const Coordinates &c);
virtual QPointF ll2xy(const Coordinates &c) const
{return _tm.ll2xy(c);}