new Graphic(lngLat, style, attributes)
Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/maplibregl/iclient-maplibregl.js"></script>
<script>
new maplibregl.supermap.Graphic(lngLat, style, attributes);
</script>
// ES6 Import
import { Graphic } from '@supermapgis/iclient-maplibregl';
new Graphic(lngLat, style, attributes);
maplibregl/overlay/graphic/Graphic.js, line 7
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
lngLat |
Object | Array.<number> |
坐标。格式:经纬度数组或包含 {lng,lat} 格式对象。 |
|||||||||
style |
Object |
图形参数。
|
|||||||||
attributes |
Object |
可选
属性信息。 |
Example
var graphic = new Graphic(
{
lng:116,
lat:39
},{
color:[255,0,0],
radius:30
}
});
Methods
-
getAttributes(){Object}
maplibregl/overlay/graphic/Graphic.js, line 101 -
获取属性信息。
Returns:
Type Description Object 属性信息。 -
getId(){string}
maplibregl/overlay/graphic/Graphic.js, line 35 -
获取当前 ID。
Returns:
Type Description string ID。 -
getLngLat(){Object}
maplibregl/overlay/graphic/Graphic.js, line 54 -
获取经纬度坐标。
Returns:
Type Description Object 经纬度坐标,数据格式 {lng,lat}。 -
getStyle(){Object}
maplibregl/overlay/graphic/Graphic.js, line 83 -
获取样式。
Returns:
Type Description Object 点样式。 -
setAttributes(attributes)
maplibregl/overlay/graphic/Graphic.js, line 92 -
设置属性信息。
Name Type Description attributes
Object 可选 属性信息。
-
setId(id)
maplibregl/overlay/graphic/Graphic.js, line 44 -
设置当前要素 ID。
Name Type Description id
string 要素 ID。
-
setLngLat(lngLat)
maplibregl/overlay/graphic/Graphic.js, line 63 -
设置经纬度坐标。
Name Type Description lngLat
Object 经纬度坐标,数据格式 {lng,lat}。
-
setStyle(style)
maplibregl/overlay/graphic/Graphic.js, line 72 -
设置点样式。
Name Type Description style
Object 样式选项。
Name Type Description color
Array 可选 颜色。
radius
number 可选 半径。