[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:
Minh Nguyễn
2015-12-16 09:29:54 -08:00
committed by John Firebaugh
parent 8a17d30c50
commit ec9a4cd328
5 changed files with 149 additions and 0 deletions

View 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

View File

@@ -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"