1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

isNull() & isValid() logic improvement

This commit is contained in:
Martin Tůma 2017-07-02 09:39:31 +02:00
parent 2b7d0cd631
commit 141e0cb404
2 changed files with 3 additions and 3 deletions

View File

@ -22,8 +22,8 @@ public:
bool isNull() const
{return std::isnan(_lon) && std::isnan(_lat);}
bool isValid() const
{return (!std::isnan(_lon) && !std::isnan(_lat)
&& _lon >= -180.0 && _lon <= 180.0 && _lat >= -90.0 && _lat <= 90.0);}
{return (_lon >= -180.0 && _lon <= 180.0
&& _lat >= -90.0 && _lat <= 90.0);}
qreal distanceTo(const Coordinates &c) const;
QPair<Coordinates, Coordinates> boundingRect(qreal distance) const;

View File

@ -15,7 +15,7 @@ public:
bool isNull() const
{return _tl.isNull() && _br.isNull();}
bool isValid() const
{return !(_tl.isNull() || _br.isNull() || _tl == _br);}
{return (_tl.isValid() && _br.isValid() && _tl != _br);}
Coordinates topLeft() const {return _tl;}
Coordinates bottomRight() const {return _br;}