summaryrefslogtreecommitdiff
path: root/src/mbgl/util/geo.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-03-01 14:17:21 +0000
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-03-01 20:58:54 +0000
commitc6757b9a9b004c566c9ff0b0715d336e668e1410 (patch)
tree6ae5a7c7fb29f5d68e2fb9e94b8da892bacbad2e /src/mbgl/util/geo.cpp
parentfde0ab98eedd77e652e1232605e4bc96f9fa65b9 (diff)
downloadqtlocation-mapboxgl-c6757b9a9b004c566c9ff0b0715d336e668e1410.tar.gz
[core] Added DEGREES_MAX as constant value
Diffstat (limited to 'src/mbgl/util/geo.cpp')
-rw-r--r--src/mbgl/util/geo.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mbgl/util/geo.cpp b/src/mbgl/util/geo.cpp
index f08dca7272..bf7cf38117 100644
--- a/src/mbgl/util/geo.cpp
+++ b/src/mbgl/util/geo.cpp
@@ -7,7 +7,7 @@
namespace mbgl {
LatLng::LatLng(const TileID& id) {
- longitude = id.x / std::pow(2.0, id.z) * 360.0 - util::LONGITUDE_MAX;
+ longitude = id.x / std::pow(2.0, id.z) * util::DEGREES_MAX - util::LONGITUDE_MAX;
const double n = M_PI - 2.0 * M_PI * id.y / std::pow(2.0, id.z);
latitude = util::RAD2DEG * std::atan(0.5 * (std::exp(n) - std::exp(-n)));
}
@@ -18,7 +18,7 @@ ScreenCoordinate LatLng::project() const {
// Project a coordinate into unit space in a square map.
const double sine = std::sin(constrainedLatitude * util::DEG2RAD);
- const double x = longitude / 360.0 + 0.5;
+ const double x = longitude / util::DEGREES_MAX + 0.5;
const double y = 0.5 - 0.25 * std::log((1.0 + sine) / (1.0 - sine)) / M_PI;
return { x, y };
}