[ios, macos] Snapshotter (runtime styling) delegates

Added a protocol and property for MGLMapSnapshotter’s delegate, which it uses for runtime styling. Generalized MGLStyle to be usable in the absence of MGLMapView. Moved MGLOpenGLStyleLayer code around to compile.
This commit is contained in:
Minh Nguyễn
2020-03-23 02:12:38 -07:00
committed by Minh Nguyễn
parent 180ab72055
commit 63bf91125a
17 changed files with 269 additions and 100 deletions

View File

@@ -50,7 +50,7 @@ void MGLMapViewImpl::onDidFailLoadingMap(mbgl::MapLoadError mapError, const std:
break;
case mbgl::MapLoadError::StyleLoadError:
code = MGLErrorCodeLoadStyleFailed;
description = NSLocalizedStringWithDefaultValue(@"LOAD_STYLE_FAILED_DESC", nil, nil, @"The map failed to load because the style can't be loaded.", @"User-friendly error description");
description = NSLocalizedStringWithDefaultValue(@"LOAD_STYLE_FAILED_DESC", nil, nil, @"The map failed to load because the style can’t be loaded.", @"User-friendly error description");
break;
case mbgl::MapLoadError::NotFoundError:
code = MGLErrorCodeNotFound;

View File

@@ -5,6 +5,7 @@
#import "MGLGeometry.h"
#import "MGLMapCamera.h"
#import "MGLTypes.h"
#import "MGLStyle.h"
NS_ASSUME_NONNULL_BEGIN
@@ -14,7 +15,6 @@ NS_ASSUME_NONNULL_BEGIN
@class MGLPolyline;
@class MGLPolygon;
@class MGLShape;
@class MGLStyle;
@protocol MGLMapViewDelegate;
@protocol MGLAnnotation;
@@ -188,7 +188,7 @@ FOUNDATION_EXTERN MGL_EXPORT MGLExceptionName const MGLUserLocationAnnotationTyp
Simple map view</a> example to learn how to initialize a basic `MGLMapView`.
*/
MGL_EXPORT
@interface MGLMapView : UIView
@interface MGLMapView : UIView <MGLStylable>
#pragma mark Creating Instances

View File

@@ -6459,7 +6459,7 @@ public:
return;
}
self.style = [[MGLStyle alloc] initWithRawStyle:&self.mbglMap.getStyle() mapView:self];
self.style = [[MGLStyle alloc] initWithRawStyle:&self.mbglMap.getStyle() stylable:self];
if ([self.delegate respondsToSelector:@selector(mapView:didFinishLoadingStyle:)])
{
[self.delegate mapView:self didFinishLoadingStyle:self.style];