Exposed Map::addCustomLayer() publicly as an undocumented, block-based API. This change avoids the terms “layer”, “initialize”, “render”, and “altitude” because they overload existing terminology in the SDK, UIKit, or MapKit. (“Layer” is qualified as “style layer”.) There are outstanding questions about ARC memory management, but this approach works in both Objective-C and Swift for pure OpenGL programming. Added a demo to iosapp that draws a green layer below any labels in Mapbox Streets.
23 lines
1.0 KiB
Objective-C
23 lines
1.0 KiB
Objective-C
#import "MGLMapView.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
typedef void (^MGLCustomStyleLayerPreparationHandler)(void);
|
|
|
|
typedef void (^MGLCustomStyleLayerDrawingHandler)(CGSize size,
|
|
CLLocationCoordinate2D centerCoordinate,
|
|
double zoomLevel,
|
|
CLLocationDirection direction,
|
|
CGFloat pitch,
|
|
CGFloat perspectiveSkew);
|
|
|
|
typedef void (^MGLCustomStyleLayerCompletionHandler)(void);
|
|
|
|
@interface MGLMapView (MGLCustomStyleLayerAdditions)
|
|
|
|
- (void)insertCustomStyleLayerWithIdentifier:(NSString *)identifier preparationHandler:(MGLCustomStyleLayerPreparationHandler)preparation drawingHandler:(MGLCustomStyleLayerDrawingHandler)drawing completionHandler:(MGLCustomStyleLayerCompletionHandler)completion belowStyleLayerWithIdentifier:(nullable NSString *)otherIdentifier;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|