summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-12 17:19:34 +0200
committerMinh Nguyễn <mxn@1ec5.org>2015-11-12 10:46:50 -0800
commit8b76f00d8cc617abb492c368fc6887183147402b (patch)
tree584e43e8147ec69be9097a0c52f4309fe639593a /src
parent6748b6155e0bdb61aa33ecfe467711ce7e1189c3 (diff)
downloadqtlocation-mapboxgl-8b76f00d8cc617abb492c368fc6887183147402b.tar.gz
[core] PrecisionPoint is now a vec2<double>
We could reuse all the operators defined in vec2<>, including operator bool() that checks if the contained values are !NaN.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/map.cpp4
-rw-r--r--src/mbgl/map/transform.cpp18
2 files changed, 11 insertions, 11 deletions
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index 9845c89ae1..69931ed29d 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -315,8 +315,8 @@ double Map::getBearing() const {
return -transform->getAngle() / M_PI * 180;
}
-void Map::resetNorth() {
- transform->setAngle(0, std::chrono::milliseconds(500));
+void Map::resetNorth(const Duration& duration) {
+ transform->setAngle(0, duration);
update(Update::Repaint);
}
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index dac4018627..b932c8cb38 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -71,7 +71,7 @@ void Transform::easeTo(const CameraOptions& options) {
LatLng latLng = easeOptions.center ? *easeOptions.center : getLatLng();
double zoom = easeOptions.zoom ? *easeOptions.zoom : getZoom();
double angle = easeOptions.angle ? *easeOptions.angle : getAngle();
- if (!latLng.isValid() || std::isnan(zoom) || std::isnan(angle)) {
+ if (!latLng || std::isnan(zoom) || std::isnan(angle)) {
return;
}
@@ -94,7 +94,7 @@ void Transform::easeTo(const CameraOptions& options) {
}
void Transform::moveBy(const PrecisionPoint& point, const Duration& duration) {
- if (!point.isValid()) {
+ if (!point) {
return;
}
@@ -113,7 +113,7 @@ void Transform::_moveBy(const PrecisionPoint& point, const Duration& duration) {
}
void Transform::setLatLng(const LatLng& latLng, const Duration& duration) {
- if (!latLng.isValid()) {
+ if (!latLng) {
return;
}
@@ -124,7 +124,7 @@ void Transform::setLatLng(const LatLng& latLng, const Duration& duration) {
}
void Transform::setLatLng(const LatLng& latLng, const PrecisionPoint& point, const Duration& duration) {
- if (!latLng.isValid() || !point.isValid()) {
+ if (!latLng || !point) {
return;
}
@@ -145,7 +145,7 @@ void Transform::setLatLng(const LatLng& latLng, const PrecisionPoint& point, con
}
void Transform::setLatLngZoom(const LatLng& latLng, double zoom, const Duration& duration) {
- if (!latLng.isValid() || std::isnan(zoom)) {
+ if (!latLng || std::isnan(zoom)) {
return;
}
@@ -160,7 +160,7 @@ void Transform::setLatLngZoom(const LatLng& latLng, double zoom, const Duration&
#pragma mark - Zoom
void Transform::scaleBy(const double ds, const PrecisionPoint& center, const Duration& duration) {
- if (std::isnan(ds) || !center.isValid()) {
+ if (std::isnan(ds) || !center) {
return;
}
@@ -176,7 +176,7 @@ void Transform::scaleBy(const double ds, const PrecisionPoint& center, const Dur
}
void Transform::setScale(const double scale, const PrecisionPoint& center, const Duration& duration) {
- if (std::isnan(scale) || !center.isValid()) {
+ if (std::isnan(scale) || !center) {
return;
}
@@ -306,7 +306,7 @@ void Transform::_easeTo(const CameraOptions& options, double new_scale, double n
#pragma mark - Angle
void Transform::rotateBy(const PrecisionPoint& first, const PrecisionPoint& second, const Duration& duration) {
- if (!first.isValid() || !second.isValid()) {
+ if (!first || !second) {
return;
}
@@ -346,7 +346,7 @@ void Transform::setAngle(const double new_angle, const Duration& duration) {
}
void Transform::setAngle(const double new_angle, const PrecisionPoint& center) {
- if (std::isnan(new_angle) || !center.isValid()) {
+ if (std::isnan(new_angle) || !center) {
return;
}