new mapboxgl.supermap.GraphicLayer(id, options)
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
string |
optional
Layer id. The theme layer ID is created by default using CommonUtil.createUniqueID("graphicLayer_"). |
||||||||||||||||||||||||||||||||||||||||||||
options |
Object |
The configuration item of the layer.
|
Members
-
graphicsArray.<mapboxgl.supermap.Graphic>
-
An array of point feature objects.
-
idstring
-
The id of the high efficiency point layer.
-
visibilityboolean
-
The layer displays the status attribute.
- Default Value: true
Methods
-
addGraphics(graphics)
GraphicLayer.js, line 204 -
Add a point feature that will not overwrite the previous feature.
Name Type Description graphicsArray.<mapboxgl.supermap.Graphic> An array of point feature objects.
-
addTo(map)
GraphicLayer.js, line 60 -
The layer is added to the map and will be discarded in the next version, please use onAdd() instead.
Name Type Description mapmapboxgl.Map The object of the Mapbox GL map.
Returns:
this -
clear()
GraphicLayer.js, line 326 -
Release layer resources.
-
draw()
GraphicLayer.js, line 438 -
Draw a layer.
-
getGraphicBy(property, value){ol.Graphic}
GraphicLayer.js, line 221 -
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 propertystring A property name for graphic.
valuestring The value corresponding to the property.
Returns:
Type Description ol.Graphic A matching graphic. -
getGraphicById(graphicId){ol.Graphic}
GraphicLayer.js, line 239 -
Returns the corresponding vector element by giving an id.
Name Type Description graphicIdstring Vector attribute id
Returns:
Type Description ol.Graphic A matching graphic. -
getGraphicsByAttribute(attrName, attrValue){Array.<ol.Graphic>}
GraphicLayer.js, line 249 -
Returns a list of all matching features by giving the key and value values of an attribute.
Name Type Description attrNamestring A property name for graphic.
attrValuestring The value corresponding to the property.
Returns:
Type Description Array.<ol.Graphic> A matching graphic array. -
getState(){Object}
GraphicLayer.js, line 394 -
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. -
moveTo(layerID, before)
GraphicLayer.js, line 355 -
Move the layer before a layer.
Name Type Default Description layerIDstring The layer ID to be inserted.
beforeboolean true optional Whether to insert this layer before the layer whose layer id is layerID (if it is false, insert this layer after the layer whose layer id is layerID).
-
onAdd(map){mapboxgl.supermap.GraphicLayer}
GraphicLayer.js, line 70 -
The layer is added to the map.
Name Type Description mapmapboxgl.Map The object of the Mapbox GL map.
Returns:
Type Description mapboxgl.supermap.GraphicLayer -
remove()
GraphicLayer.js, line 335 -
Delete the layer.
-
removeFromMap()
GraphicLayer.js, line 345 -
Delete the layer.
- Deprecated
- Yes
-
removeGraphics(graphics)
GraphicLayer.js, line 270 -
Delete feature arrays, all features will be deleted by default
Name Type Default Description graphicsArray.<ol.Graphic> null optional The graphics array to delete
-
setGraphics(graphics)
GraphicLayer.js, line 184 -
Setting the plotted point feature data will overwrite all previous features.
Name Type Description graphicsArray.<mapboxgl.supermap.Graphic> An array of point feature objects.
-
setStyle(styleOptions)
GraphicLayer.js, line 153 -
Set the overall style of the layer.
Name Type Description styleOptionsObject The style of the object.
Name Type Default Description colorArray.<number> [0, 0, 0, 255] optional The color of the point.
radiusnumber 10 optional The radius of the point.
opacitynumber 0.8 optional Opacity.
highlightColorArray [0, 0, 128, 128] optional Highlight color, currently only supports rgba arrays.
radiusScalenumber 1 optional The magnification of the point.
radiusMinPixelsnumber 0 optional The minimum radius (pixels).
radiusMaxPixelsnumber Number.MAX_SAFE_INTEGER optional The maximum value of the radius (pixels).
strokeWidthnumber 1 optional The size of the border.
outlineboolean false optional Whether to display the border.
-
setVisibility(visibility)
GraphicLayer.js, line 381 -
Set layer visibility, set the layer's hidden, display, and redraw corresponding visible markers.
Name Type Description visibilityboolean optional Whether to display the layer (the resolution of the current map is between the maximum and minimum resolution).
-
update()
GraphicLayer.js, line 311 -
Update the layer.