1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-18 21:04:24 +02:00

Added support for world file maps

This commit is contained in:
2021-06-17 21:58:25 +02:00
parent 4ada19b4bf
commit ec5a1c7851
61 changed files with 1288 additions and 322 deletions

View File

@ -40,7 +40,7 @@ static CalibrationPoint parseCalibrationPoint(const QString &str)
: CalibrationPoint(xy, pp);
}
static Projection parseProjection(const QString &str, const GCS *gcs)
static Projection parseProjection(const QString &str, const GCS &gcs)
{
QStringList fields(str.split(","));
if (fields.isEmpty())
@ -49,7 +49,6 @@ static Projection parseProjection(const QString &str, const GCS *gcs)
int id = fields.at(0).toDouble(&ret);
if (!ret)
return Projection();
PCS pcs;
int zone;
switch (id) {
@ -61,49 +60,40 @@ static Projection parseProjection(const QString &str, const GCS *gcs)
return Projection();
if (fields.at(3) == "S")
zone = -zone;
pcs = PCS(gcs, 9807, UTM::setup(zone), 9001);
return Projection(&pcs);
return Projection(PCS(gcs, 9807, UTM::setup(zone), 9001));
case 1: // LatLon
return Projection(gcs);
case 2: // Mercator
pcs = PCS(gcs, 1024, Projection::Setup(), 9001);
return Projection(&pcs);
return Projection(PCS(gcs, 1024, Projection::Setup(), 9001));
case 3: // Transversal Mercator
if (fields.size() < 7)
return Projection();
pcs = PCS(gcs, 9807, Projection::Setup(fields.at(3).toDouble(),
fields.at(2).toDouble(), fields.at(6).toDouble(),
fields.at(5).toDouble(), fields.at(4).toDouble(),
NAN, NAN), 9001);
return Projection(&pcs);
return Projection(PCS(gcs, 9807, Projection::Setup(
fields.at(3).toDouble(), fields.at(2).toDouble(),
fields.at(6).toDouble(), fields.at(5).toDouble(),
fields.at(4).toDouble(), NAN, NAN), 9001));
case 4: // Lambert 2SP
if (fields.size() < 8)
return Projection();
pcs = PCS(gcs, 9802, Projection::Setup(fields.at(4).toDouble(),
fields.at(5).toDouble(), NAN,
return Projection(PCS(gcs, 9802, Projection::Setup(
fields.at(4).toDouble(), fields.at(5).toDouble(), NAN,
fields.at(6).toDouble(), fields.at(7).toDouble(),
fields.at(3).toDouble(), fields.at(2).toDouble()), 9001);
return Projection(&pcs);
fields.at(3).toDouble(), fields.at(2).toDouble()), 9001));
case 6: // BGN (British National Grid)
pcs = PCS(gcs, 9807, Projection::Setup(49, -2, 0.999601, 400000,
-100000, NAN, NAN), 9001);
return Projection(&pcs);
return Projection(PCS(gcs, 9807, Projection::Setup(49, -2, 0.999601,
400000, -100000, NAN, NAN), 9001));
case 12: // France Lambert II etendu
pcs = PCS(gcs, 9801, Projection::Setup(52, 0, 0.99987742, 600000,
2200000, NAN, NAN), 9001);
return Projection(&pcs);
return Projection(PCS(gcs, 9801, Projection::Setup(52, 0,
0.99987742, 600000, 2200000, NAN, NAN), 9001));
case 14: // Swiss Grid
pcs = PCS(gcs, 9815, Projection::Setup(46.570866, 7.26225, 1.0,
600000, 200000, 90.0, 90.0), 9001);
return Projection(&pcs);
return Projection(PCS(gcs, 9815, Projection::Setup(46.570866,
7.26225, 1.0, 600000, 200000, 90.0, 90.0), 9001));
case 108: // Dutch RD grid
pcs = PCS(gcs, 9809, Projection::Setup(52.15616055555555,
5.38763888888889, 0.9999079, 155000, 463000, NAN, NAN), 9001);
return Projection(&pcs);
return Projection(PCS(gcs, 9809, Projection::Setup(52.15616055555555,
5.38763888888889, 0.9999079, 155000, 463000, NAN, NAN), 9001));
case 184: // Swedish Grid
pcs = PCS(gcs, 9807, Projection::Setup(0, 15.808278, 1, 1500000, 0,
NAN, NAN), 9001);
return Projection(&pcs);
return Projection(PCS(gcs, 9807, Projection::Setup(0, 15.808278, 1,
1500000, 0, NAN, NAN), 9001));
default:
return Projection();
}
@ -113,7 +103,6 @@ bool RMap::parseIMP(const QByteArray &data)
{
QStringList lines = QString(data).split("\r\n");
QVector<CalibrationPoint> calibrationPoints;
const GCS *gcs = 0;
QString projection, datum;
QRegularExpression re("^P[0-9]+=");
@ -136,7 +125,8 @@ bool RMap::parseIMP(const QByteArray &data)
}
}
if (!(gcs = GCS::gcs(datum))) {
const GCS &gcs = GCS::gcs(datum);
if (gcs.isNull()) {
_errorString = datum + ": unknown/invalid datum";
return false;
}