Class: Graphic

Graphic

高效率点图层要素类。点要素样式支持:圆形要素、三叶草要素、自定义图形要素。

new Graphic(options)

Usage
import { Graphic } from '@supermapgis/iclient-leaflet';

new Graphic(options);
<script type="text/javascript" src="https://iclient.supermap.io/dist/leaflet/iclient-leaflet.js"></script>
<script>
  new L.supermap.Graphic({paramsNames});
  // 弃用的写法

  L.supermap.graphic(options);
</script>
leaflet/overlay/graphic/Graphic.js, line 7
Name Type Description
options Object

参数。

Name Type Description
latLng L.LatLng

经纬度。

id number

要素 ID。

style CircleStyle | CloverStyle | ImageStyle 可选

点样式。

attributes Object 可选

要素属性。

API Relations

As constructor parameter: GraphicLayer.
As method parameter: GraphicLayer.addGraphics , GraphicLayer.removeGraphics , GraphicLayer.setGraphics , GraphicLayerRenderer.addGraphics , GraphicLayerRenderer.removeGraphics , GraphicLayerRenderer.setGraphics.
Returned by: GraphicLayer.getGraphicBy , GraphicLayer.getGraphicById , GraphicLayer.getGraphicsByAttribute , GraphicLayerRenderer.getGraphicBy , GraphicLayerRenderer.getGraphicById , GraphicLayerRenderer.getGraphicsByAttribute.

Extends

Graphic -> L.Class

Methods

getAttributes(){Object}

leaflet/overlay/graphic/Graphic.js, line 100

获取要素属性。

Returns:
Type Description
Object 要素属性。

deprecated getCanvas(){HTMLCanvasElement}

leaflet/overlay/graphic/Graphic.js, line 90

获取画布,已弃用该设置,请使用 getStyle 接口。

Returns:
Type Description
HTMLCanvasElement 画布。

getId(){string}

leaflet/overlay/graphic/Graphic.js, line 32

获取当前要素 ID。

Returns:
Type Description
string 要素 ID。

getLatLng(){L.LatLng}

leaflet/overlay/graphic/Graphic.js, line 80

获取经纬度。

Returns:
Type Description
L.LatLng 经纬度。

getStyle(){CircleStyle|ImageStyle|CloverStyle}

leaflet/overlay/graphic/Graphic.js, line 118

获取要素样式。

Returns:
Type Description
CircleStyle | ImageStyle | CloverStyle 样式。

setAttributes(attributes)

leaflet/overlay/graphic/Graphic.js, line 70

设置要素属性。

Name Type Description
attributes Object

属性对象。

deprecated setCanvas(canvas)

leaflet/overlay/graphic/Graphic.js, line 60

设置画布,已弃用该设置,请使用 setStyle 接口。

Name Type Description
canvas HTMLCanvasElement

传入需要设置的画布。

setId(id)

leaflet/overlay/graphic/Graphic.js, line 41

设置当前要素 ID。

Name Type Description
id string

要素 ID。

setLatLng(latLng)

leaflet/overlay/graphic/Graphic.js, line 51

设置经纬度。

Name Type Description
latLng L.LatLng

经纬度参数。

setStyle(style)

leaflet/overlay/graphic/Graphic.js, line 109

设置要素样式。

Name Type Description
style CircleStyle | ImageStyle | CloverStyle

样式。