diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-04-14 12:37:23 -0700 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2017-04-18 14:43:31 +0300 |
commit | 092da9c956de9d623c6f22d073ebb7dcb2f5a23f (patch) | |
tree | 81f59b8f687a3d3ed68ba5b601ad7accb45bd453 /platform | |
parent | 8eb23cbac8a6c5821dc5935e27689700216c3f1a (diff) | |
download | qtlocation-mapboxgl-092da9c956de9d623c6f22d073ebb7dcb2f5a23f.tar.gz |
[core] Remove non-Map-dependent projection methods from Map
Diffstat (limited to 'platform')
-rwxr-xr-x | platform/android/src/native_map_view.cpp | 13 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 3 | ||||
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 3 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 7 |
4 files changed, 15 insertions, 11 deletions
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()); } |