style~Circle(options)

圆形符号。

Summary

Methods:
clone

复制一个新的圆形符号。

getFillColor

获取填充颜色。

getOffset

获取符号的偏移量。

getOpacity

获取符号的透明度。

getOutlineColor

获取边框的颜色。

getOutlineWidth

获取边框的宽度。

getRadius

获取符号半径。

getRotateWithView

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

getRotation

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

setOffset

设置符号的偏移量。

setOpacity

设置透明度。

setOutlineColor

设置边框的颜色。

setOutlineWidth

设置边框的宽度。

setRadius

设置圆形符号半径。

setRotation

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

Constructor

new Circle(options)

构造函数

Parameters:
Name Type Description
options Object

圆形符号的可选项。

Name Type Description
radius Number

圆符号的半径(单位:像素)。

Throws:

当参数radius是NaN,或者是无穷大的数字时,抛出异常:'parameter "radius" must be a number that is not infinity'。

Example
let circle = new hmap.style.Circle({
     "radius":20,
     "fillColor":new hmap.style.Color(255,0,0,1),
     "outlineColor":new hmap.style.Color(0,0,0,1),
     "outlineWidth":1,
     "rotation":0
});

Methods

clone() → {module:style~Circle}

复制一个新的圆形符号。

Returns:
module:style~Circle -

新的圆形符号,与被复制的相同。

Example
let circle = new hmap.style.Circle();
let result = circle.clone();

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 -

线符号的宽度

getRadius() → {Number}

获取符号半径。

Returns:
Number -

圆形符号的半径,像素单位。

Example
let circle = new hmap.style.Circle();
let result = circle.getRadius();

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”。

setRadius(radius)

设置圆形符号半径。

Parameters:
Name Type Description
radius Number

圆形符号的半径,像素单位。

Throws:

当参数不是数字,或者是无穷大的数字时,抛出异常:"The radius should be a number that is not infinity."。

Example
let circle = new hmap.style.Circle();
circle.setRadius(100);

setRotation(rotation)

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

Parameters:
Name Type Description
rotation Number

旋转角度