Merge remote-tracking branch 'origin/master'
Showing
5 changed files
with
39 additions
and
19 deletions
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, |
... | @@ -237,21 +235,8 @@ | ... | @@ -237,21 +235,8 @@ |
237 | } | 235 | } |
238 | }); | 236 | }); |
239 | 237 | ||
240 | |||
241 | this.loadArcgis(); | ||
242 | |||
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