1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Cosmetics

This commit is contained in:
Martin Tůma 2018-05-12 13:13:35 +02:00
parent adb407dcf5
commit 22ea1b0bca
2 changed files with 9 additions and 11 deletions

View File

@ -9,7 +9,6 @@
static Ellipsoid WGS84e = Ellipsoid(WGS84_RADIUS, WGS84_FLATTENING);
static Datum WGS84 = Datum(&WGS84e, 0.0, 0.0, 0.0);
// Abridged Molodensky transformation
static Coordinates molodensky(const Coordinates &c, const Datum &from,
const Datum &to)
{
@ -47,7 +46,6 @@ static Coordinates molodensky(const Coordinates &c, const Datum &from,
return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat));
}
Point3D Datum::helmert(const Point3D &p) const
{
double scale = 1 + _ds * 1e-6;
@ -95,9 +93,9 @@ Datum::Datum(const Ellipsoid *ellipsoid, double dx, double dy, double dz,
if (_ellipsoid->radius() == WGS84_RADIUS && _ellipsoid->flattening()
== WGS84_FLATTENING && _dx == 0.0 && _dy == 0.0 && _dz == 0.0
&& _rx == 0.0 && _ry == 0.0 && _rz == 0.0 && _ds == 0.0)
_shift = None;
_transformation = None;
else
_shift = Helmert;
_transformation = Helmert;
}
Datum::Datum(const Ellipsoid *ellipsoid, double dx, double dy, double dz)
@ -106,14 +104,14 @@ Datum::Datum(const Ellipsoid *ellipsoid, double dx, double dy, double dz)
{
if (_ellipsoid->radius() == WGS84_RADIUS && _ellipsoid->flattening()
== WGS84_FLATTENING && _dx == 0.0 && _dy == 0.0 && _dz == 0.0)
_shift = None;
_transformation = None;
else
_shift = Molodensky;
_transformation = Molodensky;
}
Coordinates Datum::toWGS84(const Coordinates &c) const
{
switch (_shift) {
switch (_transformation) {
case Helmert:
return Geocentric::toGeodetic(helmert(Geocentric::fromGeodetic(c,
*this)), WGS84);
@ -126,7 +124,7 @@ Coordinates Datum::toWGS84(const Coordinates &c) const
Coordinates Datum::fromWGS84(const Coordinates &c) const
{
switch (_shift) {
switch (_transformation) {
case Helmert:
return Geocentric::toGeodetic(helmertr(Geocentric::fromGeodetic(c,
WGS84)), *this);

View File

@ -11,7 +11,7 @@
class Datum
{
public:
Datum() : _ellipsoid(0), _shift(None), _dx(NAN), _dy(NAN), _dz(NAN),
Datum() : _ellipsoid(0), _transformation(None), _dx(NAN), _dy(NAN), _dz(NAN),
_rx(NAN), _ry(NAN), _rz(NAN), _ds(NAN) {}
Datum(const Ellipsoid *ellipsoid, double dx, double dy, double dz,
double rx, double ry, double rz, double ds);
@ -37,7 +37,7 @@ public:
Coordinates fromWGS84(const Coordinates &c) const;
private:
enum ShiftType {
enum TransformationType {
None,
Molodensky,
Helmert
@ -47,7 +47,7 @@ private:
Point3D helmertr(const Point3D &p) const;
const Ellipsoid *_ellipsoid;
ShiftType _shift;
TransformationType _transformation;
double _dx, _dy, _dz, _rx, _ry, _rz, _ds;
};