Class: Graphic

Graphic

高效率点图层点要素类。

new Graphic(lngLat, style, attributes)

Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/mapboxgl/iclient-mapboxgl.js"></script>
<script>
  new mapboxgl.supermap.Graphic(lngLat, style, attributes);
  
</script>

// ES6 Import
import { Graphic } from '@supermap/iclient-mapboxgl';

new Graphic(lngLat, style, attributes);

mapboxgl/overlay/graphic/Graphic.js, line 8
Name Type Description
lngLat Object | Array.<number>

坐标。格式:经纬度数组或包含{lng,lat}格式对象。

style Object

图形参数。

Name Type Description
color Array.<number> 可选

点颜色。目前只支持 rgba 数组。

radius Object 可选

点半径。

attributes Object 可选

属性信息。

Example
var graphic = new Graphic(
   {
        lng:116,
        lat:39
   },{
        color:[255,0,0],
        radius:30
   }
});

Methods

getAttributes(){Object}

mapboxgl/overlay/graphic/Graphic.js, line 102

获取属性信息。

Returns:
Type Description
Object 属性信息。

getId(){string}

mapboxgl/overlay/graphic/Graphic.js, line 36

获取当前 ID。

Returns:
Type Description
string ID。

getLngLat(){Object}

mapboxgl/overlay/graphic/Graphic.js, line 55

获取经纬度坐标。

Returns:
Type Description
Object 经纬度坐标,数据格式{lng,lat}。

getStyle(){Object}

mapboxgl/overlay/graphic/Graphic.js, line 84

获取样式。

Returns:
Type Description
Object 点样式。

setAttributes(attributes)

mapboxgl/overlay/graphic/Graphic.js, line 93

设置属性信息。

Name Type Description
attributes Object 可选

属性信息。

setId(id)

mapboxgl/overlay/graphic/Graphic.js, line 45

设置当前要素 ID。

Name Type Description
id string

要素 ID。

setLngLat(lngLat)

mapboxgl/overlay/graphic/Graphic.js, line 64

设置经纬度坐标。

Name Type Description
lngLat Object

经纬度坐标,数据格式{lng,lat}。

setStyle(style)

mapboxgl/overlay/graphic/Graphic.js, line 73

设置点样式。

Name Type Description
style Object

样式选项。

Name Type Description
color Array 可选

颜色。

radius number 可选

半径。