summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-14 12:37:23 -0700
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-04-18 14:43:31 +0300
commit092da9c956de9d623c6f22d073ebb7dcb2f5a23f (patch)
tree81f59b8f687a3d3ed68ba5b601ad7accb45bd453
parent8eb23cbac8a6c5821dc5935e27689700216c3f1a (diff)
downloadqtlocation-mapboxgl-092da9c956de9d623c6f22d073ebb7dcb2f5a23f.tar.gz
[core] Remove non-Map-dependent projection methods from Map
-rw-r--r--include/mbgl/map/map.hpp3
-rwxr-xr-xplatform/android/src/native_map_view.cpp13
-rw-r--r--platform/ios/src/MGLMapView.mm3
-rw-r--r--platform/macos/src/MGLMapView.mm3
-rw-r--r--platform/qt/src/qmapboxgl.cpp7
-rw-r--r--src/mbgl/map/map.cpp13
6 files changed, 15 insertions, 27 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp
index c41bce6809..26ac154b8b 100644
--- a/include/mbgl/map/map.hpp
+++ b/include/mbgl/map/map.hpp
@@ -150,9 +150,6 @@ public:
Size getSize() const;
// Projection
- double getMetersPerPixelAtLatitude(double lat, double zoom) const;
- ProjectedMeters projectedMetersForLatLng(const LatLng&) const;
- LatLng latLngForProjectedMeters(const ProjectedMeters&) const;
ScreenCoordinate pixelForLatLng(const LatLng&) const;
LatLng latLngForPixel(const ScreenCoordinate&) const;
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index e5edc1c30f..a5699e33c1 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -24,6 +24,7 @@
#include <mbgl/util/shared_thread_pool.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/platform.hpp>
+#include <mbgl/util/projection.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/style/filter.hpp>
@@ -638,23 +639,23 @@ jni::jboolean NativeMapView::isFullyLoaded(JNIEnv&) {
}
jni::jdouble NativeMapView::getMetersPerPixelAtLatitude(JNIEnv&, jni::jdouble lat, jni::jdouble zoom) {
- return map->getMetersPerPixelAtLatitude(lat, zoom);
+ return mbgl::Projection::getMetersPerPixelAtLatitude(lat, zoom);
}
jni::Object<ProjectedMeters> NativeMapView::projectedMetersForLatLng(JNIEnv& env, jni::jdouble latitude, jni::jdouble longitude) {
- mbgl::ProjectedMeters projectedMeters = map->projectedMetersForLatLng(mbgl::LatLng(latitude, longitude));
+ mbgl::ProjectedMeters projectedMeters = mbgl::Projection::projectedMetersForLatLng(mbgl::LatLng(latitude, longitude));
return ProjectedMeters::New(env, projectedMeters.northing(), projectedMeters.easting());
}
+jni::Object<LatLng> NativeMapView::latLngForProjectedMeters(JNIEnv& env, jdouble northing, jdouble easting) {
+ return LatLng::New(env, mbgl::Projection::latLngForProjectedMeters(mbgl::ProjectedMeters(northing, easting)));
+}
+
jni::Object<PointF> NativeMapView::pixelForLatLng(JNIEnv& env, jdouble latitude, jdouble longitude) {
mbgl::ScreenCoordinate pixel = map->pixelForLatLng(mbgl::LatLng(latitude, longitude));
return PointF::New(env, static_cast<float>(pixel.x), static_cast<float>(pixel.y));
}
-jni::Object<LatLng> NativeMapView::latLngForProjectedMeters(JNIEnv& env, jdouble northing, jdouble easting) {
- return LatLng::New(env, map->latLngForProjectedMeters(mbgl::ProjectedMeters(northing, easting)));
-}
-
jni::Object<LatLng> NativeMapView::latLngForPixel(JNIEnv& env, jfloat x, jfloat y) {
return LatLng::New(env, map->latLngForPixel(mbgl::ScreenCoordinate(x, y)));
}
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index fc4d39a143..4abc77b371 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -31,6 +31,7 @@
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/shared_thread_pool.hpp>
#include <mbgl/util/string.hpp>
+#include <mbgl/util/projection.hpp>
#import "Mapbox.h"
#import "MGLFeature_Private.h"
@@ -3002,7 +3003,7 @@ public:
- (CLLocationDistance)metersPerPointAtLatitude:(CLLocationDegrees)latitude
{
- return _mbglMap->getMetersPerPixelAtLatitude(latitude, self.zoomLevel);
+ return mbgl::Projection::getMetersPerPixelAtLatitude(latitude, self.zoomLevel);
}
- (CLLocationDistance)metersPerPixelAtLatitude:(CLLocationDegrees)latitude
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index 56f003fcb0..01df48c3da 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -38,6 +38,7 @@
#import <mbgl/util/run_loop.hpp>
#import <mbgl/util/shared_thread_pool.hpp>
#import <mbgl/util/string.hpp>
+#import <mbgl/util/projection.hpp>
#import <map>
#import <unordered_map>
@@ -2692,7 +2693,7 @@ public:
}
- (CLLocationDistance)metersPerPointAtLatitude:(CLLocationDegrees)latitude {
- return _mbglMap->getMetersPerPixelAtLatitude(latitude, self.zoomLevel);
+ return mbgl::Projection::getMetersPerPixelAtLatitude(latitude, self.zoomLevel);
}
#pragma mark Debugging
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index 143af2ed16..fa4f56373c 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -21,6 +21,7 @@
#include <mbgl/util/constants.hpp>
#include <mbgl/util/geo.hpp>
#include <mbgl/util/geometry.hpp>
+#include <mbgl/util/projection.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/shared_thread_pool.hpp>
#include <mbgl/util/traits.hpp>
@@ -1121,7 +1122,7 @@ void QMapboxGL::addAnnotationIcon(const QString &name, const QImage &icon)
*/
double QMapboxGL::metersPerPixelAtLatitude(double latitude, double zoom) const
{
- return d_ptr->mapObj->getMetersPerPixelAtLatitude(latitude, zoom);
+ return mbgl::Projection::getMetersPerPixelAtLatitude(latitude, zoom);
}
/*!
@@ -1129,7 +1130,7 @@ double QMapboxGL::metersPerPixelAtLatitude(double latitude, double zoom) const
*/
QMapbox::ProjectedMeters QMapboxGL::projectedMetersForCoordinate(const QMapbox::Coordinate &coordinate_) const
{
- auto projectedMeters = d_ptr->mapObj->projectedMetersForLatLng(mbgl::LatLng { coordinate_.first, coordinate_.second });
+ auto projectedMeters = mbgl::Projection::projectedMetersForLatLng(mbgl::LatLng { coordinate_.first, coordinate_.second });
return QMapbox::ProjectedMeters(projectedMeters.northing(), projectedMeters.easting());
}
@@ -1138,7 +1139,7 @@ QMapbox::ProjectedMeters QMapboxGL::projectedMetersForCoordinate(const QMapbox::
*/
QMapbox::Coordinate QMapboxGL::coordinateForProjectedMeters(const QMapbox::ProjectedMeters &projectedMeters) const
{
- auto latLng = d_ptr->mapObj->latLngForProjectedMeters(mbgl::ProjectedMeters { projectedMeters.first, projectedMeters.second });
+ auto latLng = mbgl::Projection::latLngForProjectedMeters(mbgl::ProjectedMeters { projectedMeters.first, projectedMeters.second });
return QMapbox::Coordinate(latLng.latitude(), latLng.longitude());
}
diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp
index afa3304316..c2844f87f2 100644
--- a/src/mbgl/map/map.cpp
+++ b/src/mbgl/map/map.cpp
@@ -17,7 +17,6 @@
#include <mbgl/storage/resource.hpp>
#include <mbgl/storage/response.hpp>
#include <mbgl/util/exception.hpp>
-#include <mbgl/util/projection.hpp>
#include <mbgl/util/math.hpp>
#include <mbgl/util/exception.hpp>
#include <mbgl/util/async_task.hpp>
@@ -798,18 +797,6 @@ ViewportMode Map::getViewportMode() const {
#pragma mark - Projection
-double Map::getMetersPerPixelAtLatitude(double lat, double zoom) const {
- return Projection::getMetersPerPixelAtLatitude(lat, zoom);
-}
-
-ProjectedMeters Map::projectedMetersForLatLng(const LatLng& latLng) const {
- return Projection::projectedMetersForLatLng(latLng);
-}
-
-LatLng Map::latLngForProjectedMeters(const ProjectedMeters& projectedMeters) const {
- return Projection::latLngForProjectedMeters(projectedMeters);
-}
-
ScreenCoordinate Map::pixelForLatLng(const LatLng& latLng) const {
// If the center and point longitudes are not in the same side of the
// antimeridian, we unwrap the point longitude so it would be seen if