public final class Polygon

  1. Object
  2. MapObject
  3. Polygon
A filled, optionally stroked polygon drawn on a map. The vertices describe the outer ring; the ring is implicitly closed. Add one through MapSurface.addPolygon(Polygon).

Constructors

public Polygon()Creates an empty polygon; append outer-ring vertices with addPoint(LatLng).
public Polygon(LatLng[] pts)Creates a polygon with the supplied outer-ring vertices.

Methods

public Polygon addPoint(LatLng point)Appends an outer-ring vertex.
public List getPoints()The live list of outer-ring vertices (LatLng).
public int getFillColor()The fill color as 0xAARRGGBB (alpha in the high byte).
public Polygon setFillColor(int fillColor)Sets the fill color as 0xAARRGGBB (alpha in the high byte).
public int getStrokeColor()The stroke color as 0xRRGGBB.
public Polygon setStrokeColor(int strokeColor)Sets the stroke color as 0xRRGGBB.
public int getStrokeWidth()The stroke width in pixels (0 hides the outline).
public Polygon setStrokeWidth(int strokeWidth)Sets the stroke width in pixels (0 hides the outline).
public boolean isVisible()Whether the polygon is rendered.
public Polygon setVisible(boolean visible)Shows or hides the polygon.

Inherited methods

Constructor details

Polygon

public Polygon()
Creates an empty polygon; append outer-ring vertices with addPoint(LatLng).

Polygon

public Polygon(LatLng[] pts)
Creates a polygon with the supplied outer-ring vertices.

Method details

addPoint

public Polygon addPoint(LatLng point)
Appends an outer-ring vertex.

getPoints

public List getPoints()
The live list of outer-ring vertices (LatLng).

getFillColor

public int getFillColor()
The fill color as 0xAARRGGBB (alpha in the high byte).

setFillColor

public Polygon setFillColor(int fillColor)
Sets the fill color as 0xAARRGGBB (alpha in the high byte).

getStrokeColor

public int getStrokeColor()
The stroke color as 0xRRGGBB.

setStrokeColor

public Polygon setStrokeColor(int strokeColor)
Sets the stroke color as 0xRRGGBB.

getStrokeWidth

public int getStrokeWidth()
The stroke width in pixels (0 hides the outline).

setStrokeWidth

public Polygon setStrokeWidth(int strokeWidth)
Sets the stroke width in pixels (0 hides the outline).

isVisible

public boolean isVisible()
Whether the polygon is rendered.

setVisible

public Polygon setVisible(boolean visible)
Shows or hides the polygon.