MGLCircleStyleAnnotation
@interface MGLCircleStyleAnnotation : MGLStyleAnnotation
An MGLCircleStyleAnnotation
is a type of style layer annotation
that renders one or more filled circles on the map.
To display a circle style annotation on a map, use one of the initializers below to create a circle
style annotation object. Then, use -[MGLCircleAnnotationController add:]
to add the annotation
to a circle style annotation controller.
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)
}
-
Returns a new circle style annotation with a specified center.
Declaration
Objective-C
- (nonnull instancetype)initWithCenter:(id)center;
Swift
init(center: Any!)
Parameters
center
The coordinate at the center of the circle style annotation.
Return Value
An initialized circle style annotation at the specified coordinate.
-
Returns a new circle style annotation with a specified center and radius.
Declaration
Objective-C
- (nonnull instancetype)initWithCenter:(id)center radius:(CGFloat)radius;
Swift
init(center: Any!, radius: CGFloat)
Parameters
center
The coordinate at the center of the circle style annotation.
radius
The radius of the circle, measured in screen points.
Return Value
An initialized circle style annotation at the specified coordinate with a defined radius.
-
Returns a new circle style annotation with a specified center and radius.
Declaration
Objective-C
- (nonnull instancetype)initWithCenter:(id)center radius:(CGFloat)radius color:(nonnull UIColor *)color;
Swift
init(center: Any!, radius: CGFloat, color: UIColor)
Parameters
center
The coordinate at the center of the circle style annotation.
radius
The radius of the circle, measured in screen points.
color
The fill color of the circle style annotation.
Return Value
An initialized circle style annotation at the specified coordinate with a defined radius and fill color.
-
The center of the circle style annotation.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) int center;
Swift
var center: Int32 { get set }
-
The radius of the circle style annotation, measured in screen points. Defaults to
5
.This property corresponds to the
circle-radius
property in the Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CGFloat circleRadius;
Swift
var circleRadius: CGFloat { get set }
-
The fill color of the circle style annotation. Defaults to black.
This property corresponds to the
circle-color
property in the Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) UIColor *_Nonnull circleColor;
Swift
unowned(unsafe) var circleColor: UIColor { get set }
-
The opacity of the fill color associated with the circle style annotation, represented as a range of values between
0
and1
. Defaults to1
.This property corresponds to the
circle-opacity
property in the Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CGFloat circleOpacity;
Swift
var circleOpacity: CGFloat { get set }
-
The width of the stroke or
outline
of the circle style annotation, measured in screen points. Defaults to0
.This property corresponds to the
circle-stroke-width
property in the Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CGFloat circleStrokeWidth;
Swift
var circleStrokeWidth: CGFloat { get set }
-
The stroke or
outline
color of the circle style annotation. Defaults to black.This property corresponds to the
circle-stroke-color
property in the Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) UIColor *_Nonnull circleStrokeColor;
Swift
unowned(unsafe) var circleStrokeColor: UIColor { get set }
-
The opacity of the stroke or
outline
color of the circle style annotation, represented as a range of values between0
and1
. Defaults to1
.This property corresponds to the
circle-stroke-opacity
property in the Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CGFloat circleStrokeOpacity;
Swift
var circleStrokeOpacity: CGFloat { get set }
-
The amount to blur the circle style annotation, measured in screen points. Defaults to
0
. A value of1
blurs the circle style annotation such that only the centerpoint is shown at full opacity.This property corresponds to the
circle-blur
property in the Mapbox Style Specification.Declaration
Objective-C
@property (assign, readwrite, nonatomic) CGFloat circleBlur;
Swift
var circleBlur: CGFloat { get set }