mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Unified isNull() and isValid() logic with other (QT) classes
This commit is contained in:
parent
d106f47771
commit
2b7d0cd631
@ -20,10 +20,10 @@ public:
|
||||
qreal lat() const {return _lat;}
|
||||
|
||||
bool isNull() const
|
||||
{return (std::isnan(_lon) || std::isnan(_lat)) ? true : false;}
|
||||
{return std::isnan(_lon) && std::isnan(_lat);}
|
||||
bool isValid() const
|
||||
{return (_lon >= -180.0 && _lon <= 180.0 && _lat >= -90.0
|
||||
&& _lat <= 90.0) ? true : false;}
|
||||
{return (!std::isnan(_lon) && !std::isnan(_lat)
|
||||
&& _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;
|
||||
|
@ -112,7 +112,7 @@ void TCXParser::trackpoints(TrackData &track)
|
||||
if (_reader.name() == "Trackpoint") {
|
||||
Trackpoint t;
|
||||
trackpointData(t);
|
||||
if (!t.coordinates().isNull())
|
||||
if (t.coordinates().isValid())
|
||||
track.append(t);
|
||||
else
|
||||
warning("Missing Trackpoint coordinates");
|
||||
@ -143,7 +143,7 @@ void TCXParser::course(TrackData &track)
|
||||
else if (_reader.name() == "CoursePoint") {
|
||||
Waypoint w;
|
||||
waypointData(w);
|
||||
if (!w.coordinates().isNull())
|
||||
if (w.coordinates().isValid())
|
||||
_waypoints.append(w);
|
||||
else
|
||||
warning("Missing Trackpoint coordinates");
|
||||
|
Loading…
Reference in New Issue
Block a user