summaryrefslogtreecommitdiff
path: root/include/mbgl
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-12-16 09:29:54 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-12-16 11:03:54 -0800
commitec9a4cd3285da280d43c7ddd0ca96fe37d9c5278 (patch)
tree1ae0849e18c6c42f42e453d641279d43a0a62367 /include/mbgl
parent8a17d30c50f46b5c702807a840bbfb6395eb456e (diff)
downloadqtlocation-mapboxgl-ec9a4cd3285da280d43c7ddd0ca96fe37d9c5278.tar.gz
[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.
Diffstat (limited to 'include/mbgl')
-rw-r--r--include/mbgl/ios/MGLMapView+MGLCustomStyleLayerAdditions.h22
-rw-r--r--include/mbgl/ios/Mapbox.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/include/mbgl/ios/MGLMapView+MGLCustomStyleLayerAdditions.h b/include/mbgl/ios/MGLMapView+MGLCustomStyleLayerAdditions.h
new file mode 100644
index 0000000000..4785a36cfa
--- /dev/null
+++ b/include/mbgl/ios/MGLMapView+MGLCustomStyleLayerAdditions.h
@@ -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
diff --git a/include/mbgl/ios/Mapbox.h b/include/mbgl/ios/Mapbox.h
index 004839059f..e8b3ead1d9 100644
--- a/include/mbgl/ios/Mapbox.h
+++ b/include/mbgl/ios/Mapbox.h
@@ -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"