From d5af9b680b6b72eea7cd149a4552bd20bb676353 Mon Sep 17 00:00:00 2001 From: Jesse Bounds Date: Wed, 26 Oct 2016 17:13:38 -0700 Subject: [ios, macos] Introduce visible annotations API (#6061) Add visibleAnnotations API to make it easier for clients of MGLMapView to query for all visible annotations in the map or all visible annotations in a subsection of the map. --- platform/ios/src/MGLMapView.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'platform/ios/src/MGLMapView.h') diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index 5a89632db8..e467495a4a 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -892,6 +892,16 @@ IB_DESIGNABLE */ @property (nonatomic, readonly, nullable) NS_ARRAY_OF(id ) *annotations; +/** + The complete list of annotations associated with the receiver that are + currently visible. + + The objects in this array must adopt the `MGLAnnotation` protocol. If no + annotations are associated with the map view or if no annotations associated + with the map view are currently visible, the value of this property is `nil`. + */ +@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id ) *visibleAnnotations; + /** Adds an annotation to the map view. @@ -986,6 +996,17 @@ IB_DESIGNABLE */ - (nullable __kindof MGLAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier; +/** + Returns the list of annotations associated with the receiver that intersect with + the given rectangle. + + @param rect A rectangle expressed in the map view’s coordinate system. + @return An array of objects that adopt the `MGLAnnotation` protocol or `nil` if + no annotations associated with the map view are currently visible in the + rectangle. + */ +- (nullable NS_ARRAY_OF(id ) *)visibleAnnotationsInRect:(CGRect)rect; + #pragma mark Managing Annotation Selections /** -- cgit v1.2.1