Class: graphicLayer

L.supermap.graphicLayer

The GraphicLayer class.

L.supermap.graphicLayer(graphics, options)

GraphicLayer.js, line 31
Name Type Description
graphics Array.<L.supermap.graphic>

The graphic object.

options Object

he optinal parameters.

Name Type Default Description
render string 'canvas' optional

Specifies the renderer to use. Optional values: "webgl", "canvas" (webgl rendering currently only supports scatter).

color Array.<number> [0, 0, 0, 255] optional

The color.

highlightColor Array.<number> optional

The feature highlight color when webgl is rendered.

opacity number 0.8 optional

The opacity.

radius number 10 optional

Feature radius, in pixels.

radiusScale number 1 optional

The magnification of the feature when webgl is rendered.

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.

onClick function optional

Layer mouse click response events (valid for webgl and canvas rendering).

onHover function optional

Layer mouse hover response event (valid only when webgl renders).

Extends

Methods

addGraphics(graphics)

GraphicLayer.js, line 116

Adding a point feature does not overwrite the previous feature.

Name Type Description
graphics Array.<L.supermap.graphic>

An array of point feature objects.

clear()

GraphicLayer.js, line 250

Release layer resources.

getGraphicBy(property, value){ol.Graphic}

GraphicLayer.js, line 127

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}

GraphicLayer.js, line 145

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>}

GraphicLayer.js, line 155

Returns a list of all matching features by giving the key and value values 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.

getRenderer(){Object}

GraphicLayer.js, line 259

Get the renderer.

Returns:
Type Description
Object Internal renderer.

getState(){Object}

GraphicLayer.js, line 268

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)

GraphicLayer.js, line 176

Delete feature arrays, all features will be deleted by default.

Name Type Default Description
graphics Array.<ol.Graphic> null optional

The graphics array to be deleted.

setGraphics(graphics)

GraphicLayer.js, line 103

Setting the plotted point feature data will overwrite all previous features.

Name Type Description
graphics Array.<L.supermap.graphic>

An array of point feature objects.

setStyle(styleOptions)

GraphicLayer.js, line 210

Set the overall style of the layer features.

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()

GraphicLayer.js, line 242

Update the layer, call it after the data or style changes.