111111
Showing
1 changed file
with
37 additions
and
5 deletions
... | @@ -5,20 +5,52 @@ | ... | @@ -5,20 +5,52 @@ |
5 | </template> | 5 | </template> |
6 | <script> | 6 | <script> |
7 | 7 | ||
8 | |||
9 | |||
10 | export default { | 8 | export default { |
11 | components: {}, | 9 | components: {}, |
12 | data() { | 10 | data() { |
13 | return { | 11 | return { |
14 | 12 | viewer: undefined, | |
13 | entity: undefined, | ||
15 | } | 14 | } |
16 | }, | 15 | }, |
17 | mounted() { | 16 | mounted() { |
18 | Cesium.Ion.defaultAccessToken = this.config.mapToken; | 17 | Cesium.Ion.defaultAccessToken = this.config.mapToken; |
19 | var viewer = new Cesium.Viewer('cesiumContainer', { | 18 | this.viewer = new Cesium.Viewer('cesiumContainer', { |
20 | fullscreenButton: true, | 19 | geocoder:true, |
20 | timeline:false | ||
21 | }); | ||
22 | |||
23 | this.viewer.imageryLayers.addImageryProvider( | ||
24 | new Cesium.UrlTemplateImageryProvider({ | ||
25 | url: "https://mt1.google.cn/vt/lyrs=s&hl=zh-CN&x={x}&y={y}&z={z}&s=Gali" | ||
26 | })); | ||
27 | |||
28 | |||
29 | let tileset = new Cesium.Cesium3DTileset({ | ||
30 | url : 'http://localhost:9000/model/e44fe150d09b11eaabec1d24e8548b3a/tileset.json', | ||
31 | skipLevelOfDetail : true, | ||
32 | baseScreenSpaceError : 1024, | ||
33 | skipScreenSpaceErrorFactor : 16, | ||
34 | skipLevels : 1, | ||
35 | immediatelyLoadDesiredLevelOfDetail : false, | ||
36 | loadSiblings : false, | ||
37 | cullWithChildrenBounds : true | ||
38 | }), height = -2440; | ||
39 | this.viewer.scene.primitives.add(tileset); | ||
40 | |||
41 | tileset.readyPromise.then(argument => { | ||
42 | var cartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center); | ||
43 | var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height); | ||
44 | var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height + height); | ||
45 | var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3()); | ||
46 | tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation); | ||
47 | this.viewer.zoomTo(tileset); | ||
21 | }); | 48 | }); |
49 | |||
50 | |||
51 | |||
52 | |||
53 | |||
22 | }, | 54 | }, |
23 | methods: { | 55 | methods: { |
24 | 56 | ... | ... |
-
Please register or sign in to post a comment