MGLMultiPoint

@interface MGLMultiPoint : MGLShape

The MGLMultiPoint class is an abstract superclass used to define shapes composed of multiple points. You should not create instances of this class directly. Instead, you should create instances of the MGLPolyline or MGLPolygon classes. However, you can use the method and properties of this class to access information about the specific points associated with the line or polygon.

  • The array of coordinates 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 (readonly, nonatomic) CLLocationCoordinate2D *_Nonnull coordinates;

    Swift

    var coordinates: UnsafeMutablePointer
  • The number of coordinates associated with the shape. (read-only)

    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:(nonnull 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, 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.

  • Updates one or more coordinates for the shape, which will instantaneously cause the shape to be redrawn if it is currently visible on the map.

    Declaration

    Objective-C

    - (void)replaceCoordinatesInRange:(NSRange)range
                      withCoordinates:(nonnull CLLocationCoordinate2D *)coords;

    Swift

    func replaceCoordinatesInRange(range: NSRange, withCoordinates coords: UnsafeMutablePointer

    Parameters

    range

    The range of points to update. The location field indicates the first point you are replacing, with 0 being the first point, 1 being the second point, and so on. The length field indicates the number of points to update. The array in coords must be equal in number to the length of the range. If you want to append to the existing coordinates array use -[MGLMultiPoint appendCoordinates:count:].

    coords

    The array of coordinates defining the shape. The data in this array is copied to the object.

  • Appends one or more coordinates for the shape, which will instantaneously cause the shape to be redrawn if it is currently visible on the map.

    Declaration

    Objective-C

    - (void)appendCoordinates:(nonnull CLLocationCoordinate2D *)coords
                        count:(NSUInteger)count;

    Swift

    func appendCoordinates(coords: UnsafeMutablePointer

    Parameters

    coords

    The array of coordinates to add to the shape. The data in this array is copied to the new object.

    count

    The number of items in the coords array.