MGLMultiPoint
@interface MGLMultiPoint : MGLShape
The MGLMultiPoint class is an abstract superclass used to define shapes
composed of multiple vertices.
Create instances of MGLPolyline or MGLPolygon in order to use
properties of MGLMultiPoint. Do not create instances of MGLMultiPoint
directly and do not create your own subclasses of this class. You can use
the method and properties of this class to access information about the
vertices of the line or polygon.
Do not confuse MGLMultiPoint with MGLPointCollection, which represents a
collection of related but disconnected points.
-
The array of vertices associated with the shape.
This C array is a pointer to a structure inside the multipoint object, which may have a lifetime shorter than the multipoint object and will certainly not have a longer lifetime. Therefore, you should copy the C array if it needs to be stored outside of the memory context in which you use this property.
Declaration
Objective-C
@property (nonatomic, readonly) NS_RETURNS_INNER_POINTER CLLocationCoordinate2D *coordinates;Swift
var coordinates: UnsafeMutablePointer<CLLocationCoordinate2D> { get } -
The number of vertices in the shape.
Declaration
Objective-C
@property (nonatomic, readonly) NSUInteger pointCount;Swift
var pointCount: UInt { get } -
Retrieves the vertices of part of the shape.
Declaration
Objective-C
- (void)getCoordinates:(nonnull CLLocationCoordinate2D *)coords range:(NSRange)range;Swift
func getCoordinates(_ coords: UnsafeMutablePointer<CLLocationCoordinate2D>, range: NSRange)Parameters
coordsOn input, you must provide a C array of
CLLocationCoordinate2Dstructures large enough to hold the desired number of coordinates. On output, this structure contains the requested coordinate data.rangeThe range of vertices you want. The
locationfield indicates the first vertex you are requesting, with0being the first vertex,1being the second vertex, and so on. Thelengthfield indicates the number of vertices you want. The array incoordsmust be large enough to accommodate the number of requested coordinates. -
Sets the shape’s vertices to the given C array of vertices.
Declaration
Objective-C
- (void)setCoordinates:(nonnull CLLocationCoordinate2D *)coords count:(NSUInteger)count;Swift
func setCoordinates(_ coords: UnsafeMutablePointer<CLLocationCoordinate2D>, count: UInt)Parameters
coordsThe array of coordinates defining the shape. The data in this array is copied to the shape’s
coordinatesproperty.countThe number of coordinates from the
coordsarray. -
Inserts the given vertices into the shape.
If the shape is currently visible on the map as an annotation, it is redrawn immediately. If the shape is part of an
MGLShapeSourceobject, you must explicitly set theMGLShapeSource.shapeproperty in order for any style layers that use the source to be redrawn.Declaration
Objective-C
- (void)insertCoordinates:(nonnull const CLLocationCoordinate2D *)coords count:(NSUInteger)count atIndex:(NSUInteger)index;Swift
func insertCoordinates(_ coords: UnsafePointer<CLLocationCoordinate2D>, count: UInt, at index: UInt)Parameters
coordsThe array of coordinates to insert into the shape. The data in this array is copied to the shape’s
coordinatesproperty.countThe number of items in the
coordsarray.indexThe zero-based index at which the first coordinate in
coordswill appear in thecoordinatesproperty. -
Appends the given vertices to the shape.
If the shape is currently visible on the map as an annotation, it is redrawn immediately. If the shape is part of an
MGLShapeSourceobject, you must explicitly set theMGLShapeSource.shapeproperty in order for any style layers that use the source to be redrawn.Declaration
Objective-C
- (void)appendCoordinates:(nonnull const CLLocationCoordinate2D *)coords count:(NSUInteger)count;Swift
func appendCoordinates(_ coords: UnsafePointer<CLLocationCoordinate2D>, count: UInt)Parameters
coordsThe array of coordinates to add to the shape. The data in this array is copied to the shape’s
coordinatesproperty.countThe number of items in the
coordsarray. -
Replaces the vertices at the given range in the shape with the same number of vertices from a given C array.
If the shape is currently visible on the map as an annotation, it is redrawn immediately. If the shape is part of an
MGLShapeSourceobject, you must explicitly set theMGLShapeSource.shapeproperty in order for any style layers that use the source to be redrawn.The number of coordinates in
coordsmust be equal to the length ofrange. If you want to insert or delete one or more vertices, use the-replaceCoordinatesInRange:withCoordinates:count:method.If
rangeextends beyond the shape’scoordinatesproperty, anNSRangeExceptionis raised. If you want to append new vertices to the shape, use the-appendCoordinates:count:method.Declaration
Objective-C
- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates: (nonnull const CLLocationCoordinate2D *)coords;Swift
func replaceCoordinates(in range: NSRange, withCoordinates coords: UnsafePointer<CLLocationCoordinate2D>)Parameters
rangeThe range of vertices to replace. The
locationfield indicates the first vertex you are replacing, with0being the first vertex,1being the second vertex, and so on. Thelengthfield indicates the number of vertices to replace.coordsThe array of coordinates defining part of the shape. The data in this array is copied to the shape’s
coordinatesproperty. -
Replaces the vertices at the given range in the shape with the specified number of vertices from a given C array.
If the shape is currently visible on the map as an annotation, it is redrawn immediately. If the shape is part of an
MGLShapeSourceobject, you must explicitly set theMGLShapeSource.shapeproperty in order for any style layers that use the source to be redrawn.If
countis greater than thelengthfield ofrange, some vertices will effectively be inserted into the shape. On the other hand, ifcountis less than thelengthfield ofrange, some vertices will effectively be removed.If
rangeextends beyond the shape’scoordinatesproperty, anNSRangeExceptionis raised. If you want to append new vertices to the shape, use the-appendCoordinates:count:method.Declaration
Objective-C
- (void)replaceCoordinatesInRange:(NSRange)range withCoordinates:(nonnull const CLLocationCoordinate2D *)coords count:(NSUInteger)count;Swift
func replaceCoordinates(in range: NSRange, withCoordinates coords: UnsafePointer<CLLocationCoordinate2D>, count: UInt)Parameters
rangeThe range of vertices to replace. The
locationfield indicates the first vertex you are replacing, with0being the first vertex,1being the second vertex, and so on. Thelengthfield indicates the number of vertices to replace.coordsThe array of coordinates defining part of the shape. The data in this array is copied to the shape’s
coordinatesproperty.countThe number of coordinates from the
coordsarray to insert in place of the coordinates inrange. The sum ofrange’s length and this count must not exceed the number of items currently in thecoordinatesproperty. -
Removes the vertices at the given range from the shape.
If the shape is currently visible on the map as an annotation, it is redrawn immediately. If the shape is part of an
MGLShapeSourceobject, you must explicitly set theMGLShapeSource.shapeproperty in order for any style layers that use the source to be redrawn.If
rangeextends beyond the shape’scoordinatesproperty, anNSRangeExceptionis raised.Declaration
Objective-C
- (void)removeCoordinatesInRange:(NSRange)range;Swift
func removeCoordinates(in range: NSRange)Parameters
rangeThe range of vertices to remove. The
locationfield indicates the first vertex you are removing, with0being the first vertex,1being the second vertex, and so on. Thelengthfield indicates the number of vertices to remove.
Install in Dash
MGLMultiPoint Class Reference