1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-07 07:13:21 +02:00
GPXSee/src/map/projection.cpp

77 lines
2.0 KiB
C++
Raw Normal View History

2018-01-08 23:47:45 +01:00
#include "datum.h"
2017-11-26 18:54:03 +01:00
#include "mercator.h"
#include "transversemercator.h"
#include "lambertconic.h"
#include "albersequal.h"
#include "lambertazimuthal.h"
2018-01-08 23:47:45 +01:00
#include "projection.h"
2017-11-26 18:54:03 +01:00
2018-01-08 23:47:45 +01:00
Projection::Method::Method(int id)
2017-11-26 18:54:03 +01:00
{
2018-01-08 23:47:45 +01:00
switch (id) {
case 1024:
case 9801:
case 9802:
case 9807:
case 9820:
case 9822:
case 9841:
_id = id;
break;
default:
_id = 0;
2017-11-26 18:54:03 +01:00
}
2018-01-08 23:47:45 +01:00
}
Projection *Projection::projection(const Datum &datum, const Method &method,
const Setup &setup)
{
const Ellipsoid &ellipsoid = datum.ellipsoid();
2017-11-26 18:54:03 +01:00
2018-01-08 23:47:45 +01:00
switch (method.id()) {
case 9807:
return new TransverseMercator(ellipsoid, setup.latitudeOrigin(),
setup.longitudeOrigin(), setup.scale(), setup.falseEasting(),
setup.falseNorthing());
case 1024:
case 9841:
return new Mercator();
case 9802:
return new LambertConic2(ellipsoid, setup.standardParallel1(),
setup.standardParallel2(), setup.latitudeOrigin(),
setup.longitudeOrigin(), setup.falseEasting(),
setup.falseNorthing());
case 9801:
return new LambertConic1(ellipsoid, setup.latitudeOrigin(),
setup.longitudeOrigin(), setup.scale(), setup.falseEasting(),
setup.falseNorthing());
case 9820:
return new LambertAzimuthal(ellipsoid, setup.latitudeOrigin(),
setup.longitudeOrigin(), setup.falseEasting(),
setup.falseNorthing());
case 9822:
return new AlbersEqual(ellipsoid, setup.standardParallel1(),
setup.standardParallel2(), setup.latitudeOrigin(),
setup.longitudeOrigin(), setup.falseEasting(),
setup.falseNorthing());
default:
2017-11-26 18:54:03 +01:00
return 0;
}
}
2018-01-08 23:47:45 +01:00
QDebug operator<<(QDebug dbg, const Projection::Setup &setup)
{
dbg.nospace() << "Setup(" << setup.latitudeOrigin() << ", "
<< setup.longitudeOrigin() << ", " << setup.scale() << ", "
<< setup.falseEasting() << ", " << setup.falseNorthing() << ", "
<< setup.standardParallel1() << ", " << setup.standardParallel2() << ")";
return dbg.space();
}
QDebug operator<<(QDebug dbg, const Projection::Method &method)
2017-11-26 18:54:03 +01:00
{
2018-01-08 23:47:45 +01:00
dbg.nospace() << "Method(" << method.id() << ")";
return dbg.space();
2017-11-26 18:54:03 +01:00
}