Summary
Methods:
| clone |
克隆一个颜色填充符号。 |
| getColor |
获取颜色值。 |
| getOffset |
获取填充符号的偏移量。 |
| getOpacity |
获取透明度。 |
| setColor |
设置颜色值。 |
| setOffset |
设置填充符号的偏移量。 |
| setOpacity |
设置透明度。 |
Constructor
new ColorFill(color)
构造函数。
Parameters:
| Name | Type | Description |
|---|---|---|
color |
module:style~Color | 颜色值。 |
Throws:
当参数类型错误时,报出“color must be an instance of Color!”的异常。
Example
let colorFill = new hmap.style.ColorFill(new hmap.style.Color(0,255,0,1));
Methods
-
clone() → {module:style~Color}
-
克隆一个颜色填充符号。
Example
let newColorFill = colorFill.clone(); -
getColor() → {module:style~Color}
-
获取颜色值。
Example
let result = colorFill.getColor(); -
getOffset() → {module:basetype~Offset}
-
获取填充符号的偏移量。
-
getOpacity() → {Number}
-
获取透明度。
Returns:
Number -透明度
Example
let opacity = colorFill.getOpacity(); -
setColor(color)
-
设置颜色值。
Parameters:
Name Type Description colormodule:style~Color 颜色
Throws:
当参数类型错误时,报出“parameter "color" must be an instance of Color!”的异常。
Example
let color = new hmap.style.Color(255,0,0,1); colorFill.setColor(color); let result = colorFill.getColor(); -
setOffset(offset) → {module:style~FillSymbol}
-
设置填充符号的偏移量。
Parameters:
Name Type Description offsetmodule:basetype~Offset 偏移量
Throws:
当参数不是Offset时,抛出异常:'parameter offset must be an instance of Offset'。
-
setOpacity(opacity)
-
设置透明度。
Parameters:
Name Type Description opacityNumber 透明度,范围从0到1,0表示完全透明,1表示完全不透明。
Example
colorFill.setOpacity(0.5);