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;}
|
qreal lat() const {return _lat;}
|
||||||
|
|
||||||
bool isNull() const
|
bool isNull() const
|
||||||
{return (std::isnan(_lon) || std::isnan(_lat)) ? true : false;}
|
{return std::isnan(_lon) && std::isnan(_lat);}
|
||||||
bool isValid() const
|
bool isValid() const
|
||||||
{return (_lon >= -180.0 && _lon <= 180.0 && _lat >= -90.0
|
{return (!std::isnan(_lon) && !std::isnan(_lat)
|
||||||
&& _lat <= 90.0) ? true : false;}
|
&& _lon >= -180.0 && _lon <= 180.0 && _lat >= -90.0 && _lat <= 90.0);}
|
||||||
|
|
||||||
qreal distanceTo(const Coordinates &c) const;
|
qreal distanceTo(const Coordinates &c) const;
|
||||||
QPair<Coordinates, Coordinates> boundingRect(qreal distance) const;
|
QPair<Coordinates, Coordinates> boundingRect(qreal distance) const;
|
||||||
|
@ -112,7 +112,7 @@ void TCXParser::trackpoints(TrackData &track)
|
|||||||
if (_reader.name() == "Trackpoint") {
|
if (_reader.name() == "Trackpoint") {
|
||||||
Trackpoint t;
|
Trackpoint t;
|
||||||
trackpointData(t);
|
trackpointData(t);
|
||||||
if (!t.coordinates().isNull())
|
if (t.coordinates().isValid())
|
||||||
track.append(t);
|
track.append(t);
|
||||||
else
|
else
|
||||||
warning("Missing Trackpoint coordinates");
|
warning("Missing Trackpoint coordinates");
|
||||||
@ -143,7 +143,7 @@ void TCXParser::course(TrackData &track)
|
|||||||
else if (_reader.name() == "CoursePoint") {
|
else if (_reader.name() == "CoursePoint") {
|
||||||
Waypoint w;
|
Waypoint w;
|
||||||
waypointData(w);
|
waypointData(w);
|
||||||
if (!w.coordinates().isNull())
|
if (w.coordinates().isValid())
|
||||||
_waypoints.append(w);
|
_waypoints.append(w);
|
||||||
else
|
else
|
||||||
warning("Missing Trackpoint coordinates");
|
warning("Missing Trackpoint coordinates");
|
||||||
|
Loading…
Reference in New Issue
Block a user