Merge remote-tracking branch 'origin/master'
Showing
5 changed files
with
41 additions
and
21 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 | } | ... | ... |
... | @@ -147,8 +147,6 @@ | ... | @@ -147,8 +147,6 @@ |
147 | const Cesium = window.Cesium; | 147 | const Cesium = window.Cesium; |
148 | 148 | ||
149 | 149 | ||
150 | import { loadModules } from 'esri-loader'; | ||
151 | |||
152 | export default { | 150 | export default { |
153 | components: { | 151 | components: { |
154 | TopTitle, | 152 | TopTitle, |
... | @@ -236,22 +234,9 @@ | ... | @@ -236,22 +234,9 @@ |
236 | widget.showErrorPanel(title, undefined, e); | 234 | widget.showErrorPanel(title, undefined, e); |
237 | } | 235 | } |
238 | }); | 236 | }); |
239 | |||
240 | |||
241 | this.loadArcgis(); | ||
242 | 237 | ||
243 | }, | 238 | }, |
244 | methods: { | 239 | methods: { |
245 | loadArcgis() { | ||
246 | loadModules(['esri/views/MapView', 'esri/WebMap']) | ||
247 | .then(([MapView, WebMap]) => { | ||
248 | debugger | ||
249 | }) | ||
250 | .catch(err => { | ||
251 | // handle any errors | ||
252 | console.error(err); | ||
253 | }); | ||
254 | }, | ||
255 | searchRoat(val) { | 240 | searchRoat(val) { |
256 | /** | 241 | /** |
257 | * @param {*} val '为地名地址道路的输入值' | 242 | * @param {*} val '为地名地址道路的输入值' | ... | ... |
-
Please register or sign in to post a comment