Class: Migration

.Visuals.Custom. Migration

迁徙图层

new Migration(options)

Parameters:
Name Type Description
options Object
Properties
Name Type Description
id String 图层id
data Array 数据,geojson格式
visibility Boolean 图层默认是否显示
direction String 迁徙方向,可选为:in | out
location Object 起始位置or终点位置
rendererOptions Object 渲染配置
Properties
Name Type Description
markLine Object 标线
Properties
Name Type Description
hoverable Boolean 是否启用鼠标悬浮
curveness Number 曲线弯曲弧度,smooth为true时有效
effect Object 炫光特效
Properties
Name Type Description
color String 炫光颜色
scaleSize Number 放大倍数,以标线宽度为基准
period Number 运动周期,无单位,值越大越慢
itemStyle Object 图形样式属性
Properties
Name Type Description
width Number 线宽
dash Array 用来绘制虚线,线段和间距长度数组,默认[]
markPoint Object 标注
Properties
Name Type Description
nameField String 属性名动态选取,可缺省,缺省使用name属性字段
valueField String 属性值动态选取,可缺省,缺省使用value属性字段
hoverable Boolean 是否启用鼠标悬浮
symbol String 标注图形类型,可选为:'circle' | 'ring' | 'emptyCircle'
symbolMinSize Number 标注最小大小
symbolMaxSize Number 标注最大大小
effect Object 炫光特效
Properties
Name Type Description
scaleSize Number 放大倍数,以标注大小为基准
period Number 运动周期,无单位,值越大越慢
gradientColor Object 标注颜色取值范围,并指定全局不透明度
itemStyle Object 图形样式属性
Properties
Name Type Description
color String 颜色
shadowColor String 阴影颜色
shadowBlur String 阴影模糊度
shadowOffsetX String 阴影偏移量X
shadowOffsetY String 阴影偏移量Y
label Object 标签
Properties
Name Type Description
show Boolean 标签是否显示
color String 颜色
align String 水平对齐方式,可选为:'start' | 'end' | 'left' | 'right' | 'center'
baseline String 垂直对齐方式,可选为:'top' | 'hanging' | 'middle' | 'alphabetic' | 'ideographic' | 'bottom'
fontFamily String 字体系列
fontSize Number 字号 ,单位px
fontStyle String 样式,可选为:'normal' | 'italic' | 'oblique'
fontWeight String/Number 粗细,可选为:'normal' | 'bold' | 'bolder' | 'lighter' | 100 | 200 |... | 900
tooltip Object 悬浮提示
Properties
Name Type Description
show Boolean 是否显示悬浮提示框
backgroundColor String 背景颜色
borderColor String 边框颜色
borderRadius Number 边框圆角
borderWidth Number 边框宽度
padding Number 内边距
textStyle Object 文字样式
Properties
Name Type Description
color String 颜色
fontFamily String 字体系列
fontSize Number 字号 ,单位px
fontStyle String 样式,可选为:'normal' | 'italic' | 'oblique'
fontWeight String/Number 粗细,可选为:'normal' | 'bold' | 'bolder' | 'lighter' | 100 | 200 |... | 900
Author:
  • kz
Source:
View2D/Visuals/Custom/Migration.js
Example
//构造地图对象
 var map = new GeoGlobe.Map({
    style: Cfg.style,
    container: 'map',
    zoom: 16,
    bearing: 0,
	pitch: 0,
    units: "degrees",
    center: [114.20509630753577, 30.776055193053764]
 });
 //构造可视化定制图层
 var custom = new GeoGlobe.Visuals.Custom();
 //添加到地图中
 custom.addTo(map);
 //构造迁徙图层
 var migration = new GeoGlobe.Visuals.Custom.Migration({
    id: "migration_1",
    data: [{
        "type": "Feature",
        "properties": {name: "湖北省", value: 666},
        "geometry": {
            "type": "Point",
            "coordinates": [112.26577320468478, 30.98857642486671]
        }
    },{
        "type": "Feature",
        "properties": {name: "山东省", value: 299},
        "geometry": {
            "type": "Point",
            "coordinates": [118.15725615843111,36.354896713378366]
        }
    }],
    visibility: true,
    direction: "out",
    location: {
        name: "香港特别行政区",
        lonLat: [114.12694391453464, 22.380716926328258]
    },
    rendererOptions: {
        markLine: {
            hoverable: true,
            curveness: 0.6,
            effect: {
                color: '#fff',
                scaleSize: 3,
                period: 25
            },
            itemStyle: {
                width: 1,
                dash: [5, 5]
            }
        },
        markPoint: {
            symbol: "ring",
            symbolMinSize: 20,
            symbolMaxSize: 40,
            effect: {
                scaleSize: 3,
                period: 20
            },
            itemStyle: {
                color: {
                    "0": "rgba(58, 200, 0, 0.5)",
                    "0.5": "rgba(243, 255, 0, 0.5)",
                    "1": "rgba(255, 20, 0, 0.5)"
                }//"rgba(255,0,0,0.5)"
            },
            label: {
                show: false
            }
        }
    }
 });
 //添加到可视化定制图层
 migration.addTo(custom);
 //绘制
 custom.render();

Members


cacheCanvas :Array

离屏画布集合
Type:
  • Array
Source:
View2D/Visuals/Custom/Migration.js

cacheCanvasContext :Array

离屏画布的上下文集合
Type:
  • Array
Source:
View2D/Visuals/Custom/Migration.js

canvas :Array

画布集合,使用分层画布分别绘制
Type:
  • Array
Source:
View2D/Visuals/Custom/Migration.js

canvasContext :Array

画布的上下文集合
Type:
  • Array
Source:
View2D/Visuals/Custom/Migration.js

MarkLine :function

标线类
Type:
  • function
Source:
View2D/Visuals/Custom/Migration.js

markLines :Array

标线对象集
Type:
  • Array
Source:
View2D/Visuals/Custom/Migration.js

MarkPoint :function

标注类
Type:
  • function
Source:
View2D/Visuals/Custom/Migration.js

markPoints :Array

标注对象集
Type:
  • Array
Source:
View2D/Visuals/Custom/Migration.js

visibility :Boolean

图层默认是否显示
Type:
  • Boolean
Source:
View2D/Visuals/Custom/Migration.js

Methods


addTo(custom)

关联可视化定制图层对象
Parameters:
Name Type Description
custom GeoGlobe.Visuals.Custom
Source:
View2D/Visuals/Custom/Migration.js

clearCanvas()

画布清空
Source:
View2D/Visuals/Custom/Migration.js

destroy()

销毁图层
Source:
View2D/Visuals/Custom/Migration.js

draw()

图层绘制
Source:
View2D/Visuals/Custom/Migration.js

drawCanvas1()

将标线、标注静态部分绘制到画布1
Source:
View2D/Visuals/Custom/Migration.js

drawCanvas2()

将标线动画部分绘制到画布2
Source:
View2D/Visuals/Custom/Migration.js

drawCanvas3()

将标注动画部分绘制到画布3
Source:
View2D/Visuals/Custom/Migration.js

hideTooltip()

关闭悬浮提示
Source:
View2D/Visuals/Custom/Migration.js

hover(x, y)

鼠标悬浮时触发
Parameters:
Name Type Description
x Number 鼠标在主画布上的位置(x轴方向)
y Number 鼠标在主画布上的位置(y轴方向)
Source:
View2D/Visuals/Custom/Migration.js

onMouseMove(event)

鼠标指针悬停事件
Parameters:
Name Type Description
event Object 事件参数
Source:
View2D/Visuals/Custom/Migration.js

onMove()

图层(地图)移动时触发
Source:
View2D/Visuals/Custom/Migration.js

onMoveEnd()

图层(地图)移动结束触发
Source:
View2D/Visuals/Custom/Migration.js

onResize()

图层自适应
Source:
View2D/Visuals/Custom/Migration.js

redraw()

图层重绘
Source:
View2D/Visuals/Custom/Migration.js

render()

渲染图层
Source:
View2D/Visuals/Custom/Migration.js

setData(data)

数据的处理,构造标注、标线对象
Parameters:
Name Type Description
data Array 数据
Source:
View2D/Visuals/Custom/Migration.js

setVisible(visibility)

图层的显示与隐藏
Parameters:
Name Type Description
visibility Boolean 可见性
Source:
View2D/Visuals/Custom/Migration.js

stopDraw()

停止绘制
Source:
View2D/Visuals/Custom/Migration.js

updateXY()

重新计算标线、标注的屏幕坐标
Source:
View2D/Visuals/Custom/Migration.js