MGLPolygon
@interface MGLPolygon : MGLMultiPoint <MGLOverlay>
The MGLPolygon
class represents a shape consisting of one or more points that
define a closed polygon. The points are connected end-to-end in the order they
are provided. The first and last points are connected to each other to create
the closed shape.
-
The array of polygons nested inside the receiver.
The area occupied by any interior polygons is excluded from the overall shape. Interior polygons should not overlap. An interior polygon should not have interior polygons of its own.
If there are no interior polygons, the value of this property is
nil
.Declaration
Objective-C
@property (readonly, nonatomic, nullable) NSArray<MGLPolygon *> *interiorPolygons;
Swift
var interiorPolygons: [MGLPolygon]? { get }
-
Creates and returns an
MGLPolygon
object from the specified set of coordinates.Declaration
Objective-C
+ (nonnull instancetype)polygonWithCoordinates: (nonnull 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 polygon object.
-
Creates and returns an
MGLPolygon
object from the specified set of coordinates and interior polygons.Declaration
Objective-C
+ (nonnull instancetype) polygonWithCoordinates:(nonnull CLLocationCoordinate2D *)coords count:(NSUInteger)count interiorPolygons:(nullable NSArray<MGLPolygon *> *)interiorPolygons;
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.interiorPolygons
An array of
MGLPolygon
objects that define regions excluded from the overall shape. If this array isnil
or empty, the shape is considered to have no interior polygons.Return Value
A new polygon object.