| | |
| | | /* eslint-disable camelcase */ |
| | | <template> |
| | | <div id="viewer-container" |
| | | style="height: 100%; width: 100%;" |
| | | @click="mapClick($event)"> |
| | | <div id="viewer-container" style="height: 100%; width: 100%;" @click="mapClick($event)"> |
| | | <video |
| | | id="video" |
| | | style="position: fixed; |
| | | visibility: hidden;" |
| | | muted |
| | | autoplay |
| | | loop |
| | | crossorigin |
| | | controls |
| | | > |
| | | <source src="http://dc.dvgis.cn/examples/data/demo.mp4" type="video/mp4" /> |
| | | </video> |
| | | |
| | | <dimension /> |
| | | <div |
| | | style=" |
| | | position: fixed; |
| | | left: 4px; |
| | | bottom: 4px; |
| | | width: 80px; |
| | | line-height: 24px; |
| | | text-align: center; |
| | | color: #fff; |
| | | font-size: 14px; |
| | | border-radius: 4px; |
| | | background: #2196f3ed; |
| | | z-index: 11; |
| | | " |
| | | >智慧社区</div> |
| | | |
| | | <dimension :areaLayer="areaLayer" /> |
| | | |
| | | <left-nav ref="leftNav"></left-nav> |
| | | |
| | |
| | | |
| | | <campusBuildingSearch ref="campusBuildingSearch" /> |
| | | |
| | | <campusNav ref="campusNavRoute" |
| | | v-show="campusNavFlag" /> |
| | | <campusNav ref="campusNavRoute" v-show="campusNavFlag" /> |
| | | |
| | | <search-details v-if="searchPopupFlag"></search-details> |
| | | <org-nav-bar v-if="orgNavBarFlag"></org-nav-bar> |
| | | <arc-nav-bar v-if="arcNavBarFlag"></arc-nav-bar> |
| | | </div> |
| | |
| | | }, |
| | | data () { |
| | | return { |
| | | DC: null |
| | | DC: null, |
| | | areaLayer: null |
| | | } |
| | | }, |
| | | watch: { |
| | | searchPopupFlag: { |
| | | immediate: true, |
| | | handler (newVal, oldVal) { |
| | | if (newVal == true) { |
| | | if (this.$route.path.indexOf('/pcLayout/default/service') != -1) { |
| | | this.$store.dispatch('delVisitedViews', this.$route) |
| | | this.$router.push('/pcLayout/default') |
| | | } |
| | | |
| | | if (this.$route.path.indexOf('/orgnav') != -1) { |
| | | this.$store.dispatch('delVisitedViews', this.$route) |
| | | this.$router.push('/pcLayout/default') |
| | | this.$store.commit('SET_ORGNAVBARTITLE', '') |
| | | this.$store.commit('SET_ORGNAVBARLIST', []) |
| | | this.$store.commit('SET_ORGNAVBARFLAG', false) |
| | | } |
| | | |
| | | if (this.orgNavBarFlag == true) { |
| | | this.$store.commit('SET_ORGNAVBARTITLE', '') |
| | | this.$store.commit('SET_ORGNAVBARLIST', []) |
| | | this.$store.commit('SET_ORGNAVBARFLAG', false) |
| | | } |
| | | |
| | | if (this.$route.path.indexOf('/arc') != -1) { |
| | | this.$store.dispatch('delVisitedViews', this.$route) |
| | | this.$router.push('/pcLayout/default') |
| | | this.$store.commit('SET_ARCNAVBARTITLE', '') |
| | | this.$store.commit('SET_ARCNAVBARCODE', '') |
| | | this.$store.commit('SET_ARCNAVBARFLAG', false) |
| | | } |
| | | |
| | | if (this.arcNavBarFlag == true) { |
| | | this.$store.commit('SET_ARCNAVBARTITLE', '') |
| | | this.$store.commit('SET_ARCNAVBARCODE', '') |
| | | this.$store.commit('SET_ARCNAVBARFLAG', false) |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | |
| | | orgNavBarFlag: { |
| | | immediate: true, |
| | | handler (newVal, oldVal) { |
| | | if (newVal == true) { |
| | | this.$store.commit('SET_SEARCHPOPUPFLAG', false) |
| | | } |
| | | } |
| | | }, |
| | | |
| | | arcNavBarFlag: { |
| | | immediate: true, |
| | | handler (newVal, oldVal) { |
| | | if (newVal == true) { |
| | | this.$store.commit('SET_SEARCHPOPUPFLAG', false) |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | 'detailsPopup', |
| | | // 全景弹框显示关闭 |
| | | 'panoramaPopup', |
| | | // 校内导航的显示关闭 |
| | | // 社区内导航的显示关闭 |
| | | 'campusNavFlag', |
| | | 'orgNavBarFlag', |
| | | 'arcNavBarFlag' |
| | | 'arcNavBarFlag', |
| | | 'searchPopupFlag' |
| | | ]) |
| | | }, |
| | | mounted () { |
| | |
| | | } |
| | | }) |
| | | |
| | | that.createdLayers(viewer) |
| | | |
| | | that.$store.commit('SET_VIEWER', viewer) |
| | | |
| | | viewer.on(that.DC.SceneEventType.CAMERA_CHANGED, (e) => { |
| | | const height = Math.ceil(viewer.camera.positionCartographic.height) |
| | | |
| | | if (height < 100) { |
| | | viewer.camera.setView({ |
| | | destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(viewer.camera.positionCartographic.longitude, viewer.camera.positionCartographic.latitude, 100), |
| | | orientation: { |
| | | // 指向 |
| | | heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0), |
| | | // 视角 |
| | | pitch: that.DC.Namespace.Cesium.Math.toRadians(-90), |
| | | roll: 0.0 |
| | | } |
| | | }) |
| | | }; |
| | | if (height > 6000) { |
| | | viewer.camera.setView({ |
| | | destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(viewer.camera.positionCartographic.longitude, viewer.camera.positionCartographic.latitude, 6000), |
| | | orientation: { |
| | | // 指向 |
| | | heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0), |
| | | // 视角 |
| | | pitch: that.DC.Namespace.Cesium.Math.toRadians(-90), |
| | | roll: 0.0 |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | // 最小 |
| | | viewer.scene.screenSpaceCameraController.minimumZoomDistance = 500 |
| | | // 最大 |
| | | viewer.scene.screenSpaceCameraController.maximumZoomDistance = 6000 |
| | | // 设置相机缩小时的速率 |
| | | viewer.scene.screenSpaceCameraController._minimumZoomRate = 30000 |
| | | // 设置相机放大时的速率 |
| | | viewer.scene.screenSpaceCameraController._maximumZoomRate = 5906376272000 |
| | | // 视角平移 |
| | | viewer.scene.screenSpaceCameraController.enableRotate = true |
| | | // 视角缩放 |
| | | viewer.scene.screenSpaceCameraController.enableZoom = true |
| | | // 视角旋转 |
| | | viewer.scene.screenSpaceCameraController.enableTilt = false |
| | | |
| | | that.$refs.leftNav.initialize(viewer) |
| | | |
| | | // const baselayer = that.DC.ImageryLayerFactory.createImageryLayer(that.DC.ImageryType.XYZ, { |
| | | // url: 'https://webmap-tile.sf-express.com/MapTileService/rt?x={col}&y={row}&z={level}' |
| | | // // url: 'https://webmap-tile.sf-express.com/MapTileService/rt?fetchtype=static&x={x}&y={y}&z={z}&project=sfmap&pic_size=256&pic_type=png8&data_name=361100&data_format=merged-dat&data_type=normal' // 行政区划 |
| | | // const key = '0f7c1d161d7352116a21aacf0e9f44c1' |
| | | // const vec = that.DC.ImageryLayerFactory.createTdtImageryLayer({ |
| | | // key |
| | | // }) |
| | | // const cva = that.DC.ImageryLayerFactory.createTdtImageryLayer({ |
| | | // key, |
| | | // style: 'cva' |
| | | // }) |
| | | // viewer.addBaseLayer([vec, cva]) |
| | | |
| | | // const areaLayer = new that.DC.VectorLayer('areaLayer') |
| | | |
| | | // viewer.addLayer(areaLayer) |
| | | |
| | | // axios.get('http://59.55.128.156:6080/arcgis/rest/services/xiajiangfhgc/MapServer/4/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&returnTrueCurves=false&resultOffset=&resultRecordCount=&f=pjson').then(resultData => { |
| | | // resultData.data.features.forEach(item => { |
| | | // item.geometry.rings[0].forEach(it => { |
| | | // it = it.join(',') |
| | | // }) |
| | | |
| | | // item.geometry.rings[0] = item.geometry.rings[0].join(';') |
| | | |
| | | // const polygon = new that.DC.Polygon(item.geometry.rings[0]) |
| | | |
| | | // polygon.setStyle({ |
| | | |
| | | // material: that.DC.Namespace.Cesium.Color.fromBytes(255, 255, 255, 0) |
| | | |
| | | // }) |
| | | |
| | | // areaLayer.addOverlay(polygon) |
| | | // }) |
| | | // }) |
| | | |
| | | const baselayer = that.DC.ImageryLayerFactory.createAmapImageryLayer( |
| | | { |
| | | crs: 'WGS84' |
| | | } |
| | | ) |
| | | viewer.addBaseLayer(baselayer) |
| | | // var select = { |
| | | // overlay: undefined, |
| | | // color: undefined |
| | | // } |
| | | |
| | | // viewer.on(that.DC.MouseEventType.MOUSE_MOVE, e => { |
| | | // if (e.overlay != undefined) { |
| | | // if (select.overlay != undefined) { |
| | | // if (e.overlay != select.overlay) { |
| | | // select.overlay.setStyle({ |
| | | // material: select.color |
| | | // }) |
| | | |
| | | // select.overlay = undefined |
| | | // select.color = undefined |
| | | // } |
| | | // } |
| | | |
| | | // if (select.overlay == undefined) { |
| | | // select.overlay = e.overlay |
| | | |
| | | // select.color = e.overlay._style.material |
| | | // select.overlay.setStyle({ |
| | | |
| | | // material: that.DC.Namespace.Cesium.Color.fromBytes(32, 108, 247, 158) |
| | | |
| | | // }) |
| | | // } |
| | | // } else { |
| | | // if (select.overlay != undefined) { |
| | | // select.overlay.setStyle({ |
| | | // material: select.color |
| | | // }) |
| | | |
| | | // select.overlay = undefined |
| | | // select.color = undefined |
| | | // } |
| | | // } |
| | | // }) |
| | | |
| | | // viewer.on(that.DC.MouseEventType.CLICK, e => { |
| | | // if (e.overlay != undefined) { |
| | | // console.log(e.overlay.attr) |
| | | // } |
| | | // }) |
| | | |
| | | // viewer.addBaseLayer(baselayer, { |
| | | // iconUrl: 'examples/images/icon/img.png', |
| | |
| | | // name: '地形' |
| | | // }) |
| | | |
| | | // viewer.use(new that.DC.Measure()) |
| | | viewer.use(new that.DC.Measure()) |
| | | |
| | | // viewer.flyToPosition( |
| | | // new that.DC.Position(117.08489820, 31.65413916, 1500, 0, -90, 45) |
| | |
| | | }, |
| | | methods: { |
| | | mapClick (e) { |
| | | this.$refs.campusNavRoute.shortcutShow(e) |
| | | this.$refs.campusBuildingSearch.shortcutShow(e) |
| | | }, |
| | | |
| | | createdLayers (viewer) { |
| | | const layerGroup = new this.DC.LayerGroup('modelBox') |
| | | viewer.addLayerGroup(layerGroup) |
| | | |
| | | this.areaLayer = new this.DC.VectorLayer('areaLayer') |
| | | layerGroup.addLayer(this.areaLayer) |
| | | } |
| | | } |
| | | } |