new mapboxgl.supermap.LabelThemeLayer(name, opt_options)
Name | Type | Default | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name |
string |
The name of the layer |
|||||||||||||||||||||||||||||||||||||
opt_options |
Object |
The optional parameters of the layer.
|
|||||||||||||||||||||||||||||||||||||
options.isAvoid |
boolean | true |
optional
Whether to avoid the processing of the edge of the map. |
||||||||||||||||||||||||||||||||||||
options.isOverLay |
boolean | true |
optional
Whether to perform the gland processing, if set to true, the chart that produces the gland on the chart that has been drawn in the layer will be hidden during the chart drawing process. |
||||||||||||||||||||||||||||||||||||
opt_options.isHoverAble |
boolean |
optional
Whether to enable the hover event. |
Extends
Members
-
highlightStyleSuperMap.ThemeStyle
-
The highlight style of the thematic map layer.
-
idstring
-
Thematic layer ID.
-
isAllowFeatureStyleboolean
-
Whether to allow valid attributes in the feature style to be applied to the thematic layer. It is forbidden to use the style of the feature for the thematic feature. This property enforces the application of valid attributes in the style of the data feature to the thematic feature and has a higher priority than the layer style and styleGroups. Make the style of the thematic feature out of the control of the thematic layer. In this way, you can assign a unique style to the feature elements of the special data.
-
isAvoidboolean
-
Whether to avoid the processing of the edge of the map,If set to true, the label that intersects the edge of the map will be moved to the map and evasive at the edge of the map.
- Default Value: true
isClickAbleboolean
Whether the graphics can be clicked.
- Default Value: true
isHoverAbleboolean
Whether the graphics are bright in hover.
isMultiHoverboolean
Whether multiple graphics are highlighted at the same time, used to highlight all graphics corresponding to the same data (such as: multi-faceted).
isOverLayboolean
Whether to perform the gland processing, if set to true, the chart that produces the gland on the chart that has been drawn in the layer will be hidden during the chart drawing process.
- Default Value: true
loadWhileAnimatingboolean
Whether to redraw in real time.(It is recommended to draw a large amount of data elements, it is recommended to set this parameter to false).
- Default Value: true
mapmapboxgl.Map
Map object.
namestring
The name of the thematic layer.
nodesClipPixelnumber
Pixel distance of nodes vacuation.
- Default Value: 2
opacityfloat
The opacity of the layer.
- Default Value: 1
styleSuperMap.ThemeStyle
The global style of thematic map layer.
styleGroupsArray.<Object>
The style of these groups.The themeField property need to be set when using this property. 1.When the themeField and styleGroups are not set at the same time, all the thematic elements are rendered using the style of the layer. 2.When the themeField and styleGroups are set at the same time, obtain the attribute value corresponding to attributes in the user data (feature) according to the field name specified in themeField. a.If the attribute value is equal to the value of a certain feature defined in the styleGroups array, the thematic feature is rendered with the feature style defined in the styleGroups array. b.If the attribute value is not equal to the value of any feature defined in the styleGroups array, the thematic feature is rendered with the style of this layer. Each feature of this array must have two properties: Value - the attribute value corresponding to the themeField; style - the style of thematic feature.
themeFieldstring
The name of the attribute field used to specify the theme feature style. This attribute field is the field to be included in the user attributes, and the type of the value corresponding to the field must be numeric. Using the label grouping display also requires setting the styleGroups property.
visibilityboolean
Whether the layer is visible.
- Default Value: true
Events
-
inherited beforefeaturesadded
GeoFeatureThemeLayer.js, line 92 -
Triggered before the feature is added.
Properties:
Name Type Description features
mapboxgl.supermap.ThemeFeature | SuperMap.ServerFeature The added elements.
-
inherited changelayer
ThemeLayer.js, line 191 -
Fires after the layer property changes.
Properties:
Name Type Description layer
Object Layer.
property
string The changed attribute.
-
inherited featuresremoved
ThemeLayer.js, line 256 -
Triggered after the feature is deleted.
Properties:
Name Type Description features
Array.<SuperMap.Feature.Vector> Features that have not been successfully deleted.
succeed
boolean The deletion is successful or not.
Methods
-
inherited addFeatures(features)
GeoFeatureThemeLayer.js, line 86 -
Adding features.
Name Type Description features
mapboxgl.supermap.ThemeFeature | SuperMap.ServerFeature Feature object.
-
calculateLabelBounds(feature, loc){Array.<Object>}
LabelThemeLayer.js, line 492 -
Get the final range of the label features.
Name Type Description feature
SuperMap.Feature.Vector The number of label features need to calculate bounds.
loc
mapboxgl.Point Location of the label.
Returns:
Type Description Array.<Object> uadrilateral node array. For instance:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]. -
calculateLabelBounds2(feature, loc){Array.<Object>}
LabelThemeLayer.js, line 536 -
Another algorithm of getting the final range of the label features(according to the width and height of the recorded labels), improving the efficiency of computing bounds.
Name Type Description feature
SuperMap.Feature.Vector The number of label features need to calculate bounds.
loc
mapboxgl.Point Location of the label.
Returns:
Type Description Array.<Object> uadrilateral node array. For instance: [{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]. -
inherited clear()
GeoFeatureThemeLayer.js, line 236 -
Clear all the content including data(features), the thematic elements, the cache.
-
inherited clearCache()
GeoFeatureThemeLayer.js, line 227 -
Clear cache.
-
createThematicFeature(feature)
LabelThemeLayer.js, line 146 -
Create the thematic feature.
Name Type Description feature
Object The thematic feature to be created.
-
inherited destroyFeatures(features)
ThemeLayer.js, line 138 -
Destroy an element.
Name Type Description features
SuperMap.Feature.Vector The elements that will be destroyed.
-
inherited display(display)
ThemeLayer.js, line 169 -
Temporarily hide or show layers. Re-rendering fails by producing immediate effects on CSS controls. The setVisibility method is generally used to dynamically control the display and hiding of layers.
Name Type Description display
boolean optional Whether to display the layer.
-
getAvoidInfo(bounds, quadrilateral){Object}
LabelThemeLayer.js, line 775 -
Get avoided information.
Name Type Description bounds
SuperMap.Bounds The range of map pixel.
quadrilateral
Array.<Object> Quadrilateral node array. For instance: [{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}].
Returns:
Type Description Object The avoided information. -
inherited getCacheCount(){number}
GeoFeatureThemeLayer.js, line 247 -
Get counts of current cache.
Returns:
Type Description number Return the counts of current cache. -
getDrawnLabels(labelFeatures){Array.<SuperMap.Feature.Vector>}
LabelThemeLayer.js, line 174 -
Get the label features to be drawn on the layer after (cover) processing.
Name Type Description labelFeatures
Array.<SuperMap.Feature.Vector> An array of all the label features
Returns:
Type Description Array.<SuperMap.Feature.Vector> The final array of label feature to be drawn. -
inherited getFeatureBy(property, value){SuperMap.Feature.Vector}
ThemeLayer.js, line 291 -
Traverses each feature in the feature array features of the thematic map, and returns this feature when feature[property] === value (and returns only the first one).
Name Type Description property
string The property name of the feature
value
string The value corresponding to property.
Returns:
Type Description SuperMap.Feature.Vector The first vector feature that matches the attribute and the value. -
inherited getFeatureById(featureId){SuperMap.Feature.Vector}
ThemeLayer.js, line 310 -
Returns the corresponding vector element by giving an id.
Name Type Description featureId
string The id property of the vector feature
Returns:
Type Description SuperMap.Feature.Vector The feature corresponding to the id. If it does not exist, return to null. -
inherited getFeatures(){SuperMap.Feature.Vector}
ThemeLayer.js, line 277 -
Get the valid features in the current layer.
Returns:
Type Description SuperMap.Feature.Vector Return the valid features in the layer. -
inherited getFeaturesByAttribute(attrName, attrValue){Array.<SuperMap.Feature.Vector>}
ThemeLayer.js, line 320 -
Return an array contains all the matched features by giving a key and a value of a an attribute.
Name Type Description attrName
string The key of the attribute.
attrValue
string The value of the attribute.
Returns:
Type Description Array.<SuperMap.Feature.Vector> An array contains all the matched features. -
getLabelInfo(){Object}
LabelThemeLayer.js, line 618 -
Get the drawn label information according to the current location, including the width, height and the line number of the label.
Returns:
Type Description Object The drawn label information. -
getLabelPxLocation(feature){mapboxgl.Point}
LabelThemeLayer.js, line 465 -
Get the pixel coordinates of label features.
Name Type Description feature
SuperMap.Feature.Vector Feature of the label.
Returns:
Type Description mapboxgl.Point Location of the label. -
inherited getLocalXY(coordinate)
ThemeLayer.js, line 396 -
Convert the Geographic coordinates to Pixel coordinates.
Name Type Description coordinate
Object optional The coordinate position.
-
getRotatedLocation(x, y, rx, ry, angle){Object}
LabelThemeLayer.js, line 748 -
Get the position of a point after rotating clockwise around the center point of rotation.(This method is used for screen coordinates).
Name Type Description x
number The abscissa of the rotation point.
y
number The ordinate of the rotation point.
rx
number The abscissa of a rotating center point.
ry
number The ordinate of a rotating center point
angle
number The angle of rotation.
Returns:
Type Description Object Coordinate position object after rotation, which contains the attribute x (abscissa), and the attribute y (ordinate). -
getStyleByData(feat){Array.<SuperMap.ThemeStyle>}
LabelThemeLayer.js, line 338 -
Get style according to user data (feature).
Name Type Description feat
SuperMap.Feature.Vector The vector feature object.
Returns:
Type Description Array.<SuperMap.ThemeStyle> An style array of thematic features. -
isPointInPoly(poly){boolean}
LabelThemeLayer.js, line 919 -
whether a point is in a polygon. (Ray method). A point object that needs to be determined, which contains the attribute x (abscissa), and the attribute y (ordinate).
Name Type Description poly
Array.<Object> Polygon node array. For example, a quadrilateral:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}].
Returns:
Type Description boolean Whether the point is in a polygon. -
isQuadrilateralOverLap(quadrilateral, quadrilateral2){boolean}
LabelThemeLayer.js, line 872 -
Judge whether two quadrangles is overlapped
Name Type Description quadrilateral
Array.<Object> Quadrilateral node array. For example: [{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}].
quadrilateral2
Array.<Object> Node array of the second quadrilateral.
Returns:
Type Description boolean Whether two quadrangles is overlapped. true means overlapping. -
inherited moveTo(layerID, before)
ThemeLayer.js, line 569 -
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).
-
inherited off(event, callback, context)
ThemeLayer.js, line 365 -
Remove event listeners of the thematic elements.
Name Type Description event
Event The event listener.
callback
function The callback.
context
string The context.
-
inherited on(event, callback, context)
ThemeLayer.js, line 349 -
Add event listeners of the thematic features.
Name Type Description event
Event The event listener.
callback
function The callback.
context
string The context.
-
inherited onAdd()
ThemeLayer.js, line 79 -
Add the layer to the basemap.
-
redrawThematicFeatures(bounds)
LabelThemeLayer.js, line 109 -
Redraw all the thematic elements. This function contains all the steps to draw a thematic element,including the conversion of user data to thematic elements, thinning, caching and other steps. This function is called for layer refresh when map roaming.
Name Type Description bounds
mapboxgl.LngLatBounds Redraw bounds.
-
removeAllFeatures()
LabelThemeLayer.js, line 136 -
Clear all vector features of the current layer.
-
removeFeatures(features)
LabelThemeLayer.js, line 126 -
Remove feature from the thematic map. This function removes all vector features passed in.
Name Type Description features
SuperMap.Feature.Vector The feature object to delete.
-
inherited removeFromMap()
ThemeLayer.js, line 560 -
Remove the layer.
-
rotationBounds(bounds, rotationCenterPoi, angle){Array.<Object>}
LabelThemeLayer.js, line 716 -
rotate the bounds.
Name Type Description bounds
SuperMap.Bounds The bounds to be rotated.
rotationCenterPoi
Object A point object of rotated center , which contains the attribute x (abscissa), and the attribute y (ordinate).
angle
number The angle of rotation (clockwise).
Returns:
Type Description Array.<Object> bounds An polygonal nodes array formed after bounds rotation. It's a quadrilateral. For example: [{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]. -
setLabelsStyle(labelFeatures){Array.<SuperMap.Feature.Vector>}
LabelThemeLayer.js, line 387 -
Set style of label features.
Name Type Description labelFeatures
Array.<SuperMap.Feature.Vector> Array of label features need to be set up style.
Returns:
Type Description Array.<SuperMap.Feature.Vector> Array of label features which are set up with style. -
inherited setMaxCacheCount(cacheCount)
GeoFeatureThemeLayer.js, line 256 -
The maximum count of caches.
Name Type Description cacheCount
number optional count of caches.
-
inherited setOpacity(opacity)
ThemeLayer.js, line 178 -
Set the opacity of the layer, between values [0-1].
Name Type Description opacity
number optional Opacity.
-
setStyle(feat)
LabelThemeLayer.js, line 415 -
Set style of the label feature.
Name Type Description feat
SuperMap.Feature.Vector The label feature need to be set in style.
-
inherited setVisibility(visibility)
ThemeLayer.js, line 156 -
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 current map's resolution is between the maximum and minimum resolutions).
-
inherited toFeature(features){SuperMap.Feature.Vector}
ThemeLayer.js, line 414 -
Convert to the feature in iClient.
Name Type Description features
mapboxgl.supermap.ThemeFeature | GeoJSONObject The elements to be converted include the mapboxgl.supermap.ThemeFeature type and the GeoJOSN specification data type.
Returns:
Type Description SuperMap.Feature.Vector The converted iClient element.