MGLPointCollection
@interface MGLPointCollection : MGLShape <MGLOverlay>
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.
-
Creates and returns a
MGLPointCollection
object from the specified set of coordinates.Declaration
Objective-C
+ (instancetype)pointCollectionWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSUInteger)count;
Swift
convenience init!(coordinates coords: UnsafeMutablePointer
Parameters
coords
The array of coordinates defining the shape. The data in this array is copied to the new object.
count
The number of items in the
coords
array.Return Value
A new point collection object.
-
The array of coordinates associated with the shape.
Declaration
Objective-C
@property (readonly, nonatomic) CLLocationCoordinate2D *coordinates;
Swift
var coordinates: UnsafeMutablePointer
-
The number of coordinates associated with the shape.
Declaration
Objective-C
@property (readonly, nonatomic) NSUInteger pointCount;
Swift
var pointCount: UInt { get }
-
Retrieves one or more coordinates associated with the shape.
Declaration
Objective-C
- (void)getCoordinates:(CLLocationCoordinate2D *)coords range:(NSRange)range;
Swift
func getCoordinates(_ coords: UnsafeMutablePointer
Parameters
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.
range
The range of points you want. The
location
field indicates the first point you are requesting, with0
being the first point,1
being the second point, and so on. Thelength
field indicates the number of points you want. The array incoords
must be large enough to accommodate the number of requested coordinates.