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 graphics
Array.<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 map
mapboxgl.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 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 239 -
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 249 -
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. -
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 layerID
string The layer ID to be inserted.
before
boolean 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 map
mapboxgl.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 graphics
Array.<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 graphics
Array.<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 styleOptions
Object The style of the object.
Name Type Default Description color
Array.<number> [0, 0, 0, 255] optional The color of the point.
radius
number 10 optional The radius of the point.
opacity
number 0.8 optional Opacity.
highlightColor
Array [0, 0, 128, 128] optional Highlight color, currently only supports rgba arrays.
radiusScale
number 1 optional The magnification of the point.
radiusMinPixels
number 0 optional The minimum radius (pixels).
radiusMaxPixels
number Number.MAX_SAFE_INTEGER optional The maximum value of the radius (pixels).
strokeWidth
number 1 optional The size of the border.
outline
boolean 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 visibility
boolean 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.