类名 rankSymbolThemeLayer

# new rankSymbolThemeLayer(name, symbolType, options)

符号专题图通过为每个要素绘制符号大小来反映其对应的专题值的大小;它只能表示单个个字段属性信息。 符号专题图多用于具有相关数量特征的地图上,比如表示不同地区粮食产量、GDP、人口等。 即通过制作一个符号专题图,就可以清晰展示各个区域相关Value的分布差异等。 目前提供的符号图形有:圆形(后续进行扩展 心形 五角星 多角心 图片等)

参数:

名称 类型 默认值 描述
name string

专题图层名。

symbolType Zondy.ChartType

符号类型。目前支持:"Circle"。

options Object

参数。

isOverLay boolean true

是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。

themeFields string

指定创建专题图字段。

id string

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

opacity number 1

图层透明度。

查看源代码 document/theme/RankSymbolThemeLayer.js, line 7

继承关系

成员变量

Object

# symbolSetting

符号 Circle 配置对象。

属性:
Name Type Attributes Default Description
codomain Array

值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。

maxR number <optional>

圆形的最大半径。

minR number <optional>

圆形的最小半径。

fillColor string <optional>

圆形的填充色,如:fillColor: "#FFB980"。

circleStyle Object <optional>

圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。

decimalNumber number <optional>

数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。

circleHoverStyle Object <optional>

圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。

circleHoverAble boolean <optional>
true

是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。

circleClickAble boolean <optional>
true

是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。

查看源代码 document/theme/RankSymbolThemeLayer.js, line 24

方法

# addFeatures(features)

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

参数:

名称 类型 描述
features L.features

待添加的要素。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 74

# clear()

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

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 504

# clearCache(mapPxBounds, chartPxBounds)

判断图表是否大小合适,超过地图范围的1/4的不绘制。

参数:

名称 类型 描述
mapPxBounds Zondy.Bounds

地图像素范围。

chartPxBounds Array.<Object>

图表范围的四边形节点数组。
例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。

Overrides:

查看源代码 document/theme/GraphThemeLayer.js, line 448

# createThematicFeature(feature)

创建专题要素(图形)

参数:

名称 类型 描述
feature Zondy.Feature.Vector

要创建的专题图形要素

Overrides:

查看源代码 document/theme/RankSymbolThemeLayer.js, line 55

专题图形

Zondy.Theme

# destroyFeatures(features)

销毁要素。

参数:

名称 类型 描述
features Array.<Zondy.Feature.Vector>

将被销毁的要素。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 123

# drawCharts()

绘制图表。包含压盖处理。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 196

# getEvents()

获取图层事件。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 34

返回图层支持的事件。

Object

# getFeatureBy(property, value)

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

参数:

名称 类型 描述
property string

要的某个属性名。

value string

对应属性名得值。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 234

# getFeatureById(featureId)

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

参数:

名称 类型 描述
featureId number

要素 ID。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 250

# getFeatures()

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

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 219

返回图层中的有效数据。

Array

# getFeaturesByAttribute(attrName, attrValue)

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

参数:

名称 类型 描述
attrName string

key 值。

attrValue string

value 值。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 259

返回所有匹配的要素数组。

Array

# getLocalXY(coordinate)

地理坐标转为像素坐标。

参数:

名称 类型 描述
coordinate Array
Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 411

# getShapesByFeatureID(featureID)

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

参数:

名称 类型 描述
featureID number

要素 ID。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 222

# getWeightFieldValue(feature, weightField, defaultValue)

获取权重字段的值。

参数:

名称 类型 描述
feature Zondy.Feature.Vector

矢量要素。

weightField Array.<string>

字段名数组。

defaultValue number

当通过 weightField 获取不到权重值时,使用 defaultValue 作为权重值。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 518

# initialize(name, chartsType, options)

初始化。

参数:

名称 类型 描述
name string

专题图名。

chartsType string

图表类型。目前可用:"Bar","Bar3D","Line","Point","Pie","Ring"。

options Object

需要设置的参数对象。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 43

# isChartInMap(mapPxBounds, chartPxBounds)

判断图表是否在地图里。

参数:

名称 类型 描述
mapPxBounds Zondy.Bounds

地图像素范围。

chartPxBounds Array.<Object>

图表范围的四边形节点数组。 例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 401

# isPointInPoly(pt, poly)

判断一个点是否在多边形里面。(射线法)

参数:

名称 类型 描述
pt Object

需要判定的点对象,该对象含有属性x(横坐标),属性y(纵坐标)。

poly Array.<Object>

多边形节点数组。
例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 381

# isQuadrilateralOverLap(rect1, rect2)

判断两个四边形是否有压盖。

参数:

名称 类型 描述
rect1 Array.<Object>

四边形节点数组。

rect2 Array.<Object>

第二个四边形节点数组。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 245

示例
[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}];

# lineIntersection(a1, a2, b1, b2)

判断两条线段是不是有交点。

参数:

名称 类型 描述
a1 Zondy.Geometry.Point

第一条线段的起始节点。

a2 Zondy.Geometry.Point

第一条线段的结束节点。

b1 Zondy.Geometry.Point

第二条线段的起始节点。

b2 Zondy.Geometry.Point

第二条线段的结束节点。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 333

如果相交返回交点,如果不相交返回两条线段的位置关系。

Object

# off(event, callback, context)

移除专题要素事件监听。

参数:

名称 类型 描述
event Event

监听事件。

callback function

回调函数。

context string

信息。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 370

# on(event, callback, context)

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

参数:

名称 类型 描述
event Event

监听事件。

callback function

回调函数。

context string

信息。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 353

# onRemove(map)

删除某个地图。

参数:

名称 类型 描述
map L.Map

要删除的地图。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 52

# redraw()

重绘该图层,成功则返回 true,否则返回 false。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 494

# redrawThematicFeatures(bounds)

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

参数:

名称 类型 描述
bounds L.bounds

重绘的范围。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 109

# removeAllFeatures()

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

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 484

# removeFeatures(features)

从专题图中删除 feature。这个函数删除所有传递进来的矢量要素(数据)。

参数:

名称 类型 描述
features Object

待删除的要素。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 472

# setChartsType(chartsType)

设置图表类型,此函数可动态改变图表类型。在调用此函数前请通过 chartsSetting 为新类型的图表做相关配置。图表类型,目前支持:"Bar", "Bar3D", "Line","Point","Pie","Ring"。

参数:

名称 类型 描述
chartsType string

图表类型。目前可用:"Bar", "Bar3D", "Line","Point","Pie","Ring"。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 64

# setOpacity(opacity)

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

参数:

名称 类型 描述
opacity number

不透明度。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 319

# setSymbolType(symbolType)

设置符号类型,此函数可动态改变图表类型。在调用此函数前请通过 symbolSetting 为新类型的图表做相关配置。

参数:

名称 类型 描述
symbolType Zondy.ChartType

目前支持:"Circle"。

查看源代码 document/theme/RankSymbolThemeLayer.js, line 45

# update(bounds)

更新图层。

参数:

名称 类型 描述
bounds L.bounds

图层范围。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 283

事件

# beforefeaturesadded

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

属性:
Name Type Description
features L.features

待添加的要素。

Inherited From:

查看源代码 document/theme/GraphThemeLayer.js, line 81

# changelayer

图层属性改变之后触发。

属性:
Name Type Description
layer Object

图层。

property string

图层属性。

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 483

# featuresremoved

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

属性:
Name Type Description
features Array.<Zondy.Feature.Vector>

事件对象。

succeed boolean

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

Inherited From:

查看源代码 document/theme/ThemeLayer.js, line 191

构造函数
成员变量
方法
事件