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

Migrate MGLCustomStyleLayerAdditions to style layer API #7250

Merged
merged 5 commits into from
Dec 7, 2016

Conversation

1ec5
Copy link
Contributor

@1ec5 1ec5 commented Nov 30, 2016

Replaced the custom style layer API on MGLMapView with an equally unsupported MGLOpenGLStyleLayer API that nonetheless is consistent with the broader runtime styling API and compatible with macOS. Reprised the demo removed from iosapp in #5091 inside macosapp.

Before this can land:

  • Replace the callback blocks with either overrideable instance methods or delegate methods
  • Return the MGLStyleLayer object owned by MGLStyle on demand

A reminder: undocumented APIs like MGLOpenGLStyleLayer are unsupported and may change at any time without notice.

Fixes #5972.

/cc @friedbunny @boundsj @jfirebaugh

@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS refactor runtime styling labels Nov 30, 2016
@1ec5 1ec5 added this to the ios-v3.4.0 milestone Nov 30, 2016
@1ec5 1ec5 self-assigned this Nov 30, 2016
@mention-bot
Copy link

@1ec5, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @incanus and @boundsj to be potential reviewers.

Replaced the custom style layer API on MGLMapView with an equally unsupported MGLOpenGLStyleLayer API that nonetheless is consistent with the broader runtime styling API and is compatible with macOS.

Fixed an unrecognized selector crash when wrapping a layer of unrecognized type coming from mbgl.
Reprised the demo removed from iosapp in #5091.
MGLStyle now strongly references any MGLOpenGLStyleLayer object that’s added to it, in order to prevent pointers from going stale and make it easy for layer drawing code to get more information about the map view. Replaced the MGLOpenGLStyleLayer callback blocks with overridable instance methods. Added internal documentation for each method. Subclassed MGLOpenGLStyleLayer as LimeGreenStyleLayer inside macosapp.

Consolidated -addToMapView: into -addToMapView:belowLayer: to ensure that MGLRedundantLayerException gets raised even if the layer is being inserted rather than added to the bottom of the stack.
Don’t allow index-based layer removal to circumvent -removeFromMapView:, which MGLOpenGLStyleLayer relies on to synchronize the style’s array of MGLOpenGLStyleLayers. When obtaining an MGLOpenGLStyleLayer, get the instance already added to the style instead of creating a new one to wrap the underlying CustomLayer.
@1ec5 1ec5 merged commit a39f53d into release-ios-v3.4.0 Dec 7, 2016
@1ec5 1ec5 deleted the 1ec5-opengl-layer branch December 7, 2016 08:01
1ec5 added a commit that referenced this pull request Dec 7, 2016

/**
Forces the map view associated with this style to redraw the receiving layer,
causing its drawing handler to be run.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

causing its drawing handler to be run

This is a holdover from the former block-based API. I reworded this sentence in 1781302.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS refactor runtime styling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants