MGLLineAnnotationController
@interface MGLLineAnnotationController : MGLAnnotationController
An MGLLineAnnotationController
is a controller that creates internally
instances of an MGLShapeSource
and MGLLineStyleLayer
to simplify the creation
of runtime styling based annotations to the map.
Create instances of MGLLineStyleAnnotation
and pass it to this controller.
Example
func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
let lineAnnotationController = MGLLineAnnotationController(mapView: self.mapView)
let lineCoordinates = [
CLLocationCoordinate2D(latitude: 59, longitude: 18),
CLLocationCoordinate2D(latitude: 60, longitude: 20)
]
let line = MGLLineStyleAnnotation(coordinates: lineCoordinates, count: UInt(lineCoordinates.count))
line.color = .purple
lineAnnotationController.add(line)
}
-
The display of line endings, as defined by
MGLLineCap
. Defaults tobutt
.This property corresponds to the
line-cap
property in the style Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) int lineCap;
Swift
var lineCap: Int32 { get set }
-
Used to automatically convert miter joins to bevel joins for sharp angles. Requires
lineJoin
to be set tomiter
. Defaults to aCGFloat
that evaluates to2
.This property corresponds to the
line-miter-limit
property in the style Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CGFloat lineMiterLimit;
Swift
var lineMiterLimit: Int32 { get set }
-
Used to automatically convert round joins to miter joins for shallow angles. Requires
lineJoin
to be set toround
. Defaults to aCGFloat
that evaluates to1.05
.This property corresponds to the
line-round-limit
property in the style Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CGFloat lineRoundLimit;
Swift
var lineRoundLimit: Int32 { get set }
-
Specifies the lengths of the alternating dashes and gaps that form a dash pattern for a line style annotation. Dash lengths are later scaled by the line width.
This property corresponds to the
line-dasharray
property in the style Mapbox Style Specification.Declaration
Objective-C
@property (readwrite, strong, nonatomic) NSArray *_Nonnull lineDashPattern;
Swift
var lineDashPattern: [Any] { get set }
-
The offset distance of the line 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
CGVector
struct set to 0 points rightward and 0 points downward.This property corresponds to the
line-translate
property in the style Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CGVector lineTranslation;
Swift
var lineTranslation: Int32 { get set }
-
Controls the frame of reference for
lineTranslate
, as defined byMGLLineTranslationAnchor
. RequireslineTranslate
. Defaults tomap
.This property corresponds to the
line-translate-anchor
property in the style Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) int lineTranslationAnchor;
Swift
var lineTranslationAnchor: Int32 { get set }