summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-10 11:50:04 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2015-11-11 16:59:49 +0200
commite2052ea3e46272f5b0eb26643c0d7e70bad46557 (patch)
tree6f06237a889bc740972845d65d178908d894159a /include
parente5c460f2db3f7506f4fc38b16747f0ace9151017 (diff)
downloadqtlocation-mapboxgl-e2052ea3e46272f5b0eb26643c0d7e70bad46557.tar.gz
[core] Added PrecisionPoint to represent pixel points
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 {