L.supermap.graphicLayer(graphics, options)
leaflet/overlay/GraphicLayer.js, line 23
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
graphics |
Array.<L.supermap.graphic> |
要素对象。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
图层参数。
|
Extends
Methods
-
addGraphics(graphics)
leaflet/overlay/GraphicLayer.js, line 113 -
追加点要素,不会覆盖之前的要素。
Name Type Description graphicsArray.<L.supermap.graphic> 点要素对象数组。
-
clear()
leaflet/overlay/GraphicLayer.js, line 247 -
释放图层资源。
-
getGraphicBy(property, value){ol.Graphic}
leaflet/overlay/GraphicLayer.js, line 125 -
在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
Name Type Description propertystring graphic 的某个属性名称。
valuestring property 所对应的值。
Returns:
Type Description ol.Graphic 一个匹配的 graphic。 -
getGraphicById(graphicId){ol.Graphic}
leaflet/overlay/GraphicLayer.js, line 143 -
通过给定一个 id,返回对应的矢量要素。
Name Type Description graphicIdstring 矢量要素的属性 id。
Returns:
Type Description ol.Graphic 一个匹配的 graphic。 -
getGraphicsByAttribute(attrName, attrValue){Array.<ol.Graphic>}
leaflet/overlay/GraphicLayer.js, line 153 -
通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
Name Type Description attrNamestring graphic 的某个属性名称。
attrValuestring property 所对应的值。
Returns:
Type Description Array.<ol.Graphic> 一个匹配的 graphic 数组。 -
getRenderer(){Object}
leaflet/overlay/GraphicLayer.js, line 255 -
获取渲染器。
Returns:
Type Description Object 内部渲染器。 -
getState(){Object}
leaflet/overlay/GraphicLayer.js, line 264 -
获取当前地图及图层状态。
Returns:
Type Description Object 地图及图层状态,包含地图状态信息和本图层相关状态。 -
removeGraphics(graphics)
leaflet/overlay/GraphicLayer.js, line 174 -
删除要素数组,默认将删除所有要素。
Name Type Default Description graphicsArray.<ol.Graphic> null 可选 删除的 graphics 数组。
-
setGraphics(graphics)
leaflet/overlay/GraphicLayer.js, line 100 -
设置绘制的点要素数据,会覆盖之前的所有要素。
Name Type Description graphicsArray.<L.supermap.graphic> 点要素对象数组。
-
setStyle(styleOptions)
leaflet/overlay/GraphicLayer.js, line 207 -
设置图层要素整体样式。
Name Type Description styleOptionsObject 样式对象。
Name Type Default Description colorArray.<number> [0, 0, 0, 255] 可选 点颜色。
radiusnumber 10 可选 点半径。
opacitynumber 0.8 可选 不透明度。
highlightColorArray 可选 高亮颜色,目前只支持 rgba 数组。
radiusScalenumber 1 可选 点放大倍数。
radiusMinPixelsnumber 0 可选 半径最小值(像素)。
radiusMaxPixelsnumber Number.MAX_SAFE_INTEGER 可选 半径最大值(像素)。
strokeWidthnumber 1 可选 边框大小。
outlineboolean false 可选 是否显示边框。
-
update()
leaflet/overlay/GraphicLayer.js, line 239 -
更新图层,数据或者样式改变后调用。