Class: ThemeLayer

L.supermap.ThemeLayer

The base theme layer class. It is recommended to use subclasses to implement this class.

L.supermap.ThemeLayer(name, options)

ThemeLayer.js, line 14
Name Type Description
name string

The name of the theme layer.

options Object

The optional parameters.

Name Type Default Description
id string optional

Theme layer ID。The theme layer ID is created by default using CommonUtil.createUniqueID("themeLayer_").

opacity number 1 optional

Layer transparency.

alwaysMapCRS boolean false optional

Whether the feature coordinates are consistent with the map coordinate system, and the feature defaults to the latitude and longitude coordinates.

TFEvents Array optional

Thematic feature events are temporarily stored.

attribution string 'Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>' optional

Copyright description information.

Fires

Extends

Events

changelayer

ThemeLayer.js, line 509

Fires after the layer property changes.

Properties:
Name Type Description
layer Object

Layer.

property string

Layer properties.

featuresremoved

ThemeLayer.js, line 204

Triggered after the deleted feature succeeds.

Properties:
Name Type Description
features Array.<SuperMap.Feature.Vector>

Event object.

succeed boolean

To delete whether the deletion is successful, true is the deletion succeeds, false is the deletion failure.

Methods

addFeatures(features)

ThemeLayer.js, line 118

Add data to the thematic map. It supports the following type of the feature: the feature object in json format returned from iServer or the L.supermap.themeFeature

Name Type Description
features SuperMap.ServerFeature | L.supermap.themeFeature | GeoJSONObject

The feature to be added.

destroyFeatures(features)

ThemeLayer.js, line 136

Destroy features.

Name Type Description
features Array.<SuperMap.Feature.Vector>

Features to be destroy.

getEvents(){Object}

ThemeLayer.js, line 50

Get the event of the layer.

Returns:
Type Description
Object Return the event supported by the layer.

getFeatureBy(property, value)

ThemeLayer.js, line 241

Ergodic every feature of the features array in the thematic map. If feature[property] === value, return this feature (and only return the first one).

Name Type Description
property string

The property name of the feature.

value string

The value corresponding to property.

getFeatureById(featureId)

ThemeLayer.js, line 261

Return the corresponding vector features by the specified id. If it does not exist, return to null.

Name Type Description
featureId number

The id property of the vector feature.

getFeatures(){Array}

ThemeLayer.js, line 226

Get valid features in the current layer.

Returns:
Type Description
Array Return valid features in the layer.

getFeaturesByAttribute(attrName, attrValue){Array}

ThemeLayer.js, line 270

Retucrn 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 name of the attribute.

attrValue string

The value of the attribute.

Returns:
Type Description
Array Return all the matched feature arrays.

getLocalXY(coordinate)

ThemeLayer.js, line 407

Convert the Geographic coordinates to Pixel coordinates.

Name Type Description
coordinate Array

The coordinate object.

off(event, callback, context)

ThemeLayer.js, line 375

Remove event listeners from the thematic features

Name Type Description
event Event

The event listener.

callback function

The callback.

context string

The context,

on(event, callback, context)

ThemeLayer.js, line 359

Add event listeners on the thematic features.

Name Type Description
event Event

The event listener.

callback function

The callback.

context string

The context.

onRemove(map)

ThemeLayer.js, line 68

Remove the map.

Name Type Description
map L.Map

The map to be removed.

redraw(){boolean}

ThemeLayer.js, line 341

Redraw this layer

Returns:
Type Description
boolean Whether redraw success or not.

redrawThematicFeatures(bounds)

ThemeLayer.js, line 127

Redraw thematic features. It is an abstract function. This method should be implemented by instantiable subclasses

Name Type Description
bounds L.bounds

The bounds of redrawing the thematic feature.

removeAllFeatures()

ThemeLayer.js, line 213

Remove all vector features on the current layer.

removeFeatures(features)

ThemeLayer.js, line 154

Remove features from the thematic layer. This function removes all vector features (data) passed in.

Name Type Description
features Array.<SuperMap.Feature.Vector>

The features array to be removed.

setOpacity(opacity)

ThemeLayer.js, line 325

Set opacity of the layer. The value is between 0 and 1.

Name Type Description
opacity number

The opacity.

toFeature(features){SuperMap.Feature.Vector}

ThemeLayer.js, line 467

Convert to the iClient features, this method will be deprecated and replaced by L.supermap.ThemeLayer#toiClientFeature.

Name Type Description
features SuperMap.ServerFeature | L.supermap.themeFeature | GeoJSONObject

The pending features include the L.supermap.ThemeFeature type and the GeoJOSN specification data type.

Deprecated
  • Yes
Returns:
Type Description
SuperMap.Feature.Vector The converted iClient features.

toiClientFeature(features){Array.<SuperMap.Feature.Vector>}

ThemeLayer.js, line 432

Convert to the iClient features.

Name Type Description
features SuperMap.ServerFeature | L.supermap.themeFeature | GeoJSONObject

The pending features include the L.supermap.ThemeFeature type and the GeoJOSN specification data type.

Returns:
Type Description
Array.<SuperMap.Feature.Vector> The converted iClient features.

update(bounds)

ThemeLayer.js, line 290

Update the layer.

Name Type Description
bounds L.bounds

Bounds of the layer.