MapGeoJSON
Extends:
GeoJSON可以通过API或选项设置样式。
Example:
var data = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[
104.91763561707054,
30.154133143258463
],
[
104.93278268710557,
30.092682588091314
],
[
105.03502903861937,
30.10582236698391
]
]
}
}]};
var geojson = new KQ.Map.MapGeoJSON(data);
geojson.addToMapView(mapView);
Constructor Summary
Public Constructor | ||
public |
constructor(geojson_obj: Object, options: Object) 构造函数 |
Method Summary
Public Methods | ||
public |
addData(data: GeoJSON): Null 添加数据到已有对象 |
|
public |
addToMapView(mapview: MapView): Null 添加对象到mapview |
|
public |
绑定事件 |
|
public |
bindOnClick(callback: function(e: Object): null): Null 绑定点击事件 |
|
public |
返回经纬度范围 |
|
public |
remove(): Null 从mapview移除对象 |
|
public |
改变GeoJSON矢量图层的样式 |
Public Constructors
Public Methods
public addData(data: GeoJSON): Null source
添加数据到已有对象
Params:
Name | Type | Attribute | Description |
data | GeoJSON | GeoJSON数据 |
Return:
Null |
public addToMapView(mapview: MapView): Null source
添加对象到mapview
Params:
Name | Type | Attribute | Description |
mapview | MapView | mapview对象 |
Return:
Null |
public setStyle(style: Object): Null source
改变GeoJSON矢量图层的样式
Params:
Name | Type | Attribute | Description |
style | Object | 样式参数 |
|
style.stroke | Boolean | 是否使用画笔绘制线。设为false将不显示多边形或圆的边线。 |
|
style.color | String | 线条颜色,如:'#3388ff' |
|
style.weight | Number | 线条宽度,单位像素 |
|
style.opacity | Number | 线条透明度(0~1) |
|
style.lineCap | String | 线端口设置,参考:https://developer.mozilla.org/zh-CN/docs/Web/SVG/Attribute/stroke-linecap |
|
style.lineJoin | String | 线段连接设置,参考:https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin |
|
style.dashArray | String | 定义线段的设置,参考:https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray |
|
style.dashOffset | String | 定义线段偏移的设置,参考:https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset |
|
style.fill | Boolean | 是否填充颜色。 |
|
style.fillColor | String | 填充色 |
|
style.fillOpacity | Number | 填充透明度(0~1) |
|
style.fillRule | String | 填充规则,参考:https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule |
Return:
Null |