threeMap.vue
3.19 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<template>
<div>
<div id="cesiumContainer">
<div id="vertical-slider" style="display: none;"></div>
<div id="horizontal-slider" style="display: none;"></div>
</div>
</div>
</template>
<script>
import objectManage from '../assets/js/map/maputils';
import createDraw from '../assets/js/map/createDraw';
import URL_CONFIG from "./../config/urlConfig.vue";
const Cesium = window.Cesium;
export default {
components: {
},
data() {
return {
viewer: undefined
}
},
mounted() {
let viewer = new Cesium.Viewer('cesiumContainer', {shadows : true});
viewer.imageryLayers.addImageryProvider(new Cesium.TiandituImageryProvider({
credit : new Cesium.Credit('天地图全球影像服务'),
token: URL_CONFIG.TOKEN_TIANDITU
}));
let scene = viewer.scene
scene.shadowMap.darkness = 1; //设置第二重烘焙纹理的效果(明暗程度)
scene.skyAtmosphere.brightnessShift=0.4;
scene.debugShowFramesPerSecond = true;
scene.hdrEnabled = false;
scene.sun.show = true;
this.$parent.draw = new createDraw(viewer);
this.$parent.viewer = viewer;
var promise = [];
promise[0] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, {
name: 'build1'
});
promise[1] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_BUILD, {
name: 'build2'
});
promise[2] = scene.addS3MTilesLayerByScp(URL_CONFIG.SCP_CBD_GROUND1, {
name: 'ground'
});
Cesium.when.all(promise, layers => {
layers[1].shadowType = 2;
layers[2].shadowType = 2;
scene.camera.setView({
destination : Cesium.Cartesian3.fromDegrees(116.44621857300415, 39.899281526734555, 216.7793905027196),
orientation : {
heading : 0.41348036210986194,
pitch : -0.13636490404291735,
roll : 6.283185307179563
}
});
}, function(e){
if (widget._showRenderLoopErrors) {
var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
widget.showErrorPanel(title, undefined, e);
}
});
},
methods: {
}
}
</script>
<style>
html, body, #cesiumContainer {
height: 100%;
padding: 0;
margin: 0;
}
.slider {
position: absolute;
left: 50%;
top: 0px;
background-color: #d3d3d3;
width: 5px;
height: 100%;
z-index: 9999;
}
.slider:hover {
cursor: ew-resize;
}
.home {
position: relative;
width: 100%;
height: 100%;
}
.top {
position: absolute;
z-index: 1000;
color: red;
width: 100%;
/* height: 86.5px; */
height: 124.5px;
}
</style>