diff options
Diffstat (limited to 'platform/macos/src/MGLMapView.mm')
-rw-r--r-- | platform/macos/src/MGLMapView.mm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 59951f946d..98958f045d 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -2413,6 +2413,22 @@ public: #pragma mark Overlays +- (nonnull NS_ARRAY_OF(id <MGLOverlay>) *)overlays +{ + if (self.annotations == nil) { return @[]; } + + NS_MUTABLE_ARRAY_OF(id <MGLOverlay>) *mutableOverlays = [NSMutableArray array]; + + [self.annotations enumerateObjectsUsingBlock:^(id<MGLAnnotation> _Nonnull annotation, NSUInteger idx, BOOL * _Nonnull stop) { + if ([annotation conformsToProtocol:@protocol(MGLOverlay)]) + { + [mutableOverlays addObject:(id<MGLOverlay>)annotation]; + } + }]; + + return [NSArray arrayWithArray:mutableOverlays]; +} + - (void)addOverlay:(id <MGLOverlay>)overlay { [self addOverlays:@[overlay]]; } |