From e40ee62d3e9b71ffe3432d32a53a00c4097b5708 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 31 Dec 2021 09:03:28 +0800
Subject: [PATCH] +3d  2.5d

---
 src/components/map/index.vue |  394 +++++++++++++++++++------------------------------------
 1 files changed, 139 insertions(+), 255 deletions(-)

diff --git a/src/components/map/index.vue b/src/components/map/index.vue
index fe26a72..20e9a18 100644
--- a/src/components/map/index.vue
+++ b/src/components/map/index.vue
@@ -3,209 +3,66 @@
     <div id="viewer-container"
          style="height: 100%; width: 100%;">
 
-        <div v-show='popupFlag'
-             id="modelPopup"
-             style="width: 366px;
-                height: 240px;
-                background: url(/img/bg/nav-bg.jpeg) no-repeat;
-                background-size: 100% 100%;">
-            <div class="header">
-                <div class="logo">
-                    <img src="/img/navicon/map.png"
-                         alt="">
-                </div>
-                <div class="title">
-                    明德楼
-                </div>
-                <div class="close">
-                    <img src="/img/navicon/close.png"
-                         alt="">
-                </div>
-            </div>
-            <div class="content">
-                <div class="img">
-
-                </div>
-                <div class="meau">
-
-                </div>
-            </div>
-        </div>
-
-        <div id="map_popup_content">
-        </div>
-
-        <div ref="mapContentContent"
-             v-show="false"
-             id="map_content_content">
-            <div id="mapChildContent">
-                <div class="arc-bcg">
-                    <img :src="popupBgUrl"
-                         alt="">
-                </div>
-                <div class="popup-nav">
-                    <ul>
-                        <li class="come-here-fun">
-                            <i class="popup-icon come-nav deblurring"></i>
-                            到这
-                        </li>
-                        <li class="get-to-fun">
-                            <i class="popup-icon start-nav deblurring"></i>
-                            出发
-                        </li>
-                        <li class="qr-code-fun">
-                            <i class="popup-icon qr-code-nav deblurring"></i>
-                            二维码
-                        </li>
-                        <li class="imgs-fun">
-                            <i class="popup-icon atlas-nav deblurring"></i>
-                            图集
-                        </li>
-                        <li>
-                            <i class="popup-icon live-action-nav deblurring"></i>
-                            实景
-                        </li>
-                    </ul>
-                </div>
-                <div class="arc-box">
-                    <ul class="tab-btn">
-                        <li class="on">教学科研行政</li>
-                        <li>生活服务</li>
-                    </ul>
-                    <div class="btm-content">
-                        <div class="on">
-                            <ul>
-                                <li>
-                                    <i class="popup-icon location-icon deblurring"></i>
-                                    教学楼
-                                </li>
-                                <li>
-                                    <i class="popup-icon location-icon deblurring"></i>
-                                    教学楼
-                                </li>
-                            </ul>
-                        </div>
-                        <div>
-                            <ul>
-                                <li>
-                                    <i class="popup-icon location-icon deblurring"></i>
-                                    生活楼
-                                </li>
-                                <li>
-                                    <i class="popup-icon location-icon deblurring"></i>
-                                    生活楼
-                                </li>
-                            </ul>
-                        </div>
-                    </div>
-                </div>
-                <div class="btm-box"></div>
-            </div>
-        </div>
-
-        <!-- 二维码弹框相关 -->
-        <el-dialog title="场景二维码"
-                   :visible.sync="QRCodeFlag"
-                   width='44%'
-                   :before-close="handleClose">
-            <div style="margin: 0; position: relative; width: 100%; height: 352px;">
-                <img width="260"
-                     :src="pupupQRUrl"
-                     alt=""
-                     style="position: absolute;
-                    top: 0;
-                    left: 0;
-                    right: 0;
-                    bottom: 0;
-                    margin: auto">
-                <div style="position: absolute; bottom: 0; width: 100%; line-height: 36px; text-align: center;">
-                    (右键另存为图片)
-                </div>
-            </div>
-        </el-dialog>
-
         <left-nav ref="leftNav"></left-nav>
 
-        <campusNav :comeName="comeName"
-                   :getToName="getToName"
+        <mapPopup />
+
+        <campusBuildingSearch />
+
+        <campusNav ref="campusNavRoute"
                    v-show="campusNavFlag" />
-
-        <el-image v-show="false"
-                  style="width: 100px; height: 100px"
-                  :src="url"
-                  :preview-src-list="srcList"
-                  ref="popupImgs">
-        </el-image>
-
     </div>
 </template>
 <script>
 
 import { mapGetters } from 'vuex'
-
-var $ = window.$
+import mapPopup from './components/mapPopup.vue'
+import campusBuildingSearch from './components/campusBuildingSearch.vue'
 
 export default {
     name: 'mapBox',
+    components: {
+        mapPopup,
+        campusBuildingSearch
+    },
     data () {
         return {
-            popupFlag: false,
-            campusNavFlag: false,
-            comeName: '',
-            getToName: '',
-            QRCodeFlag: false,
-            url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
-            srcList: [
-                'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
-                'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
-            ]
+            DC: null
         }
     },
     computed: {
         ...mapGetters([
             'viewer',
             'popupBgUrl',
-            'pupupQRUrl'
+            'pupupQRUrl',
+            // 终点
+            'terminus',
+            // 起点
+            'startingPoint',
+            // 点信息
+            'pointPosition',
+            // 点名称
+            'stateName',
+            // 地址
+            'siteName',
+            // 介绍
+            'introduceText',
+            // 全景地址
+            'panoramaUrl',
+            // 详情弹框显示关闭
+            'detailsPopup',
+            // 全景弹框显示关闭
+            'panoramaPopup',
+            // 校内导航的显示关闭
+            'campusNavFlag'
         ])
     },
     mounted () {
         var that = this
 
-        this.$nextTick(() => {
-            // 动态添加dom元素,并绑定VUE事件(打开pdf)(.pdf-item为动态添加的元素,放置在父元素.pdf-body下)
-            $('#map_popup_content').on('click', '.arc-bcg', function () {
-                alert(1)
-            })
-
-            $('#map_popup_content').on('click', '.tab-btn li', function (e) {
-                $(this).addClass('on').siblings().removeClass('on')
-
-                $(this).parent().siblings().children(`div:eq(${$(this).index()})`).addClass('on').siblings().removeClass('on')
-            })
-
-            $('#map_popup_content').on('click', '.popup-nav .come-here-fun', function (e) {
-                that.comeName = '成交楼'
-                if (that.campusNavFlag == false) that.campusNavFlag = true
-            })
-
-            $('#map_popup_content').on('click', '.popup-nav .get-to-fun', function (e) {
-                that.getToName = '活动中心'
-                if (that.campusNavFlag == false) that.campusNavFlag = true
-            })
-
-            $('#map_popup_content').on('click', '.popup-nav .qr-code-fun', function (e) {
-                that.QRCodeFlag = true
-            })
-
-            $('#map_popup_content').on('click', '.popup-nav .imgs-fun', function (e) {
-                console.log(that.$refs.popupImgs)
-                that.$refs.popupImgs.clickHandler()
-            })
-        })
-
-        var DC = global.DC
-
         let viewer
+
+        that.DC = global.DC
 
         function distanceSurface () {
             viewer.measure.distanceSurface()
@@ -266,7 +123,7 @@
         }
 
         function initViewer () {
-            viewer = new DC.Viewer('viewer-container', {
+            viewer = new that.DC.Viewer('viewer-container', {
                 contextOptions: {
                     webgl: {
                         stencil: true,
@@ -283,109 +140,136 @@
 
             popup.hide()
 
-            const baselayer = DC.ImageryLayerFactory.createArcGisImageryLayer({
-                url:
-                    'http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
+            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' // 行政区划
+
             })
             viewer.addBaseLayer(baselayer, {
                 iconUrl: 'examples/images/icon/img.png',
                 name: '影像'
             })
 
-            // eslint-disable-next-line camelcase
-            const baselayer_shaded = 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_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 = 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_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 = 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: '地形'
-            })
+            // // 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 layer = new DC.TilesetLayer('layer')
-            viewer.addLayer(layer)
-            const tileset = new DC.Tileset(
-                'http://resource.dvgis.cn/data/3dtiles/ljz/tileset.json'
+            const tilesetLayer = new that.DC.TilesetLayer('tilesetLayer')
+            viewer.addLayer(tilesetLayer)
+            const tileset = new that.DC.Tileset(
+                'http://data.mars3d.cn/3dtiles/max-shihua/tileset.json',
+                {
+                    luminanceAtZenith: 0.5
+                }
             )
-            const style = new DC.TilesetStyle()
-            style.color = {
-                conditions: [
-                    ['${Height} >= 300', 'rgba(45, 0, 75, 0.5)'],
-                    ['${Height} >= 200', 'rgb(102, 71, 151)'],
-                    ['${Height} >= 100', 'rgb(170, 162, 204)'],
-                    ['${Height} >= 50', 'rgb(224, 226, 238)'],
-                    ['${Height} >= 25', 'rgb(252, 230, 200)'],
-                    ['${Height} >= 10', 'rgb(248, 176, 87)'],
-                    ['${Height} >= 5', 'rgb(198, 106, 11)'],
-                    ['true', 'rgb(127, 59, 8)']
-                ]
-            }
-
-            viewer.use(new DC.Measure())
-
-            tileset.setStyle(style)
-            layer.addOverlay(tileset)
-            viewer.flyTo(tileset)
-
-            tileset.on(DC.MouseEventType.CLICK, e => {
-                // that.popupFlag = true
-
-                console.log(e.position)
-
+            tilesetLayer.addOverlay(tileset)
+            setTimeout(() => {
+                viewer.flyTo(tileset)
+            }, 1500)
+            tileset.on(that.DC.MouseEventType.CLICK, e => {
                 viewer.scene.globe.depthTestAgainstTerrain = false
 
+                that.$store.commit('CLEAR_ALL', null)
+
+                var imgArr = ['http://223.82.109.183:2081/zhxy/upload/20211222/f66dc4527eb4cc1b2d33fa3a5b345ed0.jpg']
+
+                that.$store.commit('SET_POPUPBGURL', imgArr[0])
+                that.$store.commit('SET_POPUPQRURL', 'http://223.82.109.183:2081/zhxy/upload/20211222/9c324adea5d9e5b50cd8f874d5f780f4.png')
+                that.$store.commit('SET_POINTPOSITION', [Number(e.wgs84Position.lng), Number(e.wgs84Position.lat), Number(e.wgs84Position.alt), Number(0), Number(0), Number(0)])
+                that.$store.commit('SET_STATENAME', e.overlay.attr.name)
+                that.$store.commit('SET_SITENAME', e.overlay.attr['地址'])
+                that.$store.commit('SET_POPUPIMGATLAS', imgArr)
+
                 // 定制化窗体
-                var divForms = new DC.divForms(viewer, {
-                    domId: 'div1',
-                    title: '成教楼  ',
-                    className: 'divForms-dom',
-                    content: document.getElementById('mapChildContent'),
+                // eslint-disable-next-line no-unused-vars
+                var popup = new that.DC.DivForms(viewer, {
+                    domId: 'divFormsDomBox',
                     position: [
-                        e.position
+                        that.DC.Transform.transformWGS84ToCartesian(new that.DC.Position(Number(e.wgs84Position.lng), Number(e.wgs84Position.lat), Number(e.wgs84Position.alt), Number(0), Number(0), Number(0)))
                     ]
                 })
 
-                // popup.setWrapper('<div></div>')
-
-                // popup.showAt(e.position, document.getElementById('modelPopup'))
+                that.$store.commit('SET_DETAILSPOPUP', true)
+                that.$store.commit('SET_PANORAMAPOPUP', false)
             })
 
-            // viewer.zoomToPosition(
-            //     new DC.Position(105.565571, 31.984708, 15362816, 0, -90)
+            const wallLayer = new that.DC.VectorLayer('wallLayer')
+            viewer.addLayer(wallLayer)
+            var arr = [
+                [115.87597219, 28.74628526, 100],
+                [115.87556558, 28.74415792, 100],
+                [115.87459782, 28.74197687, 100],
+                [115.87371834, 28.74219927, 100],
+                [115.87210924, 28.74182217, 100],
+                [115.86469971, 28.73630725, 100],
+                [115.86387107, 28.73620123, 100],
+                [115.86274498, 28.73616026, 100],
+                [115.86173699, 28.74241350, 100],
+                [115.86105468, 28.74643934, 100],
+                [115.86609240, 28.74642593, 100],
+                [115.87597219, 28.74628526, 100]
+            ]
+            arr.forEach(item => {
+                item = item.join(',')
+            })
+            arr = arr.join(';')
+            const wall = new that.DC.Wall(
+                arr
+            )
+            wall.setStyle({
+                material: new that.DC.WallTrailMaterialProperty({
+                    color: that.DC.Namespace.Cesium.Color.fromBytes(0, 142, 255, 150),
+                    // color: that.DC.Color.CYAN,
+                    speed: 10
+                })
+            })
+            wallLayer.addOverlay(wall)
+
+            // viewer.use(new that.DC.Measure())
+
+            // viewer.flyTo(wallLayer)
+
+            // 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.locationBar.enable = true
+            // viewer.distanceLegend.enable = true
         }
 
-        DC.ready(initViewer)
+        that.DC.ready(initViewer)
     },
     methods: {
-        closeCampusNav () {
-            this.campusNavFlag = false
-        }
+
     }
 }
 </script>

--
Gitblit v1.9.3