summaryrefslogtreecommitdiff
path: root/src/mbgl/map/transform_state.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/map/transform_state.cpp
parentfde0ab98eedd77e652e1232605e4bc96f9fa65b9 (diff)
downloadqtlocation-mapboxgl-c6757b9a9b004c566c9ff0b0715d336e668e1410.tar.gz
[core] Added DEGREES_MAX as constant value
Diffstat (limited to 'src/mbgl/map/transform_state.cpp')
-rw-r--r--src/mbgl/map/transform_state.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mbgl/map/transform_state.cpp b/src/mbgl/map/transform_state.cpp
index b7671058e7..b9d30cf8bb 100644
--- a/src/mbgl/map/transform_state.cpp
+++ b/src/mbgl/map/transform_state.cpp
@@ -218,21 +218,21 @@ bool TransformState::isGestureInProgress() const {
#pragma mark - Projection
double TransformState::lngX(double lng) const {
- return (util::LONGITUDE_MAX + lng) * worldSize() / 360.0f;
+ return (util::LONGITUDE_MAX + lng) * worldSize() / util::DEGREES_MAX;
}
double TransformState::latY(double lat) const {
- double y_ = util::RAD2DEG * std::log(std::tan(M_PI / 4 + lat * M_PI / 360.0f));
- return (util::LONGITUDE_MAX - y_) * worldSize() / 360.0f;
+ double y_ = util::RAD2DEG * std::log(std::tan(M_PI / 4 + lat * M_PI / util::DEGREES_MAX));
+ return (util::LONGITUDE_MAX - y_) * worldSize() / util::DEGREES_MAX;
}
double TransformState::xLng(double x_, double worldSize_) const {
- return x_ * 360.0f / worldSize_ - util::LONGITUDE_MAX;
+ return x_ * util::DEGREES_MAX / worldSize_ - util::LONGITUDE_MAX;
}
double TransformState::yLat(double y_, double worldSize_) const {
- double y2 = util::LONGITUDE_MAX - y_ * 360.0f / worldSize_;
- return 360.0f / M_PI * std::atan(std::exp(y2 * util::DEG2RAD)) - 90.0f;
+ double y2 = util::LONGITUDE_MAX - y_ * util::DEGREES_MAX / worldSize_;
+ return util::DEGREES_MAX / M_PI * std::atan(std::exp(y2 * util::DEG2RAD)) - 90.0f;
}
double TransformState::zoomScale(double zoom) const {
@@ -357,7 +357,7 @@ void TransformState::moveLatLng(const LatLng& latLng, const ScreenCoordinate& an
void TransformState::setLatLngZoom(const LatLng &latLng, double zoom) {
double newScale = zoomScale(zoom);
const double newWorldSize = newScale * util::tileSize;
- Bc = newWorldSize / 360;
+ Bc = newWorldSize / util::DEGREES_MAX;
Cc = newWorldSize / util::M2PI;
const double m = 1 - 1e-15;
@@ -378,7 +378,7 @@ void TransformState::setScalePoint(const double newScale, const ScreenCoordinate
scale = constrainedScale;
x = constrainedPoint.x;
y = constrainedPoint.y;
- Bc = worldSize() / 360;
+ Bc = worldSize() / util::DEGREES_MAX;
Cc = worldSize() / util::M2PI;
}