public class

Polygon

extends VectorElement
java.lang.Object
   ↳ com.carto.vectorelements.VectorElement
     ↳ com.carto.vectorelements.Polygon

Class Overview

A geometric polygon that can be displayed on the map.
Polygons can be concave and have multiple overlapping holes.

Summary

Public Constructors
Polygon(PolygonGeometry geometry, PolygonStyle style)
Constructs a Polygon object from a geometry object and a style.
Polygon(MapPosVector poses, PolygonStyle style)
Constructs a Polygon object from a vector of map positions and a style.
Polygon(MapPosVector poses, MapPosVectorVector holes, PolygonStyle style)
Constructs a Polygon object from a vector of map positions, a vector of holes and a style.
Public Methods
synchronized void delete()
PolygonGeometry getGeometry()
Returns the geometry object that defines the location of this vector element.
MapPosVectorVector getHoles()
Returns the holes of the polygon.
MapPosVector getPoses()
Returns the vertices that define this polygon.
PolygonStyle getStyle()
Returns the style of this polygon.
void setGeometry(PolygonGeometry geometry)
Sets the location for this polygon.
void setHoles(MapPosVectorVector holes)
Sets the holes of the polygon.
void setPoses(MapPosVector poses)
Sets the vertices that define this polygon.
void setStyle(PolygonStyle style)
Sets the style for this polygon.
[Expand]
Inherited Methods
From class com.carto.vectorelements.VectorElement
From class java.lang.Object

Public Constructors

public Polygon (PolygonGeometry geometry, PolygonStyle style)

Constructs a Polygon object from a geometry object and a style.

Parameters
geometry The geometry object that defines the location and holes of this polygon.
style The style that defines what this polygon looks like.

public Polygon (MapPosVector poses, PolygonStyle style)

Constructs a Polygon object from a vector of map positions and a style.

Parameters
poses The vector of map positions that defines the location of this polygon.
style The style that defines what this polygon looks like.

public Polygon (MapPosVector poses, MapPosVectorVector holes, PolygonStyle style)

Constructs a Polygon object from a vector of map positions, a vector of holes and a style.

Parameters
poses The vector of map positions that defines the location of this polygon.
holes The vector of holes that defines the locations of holes of this polygon.
style The style that defines what this polygon looks like.

Public Methods

public synchronized void delete ()

public PolygonGeometry getGeometry ()

Returns the geometry object that defines the location of this vector element.

Returns
  • The geometry object of this vector element.

public MapPosVectorVector getHoles ()

Returns the holes of the polygon.

Returns
  • The list of holes of the polygon.

public MapPosVector getPoses ()

Returns the vertices that define this polygon.

Returns
  • The vector of map positions that define this polygon.

public PolygonStyle getStyle ()

Returns the style of this polygon.

Returns
  • The style that defines what this polygon looks like.

public void setGeometry (PolygonGeometry geometry)

Sets the location for this polygon.

Parameters
geometry The new geometry object that defines the location and holes of this polygon.

public void setHoles (MapPosVectorVector holes)

Sets the holes of the polygon.

Parameters
holes The list of holes of the polygon.

public void setPoses (MapPosVector poses)

Sets the vertices that define this polygon.
Note: holes are not affected by this call.

Parameters
poses The new vector of map positions that define this polygon.

public void setStyle (PolygonStyle style)

Sets the style for this polygon.

Parameters
style The new style that defines what this polygon looks like.