AI-generated Key Takeaways
-
GMSPolygonis an object used to represent a closed polygon on a map, including a filled region and an optional outline. -
It is defined by a path (
GMSPath) and can include optional holes represented by an array ofGMSPathobjects. -
The polygon's appearance can be customized with properties like
strokeWidth,strokeColor, andfillColor. -
You can render the polygon with geodesic correction and access its underlying Core Animation layer for advanced customization.
-
GMSPolygonprovides a convenience constructor to quickly create polygons using a given path.
GMSPolygon
@interface GMSPolygon : GMSOverlayGMSPolygon defines a polygon that appears on the map. A polygon (like a polyline) defines a
series of connected coordinates in an ordered sequence; additionally, polygons form a closed loop
and define a filled region.
-
The width of the polygon outline in screen points. Defaults to 1.
Declaration
Swift
var strokeWidth: CGFloat { get set }Objective-C
@property (nonatomic) CGFloat strokeWidth; -
The color of the polygon outline. Defaults to nil.
Declaration
Swift
var strokeColor: UIColor? { get set }Objective-C
@property (nonatomic, nullable) UIColor *strokeColor; -
The fill color. Defaults to blueColor.
Declaration
Swift
var fillColor: UIColor? { get set }Objective-C
@property (nonatomic, nullable) UIColor *fillColor; -
Whether this polygon should be rendered with geodesic correction.
Declaration
Swift
var geodesic: Bool { get set }Objective-C
@property (nonatomic) BOOL geodesic; -
Provides the Core Animation layer for this
GMSPolygon.Declaration
Swift
var layer: GMSPolygonLayer { get }Objective-C
@property (nonatomic, readonly) GMSPolygonLayer *_Nonnull layer;