mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Remaining WGS84 deduplication
This commit is contained in:
parent
06c9fbd849
commit
121a262ea1
@ -7,9 +7,6 @@
|
|||||||
#define ds2scale(x) (1.0 + (x) * 1e-6)
|
#define ds2scale(x) (1.0 + (x) * 1e-6)
|
||||||
#define scale2ds(x) (((x) - 1.0) / 1e-6)
|
#define scale2ds(x) (((x) - 1.0) / 1e-6)
|
||||||
|
|
||||||
static Ellipsoid WGS84e = Ellipsoid(WGS84_RADIUS, WGS84_FLATTENING);
|
|
||||||
static Datum WGS84 = Datum(&WGS84e, 0.0, 0.0, 0.0);
|
|
||||||
|
|
||||||
static Coordinates molodensky(const Coordinates &c, const Datum &from,
|
static Coordinates molodensky(const Coordinates &c, const Datum &from,
|
||||||
const Datum &to)
|
const Datum &to)
|
||||||
{
|
{
|
||||||
@ -46,6 +43,12 @@ static Coordinates molodensky(const Coordinates &c, const Datum &from,
|
|||||||
return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat));
|
return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Datum &Datum::WGS84()
|
||||||
|
{
|
||||||
|
static Datum d(&Ellipsoid::WGS84(), 0.0, 0.0, 0.0);
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
Point3D Datum::helmert(const Point3D &p) const
|
Point3D Datum::helmert(const Point3D &p) const
|
||||||
{
|
{
|
||||||
return Point3D(_scale * (p.x() + _rz * p.y() -_ry * p.z()) + _dx,
|
return Point3D(_scale * (p.x() + _rz * p.y() -_ry * p.z()) + _dx,
|
||||||
@ -92,9 +95,9 @@ Coordinates Datum::toWGS84(const Coordinates &c) const
|
|||||||
switch (_transformation) {
|
switch (_transformation) {
|
||||||
case Helmert:
|
case Helmert:
|
||||||
return Geocentric::toGeodetic(helmert(Geocentric::fromGeodetic(c,
|
return Geocentric::toGeodetic(helmert(Geocentric::fromGeodetic(c,
|
||||||
ellipsoid())), WGS84.ellipsoid());
|
ellipsoid())), WGS84().ellipsoid());
|
||||||
case Molodensky:
|
case Molodensky:
|
||||||
return molodensky(c, *this, WGS84);
|
return molodensky(c, *this, WGS84());
|
||||||
default:
|
default:
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@ -105,9 +108,9 @@ Coordinates Datum::fromWGS84(const Coordinates &c) const
|
|||||||
switch (_transformation) {
|
switch (_transformation) {
|
||||||
case Helmert:
|
case Helmert:
|
||||||
return Geocentric::toGeodetic(helmertr(Geocentric::fromGeodetic(c,
|
return Geocentric::toGeodetic(helmertr(Geocentric::fromGeodetic(c,
|
||||||
WGS84.ellipsoid())), ellipsoid());
|
WGS84().ellipsoid())), ellipsoid());
|
||||||
case Molodensky:
|
case Molodensky:
|
||||||
return molodensky(c, WGS84, *this);
|
return molodensky(c, WGS84(), *this);
|
||||||
default:
|
default:
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,8 @@ public:
|
|||||||
Coordinates toWGS84(const Coordinates &c) const;
|
Coordinates toWGS84(const Coordinates &c) const;
|
||||||
Coordinates fromWGS84(const Coordinates &c) const;
|
Coordinates fromWGS84(const Coordinates &c) const;
|
||||||
|
|
||||||
|
static const Datum &WGS84();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum TransformationType {
|
enum TransformationType {
|
||||||
None,
|
None,
|
||||||
|
@ -46,8 +46,7 @@ QList<GCS::Entry> GCS::_gcss = defaults();
|
|||||||
|
|
||||||
const GCS &GCS::WGS84()
|
const GCS &GCS::WGS84()
|
||||||
{
|
{
|
||||||
static Datum d(&Ellipsoid::WGS84(), 0.0, 0.0, 0.0);
|
static GCS g(Datum::WGS84(), 8901, 9122);
|
||||||
static GCS g(d, 8901, 9122);
|
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user