diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm
index f3e9e7a41..7c2385a5f 100644
--- a/platform/darwin/src/MGLMapSnapshotter.mm
+++ b/platform/darwin/src/MGLMapSnapshotter.mm
@@ -91,6 +91,21 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
#endif
@end
+@interface MGLMapSnapshotOptions ()
+
+/**
+ :nodoc:
+ Whether the Mapbox wordmark is displayed.
+
+ @note The Mapbox terms of service, which governs the use of Mapbox-hosted
+ vector tiles and styles,
+ requires most Mapbox
+ customers to display the Mapbox wordmark. If this applies to you, do not
+ hide the wordmark or change its contents.
+ */
+@property (nonatomic, readwrite) BOOL showsLogo;
+@end
+
@implementation MGLMapSnapshotOptions
- (instancetype _Nonnull)initWithStyleURL:(nullable NSURL *)styleURL camera:(MGLMapCamera *)camera size:(CGSize)size
@@ -106,6 +121,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
_styleURL = styleURL;
_size = size;
_camera = camera;
+ _showsLogo = YES;
#if TARGET_OS_IPHONE
_scale = [UIScreen mainScreen].scale;
#else
@@ -321,7 +337,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
_mbglMapSnapshotter->snapshot(_snapshotCallback->self());
}
-+ (MGLImage*)drawAttributedSnapshotWorker:(mbgl::MapSnapshotter::Attributions)attributions snapshotImage:(MGLImage *)mglImage pointForFn:(mbgl::MapSnapshotter::PointForFn)pointForFn latLngForFn:(mbgl::MapSnapshotter::LatLngForFn)latLngForFn scale:(CGFloat)scale size:(CGSize)size overlayHandler:(MGLMapSnapshotOverlayHandler)overlayHandler {
++ (MGLImage*)drawAttributedSnapshotWorker:(mbgl::MapSnapshotter::Attributions)attributions snapshotImage:(MGLImage *)mglImage pointForFn:(mbgl::MapSnapshotter::PointForFn)pointForFn latLngForFn:(mbgl::MapSnapshotter::LatLngForFn)latLngForFn scale:(CGFloat)scale size:(CGSize)size showsLogo:(BOOL)showsLogo overlayHandler:(MGLMapSnapshotOverlayHandler)overlayHandler {
NSArray* attributionInfo = [MGLMapSnapshotter generateAttributionInfos:attributions];
@@ -334,7 +350,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
break;
}
}
-
+
UIImage *logoImage = [MGLMapSnapshotter logoImageWithStyle:attributionInfoStyle];
CGSize attributionBackgroundSize = [MGLMapSnapshotter attributionTextSizeWithStyle:attributionInfoStyle attributionInfo:attributionInfo];
@@ -383,7 +399,9 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
return nil;
}
- [logoImage drawInRect:logoImageRect];
+ if (showsLogo) {
+ [logoImage drawInRect:logoImageRect];
+ }
UIImage *currentImage = UIGraphicsGetImageFromCurrentImageContext();
CGImageRef attributionImageRef = CGImageCreateWithImageInRect([currentImage CGImage], cropRect);
@@ -494,15 +512,23 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64;
dispatch_queue_t resultQueue = self.resultQueue;
// Capture scale and size by value to avoid accessing self from another thread
- CGFloat scale = self.options.scale;
- CGSize size = self.options.size;
+ CGFloat scale = self.options.scale;
+ CGSize size = self.options.size;
+ BOOL showsLogo = self.options.showsLogo;
// pointForFn is a copyable std::function that captures state by value: see MapSnapshotter::Impl::snapshot
__weak __typeof__(self) weakself = self;
dispatch_async(workQueue, ^{
// Call a class method to ensure we're not accidentally capturing self
- MGLImage *compositedImage = [MGLMapSnapshotter drawAttributedSnapshotWorker:attributions snapshotImage:mglImage pointForFn:pointForFn latLngForFn:latLngForFn scale:scale size:size overlayHandler:overlayHandler];
+ MGLImage *compositedImage = [MGLMapSnapshotter drawAttributedSnapshotWorker:attributions
+ snapshotImage:mglImage
+ pointForFn:pointForFn
+ latLngForFn:latLngForFn
+ scale:scale
+ size:size
+ showsLogo:showsLogo
+ overlayHandler:overlayHandler];
// Dispatch result to origin queue
dispatch_async(resultQueue, ^{
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index 9dec72585..e13fb01b0 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -355,12 +355,12 @@ MGL_EXPORT
@property (nonatomic, assign) CGPoint compassViewMargins;
/**
- The Mapbox logo, positioned in the lower-left corner.
+ The Mapbox wordmark, positioned in the lower-left corner.
@note The Mapbox terms of service, which governs the use of Mapbox-hosted
vector tiles and styles,
requires most Mapbox
- customers to display the Mapbox logo. If this applies to you, do not
+ customers to display the Mapbox wordmark. If this applies to you, do not
hide this view or change its contents.
*/
@property (nonatomic, readonly) UIImageView *logoView;