summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/map/map.hpp2
-rw-r--r--include/mbgl/util/geo.hpp16
2 files changed, 16 insertions, 2 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index 116722125b..5276427574 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -100,7 +100,7 @@ public:
void easeTo(CameraOptions options);
// Position
- void moveBy(double dx, double dy, const Duration& = Duration::zero());
+ void moveBy(const PrecisionPoint&, const Duration& = Duration::zero());
void setLatLng(LatLng latLng, vec2<double> point, const Duration& = Duration::zero());
void setLatLng(LatLng latLng, const Duration& = Duration::zero());
LatLng getLatLng() const;
diff --git a/include/mbgl/util/geo.hpp b/include/mbgl/util/geo.hpp
index bfcb84bd7c..7e2ad998b9 100644
--- a/include/mbgl/util/geo.hpp
+++ b/include/mbgl/util/geo.hpp
@@ -3,10 +3,24 @@
#include <mbgl/util/vec.hpp>
+#include <cmath>
+
namespace mbgl {
class TileID;
+struct PrecisionPoint {
+ double x = 0;
+ double y = 0;
+
+ inline PrecisionPoint(double x_ = 0, double y_ = 0)
+ : x(x_), y(y_) {}
+
+ inline bool isValid() const {
+ return !(std::isnan(x) || std::isnan(y));
+ }
+};
+
struct LatLng {
double latitude = 0;
double longitude = 0;
@@ -21,7 +35,7 @@ struct LatLng {
// Constructs a LatLng object with the top left position of the specified tile.
LatLng(const TileID& id);
- vec2<double> project() const;
+ PrecisionPoint project() const;
};
struct ProjectedMeters {