Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Add LatLngforScreenCoordinate to snapshotter API #12221

Merged
merged 3 commits into from
Jul 5, 2018

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Jun 26, 2018

Closes #11365

@tobrun tobrun added Android Mapbox Maps SDK for Android Core The cross-platform C++ core, aka mbgl labels Jun 26, 2018
@tobrun tobrun added this to the android-v6.3.0 milestone Jun 26, 2018
@tobrun tobrun self-assigned this Jun 26, 2018
@tobrun tobrun requested a review from LukasPaczos June 26, 2018 16:11
@tobrun tobrun added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS labels Jun 27, 2018
@julianrex julianrex requested a review from fabian-guerra June 27, 2018 20:05
@julianrex julianrex self-assigned this Jun 27, 2018
@@ -2,6 +2,13 @@

Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started.

## Future
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We leave the word master for this case.

@@ -1,5 +1,11 @@
# Changelog for Mapbox Maps SDK for macOS

## Future
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.


### Other changes

* Added `-[MGLSnapshot coordinateForPoint:]` that returns a map coordinate for a specified snapshot image point. ([#12221](https://github.com/mapbox/mapbox-gl-native/pull/12221))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant -[MGLMapSnapshot coordinateForPoint:]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch - thanks!


### Other changes

* Added `-[MGLSnapshot coordinateForPoint:]` that returns a map coordinate for a specified snapshot image point. ([#12221](https://github.com/mapbox/mapbox-gl-native/pull/12221))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@@ -85,6 +85,11 @@ MGL_EXPORT
*/
- (CGPoint)pointForCoordinate:(CLLocationCoordinate2D)coordinate;

/**
Converts the specified image point to a map coordinate
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: missing period.


- (CLLocationCoordinate2D)coordinateForPoint:(NSPoint)point
{
mbgl::LatLng latLng = _latLngForFn(mbgl::ScreenCoordinate(point.x, point.y));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this code account for the fact that the screen origin on macOS is at the bottom-left, by contrast with iOS where it’s at the top-left?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No! Superb catch - and I think this will be an existing bug for -[MGLMapSnapshot pointForCoordinate:] on macos.

mbgl::PremultipliedImage image,
mbgl::MapSnapshotter::Attributions attributions,
mbgl::MapSnapshotter::PointForFn pointForFn,
mbgl::MapSnapshotter::LatLngForFn latLngForFn) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This indentation is a bit extreme. It’s technically correct (per Xcode), but I think it would be reasponable to dedent a bit, such as by indenting both parameters to std::make_unique by only two tabs.

Copy link
Contributor

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on the Android side 🚀

Copy link
Contributor

@fabian-guerra fabian-guerra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@julianrex julianrex force-pushed the tvn-add-latlngforpixel-snapshot branch from 99452ed to acef960 Compare June 29, 2018 18:16
@julianrex
Copy link
Contributor

Rebased.

@julianrex julianrex removed their assignment Jul 2, 2018
@tobrun tobrun force-pushed the tvn-add-latlngforpixel-snapshot branch from acef960 to 846249a Compare July 5, 2018 12:54
Copy link
Contributor

@friedbunny friedbunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few questions/nits:

  • The submodule at platform/ios/vendor/mapbox-events-ios doesn’t need to be bumped.
  • Are updates to the mapbox-gl-js submodule intentional?
  • If we intend to merge @julianrex’s commits, they should be prefixed with [ios] and/or [macos] (and perhaps squashed).

@tobrun
Copy link
Member Author

tobrun commented Jul 5, 2018

@friedbunny thanks for catching those! just pushed changes addressing comments.

@tobrun tobrun force-pushed the tvn-add-latlngforpixel-snapshot branch from 846249a to e333843 Compare July 5, 2018 15:15
@tobrun tobrun force-pushed the tvn-add-latlngforpixel-snapshot branch from e333843 to 2311c7e Compare July 5, 2018 16:01
@tobrun tobrun merged commit 56ab331 into master Jul 5, 2018
@tobrun tobrun deleted the tvn-add-latlngforpixel-snapshot branch July 5, 2018 16:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android Core The cross-platform C++ core, aka mbgl iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants