public final class MapPolygon extends MapObject
GeoPolygon
to be rendered on a map. In contrast to a
MapPolyline
, it is assumed that the last coordinate within the path is connected with the
first coordinate, thereby constructing an enclosed geometry.
Self-intersecting polygons rendering are not supported.
Note, in order to use this class, library 'org.locationtech.jts:jts-core:1.15.0' must be available at runtime. Check build.gradle file if it is included there.
GeoPolygon
MapObject.Type
Constructor and Description |
---|
MapPolygon(GeoPolygon polygon)
Creates a
MapPolygon , which is a MapObject in the shape of a polygon. |
Modifier and Type | Method and Description |
---|---|
int |
getFillColor()
Returns the current fill color for this
MapPolygon , returning an ARGB
(Alpha/Red/Green/Blue) integer color value. |
int |
getLineColor()
Returns the current border line color for this
MapPolygon , returning an ARGB
(Alpha/Red/Green/Blue) integer color value. |
int |
getLineWidth()
Returns the current border line width for the
MapPolygon , in pixels. |
MapObject.Type |
getType()
Returns the type of object that this
MapObject represents. |
MapPolygon |
setFillColor(int color)
Sets a fill color for this
MapPolygon , using an ARGB (Alpha/Red/Green/Blue) integer
color value. |
MapPolygon |
setGeoPolygon(GeoPolygon polygon)
Changes the
GeoPolygon rendered by this MapPolygon . |
MapPolygon |
setLineColor(int color)
Sets a border line color for this
MapPolygon , using an ARGB (Alpha/Red/Green/Blue)
integer color value. |
MapPolygon |
setLineWidth(int width)
Sets a border line width, in pixels, for this
MapPolygon , an int value within
the [0..100] range. |
MapObject |
setVisible(boolean isVisible)
Sets whether this
MapObject is visible. |
equals, getBaseType, getParent, getVisibleMask, getZIndex, hashCode, isVisible, resetVisibleMask, setVisible, setVisible, setVisibleMask, setVisibleMask, setZIndex, unsetVisibleMask, unsetVisibleMask
public MapPolygon(GeoPolygon polygon)
MapPolygon
, which is a MapObject
in the shape of a polygon. The
default ARGB line/fill color is 0x00000000.polygon
- GeoPolygon
to construct the MapPolygon
java.lang.IllegalArgumentException
- If the input GeoPolygon
is invalid or it is a self-intersecting polygon.public MapPolygon setGeoPolygon(GeoPolygon polygon)
GeoPolygon
rendered by this MapPolygon
.polygon
- GeoPolygon
to be renderedMapPolygon
itself.java.lang.IllegalArgumentException
- If the input GeoPolygon
is invalid or it is a self-intersecting polygon.public MapPolygon setFillColor(int color)
MapPolygon
, using an ARGB (Alpha/Red/Green/Blue) integer
color value.color
- The ARGB integer color value. The packed integer is made up of 4 bytes: alpha,
red, green, blue. Each color component has a value range from [0..255], with 0
meaning no contribution for that component, and 255 meaning 100% contributionMapPolygon
object.public int getFillColor()
MapPolygon
, returning an ARGB
(Alpha/Red/Green/Blue) integer color value.public MapPolygon setLineColor(int color)
MapPolygon
, using an ARGB (Alpha/Red/Green/Blue)
integer color value.color
- The ARGB integer color value. The packed integer is made up of 4 bytes: alpha,
red, green, blue. Each color component has a value range from [0..255], with 0
meaning no contribution for that component, and 255 meaning 100% contribution.public int getLineColor()
MapPolygon
, returning an ARGB
(Alpha/Red/Green/Blue) integer color value.public MapPolygon setLineWidth(int width)
MapPolygon
, an int
value within
the [0..100] range.width
- Width of the line defining the border of the MapPolygon
public int getLineWidth()
MapPolygon
, in pixels.MapPolygon
public MapObject setVisible(boolean isVisible)
MapObject
is visible.setVisible
in class MapObject
isVisible
- A boolean variable specifying whether this MapObject
is visibleMapObject
itself.MapObject.setVisible(int, boolean)
,
MapObject.setVisible(int, int, boolean)
public MapObject.Type getType()
MapObject
MapObject
represents.getType
in class MapObject
MapObject.Type
values