diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-11-10 11:50:04 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2015-11-11 16:59:49 +0200 |
commit | e2052ea3e46272f5b0eb26643c0d7e70bad46557 (patch) | |
tree | 6f06237a889bc740972845d65d178908d894159a /include/mbgl/util/geo.hpp | |
parent | e5c460f2db3f7506f4fc38b16747f0ace9151017 (diff) | |
download | qtlocation-mapboxgl-e2052ea3e46272f5b0eb26643c0d7e70bad46557.tar.gz |
[core] Added PrecisionPoint to represent pixel points
Diffstat (limited to 'include/mbgl/util/geo.hpp')
-rw-r--r-- | include/mbgl/util/geo.hpp | 16 |
1 files changed, 15 insertions, 1 deletions
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 { |