1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-18 19:52:09 +01:00

Unified isNull() logic

This commit is contained in:
Martin Tůma 2017-07-12 21:23:56 +02:00
parent 9bc5016141
commit 9a5c5eaf61
3 changed files with 7 additions and 6 deletions

View File

@ -8,7 +8,7 @@
class Datum
{
public:
Datum() : _ellipsoid(Ellipsoid()), _dx(0), _dy(0), _dz(0) {}
Datum() : _ellipsoid(Ellipsoid()), _dx(0.0), _dy(0.0), _dz(0.0) {}
Datum(const Ellipsoid &ellipsoid, double dx, double dy, double dz)
: _ellipsoid(ellipsoid), _dx(dx), _dy(dy), _dz(dz) {}
@ -17,7 +17,8 @@ public:
double dy() const {return _dy;}
double dz() const {return _dz;}
bool isNull() const {return _ellipsoid.isNull();}
bool isNull() const
{return (_ellipsoid.isNull() && _dx == 0.0 && _dy == 0.0 && _dz == 0.0);}
Coordinates toWGS84(const Coordinates &c) const;

View File

@ -7,14 +7,14 @@
class Ellipsoid
{
public:
Ellipsoid() : _radius(-1.0), _flattening(-1.0) {}
Ellipsoid() : _radius(0.0), _flattening(0.0) {}
Ellipsoid(double radius, double flattening)
: _radius(radius), _flattening(flattening) {}
double radius() const {return _radius;}
double flattening() const {return _flattening;}
bool isNull() const {return _radius < 0 || _flattening < 0;}
bool isNull() const {return (_radius == 0.0 && _flattening == 0.0);}
static bool loadList(const QString &path);
static const QString &errorString() {return _errorString;}

View File

@ -180,8 +180,8 @@ bool OfflineMap::createProjection(const QString &datum,
if (setup.latitudeOrigin < -90.0 || setup.latitudeOrigin > 90.0
|| setup.longitudeOrigin < -180.0 || setup.longitudeOrigin > 180.0
|| setup.standardParallel1 < -90 || setup.standardParallel1 > 90
|| setup.standardParallel2 < -90 || setup.standardParallel2 > 90) {
|| setup.standardParallel1 < -90.0 || setup.standardParallel1 > 90.0
|| setup.standardParallel2 < -90.0 || setup.standardParallel2 > 90.0) {
_errorString = "Invalid projection setup";
return false;
}