Class: FMPolygonMarker

FMPolygonMarker

FMPolygonMarker 自定义多边形标注对象,为自定义图层。

new fengmap.FMPolygonMarker(param)

Name Type Description
param json

参数

Name Type Description
alpha number

多边形的透明度。0.0 - 1.0 之间取值, 默认为 1.0

color number

多边形的颜色

height number

多边形与楼层之间的高度, 默认为 1

lineWidth number

多边形边框线宽,默认为2

lineColor number

多边形边框线颜色。

points array | json

1.array格式的为多边形的坐标点集数组。类似[{x: 12961583, y: 4861865, z: 56},{x: 12961644, y: 4861874, z: 56}]数组。2.json格式的为圆形或矩形的设置,具体参数如下:

points[].x number

x坐标

points[].y number

y坐标

points.type string

多边形图层类型。'circle'表示圆形;'rectangle' 表示矩形。

points.center json

圆形或矩形的中心点设置。

points.radius number

圆形的半径。

points.segments number

组成圆形的段数,默认40。值越大越接近圆。通常设置为近似圆的最小值,这样可以节省资源。

points.startPoint json

矩形的起始点设置,代表矩形的左上角。如存在center设置时,则优先使用stratPoint的值绘制矩形。

points.width number

矩形的宽度。

points.height number

矩形的高度。

Members

center

获取中心点坐标

groupID

楼层id

Properties:
Name Type Description
groupID number

楼层id

height

高度

Properties:
Name Type Description
height number

高度

readonlymapCoord

元素中心点坐标点

Properties:
Name Type Description
mapCoord json

地图坐标{x;,y:,z:}

readonlynodeType

地图元素对象类型

Properties:
Name Type Description
nodeType fengmap.FMNodeType

地图元素对象类型

show

地图元素的显示/隐藏

Properties:
Name Type Description
show bool

【true】: 显示,【false】: 隐藏

Methods

inherited alwaysShow()

是否一直显示。

inherited avoid(value)

图层内或单个元素与同一图层内的其他元素在同一位置有相互遮盖时,是否自动避让。FMImageMarker FMTextMarker有效。

Name Type Description
value bool

【true】: 需避让,【false】: 不避让。注意:avoid方法与show属性不能同时使用,使用avoid方法会自动更新show属性的值。

contain(point)

检查多边形是否包含某一点

Name Type Description
point json

坐标数据

Name Type Description
x float

坐标x数据

y float

坐标y数据

getPoints(){Array}

获取顶点坐标数据

Returns:
Type Description
Array

setAlpha(val)

修改多边形面的透明度

Name Type Description
val number

透明度

setColor(color)

修改颜色

Name Type Description
color string

如:'#ff0000'

setLineColor(color)

修改边线颜色

Name Type Description
color string

如:'#ff0000'

setLineWidth(val)

修改边线宽度

Name Type Description
val number

线宽