Summary
Methods:
getDefault |
创建并返回默认样式。 |
clone |
克隆样式。 |
getFillSymbols |
获得填充符号数组。 |
getLineSymbols |
获取线符号数组。 |
getMarkerSymbols |
获取点符号数组。 |
getTextSymbols |
获取文本符号数组。 |
setFillSymbols |
设置填充符号数组。 |
setLineSymbols |
设置线符号数组。 |
setMarkerSymbols |
设置点符号数组。 |
setTextSymbols |
设置文本符号数组。 |
Constructor
new Style(opts)
构造函数。
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
Object | 样式的属性值,传入的值是key-value对象。
|
Throws:
-
当markerSymbols不是数组时,抛出异常:"markerSymbols option should be Array type."。
-
当lineSymbols不是数组时,抛出异常:"lineSymbols option should be Array type."。
-
当fillSymbols不是数组时,抛出异常:"fillSymbols option should be Array type."。
-
当textSymbols不是数组时,抛出异常:"textSymbols option should be Array type."。
Example
let opts = {};
let fillSymbol = new hmap.style.ColorFill(new hmap.style.Color(255, 255, 0, 0.2));
let markerSymbol = new hmap.style.Circle();
let lineSymbol = new hmap.style.LineSymbol();
let textSymbol = new hmap.style.TextSymbol();
opts.fillSymbols = [fillSymbol];
opts.markerSymbols = [markerSymbol];
opts.lineSymbols = [lineSymbol];
opts.textSymbols = [textSymbol];
let style = new hmap.style.Style(opts);
Methods
-
static getDefault() → {module:style~Style}
-
创建并返回默认样式。
Example
let result = hmap.style.Style.getDefault();
-
clone() → {module:style~Style}
-
克隆样式。
Example
let style = new hmap.style.Style(); let newStyle = style.clone();
-
getFillSymbols() → {Array.<{module:style~FillSymbol}>}
-
获得填充符号数组。
Example
let result = style.getFillSymbols();//result=[new hmap.style.ColorFill(new hmap.style.Color(0.5, 1.0, 0.0, 0.2))]
-
getLineSymbols() → {Array.<{module:style~LineSymbol}>}
-
获取线符号数组。
Example
let result = style.getLineSymbols();
-
getMarkerSymbols() → {Array.<{module:style~MarkerSymbol}>}
-
获取点符号数组。
Example
let result = style.getMarkerSymbols();
-
getTextSymbols() → {Array.<{module:style~TextSymbol}>}
-
获取文本符号数组。
Example
let result = style.getTextSymbols();
-
setFillSymbols(fillSymbols)
-
设置填充符号数组。
Parameters:
Name Type Description fillSymbols
Array.<{module:style~FillSymbol}> 填充符号对象的数组。
Example
style.setFillSymbols([fillSymbol]);
-
setLineSymbols(lineSymbols)
-
设置线符号数组。
Parameters:
Name Type Description lineSymbols
Array.<{module:style~LineSymbol}> 线符号对象的数组。
Example
style.setLineSymbols([lineSymbol]);
-
setMarkerSymbols(markerSymbols)
-
设置点符号数组。
Parameters:
Name Type Description markerSymbols
Array.<{module:style~MarkerSymbol}> 点符号对象的数组。
Example
style.setMarkerSymbols([markerSymbol]);
-
setTextSymbols(textSymbols)
-
设置文本符号数组。
Parameters:
Name Type Description textSymbols
Array.<{module:style~TextSymbol}> 文本符号的数组。
Example
style.setTextSymbols([textSymbol]);