MGLCircleAnnotationController

@interface MGLCircleAnnotationController : MGLAnnotationController

An MGLCircleAnnotationController is a controller that creates internally instances of an MGLShapeSource and MGLCicleStyleLayer to simplify the creation of runtime styling based annotations to the map.

Create instances of MGLCircleStyleAnnotation and pass it to this controller to add circular shapes to an MGLMapView.

Example

func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle) {
   let circleAnnotationController = MGLCircleAnnotationController(mapView: self.mapView)
   let circle = MGLCircleStyleAnnotation(center: CLLocationCoordinate2D(latitude: 59.31, longitude: 18.06), radius: 3.0, color: .blue)
   circle.opacity = 0.5
   circleAnnotationController.add(circle)
}
  • The offset distance of the circle style annotation from its anchor coordinate. 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 circle-translate property in the style Mapbox Style Specification.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGVector circleTranslation;

    Swift

    var circleTranslation: Int32 { get set }
  • Controls the distance of the circle style annotation from its anchor coordinate. Defaults to map. Disabled by circleTranslation.

    • map: The circle is translated relative to the map.
    • viewport: The circle is translated relative to the viewport.

    This property corresponds to the circle-translate property in the style Mapbox Style Specification.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) int circleTranslationAnchor;

    Swift

    var circleTranslationAnchor: Int32 { get set }
  • Controls the orientation of the circle style annotation when the map is pitched. Defaults to viewport.

    • map: The circle is aligned to the plane of the map.
    • viewport: The circle is aligned to the plane of the viewport.

    This property corresponds to the circle-translate property in the style Mapbox Style Specification.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) int circlePitchAlignment;

    Swift

    var circlePitchAlignment: Int32 { get set }
  • Controls the scaling behavior of the circle style annotation when the map is pitched. Defaults to map.

    • map: Circles are scaled according to their apparent distance to the camera.
    • viewport: Circles are not scaled.

    This property corresponds to the circle-translate property in the style Mapbox Style Specification.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) int circleScaleAlignment;

    Swift

    var circleScaleAlignment: Int32 { get set }