From d9dd5047a8fab9058e1f75ae55d137ede8aa0ee1 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 07 Jan 2022 09:50:24 +0800
Subject: [PATCH] 数据更改处理等

---
 src/components/map/components/dimension.vue |   90 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 64 insertions(+), 26 deletions(-)

diff --git a/src/components/map/components/dimension.vue b/src/components/map/components/dimension.vue
index 0940f19..9634680 100644
--- a/src/components/map/components/dimension.vue
+++ b/src/components/map/components/dimension.vue
@@ -11,6 +11,7 @@
 
 <script>
 
+import axios from 'axios'
 import { mapGetters } from 'vuex'
 
 export default {
@@ -19,9 +20,14 @@
         return {
             DC: null,
             dimensionValue: '3 维',
+            // 建筑2.5D地图
             newLayer: null,
+            // 电子地图
             vecLayer: null,
+            // 标注
             cvaLayer: null,
+            // 建筑2.5D面数据
+            areaLayer: null,
             provider: null,
             wallLayer: null,
             tileset: null,
@@ -282,12 +288,12 @@
                     that.viewer.camera.setView({
                         // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                         // fromDegrees()方法,将经纬度和高程转换为世界坐标
-                        destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(114.0351, 27.6314, 200.0),
+                        destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(114.04062292, 27.62666834, 220.0),
                         orientation: {
                             // 指向
-                            heading: that.DC.Namespace.Cesium.Math.toRadians(108),
+                            heading: that.DC.Namespace.Cesium.Math.toRadians(-9),
                             // 视角
-                            pitch: that.DC.Namespace.Cesium.Math.toRadians(-26.46),
+                            pitch: that.DC.Namespace.Cesium.Math.toRadians(-34.54),
                             roll: 0.0
                         }
                     })
@@ -308,6 +314,31 @@
                     that.viewer.scene.screenSpaceCameraController.enableZoom = true
                     // 视角旋转
                     that.viewer.scene.screenSpaceCameraController.enableTilt = true
+
+                    that.areaLayer = new that.DC.VectorLayer('areaLayer')
+                    that.viewer.addLayer(that.areaLayer)
+
+                    axios.get('http://arcgis.jxpskj.com:6080/arcgis/rest/services/lxxqwxq/MapServer/0/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, 255)
+
+                            })
+
+                            that.areaLayer.addOverlay(polygon)
+                        })
+
+                        that.areaLayer.show = false
+                    })
                 }
             }
         }
@@ -342,34 +373,41 @@
                 }))
                 that.silhouetteBlue.selected = []
                 that.tilesetLayer.show = true
-                that.viewer.camera.setView({
-                    // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
-                    // fromDegrees()方法,将经纬度和高程转换为世界坐标
-                    destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(114.0351, 27.6314, 200.0),
-                    orientation: {
-                        // 指向
-                        heading: that.DC.Namespace.Cesium.Math.toRadians(108),
-                        // 视角
-                        pitch: that.DC.Namespace.Cesium.Math.toRadians(-26.46),
-                        roll: 0.0
-                    }
-                })
-
                 that.viewer.off(that.DC.SceneEventType.CAMERA_CHANGED, that.camerAzoom())
+
                 // 最小
                 that.viewer.scene.screenSpaceCameraController.minimumZoomDistance = 1.0
                 // 最大
                 that.viewer.scene.screenSpaceCameraController.maximumZoomDistance = Number.POSITIVE_INFINITY
                 // 视角旋转
                 that.viewer.scene.screenSpaceCameraController.enableTilt = true
+
+                that.viewer.camera.setView({
+                    // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
+                    // fromDegrees()方法,将经纬度和高程转换为世界坐标
+                    destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(114.04062292, 27.62666834, 220.0),
+                    orientation: {
+                        // 指向
+                        heading: that.DC.Namespace.Cesium.Math.toRadians(-9),
+                        // 视角
+                        pitch: that.DC.Namespace.Cesium.Math.toRadians(-34.54),
+                        roll: 0.0
+                    }
+                })
             } else {
                 that.tilesetLayer.show = false
-                that.viewer.imageryLayers.remove(that.vecLayer)
-                that.vecLayer = null
-                that.viewer.imageryLayers.remove(that.cvaLayer)
-                that.cvaLayer = null
-                var provider = new that.DC.Namespace.Cesium.ArcGisMapServerImageryProvider({
-                    url: 'http://arcgis.jxpskj.com:6080/arcgis/rest/services/PingXiang25DMapQP/MapServer'
+                // that.viewer.imageryLayers.remove(that.vecLayer)
+                // that.vecLayer = null
+                // that.viewer.imageryLayers.remove(that.cvaLayer)
+                // that.cvaLayer = null
+
+                // var provider = new that.DC.Namespace.Cesium.ArcGisMapServerImageryProvider({
+                //     url: 'http://arcgis.jxpskj.com:6080/arcgis/rest/services/PingXiang25DMapQP/MapServer'
+                // })
+
+                var provider = new that.DC.Namespace.Cesium.UrlTemplateImageryProvider({
+                    url: '/wp/{z}/{x}/{y}.png',
+                    fileExtension: 'png'
                 })
 
                 that.newLayer = that.viewer.imageryLayers.addImageryProvider(provider)
@@ -379,7 +417,7 @@
                 that.viewer.camera.setView({
                     // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
                     // fromDegrees()方法,将经纬度和高程转换为世界坐标
-                    destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(114.03928791, 27.62954732, 360.0),
+                    destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(114.039779, 27.629696, 600.0),
                     orientation: {
                         // 指向
                         heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
@@ -393,7 +431,7 @@
                 // 最小
                 that.viewer.scene.screenSpaceCameraController.minimumZoomDistance = 1.0
                 // 最大
-                that.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 6000
+                that.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 3000
                 // 视角旋转
                 that.viewer.scene.screenSpaceCameraController.enableTilt = false
             }
@@ -425,9 +463,9 @@
                     }
                 })
             };
-            if (height > 6000) {
+            if (height > 3000) {
                 that.viewer.camera.setView({
-                    destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(that.viewer.camera.positionCartographic.longitude, that.viewer.camera.positionCartographic.latitude, 6000),
+                    destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(that.viewer.camera.positionCartographic.longitude, that.viewer.camera.positionCartographic.latitude, 3000),
                     orientation: {
                         // 指向
                         heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),

--
Gitblit v1.9.3