new ol.source.Graphic(options)
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Graphic parameters.
|
Extends
Methods
-
addGraphics(graphics)
Graphic.js, line 243 -
Adding a point feature does not overwrite the previous feature.
Name Type Description graphics
Array.<ol.Graphic> An array of point feature objects.
-
clear()
Graphic.js, line 341 -
Release layer resources.
-
getGraphicBy(property, value){ol.Graphic}
Graphic.js, line 255 -
Traverse each graphic in the Vector's feature array graphics, and return this graphic when graphic[property]===value (and only return the first one).
Name Type Description property
string A property name for graphic.
value
string The value corresponding to the property.
Returns:
Type Description ol.Graphic A matching graphic. -
getGraphicById(graphicId){ol.Graphic}
Graphic.js, line 273 -
Returns the corresponding vector element by giving an id.
Name Type Description graphicId
string Vector attribute id.
Returns:
Type Description ol.Graphic A matching graphic. -
getGraphicsByAttribute(attrName, attrValue){Array.<ol.Graphic>}
Graphic.js, line 283 -
Returns a matching array of features by giving the key and value of an attribute.
Name Type Description attrName
string A property name for graphic.
attrValue
string The value corresponding to the property.
Returns:
Type Description Array.<ol.Graphic> A matching graphic array. -
getGraphicsInExtent(extent)
Graphic.js, line 532 -
Get the geometric feature area in the specified range.
Name Type Description extent
Object Length range.
-
getLayerState(){Object}
Graphic.js, line 410 -
Get the current map and layer status.
Returns:
Type Description Object Map and layer status, including map status information and related status of this layer. -
removeGraphics(graphics)
Graphic.js, line 304 -
Delete feature arrays, all features will be deleted by default.
Name Type Description graphics
Array.<ol.Graphic> optional The graphics array to be deleted.
-
setGraphics(graphics)
Graphic.js, line 230 -
Set the drawn point features to overwrite all previous features.
Name Type Description graphics
Array.<ol.Graphic> An array of point feature objects.
-
setStyle(styleOptions)
Graphic.js, line 378 -
Set the overall style of the layer features (this interface is only useful when rendering webgl).
Name Type Description styleOptions
Object Style object.
Name Type Default Description color
Array.<number> [0, 0, 0, 255] optional Point color.
radius
number 10 optional Point radius.
opacity
number 0.8 optional Opacity.
highlightColor
Array optional Highlight color, currently only supports rgba arrays.
radiusScale
number 1 optional Point magnification.
radiusMinPixels
number 0 optional The minimum radius (pixels).
radiusMaxPixels
number Number.MAX_SAFE_INTEGER optional The maximum radius (pixels).
strokeWidth
number 1 optional The size of the border.
outline
boolean false optional Whether to display the border.
-
update()
Graphic.js, line 349 -
Update the layer.