[core] Remove non-Map-dependent projection methods from Map
This commit is contained in:
committed by
Bruno de Oliveira Abinader
parent
8eb23cbac8
commit
092da9c956
@@ -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;
|
||||
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user