GoogleNavigation Framework Reference
GMSPolygon
GMSPolygon
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 path that describes this polygon. The coordinates composing the path must be valid.
Declaration
Swift
@NSCopying var path: GMSPath? { get set }
Objective-C
@property (nonatomic, copy, nullable) GMSPath *path;
-
The array of GMSPath
instances that describes any holes in this polygon. The coordinates
composing each path must be valid.
Declaration
Swift
var holes: [GMSPath]? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSArray<GMSPath *> *holes;
-
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
Objective-C
@property (nonatomic, readonly) GMSPolygonLayer *_Nonnull layer;
-
Convenience constructor for GMSPolygon
for a particular path. Other properties will have
default values.
Declaration
Swift
convenience init(path: GMSPath?)
Objective-C
+ (nonnull instancetype)polygonWithPath:(nullable GMSPath *)path;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-15 UTC.
[null,null,["Last updated 2024-11-15 UTC."],[[["`GMSPolygon` is 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 have optional holes represented by an array of `GMSPath` objects."],["The polygon's appearance can be customized with properties like `strokeWidth`, `strokeColor`, and `fillColor`."],["`GMSPolygon` can be rendered with geodesic correction and offers access to its Core Animation layer."],["A convenience constructor is provided for creating polygons with a specified path."]]],[]]