| | |
| | | return { |
| | | tabOneFlag: true, |
| | | tabTwoFlag: false, |
| | | DC: null, |
| | | navigationWay: '步行', |
| | | routeLayer: null, |
| | | toNameText: '', |
| | |
| | | } |
| | | }, |
| | | created () { |
| | | this.DC = global.DC |
| | | }, |
| | | mounted () { |
| | | const leftBut = document.querySelectorAll('.el-input-group__prepend') |
| | |
| | | if (val == 'start') { |
| | | // 初始化图标图层 |
| | | if (this.endLayer == null) { |
| | | this.endLayer = new this.DC.VectorLayer('endLayer') |
| | | this.endLayer = new global.DC.VectorLayer('endLayer') |
| | | this.viewer.addLayer(this.endLayer) |
| | | } else { |
| | | this.endLayer.clear() |
| | | } |
| | | // console.log("baoliuend", "see"); |
| | | that.$store.commit('SET_STARTINGPOINT', []) |
| | | const endEntity = new that.DC.Billboard( |
| | | new that.DC.Position( |
| | | const endEntity = new global.DC.Billboard( |
| | | new global.DC.Position( |
| | | Number(this.terminus[0]), |
| | | Number(this.terminus[1]), |
| | | Number(this.terminus[2]) |
| | |
| | | } else if (val == 'end') { |
| | | // 初始化图标图层 |
| | | if (this.startLayer == null) { |
| | | this.startLayer = new this.DC.VectorLayer('startLayer') |
| | | this.startLayer = new global.DC.VectorLayer('startLayer') |
| | | this.viewer.addLayer(this.startLayer) |
| | | } else { |
| | | this.startLayer.clear() |
| | | } |
| | | // console.log("baoliustart", "see"); |
| | | that.$store.commit('SET_TERMINUS', []) |
| | | const startEntity = new that.DC.Billboard( |
| | | new that.DC.Position( |
| | | const startEntity = new global.DC.Billboard( |
| | | new global.DC.Position( |
| | | Number(this.startingPoint[0]), |
| | | Number(this.startingPoint[1]), |
| | | Number(this.startingPoint[2]) |
| | |
| | | title = '点击选择起点' |
| | | // 初始化图标图层 |
| | | if (this.startLayer == null) { |
| | | this.startLayer = new this.DC.VectorLayer('startLayer') |
| | | this.startLayer = new global.DC.VectorLayer('startLayer') |
| | | this.viewer.addLayer(this.startLayer) |
| | | } else { |
| | | this.startLayer.clear() |
| | |
| | | title = '点击选择终点' |
| | | // 初始化图标图层 |
| | | if (this.endLayer == null) { |
| | | this.endLayer = new this.DC.VectorLayer('endLayer') |
| | | this.endLayer = new global.DC.VectorLayer('endLayer') |
| | | this.viewer.addLayer(this.endLayer) |
| | | } else { |
| | | this.endLayer.clear() |
| | |
| | | } |
| | | that.overChouse = false // 开启事件 |
| | | // 地图选点 |
| | | that.clicks = that.viewer.on(that.DC.MouseEventType.CLICK, (e) => { |
| | | that.clicks = that.viewer.on(global.DC.MouseEventType.CLICK, (e) => { |
| | | if (that.overChouse) { |
| | | return |
| | | } |
| | |
| | | // 传输坐标数据 |
| | | that.$store.commit('SET_STARTINGPOINT', [...lnglat, 0]) |
| | | // 起点 |
| | | const startEntity = new that.DC.Billboard( |
| | | new that.DC.Position( |
| | | const startEntity = new global.DC.Billboard( |
| | | new global.DC.Position( |
| | | Number(lnglat[0]), |
| | | Number(lnglat[1]), |
| | | Number(0) |
| | |
| | | // 传输坐标数据 |
| | | that.$store.commit('SET_TERMINUS', [...lnglat, 0]) |
| | | // 终点 |
| | | const endEntity = new that.DC.Billboard( |
| | | new that.DC.Position( |
| | | const endEntity = new global.DC.Billboard( |
| | | new global.DC.Position( |
| | | Number(lnglat[0]), |
| | | Number(lnglat[1]), |
| | | Number(0) |
| | |
| | | // 开启其他地图事件 |
| | | that.$store.commit('set_closeMapClick', false) |
| | | }) |
| | | that.moves = that.viewer.on(that.DC.MouseEventType.MOUSE_MOVE, (e) => { |
| | | that.moves = that.viewer.on(global.DC.MouseEventType.MOUSE_MOVE, (e) => { |
| | | if (that.overChouse) { |
| | | return |
| | | } |
| | |
| | | } |
| | | |
| | | if (this.routeLayer == null) { |
| | | this.routeLayer = new this.DC.VectorLayer('navigation') |
| | | this.routeLayer = new global.DC.VectorLayer('navigation') |
| | | this.viewer.addLayer(this.routeLayer) |
| | | } else { |
| | | this.routeLayer.clear() |
| | |
| | | this.$message('请输入终点!!!') |
| | | } |
| | | |
| | | // var start = this.DC.Transform.transformWGS84ToCartesian() |
| | | const startEntity = new this.DC.Billboard( |
| | | new this.DC.Position( |
| | | // var start = global.DC.Transform.transformWGS84ToCartesian() |
| | | const startEntity = new global.DC.Billboard( |
| | | new global.DC.Position( |
| | | Number(this.startingPoint[0]), |
| | | Number(this.startingPoint[1]), |
| | | Number(this.startingPoint[2]) |
| | |
| | | '/img/navicon/start.png' |
| | | ) |
| | | this.routeLayer.addOverlay(startEntity) |
| | | // var end = this.DC.Transform.transformWGS84ToCartesian() |
| | | const endEntity = new this.DC.Billboard( |
| | | new this.DC.Position( |
| | | // var end = global.DC.Transform.transformWGS84ToCartesian() |
| | | const endEntity = new global.DC.Billboard( |
| | | new global.DC.Position( |
| | | Number(this.terminus[0]), |
| | | Number(this.terminus[1]), |
| | | Number(this.terminus[2]) |
| | |
| | | var endLog = Number(this.terminus[0]).toFixed(6) |
| | | var endLat = Number(this.terminus[1]).toFixed(6) |
| | | |
| | | var origin = this.DC.CoordTransform.WGS84ToGCJ02(startLog, startLat) |
| | | var destination = this.DC.CoordTransform.WGS84ToGCJ02(endLog, endLat) |
| | | var origin = global.DC.CoordTransform.WGS84ToGCJ02(startLog, startLat) |
| | | var destination = global.DC.CoordTransform.WGS84ToGCJ02(endLog, endLat) |
| | | |
| | | if (this.navigationWay == '步行') { |
| | | axios |
| | |
| | | item.polyline.forEach((it) => { |
| | | it = it.split(',') |
| | | lineArr.push( |
| | | this.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(',') |
| | | global.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(',') |
| | | ) |
| | | }) |
| | | |
| | |
| | | routes = |
| | | startLog + ',' + startLat + ';' + routes + endLog + ',' + endLat |
| | | |
| | | const polyline = new this.DC.Polyline(routes) |
| | | const polyline = new global.DC.Polyline(routes) |
| | | polyline.setStyle({ |
| | | width: 3, |
| | | material: new this.DC.PolylineTrailMaterialProperty({ |
| | | color: this.DC.Color.RED, |
| | | material: new global.DC.PolylineTrailMaterialProperty({ |
| | | color: global.DC.Color.RED, |
| | | speed: 10 |
| | | }), |
| | | clampToGround: true |
| | |
| | | this.viewer.camera.setView({ |
| | | // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州 |
| | | // fromDegrees()方法,将经纬度和高程转换为世界坐标 |
| | | destination: this.DC.Namespace.Cesium.Cartesian3.fromDegrees( |
| | | destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees( |
| | | longitude, |
| | | latitude, |
| | | 600 |
| | | ), |
| | | orientation: { |
| | | // 指向 |
| | | heading: this.DC.Namespace.Cesium.Math.toRadians(0, 0), |
| | | heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0), |
| | | // 视角 |
| | | pitch: this.DC.Namespace.Cesium.Math.toRadians(-90), |
| | | pitch: global.DC.Namespace.Cesium.Math.toRadians(-90), |
| | | roll: 0.0 |
| | | } |
| | | }) |
| | |
| | | item.polyline.forEach((it) => { |
| | | it = it.split(',') |
| | | lineArr.push( |
| | | this.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(',') |
| | | global.DC.CoordTransform.GCJ02ToWGS84(it[0], it[1]).join(',') |
| | | ) |
| | | }) |
| | | |
| | |
| | | routes = |
| | | startLog + ',' + startLat + ';' + routes + endLog + ',' + endLat |
| | | |
| | | const polyline = new this.DC.Polyline(routes) |
| | | const polyline = new global.DC.Polyline(routes) |
| | | polyline.setStyle({ |
| | | width: 3, |
| | | material: new this.DC.PolylineTrailMaterialProperty({ |
| | | color: this.DC.Color.RED, |
| | | material: new global.DC.PolylineTrailMaterialProperty({ |
| | | color: global.DC.Color.RED, |
| | | speed: 10 |
| | | }), |
| | | clampToGround: true |
| | |
| | | this.viewer.camera.setView({ |
| | | // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州 |
| | | // fromDegrees()方法,将经纬度和高程转换为世界坐标 |
| | | destination: this.DC.Namespace.Cesium.Cartesian3.fromDegrees( |
| | | destination: global.DC.Namespace.Cesium.Cartesian3.fromDegrees( |
| | | longitude, |
| | | latitude, |
| | | 600 |
| | | ), |
| | | orientation: { |
| | | // 指向 |
| | | heading: this.DC.Namespace.Cesium.Math.toRadians(0, 0), |
| | | heading: global.DC.Namespace.Cesium.Math.toRadians(0, 0), |
| | | // 视角 |
| | | pitch: this.DC.Namespace.Cesium.Math.toRadians(-90), |
| | | pitch: global.DC.Namespace.Cesium.Math.toRadians(-90), |
| | | roll: 0.0 |
| | | } |
| | | }) |