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

Better zoom level–altitude conversion #3362

Merged
merged 3 commits into from
Dec 21, 2015
Merged

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Dec 20, 2015

Greatly simplified conversions between zoom level and altitude. Adjusted the (apparently vertical) field of view to more closely match MapKit. Conversions are now nearly identical to MapKit at all latitudes.

The conversion code is now shared between iOS and OS X. It isn’t in mbgl, because although the conversions are more or less consistent with MapKit, it isn’t clear that they’re consistent with mbgl itself. (mbgl also has its own concept of “altitude” that’s distinct from the conventional meaning of altitude.)

Building off this improvement, MGLMapView now has a variation of -flyToCamera:… that accepts a peak altitude parameter.

Fixes #2266, and probably also fixes #3286. Also fixed #2456 along the way.

/cc @friedbunny @adam-mapbox

@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS labels Dec 20, 2015
@1ec5 1ec5 self-assigned this Dec 20, 2015
@1ec5 1ec5 added this to the ios-v3.1.0 milestone Dec 20, 2015
1ec5 added 2 commits December 20, 2015 03:57
Greatly simplified conversions between zoom level and altitude. Adjusted field of view to more closely match MapKit. Conversions are now well within the same order of magnitude as MapKit at all latitudes.

Fixes #2266.
@1ec5 1ec5 force-pushed the 1ec5-altitude-accuracy-2266 branch from 6ea9bf6 to b7223f2 Compare December 20, 2015 11:58
@1ec5 1ec5 merged commit 49bfdd6 into master Dec 21, 2015
@1ec5 1ec5 deleted the 1ec5-altitude-accuracy-2266 branch December 21, 2015 00:31
@1ec5 1ec5 removed the in progress label Dec 21, 2015
&& _pitch == otherCamera.pitch && _heading == otherCamera.heading);
}

- (NSUInteger)hash
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding isEqual:, will look at adding this to the a camera example.

Copy link
Contributor

Choose a reason for hiding this comment

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

(Grr, commented on the wrong line there.)

On this line, I meant to ask: where do you see hash coming in useful?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any class that implements -isEqual: must also implement -hash, because equal objects must have the same hash value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oooh, NSObject. 🏫

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS
Projects
None yet
2 participants