From 5cf33b2b4217dbe50e7fa0599e09e0ee8ae63db4 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 15 Feb 2022 15:33:02 +0800
Subject: [PATCH] 样式修改
---
src/components/map/index.vue | 347 +++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 249 insertions(+), 98 deletions(-)
diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index a6112c9..7546c3d 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -1,26 +1,127 @@
/* eslint-disable camelcase */
<template>
- <div id="viewer-container"
- style="height: 100%; width: 100%;">
+ <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>
+
+ <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>
<mapPopup />
+
+ <campusBuildingSearch ref="campusBuildingSearch" />
+
+ <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>
</template>
<script>
import { mapGetters } from 'vuex'
-import mapPopup from './component/mapPopup.vue'
+import mapPopup from './components/mapPopup.vue'
+import campusBuildingSearch from './components/campusBuildingSearch.vue'
+import dimension from './components/dimension.vue'
export default {
name: 'mapBox',
components: {
- mapPopup
+ mapPopup,
+ campusBuildingSearch,
+ dimension
},
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: {
@@ -45,7 +146,12 @@
// 详情弹框显示关闭
'detailsPopup',
// 全景弹框显示关闭
- 'panoramaPopup'
+ 'panoramaPopup',
+ // 社区内导航的显示关闭
+ 'campusNavFlag',
+ 'orgNavBarFlag',
+ 'arcNavBarFlag',
+ 'searchPopupFlag'
])
},
mounted () {
@@ -109,10 +215,6 @@
viewer.measure.deactivate()
}
- function gotoModel () {
- viewer.flyTo(tileset)
- }
-
function initViewer () {
viewer = new that.DC.Viewer('viewer-container', {
contextOptions: {
@@ -123,118 +225,167 @@
}
})
+ that.createdLayers(viewer)
+
that.$store.commit('SET_VIEWER', viewer)
that.$refs.leftNav.initialize(viewer)
- const popup = viewer.popup
+ // const key = '0f7c1d161d7352116a21aacf0e9f44c1'
+ // const vec = that.DC.ImageryLayerFactory.createTdtImageryLayer({
+ // key
+ // })
+ // const cva = that.DC.ImageryLayerFactory.createTdtImageryLayer({
+ // key,
+ // style: 'cva'
+ // })
+ // viewer.addBaseLayer([vec, cva])
- popup.hide()
+ // const areaLayer = new that.DC.VectorLayer('areaLayer')
- const baselayer = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
- url:
- 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
- })
- viewer.addBaseLayer(baselayer, {
- iconUrl: 'examples/images/icon/img.png',
- name: '影像'
- })
+ // viewer.addLayer(areaLayer)
- // eslint-disable-next-line camelcase
- const baselayer_shaded = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
- url:
- 'http://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer'
- })
- viewer.addBaseLayer(baselayer_shaded, {
- iconUrl: 'examples/images/icon/elec.png',
- name: '电子'
- })
+ // 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(',')
+ // })
- // eslint-disable-next-line camelcase
- const baselayer_street = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
- url:
- 'http://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer'
- })
- viewer.addBaseLayer(baselayer_street, {
- iconUrl: 'examples/images/icon/ter.png',
- name: '地形'
- })
+ // item.geometry.rings[0] = item.geometry.rings[0].join(';')
- // eslint-disable-next-line camelcase
- const baselayer_ter = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
- url:
- 'http://services.arcgisonline.com/arcgis/rest/services/World_Terrain_Base/MapServer'
- })
- viewer.addBaseLayer(baselayer_ter, {
- iconUrl: 'examples/images/icon/ter.png',
- name: '地形'
- })
+ // const polygon = new that.DC.Polygon(item.geometry.rings[0])
- const layer = new that.DC.TilesetLayer('layer')
- viewer.addLayer(layer)
- const tileset = new that.DC.Tileset(
- 'http://resource.dvgis.cn/data/3dtiles/ljz/tileset.json'
- )
- const style = new that.DC.TilesetStyle()
- style.color = {
- conditions: [
- // eslint-disable-next-line no-template-curly-in-string
- ['${Height} >= 300', 'rgba(45, 0, 75, 0.5)'],
- // eslint-disable-next-line no-template-curly-in-string
- ['${Height} >= 200', 'rgb(102, 71, 151)'],
- // eslint-disable-next-line no-template-curly-in-string
- ['${Height} >= 100', 'rgb(170, 162, 204)'],
- // eslint-disable-next-line no-template-curly-in-string
- ['${Height} >= 50', 'rgb(224, 226, 238)'],
- // eslint-disable-next-line no-template-curly-in-string
- ['${Height} >= 25', 'rgb(252, 230, 200)'],
- // eslint-disable-next-line no-template-curly-in-string
- ['${Height} >= 10', 'rgb(248, 176, 87)'],
- // eslint-disable-next-line no-template-curly-in-string
- ['${Height} >= 5', 'rgb(198, 106, 11)'],
- // eslint-disable-next-line no-template-curly-in-string
- ['true', 'rgb(127, 59, 8)']
- ]
- }
+ // polygon.setStyle({
+
+ // material: that.DC.Namespace.Cesium.Color.fromBytes(255, 255, 255, 0)
+
+ // })
+
+ // areaLayer.addOverlay(polygon)
+ // })
+ // })
+
+ // 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.addBaseLayer(wmtslayer, {
+ // iconUrl: 'examples/images/icon/img.png',
+ // name: '影像'
+ // })
+
+ // // eslint-disable-next-line camelcase
+ // const baselayer_shaded = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
+ // url:
+ // 'http://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer'
+ // })
+ // viewer.addBaseLayer(baselayer_shaded, {
+ // iconUrl: 'examples/images/icon/elec.png',
+ // name: '电子'
+ // })
+
+ // // eslint-disable-next-line camelcase
+ // const baselayer_street = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
+ // url:
+ // 'http://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer'
+ // })
+ // viewer.addBaseLayer(baselayer_street, {
+ // iconUrl: 'examples/images/icon/ter.png',
+ // name: '地形'
+ // })
+
+ // // eslint-disable-next-line camelcase
+ // const baselayer_ter = that.DC.ImageryLayerFactory.createArcGisImageryLayer({
+ // url:
+ // 'http://services.arcgisonline.com/arcgis/rest/services/World_Terrain_Base/MapServer'
+ // })
+ // viewer.addBaseLayer(baselayer_ter, {
+ // iconUrl: 'examples/images/icon/ter.png',
+ // name: '地形'
+ // })
viewer.use(new that.DC.Measure())
- tileset.setStyle(style)
- layer.addOverlay(tileset)
- viewer.flyTo(tileset)
-
- tileset.on(that.DC.MouseEventType.CLICK, e => {
- // that.popupFlag = true
-
- viewer.scene.globe.depthTestAgainstTerrain = false
-
- // 定制化窗体
- // eslint-disable-next-line no-unused-vars
- var popup = new that.DC.DivForms(that.viewer, {
- domId: 'divFormsDomBox',
- position: [
- e.position
- ]
- })
-
- that.$store.commit('SET_PANORAMAPOPUP', false)
- that.$store.commit('SET_DETAILSPOPUP', true)
- })
-
- // viewer.zoomToPosition(
- // new DC.Position(105.565571, 31.984708, 15362816, 0, -90)
+ // viewer.flyToPosition(
+ // new that.DC.Position(117.08489820, 31.65413916, 1500, 0, -90, 45)
// )
viewer.compass.enable = true
viewer.zoomController.enable = true
viewer.locationBar.enable = true
- viewer.distanceLegend.enable = true
+ viewer.hawkeyeMap.enable = true
+ viewer.hawkeyeMap.addBaseLayer(
+ that.DC.ImageryLayerFactory.createAmapImageryLayer(
+ {
+ crs: 'WGS84'
+ }
+ )
+ )
+ // viewer.distanceLegend.enable = true
}
that.DC.ready(initViewer)
},
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)
+ }
}
}
</script>
--
Gitblit v1.9.3