new Graphic(options)
Usage
// 浏览器
<script type="text/javascript" src="https://iclient.supermap.io/dist/openlayers/iclient-ol.js"></script>
<script>
new ol.source.Graphic(options);
</script>
// ES6 Import
import { Graphic } from '@supermapgis/iclient-ol';
new Graphic(options);
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
参数。
|
Extends
Methods
-
addGraphics(graphics)
openlayers/overlay/Graphic.js, line 280 -
追加点要素,不会覆盖之前的要素。
Name Type Description graphicsArray.<OverlayGraphic> 点要素对象数组。
-
clear()
openlayers/overlay/Graphic.js, line 375 -
释放图层资源。
-
getGraphicBy(property, value){OverlayGraphic}
openlayers/overlay/Graphic.js, line 292 -
在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
Name Type Description propertystring graphic 的属性名称。
valuestring property 所对应的值。
Returns:
Type Description OverlayGraphic 一个匹配的 graphic。 -
getGraphicById(graphicId){OverlayGraphic}
openlayers/overlay/Graphic.js, line 310 -
通过给定一个 ID,返回对应的矢量要素。
Name Type Description graphicIdstring 矢量要素的属性 ID。
Returns:
Type Description OverlayGraphic 一个匹配的 graphic。 -
getGraphicsByAttribute(attrName, attrValue){Array.<OverlayGraphic>}
openlayers/overlay/Graphic.js, line 320 -
通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
Name Type Description attrNamestring 属性的 key 值。
attrValuestring 属性的 value 值。
Returns:
Type Description Array.<OverlayGraphic> 一个匹配的 graphic 数组。 -
getGraphicsInExtent(extent)
openlayers/overlay/Graphic.js, line 568 -
在指定范围中获取几何要素面积。
Name Type Description extentObject 长度范围。
-
getLayerState(){Object}
openlayers/overlay/Graphic.js, line 446 -
获取当前地图及图层状态。
Returns:
Type Description Object 地图及图层状态,包含地图状态信息和本图层相关状态信息。 -
removeGraphics(graphics)
openlayers/overlay/Graphic.js, line 341 -
删除要素数组,默认将删除所有要素。
Name Type Description graphicsArray.<OverlayGraphic> 可选 删除的 graphics 数组。
-
setGraphics(graphics)
openlayers/overlay/Graphic.js, line 267 -
设置绘制的点要素,会覆盖之前的所有要素。
Name Type Description graphicsArray.<OverlayGraphic> 点要素对象数组。
-
setStyle(styleOptions)
openlayers/overlay/Graphic.js, line 414 -
设置图层要素整体样式(接口仅在 webgl 渲染时有用)。
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()
openlayers/overlay/Graphic.js, line 383 -
更新图层。