abstract style~RegularShape(options)

规则形状的矢量点符号。

Summary

Methods:
getFillColor

获取填充颜色。

getOffset

获取符号的偏移量。

getOpacity

获取符号的透明度。

getOutlineColor

获取边框的颜色。

getOutlineWidth

获取边框的宽度。

getRotateWithView

获得符号是否跟着地图旋转。

getRotation

获取符号的旋转角度。单位是角度制。

setOffset

设置符号的偏移量。

setOpacity

设置透明度。

setOutlineColor

设置边框的颜色。

setOutlineWidth

设置边框的宽度。

setRotation

设置旋转角度。单位是角度制。

Constructor

new abstract RegularShape(options)

构造函数

Parameters:
Name Type Description
options Object

规则矢量符号的可选项。

Name Type Description
fillColor module:style~Color

填充颜色。

outlineColor module:style~Color

边框颜色。

outlineWidth Number

外边框的宽度,单位是像素。

Throws:
  • 当实例化RegularShape时,抛出异常:"the RegularShape is an abstract class,can not be instantiated!"。

  • 当fillColor或者outlineColor不是Color,或者outlineWidth是NaN或正、负无穷大的数字时,抛出异常:"parameter 'fillColor' and 'outlineColor' must be hmap.style.Color and parameter 'outlineWidth' must be a number"。

Methods

getFillColor() → {module:style~Color}

获取填充颜色。

Returns:
module:style~Color -

填充颜色

getOffset() → {module:basetype~Offset}

获取符号的偏移量。

Returns:
module:basetype~Offset -

偏移量

getOpacity() → {Number}

获取符号的透明度。

Returns:
Number -

透明度

getOutlineColor() → {module:style~Color}

获取边框的颜色。

Returns:
module:style~Color -

边框线颜色

getOutlineWidth() → {Number}

获取边框的宽度。

Returns:
Number -

线符号的宽度

getRotateWithView() → {Boolean}

获得符号是否跟着地图旋转。

Returns:
Boolean -

如果旋转返回true;如果不旋转,返回false。

Example
let iconSymbol = new hmap.style.Icon();
let result = iconSymbol.getRotateWithView();//result=false

getRotation() → {Number}

获取符号的旋转角度。单位是角度制。

Returns:
Number -

旋转角度

setOffset(offset)

设置符号的偏移量。

Parameters:
Name Type Description
offset module:basetype~Offset

偏移量

Throws:

当参数不是Offset对象时,抛出异常:"The parameter must be a Offset"。

setOpacity(opacity)

设置透明度。

Parameters:
Name Type Description
opacity Number

透明度,透明度的范围是[0,1]。

Throws:

当参数的值不在0到1之间时,抛出异常:“The extent of the parameter 'opacity' is [0,1]”。

setOutlineColor(color)

设置边框的颜色。

Parameters:
Name Type Description
color module:style~Color

边框线颜色

Throws:

当参数不是Color时,抛出异常:"parameter 'color' must be instance of Color"。

setOutlineWidth(width)

设置边框的宽度。

Parameters:
Name Type Description
width Number

边框线宽度

Throws:

参数的值不是数字类型,或者是无穷大的数字时,抛出异常:“parameter 'width' must be Number that is not infinity”。

setRotation(rotation)

设置旋转角度。单位是角度制。

Parameters:
Name Type Description
rotation Number

旋转角度