Mapbox3DModel.js
1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import * as echarts from 'echarts/lib/echarts';
import componentPostEffectMixin from '../common/componentPostEffectMixin';
import componentLightMixin from '../common/componentLightMixin';
var MAPBOX_CAMERA_OPTION = ['zoom', 'center', 'pitch', 'bearing'];
var Mapbox3DModel = echarts.ComponentModel.extend({
type: 'mapbox3D',
layoutMode: 'box',
coordinateSystem: null,
defaultOption: {
zlevel: -10,
style: 'mapbox://styles/mapbox/light-v9',
center: [0, 0],
zoom: 0,
pitch: 0,
bearing: 0,
light: {
main: {
alpha: 20,
beta: 30
}
},
altitudeScale: 1,
// Default depend on altitudeScale
boxHeight: 'auto'
},
getMapboxCameraOption: function () {
var self = this;
return MAPBOX_CAMERA_OPTION.reduce(function (obj, key) {
obj[key] = self.get(key);
return obj;
}, {});
},
setMapboxCameraOption: function (option) {
if (option != null) {
MAPBOX_CAMERA_OPTION.forEach(function (key) {
if (option[key] != null) {
this.option[key] = option[key];
}
}, this);
}
},
/**
* Get mapbox instance
*/
getMapbox: function () {
return this._mapbox;
},
setMapbox: function (mapbox) {
this._mapbox = mapbox;
}
});
echarts.util.merge(Mapbox3DModel.prototype, componentPostEffectMixin);
echarts.util.merge(Mapbox3DModel.prototype, componentLightMixin);
export default Mapbox3DModel;