From a2df9a29362e71cb49131cc4fe568d99f22b23f9 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Tue, 04 Jan 2022 16:01:07 +0800
Subject: [PATCH] 部分更改
---
src/components/map/components/dimension.vue | 129 ++++++++++++++++++++++---------------------
1 files changed, 66 insertions(+), 63 deletions(-)
diff --git a/src/components/map/components/dimension.vue b/src/components/map/components/dimension.vue
index 2cea995..41bbcc6 100644
--- a/src/components/map/components/dimension.vue
+++ b/src/components/map/components/dimension.vue
@@ -3,8 +3,8 @@
<el-radio-group v-model="dimensionValue"
size="medium"
@change="dimensionChange">
- <el-radio-button label="2.5维"></el-radio-button>
<el-radio-button label="3 维"></el-radio-button>
+ <el-radio-button label="2.5维"></el-radio-button>
</el-radio-group>
</div>
</template>
@@ -18,7 +18,7 @@
data () {
return {
DC: null,
- dimensionValue: '2.5维',
+ dimensionValue: '3 维',
newLayer: null,
provider: null,
wallLayer: null,
@@ -84,7 +84,7 @@
that.tilesetLayer = new that.DC.TilesetLayer('tilesetLayer')
that.viewer.addLayer(that.tilesetLayer)
that.tileset = new that.DC.Tileset(
- 'http://data.mars3d.cn/3dtiles/max-shihua/tileset.json',
+ '/mx/tileset.json',
{
luminanceAtZenith: 0.5
}
@@ -193,14 +193,14 @@
// ]
// })
- var provider = new that.DC.Namespace.Cesium.ArcGisMapServerImageryProvider({
- url: 'http://arcgis.jxpskj.com:6080/arcgis/rest/services/PingXiang25DMapDN/MapServer'
- })
+ // var provider = new that.DC.Namespace.Cesium.ArcGisMapServerImageryProvider({
+ // url: 'http://arcgis.jxpskj.com:6080/arcgis/rest/services/PingXiang25DMapDN/MapServer'
+ // })
- that.newLayer = that.viewer.imageryLayers.addImageryProvider(provider)
+ // that.newLayer = that.viewer.imageryLayers.addImageryProvider(provider)
that.wallLayer = new that.DC.VectorLayer('wallLayer')
- that.viewer.addLayer(that.wallLayer)
+ // that.viewer.addLayer(that.wallLayer)
that.wallArr.forEach(item => {
item = item.join(',')
@@ -216,34 +216,33 @@
speed: 10
})
})
- that.wallLayer.addOverlay(wall)
+ // that.wallLayer.addOverlay(wall)
- that.viewer.camera.setView({
- // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
- // fromDegrees()方法,将经纬度和高程转换为世界坐标
- destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(114.03928791, 27.62954732, 1000.0),
- orientation: {
- // 指向
- heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
- // 视角
- pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
- roll: 0.0
- }
- })
+ // that.viewer.camera.setView({
+ // // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
+ // // fromDegrees()方法,将经纬度和高程转换为世界坐标
+ // destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(114.03928791, 27.62954732, 1000.0),
+ // orientation: {
+ // // 指向
+ // heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // // 视角
+ // pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+ // roll: 0.0
+ // }
+ // })
- this.tilesetLayer.show = false
- this.titlesetLayerFlag = true
+ that.tilesetLayer.show = true
+ that.viewer.flyTo(that.tileset)
+ that.titlesetLayerFlag = true
- that.viewer.on(that.DC.SceneEventType.CAMERA_CHANGED, (e) => {
- that.camerAzoom(e)
- })
+ that.viewer.on(that.DC.SceneEventType.CAMERA_CHANGED, that.camerAzoom())
// 最小
- that.viewer.scene.screenSpaceCameraController.minimumZoomDistance = 500
+ that.viewer.scene.screenSpaceCameraController.minimumZoomDistance = 1.0
// 最大
- that.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 600000
+ that.viewer.scene.screenSpaceCameraController.maximumZoomDistance = Number.POSITIVE_INFINITY
// 设置相机缩小时的速率
- that.viewer.scene.screenSpaceCameraController._minimumZoomRate = 30000
+ // that.viewer.scene.screenSpaceCameraController._minimumZoomRate = 30000
// 设置相机放大时的速率
that.viewer.scene.screenSpaceCameraController._maximumZoomRate = 5906376272000
// 视角平移
@@ -251,7 +250,7 @@
// 视角缩放
that.viewer.scene.screenSpaceCameraController.enableZoom = true
// 视角旋转
- that.viewer.scene.screenSpaceCameraController.enableTilt = false
+ that.viewer.scene.screenSpaceCameraController.enableTilt = true
}
}
}
@@ -267,9 +266,7 @@
that.tilesetLayer.show = true
that.viewer.flyTo(that.tileset)
- that.viewer.off(that.DC.SceneEventType.CAMERA_CHANGED, (e) => {
- that.camerAzoom(e)
- })
+ that.viewer.off(that.DC.SceneEventType.CAMERA_CHANGED, that.camerAzoom())
// 最小
that.viewer.scene.screenSpaceCameraController.minimumZoomDistance = 1.0
// 最大
@@ -326,47 +323,53 @@
}
})
- that.viewer.on(that.DC.SceneEventType.CAMERA_CHANGED, (e) => {
- that.camerAzoom(e)
- })
+ that.viewer.on(that.DC.SceneEventType.CAMERA_CHANGED, that.camerAzoom())
// 最小
that.viewer.scene.screenSpaceCameraController.minimumZoomDistance = 500
// 最大
- that.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 600000
+ that.viewer.scene.screenSpaceCameraController.maximumZoomDistance = 6000
// 视角旋转
that.viewer.scene.screenSpaceCameraController.enableTilt = false
}
},
- camerAzoom (e) {
+ camerAzoom () {
var that = this
- return (e) => {
- const height = Math.ceil(that.viewer.camera.positionCartographic.height)
+ const height = Math.ceil(that.viewer.camera.positionCartographic.height)
- if (height < 100) {
- that.viewer.camera.setView({
- destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(that.viewer.camera.positionCartographic.longitude, that.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 > 600000) {
- that.viewer.camera.setView({
- destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(that.viewer.camera.positionCartographic.longitude, that.viewer.camera.positionCartographic.latitude, 600000),
- orientation: {
- // 指向
- heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
- // 视角
- pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
- roll: 0.0
- }
- })
+ that.viewer.camera.setView({
+ orientation: {
+ // 指向
+ heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0
}
+ })
+
+ if (height < 100) {
+ that.viewer.camera.setView({
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(that.viewer.camera.positionCartographic.longitude, that.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) {
+ that.viewer.camera.setView({
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(that.viewer.camera.positionCartographic.longitude, that.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
+ }
+ })
}
}
}
--
Gitblit v1.9.3