# new RandomThemeLayer(name, options)
随机专题图对数据(<zondy.Feature.Vector
>)属性字段(attributes)的属性值进行分段,使用不同的颜色或符号(线型、填充)渲染不同范围段的属性值。
随机专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
参数
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
name |
string | 图层名 |
|
options |
Object | 图层参数。 |
|
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。 |
继承关系
方法
方法概述
名称 | 返回值类型 | 描述 |
---|---|---|
addFeatures |
|
|
clear |
|
|
clearCache |
|
|
createThematicFeature |
|
|
destroyFeatures |
|
|
getCacheCount |
number
|
|
getColor |
Array
|
|
getEvents |
Object
|
|
getFeatureBy |
|
|
getFeatureById |
|
|
getFeatures |
Array
|
|
getFeaturesByAttribute |
Array
|
|
getLocalXY |
|
|
getShapesByFeatureID |
|
|
getStyleByData |
Array.<zondy.themelayer.ThemeStyle>
|
|
initialize |
|
|
off |
|
|
on |
|
|
onAdd |
|
|
onRemove |
|
|
redraw |
|
|
redrawThematicFeatures |
|
|
removeAllFeatures |
|
|
removeFeatures |
|
|
setMaxCacheCount |
|
|
setOpacity |
|
|
update |
|
|
方法详情
# destroyFeatures(features)
销毁要素。
参数
名称 | 类型 | 描述 |
---|---|---|
features |
Array.<zondy.Feature.Vector> | 将被销毁的要素。 |
- Inherited From:
# getFeatureBy(property, value)
在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,返回此 feature(并且只返回第一个)。
参数
名称 | 类型 | 描述 |
---|---|---|
property |
string | 要的某个属性名。 |
value |
string | 对应属性名得值。 |
- Inherited From:
# getFeatureById(featureId)
通过给定一个 ID,返回对应的矢量要素,如果不存在则返回 null。
参数
名称 | 类型 | 描述 |
---|---|---|
featureId |
number | 要素 ID。 |
- Inherited From:
# getFeaturesByAttribute(attrName, attrValue)
通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
参数
名称 | 类型 | 描述 |
---|---|---|
attrName |
string | key 值。 |
attrValue |
string | value 值。 |
- Inherited From:
返回所有匹配的要素数组。
# getShapesByFeatureID(featureID)
通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
参数
名称 | 类型 | 描述 |
---|---|---|
featureID |
number | 要素 ID。 |
- Inherited From:
# off(event, callback, context)
移除专题要素事件监听。
参数
名称 | 类型 | 描述 |
---|---|---|
event |
Event | 监听事件。 |
callback |
function | 回调函数。 |
context |
string | 信息。 |
- Inherited From:
# on(event, callback, context)
添加专题要素事件监听。添加专题要素事件监听。
参数
名称 | 类型 | 描述 |
---|---|---|
event |
Event | 监听事件。 |
callback |
function | 回调函数。 |
context |
string | 信息。 |
- Inherited From:
# onAdd(map)
添加专题图
参数
名称 | 类型 | 描述 |
---|---|---|
map |
L.map | 要添加的地图 |
- Overrides:
- zondy.themelayer.GeoFeatureThemeLayer#onAdd
# removeFeatures(features)
从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
参数
名称 | 类型 | 描述 |
---|---|---|
features |
Object | 要删除的要素。 |
- Inherited From:
事件
事件概述
名称 | 描述 |
---|---|
beforefeaturesadded |
beforefeaturesadded |
changelayer |
changelayer |
featuresremoved |
featuresremoved |
事件详情
# beforefeaturesadded
向专题图图层中添加数据之前触发。
属性:
Name | Type | Description |
---|---|---|
features |
Object | 事件对象。 |
- Inherited From:
# changelayer
图层属性改变之后触发。
属性:
Name | Type | Description |
---|---|---|
layer |
Object | 图层。 |
property |
string | 图层属性。 |
- Inherited From:
# featuresremoved
删除的要素成功之后触发。
属性:
Name | Type | Description |
---|---|---|
features |
Array.<zondy.Feature.Vector> | 事件对象。 |
succeed |
boolean | 要输是否删除成功,true 为删除成功,false 为删除失败。 |
- Inherited From: