summaryrefslogtreecommitdiff
path: root/platform/ios/src
diff options
context:
space:
mode:
authorJesse Bounds <jesse@rebounds.net>2016-10-20 17:14:19 -0700
committerGitHub <noreply@github.com>2016-10-20 17:14:19 -0700
commit1216050f9c5c472f1c8edcc32447004a40680ec7 (patch)
tree77f937aaeaa6e34f8b2fa84e5f7c721e8f3d541f /platform/ios/src
parentbaf82fc4d4882480e6dd16ea9821be29d390bf00 (diff)
downloadqtlocation-mapboxgl-1216050f9c5c472f1c8edcc32447004a40680ec7.tar.gz
Add MGLPointCollection for GeoJSON multipoints (#6742)
* [ios, macos] Introduce MGLPointCollection This makes MGLMultiPoint abstract again so that it is only a place for shared functionality of polygons and polylines. The multipoint feature replaces the point collection feature and can be used to initialize a MGLGeoJSONSource. The previously added swift_names for polyline and polygon are removed, for now. This also updates the iOS and macOS annotation adding logic so that unwanted shapes really are avoided. Previously the combined OR conditions meant that an annotation had to logically be NOT a kind of all three types so the check always let the annotation slip through. This also expands the guard to deflect the new MGLPointCollection.
Diffstat (limited to 'platform/ios/src')
-rw-r--r--platform/ios/src/MGLMapView.h9
-rw-r--r--platform/ios/src/MGLMapView.mm12
-rw-r--r--platform/ios/src/Mapbox.h1
3 files changed, 8 insertions, 14 deletions
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index 57b74daa04..5a89632db8 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -895,11 +895,10 @@ IB_DESIGNABLE
/**
Adds an annotation to the map view.
- @note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects
- cannot be added to the map view at this time. Nor can `MGLMultiPoint`
- objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any
- multipoint, multipolyline, multipolygon, or shape collection object that is
- specified is silently ignored.
+ @note `MGLMultiPolyline`, `MGLMultiPolygon`, `MGLShapeCollection`, and
+ `MGLPointCollection` objects cannot be added to the map view at this time.
+ Any multipoint, multipolyline, multipolygon, shape or point collection
+ object that is specified is silently ignored.
@param annotation The annotation object to add to the receiver. This object
must conform to the `MGLAnnotation` protocol. The map view retains the
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 88f4d8a970..bb7e446620 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -2855,13 +2855,6 @@ public:
if ([annotation isKindOfClass:[MGLMultiPoint class]])
{
- // Actual multipoints aren’t supported as annotations.
- if ([annotation isMemberOfClass:[MGLMultiPoint class]]
- || [annotation isMemberOfClass:[MGLMultiPointFeature class]])
- {
- continue;
- }
-
// The polyline or polygon knows how to style itself (with the map view’s help).
MGLMultiPoint *multiPoint = (MGLMultiPoint *)annotation;
if (!multiPoint.pointCount) {
@@ -2876,8 +2869,9 @@ public:
[(NSObject *)annotation addObserver:self forKeyPath:@"coordinates" options:0 context:(void *)(NSUInteger)annotationTag];
}
else if ( ! [annotation isKindOfClass:[MGLMultiPolyline class]]
- || ![annotation isKindOfClass:[MGLMultiPolygon class]]
- || ![annotation isKindOfClass:[MGLShapeCollection class]])
+ && ![annotation isKindOfClass:[MGLMultiPolygon class]]
+ && ![annotation isKindOfClass:[MGLShapeCollection class]]
+ && ![annotation isKindOfClass:[MGLPointCollection class]])
{
MGLAnnotationView *annotationView;
NSString *symbolName;
diff --git a/platform/ios/src/Mapbox.h b/platform/ios/src/Mapbox.h
index 04892eb6a1..c2fda1be1f 100644
--- a/platform/ios/src/Mapbox.h
+++ b/platform/ios/src/Mapbox.h
@@ -27,6 +27,7 @@ FOUNDATION_EXPORT const unsigned char MapboxVersionString[];
#import "MGLOfflineStorage.h"
#import "MGLOverlay.h"
#import "MGLPointAnnotation.h"
+#import "MGLPointCollection.h"
#import "MGLPolygon.h"
#import "MGLPolyline.h"
#import "MGLShape.h"