summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-10 11:45:07 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-11 16:59:49 +0200
commite5c460f2db3f7506f4fc38b16747f0ace9151017 (patch)
tree4184fd983cbc254748c93b316412bc043c393c25 /src
parent54e08b1f83504e12cbc19b08295d9f9ed5177ab5 (diff)
downloadqtlocation-mapboxgl-e5c460f2db3f7506f4fc38b16747f0ace9151017.tar.gz
[core] Added isValid to geo helper structs
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/transform.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index f0c5a136e0..1a6cbb77be 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -65,7 +65,7 @@ void Transform::easeTo(CameraOptions options) {
LatLng latLng = options.center ? *options.center : getLatLng();
double zoom = options.zoom ? *options.zoom : getZoom();
double angle = options.angle ? *options.angle : getAngle();
- if (std::isnan(latLng.latitude) || std::isnan(latLng.longitude) || std::isnan(zoom)) {
+ if (!latLng.isValid() || std::isnan(zoom)) {
return;
}
@@ -108,6 +108,10 @@ void Transform::_moveBy(const double dx, const double dy, const Duration& durati
}
void Transform::setLatLng(const LatLng latLng, const Duration& duration) {
+ if (!latLng.isValid()) {
+ return;
+ }
+
CameraOptions options;
options.center = latLng;
options.duration = duration;
@@ -115,7 +119,7 @@ void Transform::setLatLng(const LatLng latLng, const Duration& duration) {
}
void Transform::setLatLng(const LatLng latLng, vec2<double> point, const Duration& duration) {
- if (std::isnan(latLng.latitude) || std::isnan(latLng.longitude)) {
+ if (!latLng.isValid()) {
return;
}