feature~Polygon(coordinates, attributes, symbol)

多边形要素

Summary

Methods:
getAttributes

获得要素的自定义属性

getCenter

返回当前多边形的中心点

getCoordinates

获取坐标数组

getElement

获取多边形DOM元素

getId

获取唯一标识

getSymbol

获得定义的样式对象

getType

获取要素类型

getVisibility

获得要素的可见性

setAttributes

设置要素的自定义属性

setCoordinates

设置坐标数组

setSymbol

设置面样式

setVisibility

设置Polygon的可见性

Constructor

new Polygon(coordinates, attributes, symbol)

Parameters:
Name Type Description
coordinates Array.<Array.<Number>>

线的坐标数组[[x,y],[x1,y1]];

attributes Object

自定义属性

symbol Object

多边形样式定义

Name Type Description
styleType String

填充样式类型 默认为 'solid' 包括 'solid'(单颜色填充)| 'point'(小圆点)| 'square'(小方块)| 'image'(图片)

color String

填充颜色,不生效图片和自定义样式 默认黄色,格式为"rgb(255,255,255)"|"#ffffff"格式

opacity Number

填充颜色透明度,默认为1,注意填充样式类型为 'solid' 生效

image Object

当模式为图片模式的时候传入的对象

Name Type Description
url string

图片路径

width Number

图片宽度

height Number

图片高度

outline Object

填充线样式,参数按照线要素的样式定义

Throws:
RangeError -

数据长度小于2的时候抛出异常

Methods

getAttributes() → {Object}

获得要素的自定义属性

Returns:
Object

getCenter() → {Array.<Number>}

返回当前多边形的中心点

Returns:
Array.<Number>

getCoordinates()

获取坐标数组

getElement() → {Object}

获取多边形DOM元素

Returns:
Object -

DOM元素

getId() → {String}

获取唯一标识

Returns:
String

getSymbol() → {Object}

获得定义的样式对象

Returns:
Object

getType() → {String}

获取要素类型

Returns:
String

getVisibility() → {Boolean}

获得要素的可见性

Returns:
Boolean

setAttributes(attributes)

设置要素的自定义属性

Parameters:
Name Type Description
attributes Object

setCoordinates(coordinates)

设置坐标数组

Parameters:
Name Type Description
coordinates Array.<Array.<Number>>

坐标数组

setSymbol(symbol)

设置面样式

Parameters:
Name Type Description
symbol Object

多边形样式定义

Name Type Description
styleType String

填充样式类型 默认为 'solid' 包括 'solid'(单颜色填充)| 'point'(小圆点)| 'square'(小方块)| 'image'(图片)

color String

填充颜色,不生效图片和自定义样式 默认黄色,格式为"rgb(255,255,255)"|"#ffffff"格式

opacity Number

填充颜色透明度,默认为1,注意填充样式类型为

image Object

当模式为图片模式的时候传入的对象

Name Type Description
url string

图片路径

width Number

图片宽度

height Number

图片高度

outline Object

填充线样式,参数按照线要素的样式定义

Throws:

样式传入错误的话抛出异常

setVisibility(visible)

设置Polygon的可见性

Parameters:
Name Type Description
visible Boolean

可见性