summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLPointCollection.h
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/darwin/src/MGLPointCollection.h
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/darwin/src/MGLPointCollection.h')
-rw-r--r--platform/darwin/src/MGLPointCollection.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLPointCollection.h b/platform/darwin/src/MGLPointCollection.h
new file mode 100644
index 0000000000..db497d0a52
--- /dev/null
+++ b/platform/darwin/src/MGLPointCollection.h
@@ -0,0 +1,51 @@
+#import <Foundation/Foundation.h>
+#import <CoreLocation/CoreLocation.h>
+
+#import "MGLOverlay.h"
+#import "MGLShape.h"
+
+/**
+ The `MGLPointCollection` class is used to define an array of disconnected
+ coordinates. The points in the collection may be related but are not
+ connected visually in any way.
+
+ @note `MGLPointCollection` objects cannot be added to a map view using
+ `-[MGLMapView addAnnotations:]` and related methods. However, when used in a
+ `MGLPointCollectionFeature` to initialize a `MGLGeoJSONSource` that is added
+ to the map view's style, the point collection represents as a group of distinct
+ annotations.
+ */
+@interface MGLPointCollection : MGLShape <MGLOverlay>
+
+/**
+ Creates and returns a `MGLPointCollection` object from the specified set of
+ coordinates.
+
+ @param coords The array of coordinates defining the shape. The data in this
+ array is copied to the new object.
+ @param count The number of items in the `coords` array.
+ @return A new point collection object.
+ */
++ (instancetype)pointCollectionWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count;
+
+/** The array of coordinates associated with the shape. */
+@property (nonatomic, readonly) CLLocationCoordinate2D *coordinates NS_RETURNS_INNER_POINTER;
+
+/** The number of coordinates associated with the shape. */
+@property (nonatomic, readonly) NSUInteger pointCount;
+
+/**
+ Retrieves one or more coordinates associated with the shape.
+
+ @param coords On input, you must provide a C array of structures large enough
+ to hold the desired number of coordinates. On output, this structure
+ contains the requested coordinate data.
+ @param range The range of points you want. The `location` field indicates the
+ first point you are requesting, with `0` being the first point, `1` being
+ the second point, and so on. The `length` field indicates the number of
+ points you want. The array in _`coords`_ must be large enough to accommodate
+ the number of requested coordinates.
+ */
+- (void)getCoordinates:(CLLocationCoordinate2D *)coords range:(NSRange)range;
+
+@end