MapPolygon
public class MapPolygon
extension MapPolygon: NativeBase
extension MapPolygon: Hashable
A visual representation of a polygon on the map. Can be used to visualize areas of all shapes and sizes.
The geometry to be visualized is represented by an instance of GeoPolygon.
To display circular areas (for example, a position accuracy indicator) use a GeoPolygon
created from a GeoCircle using GeoPolygon.init(GeoCircle).
Note:
- The polygon shape should not cover more than half of the globe, otherwise unexpected results may occur.
- Polygons which are self-intersecting are not supported and may lead to render artifacts.
- The inner boundaries (holes) specified in the GeoPolygon are ignored.
-
Creates a new MapPolygon instance with outline visualization disabled and containing the geometry passed in.
The winding order of the vertices can be in clockwise or counter-clockwise order. It is recomended to provide the outer boundary ordered clockwise and closed.
Note:
- The polygon shape should not cover more than half of the globe, otherwise unexpected results may occur.
- Polygons which are self-intersecting are not supported and may lead to render artifacts.
- The inner boundaries (holes) specified in the GeoPolygon are ignored.
Declaration
Swift
public init(geometry: GeoPolygon, color: UIColor)Parameters
geometryThe list of vertices representing the outer boundary of polygon.
colorThe fill color for the polygon
-
Creates a new MapPolygon instance with outline visualization enabled and containing the geometry passed in.
Transparent outlines are not supported. Any color with transparency (alpha value other than 1) will be rendered as fully opaque by interpreting the alpha value as 1.
The winding order of the vertices can be in clockwise or counter-clockwise order. It is recomended to provide the outer boundary ordered clockwise and closed.
Note:
- The polygon shape should not cover more than half of the globe, otherwise unexpected results may occur.
- Polygons which are self-intersecting are not supported and may lead to render artifacts.
- The inner boundaries (holes) specified in the GeoPolygon are ignored.
Declaration
Swift
public init(geometry: GeoPolygon, color: UIColor, outlineColor: UIColor, outlineWidthInPixels: Double)Parameters
geometryThe list of vertices representing the outer boundary of polygon.
colorThe fill color for the polygon.
outlineColorThe color of the polygon outline, alpha channel is ignored and treated as 1.
outlineWidthInPixelsThe width of the polygon outline (in pixels). Negative values are clamped to 0.
-
The geometry of the polygon. Setting a new geometry will update the appearance. The winding order of the vertices can be in clockwise or counter-clockwise order. It is recomended to provide the outer boundary ordered clockwise and closed.
Note:
- The polygon shape should not cover more than half of the globe, otherwise unexpected results may occur.
- Polygons which are self-intersecting are not supported and may lead to render artifacts.
- The inner boundaries (holes) specified in the GeoPolygon are ignored.
Declaration
Swift
public var geometry: GeoPolygon { get set } -
The Metadata instance attached to this polygon,
nilby default.Declaration
Swift
public var metadata: Metadata? { get set } -
Color of the polygon’s fill. Fully transparent color (alpha set to 0) disables the fill completely.
Declaration
Swift
public var fillColor: UIColor { get set } -
The draw order of this map polygon relative to other map polygons. Polygons with higher draw order value are drawn on top of polygons with lower draw order.
In case multiple polygons have the same draw order value then the order in which they were added to the scene matters. Last added polygon is drawn on top.
Allowed range is 0-1023. Values outside this range will be clamped. Default value is 0.
Declaration
Swift
public var drawOrder: Int32 { get set } -
The list of visibility ranges. The map polygon is visible only inside these map measure ranges. A range is half open - [minimumZoomLevel, maximumZoomLevel), the given maximum value is not contained in the range.
When empty (the default), the map polygon is visible without map measure restrictions. Only MapMeasureRange of
MapMeasure.Kind.zoomLeveltype are supported. MapMeasureRange of other unsupported types will be ignored.Declaration
Swift
public var visibilityRanges: [MapMeasureRange] { get set } -
The color of the polygon outline. The default outline color is opaque white.
Transparent outlines are not supported. Any color with transparency (alpha value other than 1) will be rendered as fully opaque.
Declaration
Swift
public var outlineColor: UIColor { get set } -
The width of the polygon outline in pixels. The value should be greater than or equal to zero. Negative values are clamped to zero.
By default, the outline width is set to zero.
Declaration
Swift
public var outlineWidth: Double { get set }