[core] Added PrecisionPoint to represent pixel points

This commit is contained in:
Bruno de Oliveira Abinader
2015-11-10 11:50:04 +02:00
parent e5c460f2db
commit e2052ea3e4
8 changed files with 30 additions and 17 deletions

View File

@@ -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;

View File

@@ -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 {