Maptalks3DModel.js
1.8 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
75
import * as echarts from 'echarts/lib/echarts';
import componentPostEffectMixin from '../common/componentPostEffectMixin';
import componentLightMixin from '../common/componentLightMixin';
var MAPTALKS_CAMERA_OPTION = ['zoom', 'center', 'pitch', 'bearing'];
var Maptalks3DModel = echarts.ComponentModel.extend({
type: 'maptalks3D',
layoutMode: 'box',
coordinateSystem: null,
defaultOption: {
zlevel: -10,
urlTemplate: 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
attribution: '© <a href="http://osm.org">OpenStreetMap</a> contributors, © <a href="https://carto.com/">CARTO</a>',
center: [0, 0],
zoom: 0,
pitch: 0,
bearing: 0,
light: {
main: {
alpha: 20,
beta: 30
}
},
altitudeScale: 1,
// Default depend on altitudeScale
boxHeight: 'auto'
},
getMaptalksCameraOption: function () {
var self = this;
return MAPTALKS_CAMERA_OPTION.reduce(function (obj, key) {
obj[key] = self.get(key);
return obj;
}, {});
},
setMaptalksCameraOption: function (option) {
if (option != null) {
MAPTALKS_CAMERA_OPTION.forEach(function (key) {
if (option[key] != null) {
this.option[key] = option[key];
}
}, this);
}
},
/**
* Get maptalks instance
*/
getMaptalks: function () {
return this._maptalks;
},
setMaptalks: function (maptalks) {
this._maptalks = maptalks;
}
});
echarts.util.merge(Maptalks3DModel.prototype, componentPostEffectMixin);
echarts.util.merge(Maptalks3DModel.prototype, componentLightMixin);
export default Maptalks3DModel;