Class: rangeThemeLayer

rangeThemeLayer

new zondy.themelayer.rangeThemeLayer(name, options)

document/theme/RangeThemeLayer.js, line 3

范围分段专题图对数据(<zondy.Feature.Vector>)属性字段(attributes)的属性值进行分段,使用不同的颜色或符号(线型、填充)渲染不同范围段的属性值。 分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。

Name Type Description
name string

图层名

options Object

图层参数。

Name Type Default Description
id string 可选

专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。

opacity number 1 可选

图层透明度。

nodesClipPixel number 2 可选

节点抽稀像素距离。

isHoverAble boolean false 可选

图形是否在 hover 时高亮。

isMultiHover boolean false 可选

是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。

isClickAble boolean true 可选

图形是否可点击。

isAllowFeatureStyle boolean false 可选

是否允许 feature 样式(style) 中的有效属性应用到专题图层。禁止对专题要素使用数据(feature)的 style。此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。

Extends

Members

styleObject

专题图样式。

styleGroupsArray

使用此属性需要设置 themeField 属性。 1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染; 2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值; a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。 b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。 此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。

themeFieldString

用于指定专题要素样式的属性字段名称。此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。使用标签分组显示还需要设置 styleGroups 属性。

Events

inherited beforefeaturesadded

document/theme/GeoFeatureThemeLayer.js, line 65

向专题图图层中添加数据之前触发。

Properties:
Name Type Description
features Object

事件对象。

inherited changelayer

document/theme/ThemeLayer.js, line 485

图层属性改变之后触发。

Properties:
Name Type Description
layer Object

图层。

property string

图层属性。

inherited featuresremoved

document/theme/ThemeLayer.js, line 193

删除的要素成功之后触发。

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

事件对象。

succeed boolean

要输是否删除成功,true 为删除成功,false 为删除失败。

Methods

inherited addFeatures(features)

document/theme/GeoFeatureThemeLayer.js, line 57

向专题图图层中添加数据。

Name Type Description
features Object

待填加的要素。

inherited clear()

document/theme/GeoFeatureThemeLayer.js, line 256

清除的内容包括数据(features) 、专题要素、缓存。

inherited clearCache()

document/theme/GeoFeatureThemeLayer.js, line 247

清除缓存数据。

inherited createThematicFeature(feature)

document/theme/GeoFeatureThemeLayer.js, line 204

创建专题要素。

Name Type Description
feature Object

要创建的要素。

inherited destroyFeatures(features)

document/theme/ThemeLayer.js, line 125

销毁要素。

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

将被销毁的要素。

inherited getCacheCount(){number}

document/theme/GeoFeatureThemeLayer.js, line 268

获取当前缓存数量。

Returns:
Type Description
number 返回当前缓存数量。

inherited getEvents(){Object}

document/theme/ThemeLayer.js, line 36

获取图层事件。

Returns:
Type Description
Object 返回图层支持的事件。

inherited getFeatureBy(property, value)

document/theme/ThemeLayer.js, line 236

在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,返回此 feature(并且只返回第一个)。

Name Type Description
property string

要的某个属性名。

value string

对应属性名得值。

inherited getFeatureById(featureId)

document/theme/ThemeLayer.js, line 252

通过给定一个 ID,返回对应的矢量要素,如果不存在则返回 null。

Name Type Description
featureId number

要素 ID。

inherited getFeatures(){Array}

document/theme/ThemeLayer.js, line 221

查看当前图层中的有效数据。

Returns:
Type Description
Array 返回图层中的有效数据。

inherited getFeaturesByAttribute(attrName, attrValue){Array}

document/theme/ThemeLayer.js, line 261

通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。

Name Type Description
attrName string

key 值。

attrValue string

value 值。

Returns:
Type Description
Array 返回所有匹配的要素数组。

inherited getLocalXY(coordinate)

document/theme/ThemeLayer.js, line 413

地理坐标转为像素坐标。

Name Type Description
coordinate Array

inherited getShapesByFeatureID(featureID)

document/theme/GeoFeatureThemeLayer.js, line 290

通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。

Name Type Description
featureID number

要素 ID。

getStyleByData(feat){Array.<zondy.themelayer.ThemeStyle>}

document/theme/RangeThemeLayer.js, line 47

根据用户数据(feature)设置专题要素的 Style

Name Type Description
feat zondy.Feature.Vector

矢量要素对象

Returns:
Type Description
Array.<zondy.themelayer.ThemeStyle> 专题要素的 Style

inherited initialize(name, options)

document/theme/GeoFeatureThemeLayer.js, line 41

初始化。

Name Type Description
name string

专题图名。

options Object

需要设置的参数对象。

inherited off(event, callback, context)

document/theme/ThemeLayer.js, line 372

移除专题要素事件监听。

Name Type Description
event Event

监听事件。

callback function

回调函数。

context string

信息。

inherited on(event, callback, context)

document/theme/ThemeLayer.js, line 355

添加专题要素事件监听。添加专题要素事件监听。

Name Type Description
event Event

监听事件。

callback function

回调函数。

context string

信息。

inherited onRemove(map)

document/theme/ThemeLayer.js, line 54

删除某个地图。

Name Type Description
map L.Map

要删除的地图。

inherited redraw()

document/theme/GeoFeatureThemeLayer.js, line 238

重绘该图层。

inherited redrawThematicFeatures(bounds)

document/theme/GeoFeatureThemeLayer.js, line 125

重绘所有专题要素。 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。 地图漫游时调用此方法进行图层刷新。

Name Type Description
bounds L.bounds

重绘的范围。

inherited removeAllFeatures()

document/theme/GeoFeatureThemeLayer.js, line 116

清除当前图层所有的矢量要素。

inherited removeFeatures(features)

document/theme/GeoFeatureThemeLayer.js, line 105

从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。

Name Type Description
features Object

要删除的要素。

inherited setMaxCacheCount(cacheCount)

document/theme/GeoFeatureThemeLayer.js, line 277

设置最大缓存数量。

Name Type Description
cacheCount number

最大缓存量。

inherited setOpacity(opacity)

document/theme/ThemeLayer.js, line 321

设置图层的不透明度,取值 [0-1] 之间。

Name Type Description
opacity number

不透明度。

inherited update(bounds)

document/theme/ThemeLayer.js, line 285

更新图层。

Name Type Description
bounds L.bounds

图层范围。