MGLPointCollection
@interface MGLPointCollection : MGLShape <MGLOverlay>
An MGLPointCollection object represents a shape consisting of one or more
disconnected vertices, specified as CLLocationCoordinate2D instances. The
points in the collection may be related but are not connected spatially. For
example, you could use a point collection to represent all the trees in an
orchard.
You can add point collections to the map by adding them to an MGLShapeSource
object. Configure the appearance of an MGLShapeSource’s or
MGLVectorSource’s point collections collectively using an
MGLCircleStyleLayer or MGLSymbolStyleLayer object.
You cannot add an MGLPointCollection object directly to a map view as an
annotation. However, you can create individual MGLPointAnnotation objects
from the coordinates array and add those annotation objects to the map view
using the -[MGLMapView addAnnotations:] method.
A point collection is known as a
MultiPoint
geometry in GeoJSON. Do not confuse MGLPointCollection with MGLMultiPoint,
the abstract superclass of MGLPolyline and MGLPolygon.
-
Creates and returns a
MGLPointCollectionobject from the specified set of coordinates.Declaration
Objective-C
+ (instancetype)pointCollectionWithCoordinates: (const CLLocationCoordinate2D *)coords count:(NSUInteger)count;Swift
convenience init!(coordinates coords: UnsafePointerParameters
coordsThe array of coordinates defining the shape. The data in this array is copied to the new object.
countThe number of items in the
coordsarray.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: UnsafeMutablePointerParameters
coordsOn 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.
rangeThe range of points you want. The
locationfield indicates the first point you are requesting, with0being the first point,1being the second point, and so on. Thelengthfield indicates the number of points you want. The array incoordsmust be large enough to accommodate the number of requested coordinates.
Install in Dash
MGLPointCollection Class Reference