| | |
| | | |
| | | <script> |
| | | |
| | | import axios from 'axios' |
| | | import { mapGetters } from 'vuex' |
| | | |
| | | export default { |
| | |
| | | return { |
| | | DC: null, |
| | | dimensionValue: '3 维', |
| | | // 建筑2.5D地图 |
| | | newLayer: null, |
| | | // 电子地图 |
| | | vecLayer: null, |
| | | // 标注 |
| | | cvaLayer: null, |
| | | // 建筑2.5D面数据 |
| | | areaLayer: null, |
| | | provider: null, |
| | | wallLayer: null, |
| | | tileset: null, |
| | |
| | | handler (newCode, oldCode) { |
| | | if (this.titlesetLayerFlag == false && newCode != null) { |
| | | var that = this |
| | | that.vecLayer = that.viewer.imageryLayers.addImageryProvider(new that.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({ |
| | | url: ' http://t1.tianditu.gov.cn/vec_w/wmts?tk=9ae78c51a0a28f06444d541148496e36', |
| | | type: 'wmts', |
| | | layer: 'vec', |
| | | style: 'default', |
| | | format: 'tiles', |
| | | tileMatrixSetID: 'w', |
| | | show: true, |
| | | maximumLevel: 18 |
| | | })) |
| | | |
| | | that.cvaLayer = that.viewer.imageryLayers.addImageryProvider(new that.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({ |
| | | url: ' http://t1.tianditu.gov.cn/cva_w/wmts?tk=9ae78c51a0a28f06444d541148496e36', |
| | | type: 'wmts', |
| | | layer: 'cva', |
| | | style: 'default', |
| | | format: 'tiles', |
| | | tileMatrixSetID: 'w', |
| | | show: true, |
| | | maximumLevel: 18 |
| | | })) |
| | | |
| | | that.tilesetLayer = new that.DC.TilesetLayer('tilesetLayer') |
| | | that.viewer.addLayer(that.tilesetLayer) |
| | | that.tileset = new that.DC.Tileset( |
| | |
| | | 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 |
| | | } |
| | | }) |
| | |
| | | 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 |
| | | }) |
| | | } |
| | | } |
| | | } |
| | |
| | | that.wallLayer.show = false |
| | | that.viewer.imageryLayers.remove(that.newLayer) |
| | | that.newLayer = null |
| | | that.vecLayer = that.viewer.imageryLayers.addImageryProvider(new that.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({ |
| | | url: ' http://t1.tianditu.gov.cn/vec_w/wmts?tk=9ae78c51a0a28f06444d541148496e36', |
| | | type: 'wmts', |
| | | layer: 'vec', |
| | | style: 'default', |
| | | format: 'tiles', |
| | | tileMatrixSetID: 'w', |
| | | show: true, |
| | | maximumLevel: 18 |
| | | })) |
| | | |
| | | that.cvaLayer = that.viewer.imageryLayers.addImageryProvider(new that.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({ |
| | | url: ' http://t1.tianditu.gov.cn/cva_w/wmts?tk=9ae78c51a0a28f06444d541148496e36', |
| | | type: 'wmts', |
| | | layer: 'cva', |
| | | style: 'default', |
| | | format: 'tiles', |
| | | tileMatrixSetID: 'w', |
| | | show: true, |
| | | maximumLevel: 18 |
| | | })) |
| | | 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 |
| | | var provider = new that.DC.Namespace.Cesium.ArcGisMapServerImageryProvider({ |
| | | url: 'http://arcgis.jxpskj.com:6080/arcgis/rest/services/PingXiang25DMapDN/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) |
| | |
| | | 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), |
| | |
| | | // 最小 |
| | | 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 |
| | | } |
| | |
| | | } |
| | | }) |
| | | }; |
| | | 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), |