[ios] Custom style layer
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.
This commit is contained in:
committed by
John Firebaugh
parent
8a17d30c50
commit
ec9a4cd328
22
include/mbgl/ios/MGLMapView+MGLCustomStyleLayerAdditions.h
Normal file
22
include/mbgl/ios/MGLMapView+MGLCustomStyleLayerAdditions.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#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
|
||||
@@ -5,6 +5,7 @@
|
||||
#import "MGLGeometry.h"
|
||||
#import "MGLMapView.h"
|
||||
#import "MGLMapView+IBAdditions.h"
|
||||
#import "MGLMapView+MGLCustomStyleLayerAdditions.h"
|
||||
#import "MGLMultiPoint.h"
|
||||
#import "MGLOverlay.h"
|
||||
#import "MGLPointAnnotation.h"
|
||||
|
||||
Reference in New Issue
Block a user