MGLPolygonAnnotationController
@interface MGLPolygonAnnotationController : MGLAnnotationController
An MGLPolygonAnnotationController is a controller that creates internally
instances of an MGLShapeSource and MGLFillStyleLayer to simplify the creation
of runtime styling based annotations to the map.
Create instances of MGLPolygonStyleAnnotation and pass it to this controller.
Example
func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
let polygonAnnotationController = MGLPolygonAnnotationController(mapView: self.mapView)
let polygonCoordinates = [
CLLocationCoordinate2DMake(59, 18),
CLLocationCoordinate2DMake(62, 19),
CLLocationCoordinate2DMake(54, 20),
CLLocationCoordinate2DMake(59, 18)
]
let polygon = MGLPolygonStyleAnnotation(coordinates: polygonCoordinates, count: UInt(polygonCoordinates.count))
polygon.fillOutlineColor = .red
polygonAnnotationController.add(polygon)
}
-
Determines whether of not the polygon style annotation should be antialiased. Defaults to
true.This property corresponds to the
fill-antialiasproperty in the style Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) BOOL fillAntialiased;Swift
var fillAntialiased: Bool { get set } -
The offset distance of the polygon style annotation from its anchor, measured in screen points. Positive values indicate right and down, while negative values indicate left and up. Defaults to a
CGVectorstruct set to 0 points rightward and 0 points downward.This property corresponds to the
fill-translateproperty in the style Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CGVector fillTranslation;Swift
var fillTranslation: Int32 { get set } -
Controls the frame of reference for
fillTranslation, as defined byMGLFillTranslationAnchor. RequiresfillTranslation. Defaults tomap.This property corresponds to the
line-capproperty in the style Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) int fillTranslationAnchor;Swift
var fillTranslationAnchor: Int32 { get set }
MGLPolygonAnnotationController Class Reference