public final class Polygon extends BaseOverlay
它有以下属性:
一个多边开的边框由一系列的顺时针或逆时针顶点组成。边框不需要声明起点和终点一致。如果边框的起点与终点不一致,API会自动将它封闭。
边框的宽度以像素为单位,不会受可视区域缩放级别的影响。默认为10。
边框颜色是一个ARGB格式,ARGB请参考android.graphics.Color。默认为黑色。
填充颜色是一个ARGB格式,ARGB格式可参考android.graphics.Color。默认是透明的。如果多边形的几何图形不正确,则填充颜色不会被绘制。
Z轴是控制覆盖物重复区域的绘制顺序的值。Z轴较大的覆盖物会在绘制在Z轴较小的覆盖物上面。如果两个覆盖物的Z轴数值相同,则覆盖情况将随机。默认为0。
标示多边形是否可见。如果可见性为否,则不会被绘制。 多边形方法必须在主线程中调用,否则会抛出IllegalStateException。
It has the following attributes:
The border of a polygon consists of a series of clockwise or counterclockwise vertices. The border does not need to declare that the start and end points are the same. If the start and end points of the border are not the same, the API will automatically close it.
The width of the border is in pixels and is not affected by the zoom level of the visible area. The default is 10.
The border color is in ARGB format, ARGB refers to android.graphics.Color. The default is black.
The fill color is in ARGB format, ARGB format refers to android.graphics.Color. The default is transparent. If the geometry of the polygon is incorrect, the fill color will not be drawn.
The Z-axis is a value that controls the drawing order of overlapping areas of overlays. Overlays with a larger Z-axis will be drawn on top of overlays with a smaller Z-axis. If two overlays have the same Z-axis value, the overlap will be random. The default is 0.
Indicates whether the polygon is visible. If visibility is false, it will not be drawn. Polygon methods must be called in the main thread, otherwise, an IllegalStateException will be thrown.
Field1, Field2, overlayName| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
contains(LatLng latLng)
判断多边形是否包含传入的经纬度点。
|
boolean |
equals(java.lang.Object paramObject) |
int |
getFillColor()
获取多边形的填充颜色
Get the fill color of the polygon |
java.util.List |
getHoleOptions()
获取多边形空心洞的配置项集合
Get the configuration collection of polygon hollow holes |
java.lang.String |
getId()
获取多边形的Id。
|
java.util.List<LatLng> |
getPoints()
获取多边形的顶点列表。
|
int |
getStrokeColor()
获取多边形的边框颜色
Get the border color of the polygon |
int |
getStrokeDottedLineType()
获取多边形的边框虚线形状。
|
float |
getStrokeWidth()
获取多边形的边框宽度
Get the border width of the polygon |
float |
getZIndex()
获取多边形的Z轴值
Get the Z-axis value of the polygon |
int |
hashCode() |
boolean |
isVisible()
获取多边形是否可见。
|
void |
remove()
从地图上删除当前多边形。
|
void |
setFillColor(int color)
设置多边形的填充颜色
Set the fill color of the polygon |
void |
setHoleOptions(java.util.List options)
设置多边形空心洞的配置项集合
Set the configuration collection of polygon hollow holes |
void |
setPoints(java.util.List<LatLng> points)
设置多边形的顶点。
|
void |
setStrokeColor(int color)
设置多边形的边框颜色
Set the border color of the polygon |
void |
setStrokeDottedLineType(int type)
设置多边形的边框虚线形状。
|
void |
setStrokeWidth(float width)
设置多边形的边框宽度
Set the border width of the polygon |
void |
setVisible(boolean visible)
设置多边形的可见属性。
|
void |
setZIndex(float zIndex)
设置多边形的Z轴数值。
|
method1, method2public void remove()
public java.lang.String getId()
public void setPoints(java.util.List<LatLng> points)
points - 多边形顶点列表
public java.util.List<LatLng> getPoints()
public void setHoleOptions(java.util.List options)
options - 空心洞的配置项集合
public java.util.List getHoleOptions()
public void setStrokeWidth(float width)
width - 多边形边框宽度,单位:像素
public float getStrokeWidth()
public void setStrokeColor(int color)
color - 边框颜色,ARGB格式。
public int getStrokeColor()
public void setFillColor(int color)
color - 填充颜色的ARGB格式
public int getFillColor()
public void setZIndex(float zIndex)
zIndex - 多边形Z轴数值
public float getZIndex()
public void setVisible(boolean visible)
visible - true:可见;false:不可见。
public boolean isVisible()
public boolean contains(LatLng latLng)
latLng - 经纬度点。
public boolean equals(java.lang.Object paramObject)
equals 在类中 java.lang.Objectpublic int hashCode()
hashCode 在类中 java.lang.Objectpublic void setStrokeDottedLineType(int type)
type - 形状:AMapPara.DOTTEDLINE_TYPE_DEFAULT:不绘制虚线(默认)AMapPara.DOTTEDLINE_TYPE_SQUARE:方形;AMapPara.DOTTEDLINE_TYPE_CIRCLE:圆形;AMapPara.DOTTEDLINE_TYPE_DEFAULT: Do not draw dotted lines (default)AMapPara.DOTTEDLINE_TYPE_SQUARE: Square;AMapPara.DOTTEDLINE_TYPE_CIRCLE: Circle;public int getStrokeDottedLineType()
AMapPara.DOTTEDLINE_TYPE_DEFAULT:不绘制虚线(默认)AMapPara.DOTTEDLINE_TYPE_DEFAULT: Do not draw dotted lines (default)