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

Fixed broken southern hemisphere reference points conversion

Fixed broken UTM zone setup
Added New Zealand TM 2000 "projection" support
This commit is contained in:
Martin Tůma 2017-05-06 00:53:39 +02:00
parent 02654ec862
commit 58b4c87d46

View File

@ -100,14 +100,18 @@ int OfflineMap::parse(QIODevice &device, QList<ReferencePoint> &points,
qreal lonm = list.at(10).trimmed().toFloat(&res); qreal lonm = list.at(10).trimmed().toFloat(&res);
if (!res) if (!res)
ll = false; ll = false;
if (ll && list.at(8).trimmed() == "S") if (ll && list.at(8).trimmed() == "S") {
latd = -latd; latd = -latd;
if (ll && list.at(11).trimmed() == "W") latm = -latm;
}
if (ll && list.at(11).trimmed() == "W") {
lond = -lond; lond = -lond;
lonm = -lonm;
}
int zone = list.at(13).trimmed().toInt(&res); setup.zone = list.at(13).trimmed().toInt(&res);
if (!res) if (!res)
zone = 0; setup.zone = 0;
qreal ppx = list.at(14).trimmed().toFloat(&res); qreal ppx = list.at(14).trimmed().toFloat(&res);
if (!res) if (!res)
pp = false; pp = false;
@ -115,7 +119,7 @@ int OfflineMap::parse(QIODevice &device, QList<ReferencePoint> &points,
if (!res) if (!res)
pp = false; pp = false;
if (list.at(16).trimmed() == "S") if (list.at(16).trimmed() == "S")
zone = -zone; setup.zone = -setup.zone;
ReferencePoint p; ReferencePoint p;
p.xy = QPoint(x, y); p.xy = QPoint(x, y);
@ -127,7 +131,6 @@ int OfflineMap::parse(QIODevice &device, QList<ReferencePoint> &points,
return ln; return ln;
} else if (pp) { } else if (pp) {
p.pp = QPointF(ppx, ppy); p.pp = QPointF(ppx, ppy);
setup.zone = zone;
points.append(p); points.append(p);
} else } else
return ln; return ln;
@ -242,7 +245,10 @@ bool OfflineMap::createProjection(const QString &datum,
_errorString = "Can not determine UTM zone"; _errorString = "Can not determine UTM zone";
return false; return false;
} }
} else { } else if (projection == "(NZTM2) New Zealand TM 2000")
_projection = new TransverseMercator(d.ellipsoid(), 173.0, 0.9996,
1600000, 10000000);
else {
_errorString = QString("%1: Unknown map projection").arg(projection); _errorString = QString("%1: Unknown map projection").arg(projection);
return false; return false;
} }