| | |
| | | import { mapGetters } from 'vuex' |
| | | import { getSearchList } from '@/api/pc/public/search' |
| | | import axios from 'axios' |
| | | |
| | | const CamPusNavLayer = { |
| | | campusStartLayer: null, |
| | | campusEndLayer: null, |
| | | campusRouteLayer: null |
| | | } |
| | | |
| | | export default { |
| | | name: 'campusNav', |
| | | data () { |
| | | return { |
| | | |
| | | tabOneFlag: true, |
| | | tabTwoFlag: false, |
| | | navigationWay: '步行', |
| | | routeLayer: null, |
| | | toNameText: '', |
| | | comeNameText: '', |
| | | toNameList: [], |
| | |
| | | |
| | | overChouse: false, |
| | | butChouse: '', |
| | | startLayer: null, |
| | | endLayer: null, |
| | | |
| | | pathBoxShow: false, |
| | | pathBoxList: [], |
| | |
| | | // 若是已经有导航,恢复未点击图标 |
| | | if (val == 'start') { |
| | | // 初始化图标图层 |
| | | if (this.endLayer == null) { |
| | | this.endLayer = new global.DC.VectorLayer('endLayer') |
| | | global.viewer.addLayer(this.endLayer) |
| | | if (CamPusNavLayer.campusEndLayer == null) { |
| | | CamPusNavLayer.campusEndLayer = new global.DC.VectorLayer('campusEndLayer') |
| | | global.viewer.addLayer(CamPusNavLayer.campusEndLayer) |
| | | } else { |
| | | this.endLayer.clear() |
| | | CamPusNavLayer.campusEndLayer.clear() |
| | | } |
| | | // console.log("baoliuend", "see"); |
| | | that.$store.commit('SET_STARTINGPOINT', []) |
| | |
| | | ), |
| | | '/img/navicon/end.png' |
| | | ) |
| | | that.endLayer.addOverlay(endEntity) |
| | | CamPusNavLayer.campusEndLayer.addOverlay(endEntity) |
| | | } else if (val == 'end') { |
| | | // 初始化图标图层 |
| | | if (this.startLayer == null) { |
| | | this.startLayer = new global.DC.VectorLayer('startLayer') |
| | | global.viewer.addLayer(this.startLayer) |
| | | if (CamPusNavLayer.campusStartLayer == null) { |
| | | CamPusNavLayer.campusStartLayer = new global.DC.VectorLayer('campusStartLayer') |
| | | global.viewer.addLayer(CamPusNavLayer.campusStartLayer) |
| | | } else { |
| | | this.startLayer.clear() |
| | | CamPusNavLayer.campusStartLayer.clear() |
| | | } |
| | | // console.log("baoliustart", "see"); |
| | | that.$store.commit('SET_TERMINUS', []) |
| | |
| | | ), |
| | | '/img/navicon/start.png' |
| | | ) |
| | | that.startLayer.addOverlay(startEntity) |
| | | CamPusNavLayer.campusStartLayer.addOverlay(startEntity) |
| | | } |
| | | } |
| | | |
| | |
| | | if (val == 'start') { |
| | | title = '点击选择起点' |
| | | // 初始化图标图层 |
| | | if (this.startLayer == null) { |
| | | this.startLayer = new global.DC.VectorLayer('startLayer') |
| | | global.viewer.addLayer(this.startLayer) |
| | | if (CamPusNavLayer.campusStartLayer == null) { |
| | | CamPusNavLayer.campusStartLayer = new global.DC.VectorLayer('campusStartLayer') |
| | | global.viewer.addLayer(CamPusNavLayer.campusStartLayer) |
| | | } else { |
| | | this.startLayer.clear() |
| | | CamPusNavLayer.campusStartLayer.clear() |
| | | } |
| | | } else if (val == 'end') { |
| | | title = '点击选择终点' |
| | | // 初始化图标图层 |
| | | if (this.endLayer == null) { |
| | | this.endLayer = new global.DC.VectorLayer('endLayer') |
| | | global.viewer.addLayer(this.endLayer) |
| | | if (CamPusNavLayer.campusEndLayer == null) { |
| | | CamPusNavLayer.campusEndLayer = new global.DC.VectorLayer('campusEndLayer') |
| | | global.viewer.addLayer(CamPusNavLayer.campusEndLayer) |
| | | } else { |
| | | this.endLayer.clear() |
| | | CamPusNavLayer.campusEndLayer.clear() |
| | | } |
| | | } |
| | | that.overChouse = false // 开启事件 |
| | |
| | | ), |
| | | '/img/navicon/start.png' |
| | | ) |
| | | that.startLayer.addOverlay(startEntity) |
| | | CamPusNavLayer.campusStartLayer.addOverlay(startEntity) |
| | | } else if (that.butChouse == 'end') { |
| | | that.comeNameText = '自定义终点' |
| | | // 传输坐标数据 |
| | |
| | | ), |
| | | '/img/navicon/end.png' |
| | | ) |
| | | that.endLayer.addOverlay(endEntity) |
| | | CamPusNavLayer.campusEndLayer.addOverlay(endEntity) |
| | | } |
| | | title = '' |
| | | tooltip.enable = false |
| | |
| | | tooltip.showAt(e.windowPosition, title) |
| | | }) |
| | | }, |
| | | |
| | | closeModel () { |
| | | if (this.$route.path.indexOf('/campusnavi') != -1) { |
| | | this.$store.dispatch('delVisitedViews', this.$route) |
| | |
| | | this.comeNameText = '' |
| | | this.comeNameList = [] |
| | | this.comeNameShow = false |
| | | if (this.routeLayer != null) { |
| | | this.routeLayer.clear() |
| | | this.pathBoxList = [] |
| | | this.pathBoxShow = false |
| | | |
| | | if (CamPusNavLayer.campusRouteLayer != null) { |
| | | CamPusNavLayer.campusRouteLayer.clear() |
| | | this.isOverRouter = false |
| | | } |
| | | // 清除自定义位置 |
| | | if (this.startLayer != null) { |
| | | this.startLayer.clear() |
| | | // this.startLayer = null; |
| | | if (CamPusNavLayer.campusStartLayer != null) { |
| | | CamPusNavLayer.campusStartLayer.clear() |
| | | // CamPusNavLayer.campusStartLayer = null; |
| | | } |
| | | if (this.endLayer != null) { |
| | | this.endLayer.clear() |
| | | // this.endLayer = null; |
| | | if (CamPusNavLayer.campusEndLayer != null) { |
| | | CamPusNavLayer.campusEndLayer.clear() |
| | | // CamPusNavLayer.campusEndLayer = null; |
| | | } |
| | | this.$store.commit('SET_COMENAME', '') |
| | | this.$store.commit('SET_TERMINUS', null) |
| | |
| | | startNavigation () { |
| | | const that = this |
| | | // 清除自定义位置 |
| | | if (this.startLayer != null) { |
| | | this.startLayer.clear() |
| | | // this.startLayer = null; |
| | | if (CamPusNavLayer.campusStartLayer != null) { |
| | | CamPusNavLayer.campusStartLayer.clear() |
| | | // CamPusNavLayer.campusStartLayer = null; |
| | | } |
| | | if (this.endLayer != null) { |
| | | this.endLayer.clear() |
| | | // this.endLayer = null; |
| | | if (CamPusNavLayer.campusEndLayer != null) { |
| | | CamPusNavLayer.campusEndLayer.clear() |
| | | // CamPusNavLayer.campusEndLayer = null; |
| | | } |
| | | |
| | | if (this.routeLayer == null) { |
| | | this.routeLayer = new global.DC.VectorLayer('navigation') |
| | | global.viewer.addLayer(this.routeLayer) |
| | | if (CamPusNavLayer.campusRouteLayer == null) { |
| | | CamPusNavLayer.campusRouteLayer = new global.DC.VectorLayer('campusRouteLayer') |
| | | global.viewer.addLayer(CamPusNavLayer.campusRouteLayer) |
| | | } else { |
| | | this.routeLayer.clear() |
| | | CamPusNavLayer.campusRouteLayer.clear() |
| | | } |
| | | if (this.startingPoint == null) { |
| | | this.$message('请输入起点!!!') |
| | |
| | | ), |
| | | '/img/navicon/start.png' |
| | | ) |
| | | this.routeLayer.addOverlay(startEntity) |
| | | CamPusNavLayer.campusRouteLayer.addOverlay(startEntity) |
| | | // var end = global.DC.Transform.transformWGS84ToCartesian() |
| | | const endEntity = new global.DC.Billboard( |
| | | new global.DC.Position( |
| | |
| | | ), |
| | | '/img/navicon/end.png' |
| | | ) |
| | | this.routeLayer.addOverlay(endEntity) |
| | | CamPusNavLayer.campusRouteLayer.addOverlay(endEntity) |
| | | |
| | | var routes = '' |
| | | |
| | |
| | | |
| | | const polyline = new global.DC.Polyline(routes) |
| | | polyline.setStyle({ |
| | | width: 3, |
| | | material: new global.DC.PolylineTrailMaterialProperty({ |
| | | color: global.DC.Color.RED, |
| | | speed: 10 |
| | | width: 6, |
| | | arcType: true, |
| | | material: new global.DC.PolylineImageTrailMaterialProperty({ |
| | | color: global.DC.Namespace.Cesium.Color.fromBytes(10, 255, 10), |
| | | speed: 60, |
| | | image: '/img/icon/right.png', |
| | | repeat: { x: 320, y: 1 } |
| | | }), |
| | | clampToGround: true |
| | | }) |
| | | this.routeLayer.addOverlay(polyline) |
| | | |
| | | CamPusNavLayer.campusRouteLayer.addOverlay(polyline) |
| | | if (this.twoOrThree == '真三维') { |
| | | global.viewer.flyTo(this.routeLayer) |
| | | global.viewer.flyTo(CamPusNavLayer.campusRouteLayer) |
| | | } else { |
| | | var longitude = null |
| | | var latitude = null |
| | |
| | | |
| | | const polyline = new global.DC.Polyline(routes) |
| | | polyline.setStyle({ |
| | | width: 3, |
| | | material: new global.DC.PolylineTrailMaterialProperty({ |
| | | color: global.DC.Color.RED, |
| | | speed: 10 |
| | | width: 6, |
| | | arcType: true, |
| | | material: new global.DC.PolylineImageTrailMaterialProperty({ |
| | | color: global.DC.Namespace.Cesium.Color.fromBytes(10, 255, 10), |
| | | speed: 60, |
| | | image: '/img/icon/right.png', |
| | | repeat: { x: 320, y: 1 } |
| | | }), |
| | | clampToGround: true |
| | | }) |
| | | this.routeLayer.addOverlay(polyline) |
| | | |
| | | CamPusNavLayer.campusRouteLayer.addOverlay(polyline) |
| | | |
| | | if (this.twoOrThree == '真三维') { |
| | | global.viewer.flyTo(this.routeLayer) |
| | | global.viewer.flyTo(CamPusNavLayer.campusRouteLayer) |
| | | } else { |
| | | var longitude = null |
| | | var latitude = null |
| | |
| | | }, |
| | | |
| | | clearLayer () { |
| | | if (this.routeLayer != null) { |
| | | this.routeLayer.clear() |
| | | if (CamPusNavLayer.campusRouteLayer != null) { |
| | | CamPusNavLayer.campusRouteLayer.clear() |
| | | this.pathBoxList = [] |
| | | this.pathBoxShow = false |
| | | } |
| | | }, |
| | | |