diff options
author | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2017-12-18 17:11:43 -0800 |
---|---|---|
committer | Asheem Mamoowala <asheem.mamoowala@mapbox.com> | 2018-04-05 18:04:25 -0700 |
commit | cc01781db7281032f8c0c5eae54281187522a861 (patch) | |
tree | c12b23f6b69f8499a4d3db476b0f30c693c654e2 /platform/darwin/src/MGLGeometry.mm | |
parent | dc495e1c9d831ccf928381845ffcb409c5d91271 (diff) | |
download | qtlocation-mapboxgl-cc01781db7281032f8c0c5eae54281187522a861.tar.gz |
[ios, macos] Projection Matrix and LatLng projection to Mercator methods
Diffstat (limited to 'platform/darwin/src/MGLGeometry.mm')
-rw-r--r-- | platform/darwin/src/MGLGeometry.mm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLGeometry.mm b/platform/darwin/src/MGLGeometry.mm index 715a70f0b8..63886b6474 100644 --- a/platform/darwin/src/MGLGeometry.mm +++ b/platform/darwin/src/MGLGeometry.mm @@ -106,3 +106,12 @@ CGPoint MGLPointRounded(CGPoint point) { #endif return CGPointMake(round(point.x * scaleFactor) / scaleFactor, round(point.y * scaleFactor) / scaleFactor); } + +MGLMapPoint MGLMapPointMake(CLLocationCoordinate2D coordinate, double zoomLevel) { + mbgl::Point<double> projectedCoordinate = mbgl::Projection::project(MGLLatLngFromLocationCoordinate2D(coordinate), std::pow(2.0, zoomLevel)); + MGLMapPoint point; + point.x = projectedCoordinate.x; + point.y = projectedCoordinate.y; + point.zoomLevel = zoomLevel; + return point; +} |