'20191208'
Showing
4 changed files
with
30 additions
and
14 deletions
1 | <!-- | 1 | <!-- |
2 | * 火焰效果 | 2 | * 火焰效果 |
3 | * 鼠标点击处会出现火灾效果 | ||
3 | * @Author: jiangbotao | 4 | * @Author: jiangbotao |
4 | * @Date: 2019-12-08 22:39:07 | 5 | * @Date: 2019-12-08 22:39:07 |
5 | * @LastEditors: jiangbotao | 6 | * @LastEditors: jiangbotao |
6 | * @LastEditTime: 2019-12-08 23:11:03 | 7 | * @LastEditTime: 2019-12-09 12:01:09 |
7 | * @FilePath: \superglobevue\src\components\viewer_fire.vue | 8 | * @FilePath: \superglobevue\src\components\viewer_fire.vue |
8 | --> | 9 | --> |
9 | <template> | 10 | <template> |
... | @@ -50,15 +51,16 @@ export default { | ... | @@ -50,15 +51,16 @@ export default { |
50 | } | 51 | } |
51 | }, | 52 | }, |
52 | mounted: function(){ | 53 | mounted: function(){ |
53 | this.smviewer=new Cesium.Viewer('cesiumContainer', { animation: true }); | 54 | var __this = this; |
54 | var scene = this.smviewer.scene; | 55 | __this.smviewer=new Cesium.Viewer('cesiumContainer', { animation: true }); |
56 | var scene = __this.smviewer.scene; | ||
55 | // 隐藏logo | 57 | // 隐藏logo |
56 | $(".cesium-widget-credits")[0].style.visibility="hidden"; | 58 | $(".cesium-widget-credits")[0].style.visibility="hidden"; |
57 | $(".cesium-viewer-animationContainer")[0].style.visibility="hidden"; | 59 | $(".cesium-viewer-animationContainer")[0].style.visibility="hidden"; |
58 | // 隐藏导航工具 | 60 | // 隐藏导航工具 |
59 | // $(".cesium-viewer-navigationContainer")[0].style.visibility="hidden"; | 61 | // $(".cesium-viewer-navigationContainer")[0].style.visibility="hidden"; |
60 | 62 | ||
61 | this.smviewer.imageryLayers.addImageryProvider(new Cesium.TiandituImageryProvider({ | 63 | __this.smviewer.imageryLayers.addImageryProvider(new Cesium.TiandituImageryProvider({ |
62 | mapStyle : Cesium.TiandituMapsStyle.IMG_C, | 64 | mapStyle : Cesium.TiandituMapsStyle.IMG_C, |
63 | token: URL_CONFIG.TOKEN_TIANDITU | 65 | token: URL_CONFIG.TOKEN_TIANDITU |
64 | })); | 66 | })); |
... | @@ -70,11 +72,25 @@ export default { | ... | @@ -70,11 +72,25 @@ export default { |
70 | }); | 72 | }); |
71 | imageryLayers.addImageryProvider(labelImagery); | 73 | imageryLayers.addImageryProvider(labelImagery); |
72 | 74 | ||
73 | this.smviewer.camera.setView({ | 75 | __this.smviewer.camera.setView({ |
74 | destination : Cesium.Cartesian3.fromDegrees(116.34485552299206, 39.99754814959118, 250.0) | 76 | destination : Cesium.Cartesian3.fromDegrees(116.34485552299206, 39.99754814959118, 450.0) |
75 | }); | 77 | }); |
76 | var staticPosition = Cesium.Cartesian3.fromDegrees(116.34516786934411, 39.99753297677145, 10.614538127977399); | 78 | |
77 | var entity = this.smviewer.entities.add({ | 79 | |
80 | var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas); | ||
81 | handler.setInputAction(function(e) { | ||
82 | //首先移除之前添加的点 | ||
83 | // viewer.entities.removeAll(); | ||
84 | //获取点击位置笛卡尔坐标 | ||
85 | var position = scene.pickPosition(e.position); | ||
86 | //将笛卡尔坐标转化为经纬度坐标 | ||
87 | var cartographic = Cesium.Cartographic.fromCartesian(position); | ||
88 | var longitude = Cesium.Math.toDegrees(cartographic.longitude); | ||
89 | var latitude = Cesium.Math.toDegrees(cartographic.latitude); | ||
90 | var height = 2; | ||
91 | |||
92 | var staticPosition = Cesium.Cartesian3.fromDegrees(longitude, latitude, height); | ||
93 | var entity = __this.smviewer.entities.add({ | ||
78 | position : staticPosition | 94 | position : staticPosition |
79 | }); | 95 | }); |
80 | var particleSystem = scene.primitives.add(new Cesium.ParticleSystem({ | 96 | var particleSystem = scene.primitives.add(new Cesium.ParticleSystem({ |
... | @@ -108,7 +124,7 @@ export default { | ... | @@ -108,7 +124,7 @@ export default { |
108 | sizeInMeters: true | 124 | sizeInMeters: true |
109 | })) | 125 | })) |
110 | 126 | ||
111 | this.smviewer.scene.preUpdate.addEventListener(function(scene, time) { | 127 | __this.smviewer.scene.preUpdate.addEventListener(function(scene, time) { |
112 | particleSystem.modelMatrix = computeModelMatrix(entity, time) | 128 | particleSystem.modelMatrix = computeModelMatrix(entity, time) |
113 | // Account for any changes to the emitter model matrix. | 129 | // Account for any changes to the emitter model matrix. |
114 | particleSystem.emitterModelMatrix = computeEmitterModelMatrix() | 130 | particleSystem.emitterModelMatrix = computeEmitterModelMatrix() |
... | @@ -131,6 +147,7 @@ export default { | ... | @@ -131,6 +147,7 @@ export default { |
131 | trs.rotation = Cesium.Quaternion.fromHeadingPitchRoll(hpr, rotation) | 147 | trs.rotation = Cesium.Quaternion.fromHeadingPitchRoll(hpr, rotation) |
132 | return Cesium.Matrix4.fromTranslationRotationScale(trs, emitterModelMatrix) | 148 | return Cesium.Matrix4.fromTranslationRotationScale(trs, emitterModelMatrix) |
133 | } | 149 | } |
150 | }, Cesium.ScreenSpaceEventType.LEFT_CLICK); | ||
134 | 151 | ||
135 | $('#loadingbar').remove(); | 152 | $('#loadingbar').remove(); |
136 | } | 153 | } | ... | ... |
... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
3 | * @Author: jiangbotao | 3 | * @Author: jiangbotao |
4 | * @Date: 2019-12-07 14:24:01 | 4 | * @Date: 2019-12-07 14:24:01 |
5 | * @LastEditors: jiangbotao | 5 | * @LastEditors: jiangbotao |
6 | * @LastEditTime: 2019-12-07 18:19:06 | 6 | * @LastEditTime: 2019-12-09 11:46:57 |
7 | * @FilePath: \superglobevue\src\components\viewer_3dmodel.vue | 7 | * @FilePath: \superglobevue\src\components\viewer_3dmodel.vue |
8 | --> | 8 | --> |
9 | <template> | 9 | <template> | ... | ... |
... | @@ -8,7 +8,7 @@ | ... | @@ -8,7 +8,7 @@ |
8 | * @Author: jiangbotao | 8 | * @Author: jiangbotao |
9 | * @Date: 2019-12-02 09:05:50 | 9 | * @Date: 2019-12-02 09:05:50 |
10 | * @LastEditors: jiangbotao | 10 | * @LastEditors: jiangbotao |
11 | * @LastEditTime: 2019-12-09 09:50:49 | 11 | * @LastEditTime: 2019-12-09 11:38:20 |
12 | * @FilePath: \WebGL_Webpack_Vue\components\viewer.vue | 12 | * @FilePath: \WebGL_Webpack_Vue\components\viewer.vue |
13 | --> | 13 | --> |
14 | <template> | 14 | <template> | ... | ... |
1 | <!-- | 1 | <!-- |
2 | * 开挖分析 | ||
3 | * @Author: jiangbotao | 2 | * @Author: jiangbotao |
4 | * @Date: 2019-12-03 22:31:08 | 3 | * @Date: 2019-12-03 22:31:08 |
5 | * @LastEditors: jiangbotao | 4 | * @LastEditors: jiangbotao |
6 | * @LastEditTime: 2019-12-09 09:48:39 | 5 | * @LastEditTime: 2019-12-09 12:07:37 |
7 | * @FilePath: \superglobevue\src\views\Home.vue | 6 | * @FilePath: \superglobevue\src\views\Home.vue |
8 | --> | 7 | --> |
9 | <template> | 8 | <template> |
... | @@ -11,7 +10,7 @@ | ... | @@ -11,7 +10,7 @@ |
11 | </template> | 10 | </template> |
12 | 11 | ||
13 | <script> | 12 | <script> |
14 | import viewer from "@/components/viewer_s3m_single.vue"; | 13 | import viewer from "@/components/viewer_fire.vue"; |
15 | 14 | ||
16 | export default { | 15 | export default { |
17 | name: "home", | 16 | name: "home", | ... | ... |
-
Please register or sign in to post a comment