@sword916/vae-map-plus 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +5376 -0
- package/lib/style.css +1 -0
- package/lib/vae-amap/favicon.ico +0 -0
- package/lib/vae-amap/images/game.png +0 -0
- package/lib/vae-amap/images/grid.png +0 -0
- package/lib/vae-amap/images/marker.png +0 -0
- package/lib/vae-amap/index.js +209 -0
- package/lib/vae-amap/style.css +1 -0
- package/lib/vae-cloudmap/favicon.ico +0 -0
- package/lib/vae-cloudmap/images/game.png +0 -0
- package/lib/vae-cloudmap/images/grid.png +0 -0
- package/lib/vae-cloudmap/images/marker.png +0 -0
- package/lib/vae-cloudmap/index.html +30 -0
- package/lib/vae-cloudmap/index.js +4085 -0
- package/lib/vae-cloudmap/style.css +1 -0
- package/lib/vae-map/favicon.ico +0 -0
- package/lib/vae-map/images/game.png +0 -0
- package/lib/vae-map/images/grid.png +0 -0
- package/lib/vae-map/images/marker.png +0 -0
- package/lib/vae-map/index.html +30 -0
- package/lib/vae-map/index.js +4322 -0
- package/lib/vae-map/style.css +1 -0
- package/package.json +1 -1
- package/plugins/L.AnimatedMarker/favicon.ico +0 -0
- package/plugins/L.AnimatedMarker/images/game.png +0 -0
- package/plugins/L.AnimatedMarker/images/grid.png +0 -0
- package/plugins/L.AnimatedMarker/images/marker.png +0 -0
- package/plugins/L.AnimatedMarker/index.html +30 -0
- package/plugins/L.AnimatedMarker/index.js +83 -0
- package/plugins/L.EchartsLayer/favicon.ico +0 -0
- package/plugins/L.EchartsLayer/images/game.png +0 -0
- package/plugins/L.EchartsLayer/images/grid.png +0 -0
- package/plugins/L.EchartsLayer/images/marker.png +0 -0
- package/plugins/L.EchartsLayer/index.html +30 -0
- package/plugins/L.EchartsLayer/index.js +176 -0
- package/plugins/L.FootageCalculator.Area/favicon.ico +0 -0
- package/plugins/L.FootageCalculator.Area/images/game.png +0 -0
- package/plugins/L.FootageCalculator.Area/images/grid.png +0 -0
- package/plugins/L.FootageCalculator.Area/images/marker.png +0 -0
- package/plugins/L.FootageCalculator.Area/index.html +30 -0
- package/plugins/L.FootageCalculator.Area/index.js +418 -0
- package/plugins/L.FootageCalculator.Line/favicon.ico +0 -0
- package/plugins/L.FootageCalculator.Line/images/game.png +0 -0
- package/plugins/L.FootageCalculator.Line/images/grid.png +0 -0
- package/plugins/L.FootageCalculator.Line/images/marker.png +0 -0
- package/plugins/L.FootageCalculator.Line/index.html +30 -0
- package/plugins/L.FootageCalculator.Line/index.js +416 -0
- package/plugins/L.GeoUtil/favicon.ico +0 -0
- package/plugins/L.GeoUtil/images/game.png +0 -0
- package/plugins/L.GeoUtil/images/grid.png +0 -0
- package/plugins/L.GeoUtil/images/marker.png +0 -0
- package/plugins/L.GeoUtil/index.html +30 -0
- package/plugins/L.GeoUtil/index.js +279 -0
- package/plugins/L.Glyphicon/favicon.ico +0 -0
- package/plugins/L.Glyphicon/images/game.png +0 -0
- package/plugins/L.Glyphicon/images/grid.png +0 -0
- package/plugins/L.Glyphicon/images/marker.png +0 -0
- package/plugins/L.Glyphicon/index.html +30 -0
- package/plugins/L.Glyphicon/index.js +57 -0
- package/plugins/L.Glyphicon/style.css +1 -0
- package/plugins/L.MarkerClusterX/favicon.ico +0 -0
- package/plugins/L.MarkerClusterX/images/game.png +0 -0
- package/plugins/L.MarkerClusterX/images/grid.png +0 -0
- package/plugins/L.MarkerClusterX/images/marker.png +0 -0
- package/plugins/L.MarkerClusterX/index.html +30 -0
- package/plugins/L.MarkerClusterX/index.js +33 -0
- package/plugins/L.MarkerClusterX/style.css +1 -0
- package/plugins/L.SafeDivOverlay/favicon.ico +0 -0
- package/plugins/L.SafeDivOverlay/images/game.png +0 -0
- package/plugins/L.SafeDivOverlay/images/grid.png +0 -0
- package/plugins/L.SafeDivOverlay/images/marker.png +0 -0
- package/plugins/L.SafeDivOverlay/index.html +30 -0
- package/plugins/L.SafeDivOverlay/index.js +26 -0
- package/plugins/L.TileLayer.ChinaProvider/favicon.ico +0 -0
- package/plugins/L.TileLayer.ChinaProvider/images/game.png +0 -0
- package/plugins/L.TileLayer.ChinaProvider/images/grid.png +0 -0
- package/plugins/L.TileLayer.ChinaProvider/images/marker.png +0 -0
- package/plugins/L.TileLayer.ChinaProvider/index.html +30 -0
- package/plugins/L.TileLayer.ChinaProvider/index.js +91 -0
- package/plugins/L.VuePopup/favicon.ico +0 -0
- package/plugins/L.VuePopup/images/game.png +0 -0
- package/plugins/L.VuePopup/images/grid.png +0 -0
- package/plugins/L.VuePopup/images/marker.png +0 -0
- package/plugins/L.VuePopup/index.html +30 -0
- package/plugins/L.VuePopup/index.js +68 -0
- package/plugins/L.VueTooltip/favicon.ico +0 -0
- package/plugins/L.VueTooltip/images/game.png +0 -0
- package/plugins/L.VueTooltip/images/grid.png +0 -0
- package/plugins/L.VueTooltip/images/marker.png +0 -0
- package/plugins/L.VueTooltip/index.html +30 -0
- package/plugins/L.VueTooltip/index.js +68 -0
- package/plugins/Mixin.Map.Measure/favicon.ico +0 -0
- package/plugins/Mixin.Map.Measure/images/game.png +0 -0
- package/plugins/Mixin.Map.Measure/images/grid.png +0 -0
- package/plugins/Mixin.Map.Measure/images/marker.png +0 -0
- package/plugins/Mixin.Map.Measure/index.html +30 -0
- package/plugins/Mixin.Map.Measure/index.js +84 -0
- package/plugins/globals/favicon.ico +0 -0
- package/plugins/globals/images/game.png +0 -0
- package/plugins/globals/images/grid.png +0 -0
- package/plugins/globals/images/marker.png +0 -0
- package/plugins/globals/index.html +30 -0
- package/plugins/globals/index.js +4 -0
- package/build/index.mjs +0 -113
- package/examples/App.vue +0 -18
- package/examples/index.js +0 -13
- package/examples/router/index.js +0 -35
- package/examples/views/amap.vue +0 -29
- package/examples/views/amarker.vue +0 -58
- package/examples/views/buffer.vue +0 -66
- package/examples/views/cluster.vue +0 -74
- package/examples/views/cover.vue +0 -85
- package/examples/views/draw-line.vue +0 -49
- package/examples/views/draw.vue +0 -54
- package/examples/views/echarts.vue +0 -142
- package/examples/views/emarker.vue +0 -39
- package/examples/views/image.vue +0 -182
- package/examples/views/index.vue +0 -61
- package/examples/views/lrmap.vue +0 -108
- package/examples/views/map.vue +0 -82
- package/examples/views/measure.vue +0 -86
- package/examples/views/parts/popup.vue +0 -39
- package/examples/views/parts/tooltip.vue +0 -39
- package/examples/views/push-area.vue +0 -52
- package/examples/views/push-line.vue +0 -84
- package/examples/views/trace.vue +0 -49
- package/jsconfig.json +0 -17
- package/src/components/resize-listener/component.jsx +0 -30
- package/src/components/resize-listener/index.js +0 -3
- package/src/composables/useAutoMessage.js +0 -41
- package/src/composables/useContextMenu.js +0 -99
- package/src/composables/useMapMeasure.js +0 -191
- package/src/composables/useResizeObserver.js +0 -81
- package/src/mixins/message.js +0 -1
- package/src/packages/index.js +0 -16
- package/src/packages/vae-amap/index.js +0 -8
- package/src/packages/vae-amap/style.less +0 -9
- package/src/packages/vae-amap/vae-amap.jsx +0 -98
- package/src/packages/vae-cloudmap/ctrl-context-menu/index.vue +0 -74
- package/src/packages/vae-cloudmap/ctrl-draw/index.vue +0 -499
- package/src/packages/vae-cloudmap/ctrl-draw-line/index.vue +0 -161
- package/src/packages/vae-cloudmap/index.js +0 -57
- package/src/packages/vae-cloudmap/scripts/L.MarkerCluster/index.js +0 -2690
- package/src/packages/vae-cloudmap/scripts/L.MarkerCluster/style.css +0 -14
- package/src/packages/vae-cloudmap/scripts/L.Vae.CRS/index.js +0 -212
- package/src/packages/vae-cloudmap/scripts/L.Vae.Client/index.js +0 -780
- package/src/packages/vae-cloudmap/scripts/Mixin.ContextMenu/index.js +0 -101
- package/src/packages/vae-cloudmap/style.less +0 -163
- package/src/packages/vae-cloudmap/vae-cloudmap.jsx +0 -272
- package/src/packages/vae-map/ctrl-context-menu/index.vue +0 -74
- package/src/packages/vae-map/ctrl-draw/index.vue +0 -498
- package/src/packages/vae-map/ctrl-draw-line/index.vue +0 -128
- package/src/packages/vae-map/index.js +0 -59
- package/src/packages/vae-map/scripts/L.MarkerCluster/index.js +0 -2690
- package/src/packages/vae-map/scripts/L.MarkerCluster/style.css +0 -14
- package/src/packages/vae-map/scripts/L.Vae.CRS/index.js +0 -114
- package/src/packages/vae-map/scripts/L.Vae.Client/index.js +0 -548
- package/src/packages/vae-map/scripts/Mixin.ContextMenu/index.js +0 -1
- package/src/packages/vae-map/style.less +0 -161
- package/src/packages/vae-map/vae-lrmap.jsx +0 -237
- package/src/packages/vae-map/vae-map.jsx +0 -135
- package/src/plugins/L.AnimatedMarker/index.js +0 -158
- package/src/plugins/L.EchartsLayer/index.js +0 -339
- package/src/plugins/L.ElasticMarker/index.js +0 -162
- package/src/plugins/L.FootageCalculator.Area/index.js +0 -263
- package/src/plugins/L.FootageCalculator.Line/index.js +0 -273
- package/src/plugins/L.GeoUtil/buffer.js +0 -67
- package/src/plugins/L.GeoUtil/index.js +0 -284
- package/src/plugins/L.Glyphicon/index.js +0 -91
- package/src/plugins/L.Glyphicon/style.less +0 -37
- package/src/plugins/L.MarkerClusterX/index.js +0 -93
- package/src/plugins/L.MarkerClusterX/style.less +0 -162
- package/src/plugins/L.SafeDivOverlay/index.js +0 -55
- package/src/plugins/L.TileLayer.ChinaProvider/index.js +0 -108
- package/src/plugins/L.VuePopup/index.js +0 -67
- package/src/plugins/L.VueTooltip/index.js +0 -63
- package/src/plugins/Mixin.Map.Measure/index.js +0 -248
- package/src/plugins/globals/index.js +0 -7
- package/src/utils/index.js +0 -36
- package/src/utils/resize-event.js +0 -45
- /package/{public → lib}/favicon.ico +0 -0
- /package/{public → lib}/images/game.png +0 -0
- /package/{public → lib}/images/grid.png +0 -0
- /package/{public → lib}/images/marker.png +0 -0
- /package/{public → lib/vae-amap}/index.html +0 -0
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
import * as echarts from "echarts"
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @class L.supermap.echartsLayer
|
|
5
|
-
* @classdesc 百度 ECharts 图层类。
|
|
6
|
-
* @category Visualization ECharts
|
|
7
|
-
* @extends {L.Layer}
|
|
8
|
-
* @param {Object} echartsOptions - 图表参数。
|
|
9
|
-
* @param {Object} options - 可选图层参数。
|
|
10
|
-
* @param {boolean} [options.loadWhileAnimating=false] - 是否在移动时实时绘制。
|
|
11
|
-
* @param {string} [options.attribution='© 2018 百度 ECharts'] - 版权信息。
|
|
12
|
-
*/
|
|
13
|
-
L.EchartsLayer = L.Layer.extend({
|
|
14
|
-
|
|
15
|
-
includes: [],
|
|
16
|
-
_echartsContainer: null,
|
|
17
|
-
_map: null,
|
|
18
|
-
_ec: null,
|
|
19
|
-
_echartsOptions: null,
|
|
20
|
-
|
|
21
|
-
options: {
|
|
22
|
-
loadWhileAnimating: false
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
initialize: function (echartsOptions, options) {
|
|
26
|
-
L.Util.setOptions(this, options)
|
|
27
|
-
this.setOption(echartsOptions)
|
|
28
|
-
},
|
|
29
|
-
/**
|
|
30
|
-
* @function L.supermap.echartsLayer.prototype.setOption
|
|
31
|
-
* @description 设置图表地图参数。
|
|
32
|
-
* @param {Object} echartsOptions - 图表参数。
|
|
33
|
-
* @param {string} lazyUpdate - 后台自动更新。
|
|
34
|
-
* @param {boolean} [notMerge] - 是否合并参数。
|
|
35
|
-
*/
|
|
36
|
-
setOption: function (echartsOptions, notMerge, lazyUpdate) {
|
|
37
|
-
const baseOption = echartsOptions.baseOption || echartsOptions
|
|
38
|
-
baseOption.LeafletMap = baseOption.LeafletMap || {
|
|
39
|
-
roam: true
|
|
40
|
-
}
|
|
41
|
-
baseOption.animation = baseOption.animation === true
|
|
42
|
-
this._echartsOptions = echartsOptions
|
|
43
|
-
this._ec && this._ec.setOption(echartsOptions, notMerge, lazyUpdate)
|
|
44
|
-
},
|
|
45
|
-
getEcharts: function () {
|
|
46
|
-
return this._ec
|
|
47
|
-
},
|
|
48
|
-
_disableEchartsContainer: function () {
|
|
49
|
-
this._echartsContainer.style.visibility = "hidden"
|
|
50
|
-
},
|
|
51
|
-
_enableEchartsContainer: function () {
|
|
52
|
-
this._echartsContainer.style.visibility = "visible"
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @private
|
|
57
|
-
* @function L.supermap.echartsLayer.prototype.onAdd
|
|
58
|
-
* @description 添加地图。
|
|
59
|
-
* @param {L.Map} map - 待添加的地图。
|
|
60
|
-
*/
|
|
61
|
-
onAdd: function (map) {
|
|
62
|
-
this._map = map
|
|
63
|
-
this._initEchartsContainer()
|
|
64
|
-
this._ec = echarts.init(this._echartsContainer)
|
|
65
|
-
this._ec.leafletMap = map
|
|
66
|
-
const me = this
|
|
67
|
-
|
|
68
|
-
map.on("zoomstart", function () {
|
|
69
|
-
me._disableEchartsContainer()
|
|
70
|
-
})
|
|
71
|
-
!me.options.loadWhileAnimating && map.on("movestart", function () {
|
|
72
|
-
me._disableEchartsContainer()
|
|
73
|
-
})
|
|
74
|
-
echarts.registerAction({
|
|
75
|
-
type: 'LeafletMapLayout',
|
|
76
|
-
event: 'LeafletMapLayout',
|
|
77
|
-
update: 'updateLayout'
|
|
78
|
-
}, function (payload) { // eslint-disable-line no-unused-vars
|
|
79
|
-
})
|
|
80
|
-
echarts.registerCoordinateSystem(
|
|
81
|
-
'leaflet', LeafletMapCoordSys
|
|
82
|
-
)
|
|
83
|
-
echarts.extendComponentModel({
|
|
84
|
-
type: 'LeafletMap',
|
|
85
|
-
getBMap: function () {
|
|
86
|
-
return this.__LeafletMap
|
|
87
|
-
},
|
|
88
|
-
defaultOption: {
|
|
89
|
-
roam: false
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
echarts.extendComponentView({
|
|
93
|
-
type: 'LeafletMap',
|
|
94
|
-
render: function (LeafletMapModel, ecModel, api) {
|
|
95
|
-
let rendering = true
|
|
96
|
-
let leafletMap = ecModel.scheduler.ecInstance.leafletMap
|
|
97
|
-
const viewportRoot = api.getZr().painter.getViewportRoot()
|
|
98
|
-
|
|
99
|
-
const animated = leafletMap.options.zoomAnimation && L.Browser.any3d
|
|
100
|
-
viewportRoot.className = ' leaflet-layer leaflet-zoom-' + (animated ? 'animated' : 'hide') + ' echarts-layer'
|
|
101
|
-
|
|
102
|
-
const originProp = L.DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'msTransformOrigin'])
|
|
103
|
-
viewportRoot.style[originProp] = '50% 50%'
|
|
104
|
-
|
|
105
|
-
const coordSys = LeafletMapModel.coordinateSystem
|
|
106
|
-
|
|
107
|
-
const ecLayers = api.getZr().painter.getLayers()
|
|
108
|
-
|
|
109
|
-
const moveHandler = function () {
|
|
110
|
-
if (rendering) {
|
|
111
|
-
return
|
|
112
|
-
}
|
|
113
|
-
const offset = me._map.containerPointToLayerPoint([0, 0])
|
|
114
|
-
const mapOffset = [offset.x || 0, offset.y || 0]
|
|
115
|
-
viewportRoot.style.left = mapOffset[0] + 'px'
|
|
116
|
-
viewportRoot.style.top = mapOffset[1] + 'px'
|
|
117
|
-
|
|
118
|
-
if (!me.options.loadWhileAnimating) {
|
|
119
|
-
for (let item in ecLayers) {
|
|
120
|
-
if (!ecLayers.hasOwnProperty(item)) {
|
|
121
|
-
continue
|
|
122
|
-
}
|
|
123
|
-
ecLayers[item] && clearContext(ecLayers[item].ctx)
|
|
124
|
-
}
|
|
125
|
-
me._enableEchartsContainer()
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
coordSys.setMapOffset(mapOffset)
|
|
129
|
-
LeafletMapModel.__mapOffset = mapOffset
|
|
130
|
-
|
|
131
|
-
api.dispatchAction({
|
|
132
|
-
type: 'LeafletMapLayout'
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function clearContext(context) {
|
|
139
|
-
context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function zoomEndHandler() {
|
|
143
|
-
if (rendering) {
|
|
144
|
-
return
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
api.dispatchAction({
|
|
148
|
-
type: 'LeafletMapLayout'
|
|
149
|
-
})
|
|
150
|
-
me._enableEchartsContainer()
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (me._oldMoveHandler) {
|
|
154
|
-
leafletMap.off(me.options.loadWhileAnimating ? 'move' : 'moveend', me._oldMoveHandler)
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
if (me._oldZoomEndHandler) {
|
|
158
|
-
leafletMap.off('zoomend', me._oldZoomEndHandler)
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
leafletMap.on(me.options.loadWhileAnimating ? 'move' : 'moveend', moveHandler)
|
|
163
|
-
leafletMap.on('zoomend', zoomEndHandler)
|
|
164
|
-
me._oldMoveHandler = moveHandler
|
|
165
|
-
me._oldZoomEndHandler = zoomEndHandler
|
|
166
|
-
rendering = false
|
|
167
|
-
}
|
|
168
|
-
})
|
|
169
|
-
this._ec.setOption(this._echartsOptions)
|
|
170
|
-
},
|
|
171
|
-
|
|
172
|
-
onRemove: function () {
|
|
173
|
-
// 销毁echarts实例
|
|
174
|
-
this._ec.clear()
|
|
175
|
-
this._ec.dispose()
|
|
176
|
-
delete this._ec
|
|
177
|
-
L.DomUtil.remove(this._echartsContainer)
|
|
178
|
-
|
|
179
|
-
if (this._oldZoomEndHandler) {
|
|
180
|
-
this._map.off("zoomend", this._oldZoomEndHandler)
|
|
181
|
-
this._oldZoomEndHandler = null
|
|
182
|
-
}
|
|
183
|
-
if (this._oldMoveHandler) {
|
|
184
|
-
this._map.off(this.options.loadWhileAnimating ? 'move' : 'moveend', this._oldMoveHandler)
|
|
185
|
-
this._oldMoveHandler = null
|
|
186
|
-
}
|
|
187
|
-
if (this._resizeHandler) {
|
|
188
|
-
this._map.off('resize', this._resizeHandler)
|
|
189
|
-
this._resizeHandler = null
|
|
190
|
-
}
|
|
191
|
-
delete this._map
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
_initEchartsContainer: function () {
|
|
195
|
-
const size = this._map.getSize()
|
|
196
|
-
|
|
197
|
-
const _div = document.createElement('div')
|
|
198
|
-
_div.style.position = 'absolute'
|
|
199
|
-
_div.style.height = size.y + 'px'
|
|
200
|
-
_div.style.width = size.x + 'px'
|
|
201
|
-
_div.style.zIndex = 10
|
|
202
|
-
this._echartsContainer = _div
|
|
203
|
-
|
|
204
|
-
this.getPane().appendChild(this._echartsContainer)
|
|
205
|
-
const me = this
|
|
206
|
-
|
|
207
|
-
function _resizeHandler(e) {
|
|
208
|
-
let size = e.newSize
|
|
209
|
-
me._echartsContainer.style.width = size.x + 'px'
|
|
210
|
-
me._echartsContainer.style.height = size.y + 'px'
|
|
211
|
-
me._ec.resize()
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
this._map.on('resize', _resizeHandler)
|
|
215
|
-
this._resizeHandler = _resizeHandler
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* @class L.supermap.LeafletMapCoordSys
|
|
222
|
-
* @private
|
|
223
|
-
* @classdesc 地图坐标系统类。
|
|
224
|
-
* @param {L.Map} leafletMap - 地图。
|
|
225
|
-
*/
|
|
226
|
-
export function LeafletMapCoordSys(leafletMap) {
|
|
227
|
-
this._LeafletMap = leafletMap
|
|
228
|
-
this.dimensions = ['lng', 'lat']
|
|
229
|
-
this._mapOffset = [0, 0]
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
LeafletMapCoordSys.prototype.dimensions = ['lng', 'lat']
|
|
233
|
-
|
|
234
|
-
LeafletMapCoordSys.prototype.setMapOffset = function (mapOffset) {
|
|
235
|
-
this._mapOffset = mapOffset
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
LeafletMapCoordSys.prototype.getBMap = function () {
|
|
239
|
-
return this._LeafletMap
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
LeafletMapCoordSys.prototype.prepareCustoms = function () {
|
|
243
|
-
const zrUtil = echarts.util
|
|
244
|
-
|
|
245
|
-
const rect = this.getViewRect()
|
|
246
|
-
return {
|
|
247
|
-
coordSys: {
|
|
248
|
-
// The name exposed to user is always 'cartesian2d' but not 'grid'.
|
|
249
|
-
type: 'leaflet',
|
|
250
|
-
x: rect.x,
|
|
251
|
-
y: rect.y,
|
|
252
|
-
width: rect.width,
|
|
253
|
-
height: rect.height
|
|
254
|
-
},
|
|
255
|
-
api: {
|
|
256
|
-
coord: zrUtil.bind(this.dataToPoint, this),
|
|
257
|
-
size: zrUtil.bind(dataToCoordSize, this)
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
function dataToCoordSize(dataSize, dataItem) {
|
|
262
|
-
dataItem = dataItem || [0, 0]
|
|
263
|
-
return zrUtil.map([0, 1], function (dimIdx) {
|
|
264
|
-
const val = dataItem[dimIdx]
|
|
265
|
-
const halfSize = dataSize[dimIdx] / 2
|
|
266
|
-
const p1 = []
|
|
267
|
-
const p2 = []
|
|
268
|
-
p1[dimIdx] = val - halfSize
|
|
269
|
-
p2[dimIdx] = val + halfSize
|
|
270
|
-
p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx]
|
|
271
|
-
return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx])
|
|
272
|
-
}, this)
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
LeafletMapCoordSys.prototype.dataToPoint = function (data) {
|
|
277
|
-
//处理数据中的null值
|
|
278
|
-
if (data[1] === null) {
|
|
279
|
-
data[1] = L.CRS.EPSG3857.projection.MAX_LATITUDE
|
|
280
|
-
}
|
|
281
|
-
//平面坐标系不能这么处理
|
|
282
|
-
//data[1] = this.fixLat(data[1])
|
|
283
|
-
|
|
284
|
-
const px = this._LeafletMap.latLngToLayerPoint([data[1], data[0]])
|
|
285
|
-
|
|
286
|
-
const mapOffset = this._mapOffset
|
|
287
|
-
return [px.x - mapOffset[0], px.y - mapOffset[1]]
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
LeafletMapCoordSys.prototype.fixLat = function (lat) {
|
|
291
|
-
if (lat >= 90) {
|
|
292
|
-
return 89.99999999999999
|
|
293
|
-
}
|
|
294
|
-
if (lat <= -90) {
|
|
295
|
-
return -89.99999999999999
|
|
296
|
-
}
|
|
297
|
-
return lat
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
LeafletMapCoordSys.prototype.pointToData = function (pt) {
|
|
301
|
-
let mapOffset = this._mapOffset
|
|
302
|
-
let point = this._LeafletMap.layerPointToLatLng([pt[0] + mapOffset[0], pt[1] + mapOffset[1]])
|
|
303
|
-
return [point.lng, point.lat]
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
LeafletMapCoordSys.prototype.getViewRect = function () {
|
|
307
|
-
const size = this._LeafletMap.getSize()
|
|
308
|
-
return new echarts.graphic.BoundingRect(0, 0, size.x, size.y)
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
LeafletMapCoordSys.prototype.getRoamTransform = function () {
|
|
312
|
-
return echarts.matrix.create()
|
|
313
|
-
}
|
|
314
|
-
LeafletMapCoordSys.dimensions = LeafletMapCoordSys.prototype.dimensions
|
|
315
|
-
|
|
316
|
-
LeafletMapCoordSys.create = function (ecModel) {
|
|
317
|
-
let coordSys
|
|
318
|
-
let leafletMap = ecModel.scheduler.ecInstance.leafletMap
|
|
319
|
-
ecModel.eachComponent('LeafletMap', function (leafletMapModel) {
|
|
320
|
-
if (!coordSys) {
|
|
321
|
-
coordSys = new LeafletMapCoordSys(leafletMap)
|
|
322
|
-
}
|
|
323
|
-
leafletMapModel.coordinateSystem = coordSys
|
|
324
|
-
leafletMapModel.coordinateSystem.setMapOffset(leafletMapModel.__mapOffset || [0, 0])
|
|
325
|
-
})
|
|
326
|
-
ecModel.eachSeries(function (seriesModel) {
|
|
327
|
-
if (!seriesModel.get('coordinateSystem') || seriesModel.get('coordinateSystem') === 'leaflet') {
|
|
328
|
-
if (!coordSys) {
|
|
329
|
-
coordSys = new LeafletMapCoordSys(leafletMap)
|
|
330
|
-
}
|
|
331
|
-
seriesModel.coordinateSystem = coordSys
|
|
332
|
-
seriesModel.animation = seriesModel.animation === true
|
|
333
|
-
}
|
|
334
|
-
})
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
L.echartsLayer = (echartsOptions, options) => {
|
|
338
|
-
return new L.EchartsLayer(echartsOptions, options)
|
|
339
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import jQuery from 'jquery'
|
|
2
|
-
|
|
3
|
-
// 灵活marker
|
|
4
|
-
L.ElasticMarker = L.Marker.extend({
|
|
5
|
-
|
|
6
|
-
targetMap: null,
|
|
7
|
-
|
|
8
|
-
options: {
|
|
9
|
-
// 启用动态尺寸
|
|
10
|
-
elasticScale: true,
|
|
11
|
-
// 合适的级别
|
|
12
|
-
fitZoom: 10,
|
|
13
|
-
// 最大比例
|
|
14
|
-
maxScale: 1.35,
|
|
15
|
-
// 最小比例
|
|
16
|
-
minScale: 0.35,
|
|
17
|
-
// 比例变换系数
|
|
18
|
-
scaleFactor: 1.35,
|
|
19
|
-
|
|
20
|
-
// 启用动态透明度
|
|
21
|
-
elasticOpacity: false,
|
|
22
|
-
opacityFitZoom: null,
|
|
23
|
-
minOpacity: 0.1,
|
|
24
|
-
opacityFactor: 2,
|
|
25
|
-
|
|
26
|
-
// 启动动态tooltip
|
|
27
|
-
elasticTooltip: true,
|
|
28
|
-
tooltipFitZoom: null
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
initialize(latLng, options) {
|
|
32
|
-
L.setOptions(this, options)
|
|
33
|
-
this.options.opacityFitZoom = this.options.opacityFitZoom || this.options.fitZoom
|
|
34
|
-
this.options.tooltipFitZoom = this.options.tooltipFitZoom || this.options.fitZoom
|
|
35
|
-
this._bindEvents()
|
|
36
|
-
L.Marker.prototype.initialize.call(this, latLng, this.options)
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
_bindEvents() {
|
|
40
|
-
this.on('add', e => {
|
|
41
|
-
this.targetMap = e.target._map
|
|
42
|
-
this.targetMap.on('zoomend', this._update, this)
|
|
43
|
-
this._update()
|
|
44
|
-
})
|
|
45
|
-
this.on('remove', () => {
|
|
46
|
-
this.targetMap.off('zoomend', this._update, this)
|
|
47
|
-
this.targetMap = null
|
|
48
|
-
})
|
|
49
|
-
this.on('tooltipopen', e => {
|
|
50
|
-
this._updateTooltip()
|
|
51
|
-
})
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
_update() {
|
|
55
|
-
// icon
|
|
56
|
-
if (this.options.elasticScale && this.targetMap) {
|
|
57
|
-
// 获取缩放值
|
|
58
|
-
const zoom = this.targetMap.getZoom()
|
|
59
|
-
let scale = 1.0 - (this.options.fitZoom - zoom) * this.options.scaleFactor * 0.1
|
|
60
|
-
scale = _.max([this.options.minScale, scale])
|
|
61
|
-
scale = _.min([this.options.maxScale, scale])
|
|
62
|
-
|
|
63
|
-
const markerIcon = this.getIcon()
|
|
64
|
-
// L.DivIcon
|
|
65
|
-
if (markerIcon instanceof L.DivIcon) {
|
|
66
|
-
const iconDom = jQuery(this._icon)
|
|
67
|
-
const innerIconDom = iconDom.contents()
|
|
68
|
-
// 调整鼠标事件响应范围
|
|
69
|
-
if (this.options.interactive) {
|
|
70
|
-
if (scale < 1) {
|
|
71
|
-
iconDom.css('pointer-events', 'none')
|
|
72
|
-
innerIconDom.css('pointer-events', 'auto')
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
innerIconDom.css('transform', `scale(${scale})`)
|
|
76
|
-
innerIconDom.css('transition', `0.2s`)
|
|
77
|
-
}
|
|
78
|
-
// L.Icon
|
|
79
|
-
else if (markerIcon instanceof L.Icon) {
|
|
80
|
-
const iconDom = jQuery(this._icon)
|
|
81
|
-
const shadowDom = jQuery(this._shadow)
|
|
82
|
-
let iconAnchor, shadowAnchor
|
|
83
|
-
// 默认图标
|
|
84
|
-
if (markerIcon instanceof L.Icon.Default) {
|
|
85
|
-
iconAnchor = shadowAnchor = L.Icon.Default.prototype.options.iconAnchor
|
|
86
|
-
}
|
|
87
|
-
// 自定义图标
|
|
88
|
-
else {
|
|
89
|
-
iconAnchor = markerIcon.options.iconAnchor
|
|
90
|
-
shadowAnchor = markerIcon.options.shadowAnchor
|
|
91
|
-
}
|
|
92
|
-
if (iconDom.length > 0) {
|
|
93
|
-
iconDom.css('transform', iconDom.css('transform') + ` scale(${scale})`)
|
|
94
|
-
if (iconAnchor && iconAnchor.length == 2) {
|
|
95
|
-
iconDom.css('transform-origin', `${iconAnchor[0] + 'px'} ${iconAnchor[1] + 'px'}`)
|
|
96
|
-
}
|
|
97
|
-
iconDom.css('transition', `0.2s`)
|
|
98
|
-
}
|
|
99
|
-
if (shadowDom.length > 0) {
|
|
100
|
-
shadowDom.css('transform', shadowDom.css('transform') + ` scale(${scale})`)
|
|
101
|
-
if (shadowAnchor && shadowAnchor.length == 2) {
|
|
102
|
-
shadowDom.css('transform-origin', `${shadowAnchor[0] + 'px'} ${shadowAnchor[1] + 'px'}`)
|
|
103
|
-
}
|
|
104
|
-
shadowDom.css('transition', `0.2s`)
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// opacity
|
|
110
|
-
if (this.options.elasticOpacity && this.targetMap) {
|
|
111
|
-
// 获取透明度
|
|
112
|
-
const zoom = this.targetMap.getZoom()
|
|
113
|
-
let opacity = 1.0
|
|
114
|
-
if (zoom < this.options.fitZoom) {
|
|
115
|
-
opacity = 1.0 - (this.options.fitZoom - zoom) * this.options.opacityFactor * 0.1
|
|
116
|
-
}
|
|
117
|
-
opacity = _.max([this.options.minOpacity, opacity])
|
|
118
|
-
|
|
119
|
-
const iconDom = jQuery(this._icon)
|
|
120
|
-
const shadowDom = jQuery(this._shadow)
|
|
121
|
-
if (iconDom.length > 0) {
|
|
122
|
-
iconDom.css('opacity', opacity)
|
|
123
|
-
}
|
|
124
|
-
if (shadowDom.length > 0) {
|
|
125
|
-
shadowDom.css('opacity', opacity)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
this._updateTooltip()
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
_updateTooltip() {
|
|
133
|
-
if (this.options.elasticTooltip && this.targetMap) {
|
|
134
|
-
const markerTooltip = this.getTooltip()
|
|
135
|
-
if (markerTooltip) {
|
|
136
|
-
const zoom = this.targetMap.getZoom()
|
|
137
|
-
const tooltipDom = jQuery(markerTooltip._container)
|
|
138
|
-
if (zoom >= this.options.fitZoom) {
|
|
139
|
-
tooltipDom.css('display', '')
|
|
140
|
-
} else {
|
|
141
|
-
tooltipDom.css('display', 'none')
|
|
142
|
-
}
|
|
143
|
-
// 调整位置
|
|
144
|
-
_.delay(() => {
|
|
145
|
-
if (
|
|
146
|
-
this.isTooltipOpen() &&
|
|
147
|
-
markerTooltip._map &&
|
|
148
|
-
markerTooltip._latlng &&
|
|
149
|
-
markerTooltip._container
|
|
150
|
-
) {
|
|
151
|
-
markerTooltip._updatePosition()
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
L.elasticMarker = (latLng, options) => {
|
|
161
|
-
return new L.ElasticMarker(latLng, options)
|
|
162
|
-
}
|