summaryrefslogtreecommitdiff
path: root/platform/ios
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios')
-rw-r--r--platform/ios/CHANGELOG.md2
-rw-r--r--platform/ios/app/MBXViewController.m8
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj18
-rw-r--r--platform/ios/jazzy.yml1
-rw-r--r--platform/ios/sdk-files.json3
-rw-r--r--platform/ios/src/MGLMapView.h2
-rw-r--r--platform/ios/src/MGLMapView.mm56
-rw-r--r--platform/ios/src/MGLMapViewDelegate.h30
-rw-r--r--platform/ios/src/Mapbox.h1
-rw-r--r--platform/ios/test/MGLMapViewDelegateIntegrationTests.swift2
10 files changed, 101 insertions, 22 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 1940cd306f..633d27890b 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -4,6 +4,8 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
## 4.12.0
+* Added the `MGLCircle` class for adding physical circles to the map view as overlays or to a shape source as polygons. ([#14534](https://github.com/mapbox/mapbox-gl-native/pull/14534))
+* Deprecated the `-[MGLMapViewDelegate mapView:fillColorForPolygonAnnotation:]` method in favor of `-[MGLMapViewDelegate mapView:fillColorForShape:]`, which is also called for `MGLCircle` annotations. ([#14534](https://github.com/mapbox/mapbox-gl-native/pull/14534))
* Fixed an issue where `-[MGLMapView setVisibleCoordinates:count:edgePadding:direction:duration:animationTimingFunction:completionHandler:]` interpreted a negative `direction` as due north instead of maintaining the current direction. ([#14575](https://github.com/mapbox/mapbox-gl-native/pull/14575))
## 4.11.0
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m
index 3335606f98..f98ee1244d 100644
--- a/platform/ios/app/MBXViewController.m
+++ b/platform/ios/app/MBXViewController.m
@@ -2128,9 +2128,13 @@ CLLocationCoordinate2D randomWorldCoordinate() {
return [color colorWithAlphaComponent:0.9];
}
-- (UIColor *)mapView:(__unused MGLMapView *)mapView fillColorForPolygonAnnotation:(__unused MGLPolygon *)annotation
+- (UIColor *)mapView:(__unused MGLMapView *)mapView fillColorForShape:(MGLShape *)shape
{
- UIColor *color = annotation.pointCount > 3 ? [UIColor greenColor] : [UIColor redColor];
+ UIColor *color = [UIColor redColor];
+ if ([shape isKindOfClass:[MGLPolygon class]] && [(MGLPolygon *)shape pointCount] > 3)
+ {
+ color = [UIColor greenColor];
+ }
return [color colorWithAlphaComponent:0.5];
}
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index c1b0b875a2..d6e760ef06 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -516,6 +516,12 @@
DA35A2CB1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */; };
DA35A2CC1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */; };
DA35D0881E1A6309007DED41 /* one-liner.json in Resources */ = {isa = PBXBuildFile; fileRef = DA35D0871E1A6309007DED41 /* one-liner.json */; };
+ DA44897E2270FFC5005B8357 /* MGLCircle.h in Headers */ = {isa = PBXBuildFile; fileRef = DA44897C2270FFC5005B8357 /* MGLCircle.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ DA44897F2270FFC5005B8357 /* MGLCircle.h in Headers */ = {isa = PBXBuildFile; fileRef = DA44897C2270FFC5005B8357 /* MGLCircle.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ DA4489802270FFC5005B8357 /* MGLCircle.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA44897D2270FFC5005B8357 /* MGLCircle.mm */; };
+ DA4489812270FFC5005B8357 /* MGLCircle.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA44897D2270FFC5005B8357 /* MGLCircle.mm */; };
+ DA448989227311C5005B8357 /* MGLCircle_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA448988227311C5005B8357 /* MGLCircle_Private.h */; };
+ DA44898A227311C5005B8357 /* MGLCircle_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DA448988227311C5005B8357 /* MGLCircle_Private.h */; };
DA5DB12A1FABF1EE001C2326 /* MGLMapAccessibilityElementTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA5DB1291FABF1EE001C2326 /* MGLMapAccessibilityElementTests.m */; };
DA6408DB1DA4E7D300908C90 /* MGLVectorStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DA6408D91DA4E7D300908C90 /* MGLVectorStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
DA6408DC1DA4E7D300908C90 /* MGLVectorStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = DA6408D91DA4E7D300908C90 /* MGLVectorStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1173,6 +1179,9 @@
DA35A2D11CCAB25200E826B2 /* jazzy.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = jazzy.yml; sourceTree = "<group>"; };
DA35D0871E1A6309007DED41 /* one-liner.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "one-liner.json"; path = "../../darwin/test/one-liner.json"; sourceTree = "<group>"; };
DA3C6FF21E2859E700F962BE /* test-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "test-Bridging-Header.h"; path = "../../darwin/test/test-Bridging-Header.h"; sourceTree = "<group>"; };
+ DA44897C2270FFC5005B8357 /* MGLCircle.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLCircle.h; sourceTree = "<group>"; };
+ DA44897D2270FFC5005B8357 /* MGLCircle.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLCircle.mm; sourceTree = "<group>"; };
+ DA448988227311C5005B8357 /* MGLCircle_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCircle_Private.h; sourceTree = "<group>"; };
DA4A26961CB6E795000B7809 /* Mapbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Mapbox.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA57D4AA1EBA8ED300793288 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = es; path = es.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
DA57D4AB1EBA909900793288 /* lt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = lt; path = lt.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
@@ -2151,6 +2160,9 @@
children = (
CA65C4F721E9BB080068B0D4 /* MGLCluster.h */,
DA8847E01CBAFA5100AB86E3 /* MGLAnnotation.h */,
+ DA448988227311C5005B8357 /* MGLCircle_Private.h */,
+ DA44897C2270FFC5005B8357 /* MGLCircle.h */,
+ DA44897D2270FFC5005B8357 /* MGLCircle.mm */,
DAD1656A1CF41981001FF4B9 /* MGLFeature_Private.h */,
DAD165691CF41981001FF4B9 /* MGLFeature.h */,
DAD1656B1CF41981001FF4B9 /* MGLFeature.mm */,
@@ -2314,6 +2326,7 @@
DA8848231CBAFA6200AB86E3 /* MGLOfflineStorage_Private.h in Headers */,
404326891D5B9B27007111BD /* MGLAnnotationContainerView_Private.h in Headers */,
CA55CD41202C16AA00CE7095 /* MGLCameraChangeReason.h in Headers */,
+ DA44897E2270FFC5005B8357 /* MGLCircle.h in Headers */,
DA88483B1CBAFB8500AB86E3 /* MGLCalloutView.h in Headers */,
35E0CFE61D3E501500188327 /* MGLStyle_Private.h in Headers */,
3510FFF01D6D9D8C00F413B2 /* NSExpression+MGLAdditions.h in Headers */,
@@ -2373,6 +2386,7 @@
74CB5ED1219B286400102936 /* MGLSymbolStyleLayer_Private.h in Headers */,
9221BAAD2069843A0054BDF4 /* MGLTilePyramidOfflineRegion_Private.h in Headers */,
96F3F73C1F57124B003E2D2C /* MGLUserLocationHeadingIndicator.h in Headers */,
+ DA448989227311C5005B8357 /* MGLCircle_Private.h in Headers */,
408AA8571DAEDA1700022900 /* NSDictionary+MGLAdditions.h in Headers */,
DA88483F1CBAFB8500AB86E3 /* MGLUserLocation.h in Headers */,
558DE7A01E5615E400C7916D /* MGLFoundation_Private.h in Headers */,
@@ -2480,6 +2494,7 @@
DA35A2CA1CCAAAD200E826B2 /* NSValue+MGLAdditions.h in Headers */,
350098BC1D480108004B2AF0 /* MGLVectorTileSource.h in Headers */,
FA68F14B1E9D656600F9F6C2 /* MGLFillExtrusionStyleLayer.h in Headers */,
+ DA44897F2270FFC5005B8357 /* MGLCircle.h in Headers */,
96E516DE200054F700A02306 /* MGLGeometry_Private.h in Headers */,
353933FC1D3FB7C0003F57D7 /* MGLRasterStyleLayer.h in Headers */,
3566C76D1D4A8DFA008152BC /* MGLRasterTileSource.h in Headers */,
@@ -2573,6 +2588,7 @@
353933F31D3FB753003F57D7 /* MGLCircleStyleLayer.h in Headers */,
558DE7A11E5615E400C7916D /* MGLFoundation_Private.h in Headers */,
96E516F820005A3000A02306 /* MGLCompactCalloutView.h in Headers */,
+ DA44898A227311C5005B8357 /* MGLCircle_Private.h in Headers */,
96E516E22000551900A02306 /* MGLPointCollection_Private.h in Headers */,
3538AA1E1D542239008EC33D /* MGLForegroundStyleLayer.h in Headers */,
30E578181DAA85520050F07E /* UIImage+MGLAdditions.h in Headers */,
@@ -3148,6 +3164,7 @@
96036A03200565C700510F3D /* NSOrthography+MGLAdditions.m in Sources */,
ACA65F592140697200537748 /* MMEDispatchManager.m in Sources */,
40834BF31FE05E1800C1BD0D /* MMETimerManager.m in Sources */,
+ DA4489802270FFC5005B8357 /* MGLCircle.mm in Sources */,
35136D421D42274500C20EFD /* MGLRasterStyleLayer.mm in Sources */,
3538AA1F1D542239008EC33D /* MGLForegroundStyleLayer.mm in Sources */,
AC1B0918221CA14D00DB56C8 /* CLLocationManager+MMEMobileEvents.m in Sources */,
@@ -3272,6 +3289,7 @@
ACA65F5A2140697200537748 /* MMEDispatchManager.m in Sources */,
3538AA201D542239008EC33D /* MGLForegroundStyleLayer.mm in Sources */,
DA00FC911D5EEB0D009AABC8 /* MGLAttributionInfo.mm in Sources */,
+ DA4489812270FFC5005B8357 /* MGLCircle.mm in Sources */,
40834C051FE05E1800C1BD0D /* MMEDate.m in Sources */,
AC1B0919221CA14D00DB56C8 /* CLLocationManager+MMEMobileEvents.m in Sources */,
40834BFA1FE05E1800C1BD0D /* CLLocation+MMEMobileEvents.m in Sources */,
diff --git a/platform/ios/jazzy.yml b/platform/ios/jazzy.yml
index d459e93613..29ecc6b66e 100644
--- a/platform/ios/jazzy.yml
+++ b/platform/ios/jazzy.yml
@@ -42,6 +42,7 @@ custom_categories:
- MGLMultiPoint
- MGLPointAnnotation
- MGLPointCollection
+ - MGLCircle
- MGLPolygon
- MGLPolyline
- MGLMultiPolygon
diff --git a/platform/ios/sdk-files.json b/platform/ios/sdk-files.json
index 3031a87fd6..1e9e46d1fe 100644
--- a/platform/ios/sdk-files.json
+++ b/platform/ios/sdk-files.json
@@ -33,6 +33,7 @@
"platform/ios/src/NSOrthography+MGLAdditions.m",
"platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEDispatchManager.m",
"platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMETimerManager.m",
+ "platform/darwin/src/MGLCircle.mm",
"platform/darwin/src/MGLRasterStyleLayer.mm",
"platform/darwin/src/MGLForegroundStyleLayer.mm",
"platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/CLLocationManager+MMEMobileEvents.m",
@@ -132,6 +133,7 @@
"MGLPolyline.h": "platform/darwin/src/MGLPolyline.h",
"MGLStyleLayer.h": "platform/darwin/src/MGLStyleLayer.h",
"MGLCameraChangeReason.h": "platform/ios/src/MGLCameraChangeReason.h",
+ "MGLCircle.h": "platform/darwin/src/MGLCircle.h",
"MGLCalloutView.h": "platform/ios/src/MGLCalloutView.h",
"NSExpression+MGLAdditions.h": "platform/darwin/src/NSExpression+MGLAdditions.h",
"MGLShape.h": "platform/darwin/src/MGLShape.h",
@@ -243,6 +245,7 @@
"MGLSymbolStyleLayer_Private.h": "platform/darwin/src/MGLSymbolStyleLayer_Private.h",
"MGLTilePyramidOfflineRegion_Private.h": "platform/darwin/src/MGLTilePyramidOfflineRegion_Private.h",
"MGLUserLocationHeadingIndicator.h": "platform/ios/src/MGLUserLocationHeadingIndicator.h",
+ "MGLCircle_Private.h": "platform/darwin/src/MGLCircle_Private.h",
"NSDictionary+MGLAdditions.h": "platform/darwin/src/NSDictionary+MGLAdditions.h",
"MGLFoundation_Private.h": "platform/darwin/src/MGLFoundation_Private.h",
"MGLUserLocationHeadingBeamLayer.h": "platform/ios/src/MGLUserLocationHeadingBeamLayer.h",
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index 63bd28fc0c..ed5462a755 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -11,8 +11,6 @@ NS_ASSUME_NONNULL_BEGIN
@class MGLAnnotationView;
@class MGLAnnotationImage;
@class MGLUserLocation;
-@class MGLPolyline;
-@class MGLPolygon;
@class MGLShape;
@class MGLStyle;
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index fdd91dacd7..f43bb93115 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -38,6 +38,7 @@
#import "MGLFeature_Private.h"
#import "MGLGeometry_Private.h"
#import "MGLMultiPoint_Private.h"
+#import "MGLCircle_Private.h"
#import "MGLOfflineStorage_Private.h"
#import "MGLVectorTileSource_Private.h"
#import "MGLFoundation_Private.h"
@@ -317,6 +318,7 @@ public:
BOOL _delegateHasAlphasForShapeAnnotations;
BOOL _delegateHasStrokeColorsForShapeAnnotations;
+ BOOL _delegateHasFillColorsForPolygonAnnotations;
BOOL _delegateHasFillColorsForShapeAnnotations;
BOOL _delegateHasLineWidthsForShapeAnnotations;
@@ -826,7 +828,8 @@ public:
_delegateHasAlphasForShapeAnnotations = [_delegate respondsToSelector:@selector(mapView:alphaForShapeAnnotation:)];
_delegateHasStrokeColorsForShapeAnnotations = [_delegate respondsToSelector:@selector(mapView:strokeColorForShapeAnnotation:)];
- _delegateHasFillColorsForShapeAnnotations = [_delegate respondsToSelector:@selector(mapView:fillColorForPolygonAnnotation:)];
+ _delegateHasFillColorsForPolygonAnnotations = [_delegate respondsToSelector:@selector(mapView:fillColorForPolygonAnnotation:)];
+ _delegateHasFillColorsForShapeAnnotations = [_delegate respondsToSelector:@selector(mapView:fillColorForShape:)];
_delegateHasLineWidthsForShapeAnnotations = [_delegate respondsToSelector:@selector(mapView:lineWidthForPolylineAnnotation:)];
}
@@ -2557,7 +2560,7 @@ public:
[MGLMapboxEvents ensureMetricsOptoutExists];
}
}
- else if ([keyPath isEqualToString:@"coordinate"] && [object conformsToProtocol:@protocol(MGLAnnotation)] && ![object isKindOfClass:[MGLMultiPoint class]])
+ else if ([keyPath isEqualToString:@"coordinate"] && [object conformsToProtocol:@protocol(MGLAnnotation)] && ![object isKindOfClass:[MGLMultiPoint class]] && ![object isKindOfClass:[MGLCircle class]])
{
id <MGLAnnotation> annotation = object;
MGLAnnotationTag annotationTag = (MGLAnnotationTag)(NSUInteger)context;
@@ -2588,7 +2591,8 @@ public:
}
}
}
- else if ([keyPath isEqualToString:@"coordinates"] && [object isKindOfClass:[MGLMultiPoint class]])
+ else if (([keyPath isEqualToString:@"coordinates"] && [object isKindOfClass:[MGLMultiPoint class]]) ||
+ (([keyPath isEqualToString:@"coordinate"] || [keyPath isEqualToString:@"radius"]) && [object isKindOfClass:[MGLCircle class]]))
{
MGLMultiPoint *annotation = object;
MGLAnnotationTag annotationTag = (MGLAnnotationTag)(NSUInteger)context;
@@ -4222,6 +4226,21 @@ public:
[(NSObject *)annotation addObserver:self forKeyPath:@"coordinates" options:0 context:(void *)(NSUInteger)annotationTag];
}
+ else if ([annotation isKindOfClass:[MGLCircle class]])
+ {
+ // The circle knows how to style itself (with the map view’s help).
+ MGLCircle *circle = (MGLCircle *)annotation;
+
+ _isChangingAnnotationLayers = YES;
+ MGLAnnotationTag annotationTag = _mbglMap->addAnnotation([circle annotationObjectWithDelegate:self]);
+ MGLAnnotationContext context;
+ context.annotation = annotation;
+ _annotationContextsByAnnotationTag[annotationTag] = context;
+ _annotationTagsByAnnotation[annotation] = annotationTag;
+
+ [(NSObject *)annotation addObserver:self forKeyPath:@"coordinate" options:0 context:(void *)(NSUInteger)annotationTag];
+ [(NSObject *)annotation addObserver:self forKeyPath:@"radius" options:0 context:(void *)(NSUInteger)annotationTag];
+ }
else if ( ! [annotation isKindOfClass:[MGLMultiPolyline class]]
&& ![annotation isKindOfClass:[MGLMultiPolygon class]]
&& ![annotation isKindOfClass:[MGLShapeCollection class]]
@@ -4439,11 +4458,26 @@ public:
return color.mgl_color;
}
-- (mbgl::Color)fillColorForPolygonAnnotation:(MGLPolygon *)annotation
+- (mbgl::Color)fillColorForShape:(MGLShape *)shape
{
- UIColor *color = (_delegateHasFillColorsForShapeAnnotations
- ? [self.delegate mapView:self fillColorForPolygonAnnotation:annotation]
- : self.tintColor);
+ UIColor *color = self.tintColor;
+ if (_delegateHasFillColorsForShapeAnnotations)
+ {
+ color = [self.delegate mapView:self fillColorForShape:shape];
+ }
+ else if (_delegateHasFillColorsForPolygonAnnotations && [shape isKindOfClass:[MGLPolygon class]])
+ {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ NSLog(@"-[MGLMapViewDelegate mapView:fillColorForPolygonAnnotation:] is deprecated; "
+ @"use -[MGLMapViewDelegate mapView:fillColorForShape:] instead."
+ @"This warning will only appear once.");
+ });
+ color = [self.delegate mapView:self fillColorForPolygonAnnotation:(MGLPolygon *)shape];
+#pragma clang diagnostic pop
+ }
return color.mgl_color;
}
@@ -4535,6 +4569,10 @@ public:
{
[(NSObject *)annotation removeObserver:self forKeyPath:@"coordinates" context:(void *)(NSUInteger)annotationTag];
}
+ if ([annotation isKindOfClass:[MGLCircle class]])
+ {
+ [(NSObject *)annotation removeObserver:self forKeyPath:@"radius" context:(void *)(NSUInteger)annotationTag];
+ }
_isChangingAnnotationLayers = YES;
self.mbglMap.removeAnnotation(annotationTag);
@@ -5286,6 +5324,10 @@ public:
{
bounds.extend(MGLLatLngBoundsFromCoordinateBounds(((id <MGLOverlay>)annotation).overlayBounds));
}
+ else if ([annotation isKindOfClass:[MGLCircle class]])
+ {
+ bounds.extend(MGLLatLngBoundsFromCoordinateBounds(((MGLCircle *)annotation).coordinateBounds));
+ }
else
{
bounds.extend(MGLLatLngFromLocationCoordinate2D(annotation.coordinate));
diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h
index 055d4c9517..c6128ae953 100644
--- a/platform/ios/src/MGLMapViewDelegate.h
+++ b/platform/ios/src/MGLMapViewDelegate.h
@@ -1,11 +1,19 @@
#import <UIKit/UIKit.h>
-#import "Mapbox.h"
#import "MGLCameraChangeReason.h"
NS_ASSUME_NONNULL_BEGIN
+@protocol MGLAnnotation;
+@protocol MGLCalloutView;
+@class MGLAnnotationImage;
+@class MGLAnnotationView;
+@class MGLCircle;
+@class MGLMapCamera;
@class MGLMapView;
+@class MGLPolygon;
+@class MGLPolyline;
+@class MGLShape;
/**
The `MGLMapViewDelegate` protocol defines a set of optional methods that you
@@ -422,25 +430,25 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (UIColor *)mapView:(MGLMapView *)mapView strokeColorForShapeAnnotation:(MGLShape *)annotation;
+- (UIColor *)mapView:(MGLMapView *)mapView fillColorForPolygonAnnotation:(MGLPolygon *)annotation __attribute__((deprecated("", "-mapView:fillColorForShape:")));
+
/**
- Returns the color to use when rendering the fill of a polygon annotation.
+ Returns the color to use when rendering the fill of a shape annotation.
+
+ This method is only called for `MGLPolygon` and `MGLCircle` annotations. It is
+ not possible to fill a polyline or point annotation.
- The default fill color is the map view’s tint color. If a pattern color is
+ The default fill color is the selected menu item color. If a pattern color is
specified, the result is undefined.
Opacity may be set by specifying an alpha component. The default alpha value is
`1.0` and results in a completely opaque shape.
@param mapView The map view rendering the polygon annotation.
- @param annotation The annotation being rendered.
- @return The polygon’s interior fill color.
-
- #### Related examples
- See the <a href="https://docs.mapbox.com/ios/maps/examples/polygon/">Add
- a polygon annotation</a> example to learn how to modify the color of a an
- `MGLPolygon` at runtime.
+ @param shape The annotation being rendered.
+ @return The shape’s fill color.
*/
-- (UIColor *)mapView:(MGLMapView *)mapView fillColorForPolygonAnnotation:(MGLPolygon *)annotation;
+- (UIColor *)mapView:(MGLMapView *)mapView fillColorForShape:(MGLShape *)shape;
/**
Returns the line width in points to use when rendering the outline of a
diff --git a/platform/ios/src/Mapbox.h b/platform/ios/src/Mapbox.h
index 635bda490f..b4f5a707e9 100644
--- a/platform/ios/src/Mapbox.h
+++ b/platform/ios/src/Mapbox.h
@@ -34,6 +34,7 @@ FOUNDATION_EXPORT MGL_EXPORT const unsigned char MapboxVersionString[];
#import "MGLPointCollection.h"
#import "MGLPolygon.h"
#import "MGLPolyline.h"
+#import "MGLCircle.h"
#import "MGLShape.h"
#import "MGLShapeCollection.h"
#import "MGLStyle.h"
diff --git a/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift b/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift
index 1330281faa..e117298d5a 100644
--- a/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift
+++ b/platform/ios/test/MGLMapViewDelegateIntegrationTests.swift
@@ -82,6 +82,8 @@ extension MGLMapViewDelegateIntegrationTests: MGLMapViewDelegate {
func mapView(_ mapView: MGLMapView, strokeColorForShapeAnnotation annotation: MGLShape) -> UIColor { return .black }
func mapView(_ mapView: MGLMapView, fillColorForPolygonAnnotation annotation: MGLPolygon) -> UIColor { return .black }
+
+ func mapView(_ mapView: MGLMapView, fillColorFor shape: MGLShape) -> UIColor { return .black }
func mapView(_ mapView: MGLMapView, leftCalloutAccessoryViewFor annotation: MGLAnnotation) -> UIView? { return nil }