111111
Showing
5 changed files
with
64 additions
and
7 deletions
... | @@ -10,7 +10,7 @@ export default class createDraw { | ... | @@ -10,7 +10,7 @@ export default class createDraw { |
10 | } | 10 | } |
11 | distance() { | 11 | distance() { |
12 | this.handlerDis.measureEvt.addEventListener(result => { | 12 | this.handlerDis.measureEvt.addEventListener(result => { |
13 | var dis = Number(result.distance), distance = dis > 1000 ? (dis / 1000).toFixed(2) + 'km' : dis.toFixed(2) + 'm'; | 13 | var dis = Number(result.distance), distance = dis > 1000 ? (dis / 1000).toFixed(2) + 'km' : dis.toFixed(2) + 'm'; |
14 | this.handlerDis.disLabel.text = '距离:' + distance; | 14 | this.handlerDis.disLabel.text = '距离:' + distance; |
15 | }); | 15 | }); |
16 | this.handlerDis.activeEvt.addEventListener(this.handle()); | 16 | this.handlerDis.activeEvt.addEventListener(this.handle()); | ... | ... |
... | @@ -18,8 +18,7 @@ export default class flood { | ... | @@ -18,8 +18,7 @@ export default class flood { |
18 | this.positions2d.push(latitude); | 18 | this.positions2d.push(latitude); |
19 | this.positions2d.push(1000.0); | 19 | this.positions2d.push(1000.0); |
20 | } | 20 | } |
21 | } | 21 | } |
22 | return positions; | ||
23 | }); | 22 | }); |
24 | } | 23 | } |
25 | initHyp() { | 24 | initHyp() { | ... | ... |
src/assets/js/map/heightControl.js
0 → 100644
1 | import objectManage from './maputils'; | ||
2 | export default class heightControl { | ||
3 | constructor() { | ||
4 | this.handlerPolygon = new Cesium.DrawHandler(objectManage.viewer, Cesium.DrawMode.Polygon); | ||
5 | this.handlerPolygon.drawEvt.addEventListener(result => { | ||
6 | var array = [].concat(result.object.positions), positions = []; | ||
7 | var polygon = result.object; | ||
8 | if(!polygon) return; | ||
9 | polygon.show = false; | ||
10 | this.handlerPolygon.polyline.show = false; | ||
11 | for(var i = 0, len = array.length; i < len; i++){ | ||
12 | var cartographic = Cesium.Cartographic.fromCartesian(array[i]); | ||
13 | var longitude = Cesium.Math.toDegrees(cartographic.longitude); | ||
14 | var latitude = Cesium.Math.toDegrees(cartographic.latitude); | ||
15 | if(positions.indexOf(longitude)===-1&&positions.indexOf(latitude)===-1){ | ||
16 | positions.push(longitude); | ||
17 | positions.push(latitude); | ||
18 | } | ||
19 | } | ||
20 | this.polygon = objectManage.viewer.entities.add({ | ||
21 | id: 'polygonA', | ||
22 | polygon: { | ||
23 | hierarchy: Cesium.Cartesian3.fromDegreesArray(positions), | ||
24 | height: 105, | ||
25 | material: new Cesium.Color(1, 1, 0.20, 0.5), | ||
26 | outline: true, | ||
27 | outlineColor: Cesium.Color.RED | ||
28 | } | ||
29 | }).polygon; | ||
30 | }); | ||
31 | } | ||
32 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -41,6 +41,7 @@ | ... | @@ -41,6 +41,7 @@ |
41 | </template> | 41 | </template> |
42 | 42 | ||
43 | <script> | 43 | <script> |
44 | import height from "../assets/js/map/heightControl"; | ||
44 | export default { | 45 | export default { |
45 | name: 'tjxAnslysis', | 46 | name: 'tjxAnslysis', |
46 | components: {}, | 47 | components: {}, |
... | @@ -49,16 +50,19 @@ | ... | @@ -49,16 +50,19 @@ |
49 | src: 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3820738330,1510784229&fm=26&gp=0.jpg' | 50 | src: 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3820738330,1510784229&fm=26&gp=0.jpg' |
50 | } | 51 | } |
51 | }, | 52 | }, |
52 | mounted() {}, | 53 | mounted() { |
54 | this.height instanceof height || (this.height = new height()); | ||
55 | }, | ||
53 | methods: { | 56 | methods: { |
54 | closePop() { | 57 | closePop() { |
55 | this.$emit('closePop', 'tjxAnslysis') | 58 | this.$emit('closePop', 'tjxAnslysis') |
56 | }, | 59 | }, |
57 | startAnalysis() { | 60 | startAnalysis() { |
58 | 61 | this.height.handlerPolygon.deactivate(); | |
62 | this.height.handlerPolygon.activate(); | ||
59 | }, | 63 | }, |
60 | stopAnalysis() { | 64 | stopAnalysis() { |
61 | 65 | this.height.polygon.height = 50; | |
62 | }, | 66 | }, |
63 | } | 67 | } |
64 | } | 68 | } | ... | ... |
... | @@ -127,6 +127,7 @@ | ... | @@ -127,6 +127,7 @@ |
127 | // import flood from "../assets/js/map/flood"; | 127 | // import flood from "../assets/js/map/flood"; |
128 | // import viewpoint from "../assets/js/map/viewpoint"; | 128 | // import viewpoint from "../assets/js/map/viewpoint"; |
129 | // import visual from "../assets/js/map/visual"; | 129 | // import visual from "../assets/js/map/visual"; |
130 | import { loadModules } from "esri-loader"; | ||
130 | 131 | ||
131 | 132 | ||
132 | import TopTitle from '../components/topTitle'; | 133 | import TopTitle from '../components/topTitle'; |
... | @@ -194,6 +195,24 @@ | ... | @@ -194,6 +195,24 @@ |
194 | } | 195 | } |
195 | }, | 196 | }, |
196 | mounted() { | 197 | mounted() { |
198 | // loadModules([ | ||
199 | // "esri/Map", | ||
200 | // "esri/Basemap", | ||
201 | // "esri/views/MapView", | ||
202 | // "esri/layers/TileLayer", | ||
203 | // "esri/layers/WebTileLayer", | ||
204 | // // "dojo/domReady!" | ||
205 | // ]).then(([Map, Basemap, MapView, TileLayer, WebTileLayer]) => { | ||
206 | |||
207 | // // let configure = mapUrl[a], | ||
208 | // // args = { baseLayers: [] }; | ||
209 | // // configure.layers.forEach(e => { | ||
210 | // // args.baseLayers.push(new WebTileLayer(e)); | ||
211 | // // }); | ||
212 | // // configure.url && (args.baseLayers.thumbnailUrl = configure.url); | ||
213 | // // this.map.basemap = new Basemap(args); | ||
214 | // }); | ||
215 | |||
197 | this.viewer = new Cesium.Viewer('cesiumContainer', {shadows : true}); | 216 | this.viewer = new Cesium.Viewer('cesiumContainer', {shadows : true}); |
198 | this.viewer.imageryLayers.addImageryProvider(new Cesium.TiandituImageryProvider({ | 217 | this.viewer.imageryLayers.addImageryProvider(new Cesium.TiandituImageryProvider({ |
199 | credit : new Cesium.Credit('天地图全球影像服务'), | 218 | credit : new Cesium.Credit('天地图全球影像服务'), |
... | @@ -233,7 +252,8 @@ | ... | @@ -233,7 +252,8 @@ |
233 | var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?'; | 252 | var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?'; |
234 | widget.showErrorPanel(title, undefined, e); | 253 | widget.showErrorPanel(title, undefined, e); |
235 | } | 254 | } |
236 | }); | 255 | }); |
256 | |||
237 | }, | 257 | }, |
238 | methods: { | 258 | methods: { |
239 | searchRoat(val) { | 259 | searchRoat(val) { |
... | @@ -331,6 +351,7 @@ | ... | @@ -331,6 +351,7 @@ |
331 | EtjxAnslysis(val) { | 351 | EtjxAnslysis(val) { |
332 | this[val] = !this[val]; | 352 | this[val] = !this[val]; |
333 | this.onlySelect(val); | 353 | this.onlySelect(val); |
354 | |||
334 | }, | 355 | }, |
335 | // 可视化分析 | 356 | // 可视化分析 |
336 | EvisualField(val) { | 357 | EvisualField(val) { |
... | @@ -346,6 +367,7 @@ | ... | @@ -346,6 +367,7 @@ |
346 | EkgAnalusis(val) { | 367 | EkgAnalusis(val) { |
347 | this[val] = !this[val]; | 368 | this[val] = !this[val]; |
348 | this.onlySelect(val); | 369 | this.onlySelect(val); |
370 | |||
349 | }, | 371 | }, |
350 | // 关闭pop方法 | 372 | // 关闭pop方法 |
351 | closePop(val) { | 373 | closePop(val) { | ... | ... |
-
Please register or sign in to post a comment