Class: Theme

ol.source.Theme

Thematic map base class.

new ol.source.Theme(name, opt_options)

Theme.js, line 15
Name Type Default Description
name string

Name of the layer.

opt_options Object

parameters.

Name Type Default Description
map ol.Map

The map for OpenLayers.

id string optional

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

opacity number 1 optional

Layer opacity.

opt_option.logo string optional

Logo.

opt_options.projection ol.proj.Projection optional

Projection information.

opt_options.ratio number 1.5 optional

View ratio, 1 means that the canvas is the size of the map viewport, 2 means that the canvas is twice the width and height of the map viewport, and so on. Must be 1 or higher.

opt_options.resolutions Array optional

Resolution array.

opt_option.state ol.source.State optional

Resource status.

opt_option.attributions string | Object 'Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>' optional

Copyright information.

Extends

  • ol.source.ImageCanvas

Methods

addFeatures(features)

Theme.js, line 175

An abstract method, which can be implemented by an instantiated subclass. Add data to the thematic map layer. The thematic graph only receives SuperMap.Feature.Vector type data, Feature will be stored in the features attribute, which is stored as an array.

Name Type Description
features ol.supermap.ThemeFeature | GeoJSONObject | ol.Feature

The pending features include the ol.supermap.ThemeFeature type, the GeoJOSN specification data type, and the ol.feature type.

destroy()

Theme.js, line 120

Disposes the resource. The property that references resource is set to null.

destroyFeatures(features)

Theme.js, line 139

Destroy one features.

Name Type Description
features SuperMap.Feature.Vector

The feature to be destroy.

fire(type, event)

Theme.js, line 337

Add thematic element event listener.

Name Type Description
type string

Type of the event.

event string

Name of the event.

getFeatureBy(property, value){SuperMap.Feature.Vector}

Theme.js, line 259

Traversing each feature in the element array features of the thematic graph, When feature[property] === value, return to this feature (and return only to the first one).

Name Type Description
property string

The name of an attribute for the feature.

value string

The value corresponding to property.

Returns:
Type Description
SuperMap.Feature.Vector The first vector element that matches the attributes and values.

getFeatureById(featureId){SuperMap.Feature.Vector}

Theme.js, line 279

Return to a corresponding vector elements by a specified ID.

Name Type Description
featureId string

Property ID of the vector feature.

Returns:
Type Description
SuperMap.Feature.Vector The feature corresponding to ID, if it does not exist, return to null.

getFeatures(){SuperMap.Feature.Vector}

Theme.js, line 244

Look at the valid data in the current layer.

Returns:
Type Description
SuperMap.Feature.Vector The user joins the valid data of the layer.

getFeaturesByAttribute(attrName, attrValue){Array.<SuperMap.Feature.Vector>}

Theme.js, line 289

By giving the key and value of an attribute, return to all the matched features.

Name Type Description
attrName string

Key of the property.

attrValue string

Property ID of the vector features.

Returns:
Type Description
Array.<SuperMap.Feature.Vector> A matching feature array.

getLocalXY(coordinate)

Theme.js, line 442

Get the coordinate system.

Name Type Description
coordinate Object

Coordinate position.

on(event, callback)

Theme.js, line 319

Add thematic element event listener. The events supported include: click, mousedown, mousemove, mouseout, mouseover, mouseup.

Name Type Description
event string

Name of the event.

callback RequestCallback

event callbacks.

redrawThematicFeatures(extent)

Theme.js, line 311

An abstract method, which can be implemented by an instantiated subclass. Redraw the thematic elements.

Name Type Description
extent Array

Map range calculated at the current level

removeAllFeatures()

Theme.js, line 232

Clear all the vector elements of the current layer.

removeFeatures(features)

Theme.js, line 186

Delete feature from the thematic map. This function removes all the vector elements that are passed in. Each item in the features array in the parameter must be the feature that has been added to the current layer. If you can't determine the feature array, you can call removeAllFeatures to delete all feature. If there are more elements in the feature array to delete, it is recommended to use removeAllFeatures, delete all feature, and then add it again. This will be more efficient.

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

The array of the feature to be deleted.

rotate(pixelP, rotation, center)

Theme.js, line 470

Get the pixel coordinates after a pixel coordinate point pixelP revolves the rotation arc in the center of the center counterclockwise.

Name Type Description
pixelP number

Pixel coordinates point position.

rotation number

Angle of rotation.

center number

Center position.

scale(pixelP, center, scaleRatio){Array.<number>}

Theme.js, line 483

Get the pixel coordinates of a pixel coordinate point pixelP is scaleRatio times larger than the center.

Name Type Description
pixelP Object

Pixel point.

center Object

Center position.

scaleRatio number

Scaling multiplier.

Returns:
Type Description
Array.<number> Return array ratio.

setOpacity(opacity)

Theme.js, line 157

Set the opacity of the layer and take the value between [0-1].

Name Type Description
opacity number

opacity.

toFeature(features){SuperMap.Feature.Vector}

Theme.js, line 539

Converted to an iClient feature, this method will be deprecated and replaced by ol.source.Theme#toiClientFeature.

Name Type Description
features ol.supermap.ThemeFeature | GeoJSONObject | ol.Feature

The pending features include the ol.supermap.ThemeFeature type, the GeoJOSN specification data type, and the ol.feature type.

Deprecated
  • Yes
Returns:
Type Description
SuperMap.Feature.Vector IClient feature after conversion.

toiClientFeature(features){SuperMap.Feature.Vector}

Theme.js, line 497

Convert to the iClient features.

Name Type Description
features ol.supermap.ThemeFeature | GeoJSONObject | ol.Feature

The pending features include the ol.supermap.ThemeFeature type, the GeoJOSN specification data type, and the ol.feature type.

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

un(event, callback)

Theme.js, line 404

Removal of thematic element event listener.

Name Type Description
event string

Name of the event.

callback RequestCallback

event callbacks.