From 26215b4645227b91a58f3e56103c0f0c6ccb46b2 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 09 Feb 2022 11:20:57 +0800
Subject: [PATCH] +
---
src/components/mobilemap/index.vue | 152 ++++++++++++++++++++++++
package.json | 124 ++++++++++----------
src/store/modules/mobile.js | 10 +
src/store/modules/mobilePosition.js | 24 ++--
4 files changed, 228 insertions(+), 82 deletions(-)
diff --git a/package.json b/package.json
index c8ee387..b33568a 100644
--- a/package.json
+++ b/package.json
@@ -1,66 +1,66 @@
{
- "name": "smart-campus",
- "version": "0.1.0",
- "private": true,
- "scripts": {
- "serve": "vue-cli-service serve",
- "build": "vue-cli-service build",
- "lint": "vue-cli-service lint"
- },
- "dependencies": {
- "@dvgis/dc-sdk": "^2.5.0",
- "axios": "^0.22.0",
- "core-js": "^3.6.5",
- "echarts": "^5.2.1",
- "element-ui": "^2.15.6",
- "lodash": "^4.17.21",
- "vue": "^2.6.11",
- "vue-axios": "^3.3.7",
- "vue-router": "^3.5.2",
- "vuex": "^3.6.2"
- },
- "devDependencies": {
- "@vue/cli-plugin-babel": "~4.5.0",
- "@vue/cli-plugin-eslint": "~4.5.0",
- "@vue/cli-plugin-router": "~4.5.0",
- "@vue/cli-plugin-vuex": "~4.5.0",
- "@vue/cli-service": "~4.5.0",
- "@vue/eslint-config-standard": "^5.1.2",
- "babel-eslint": "^10.1.0",
- "eslint": "^6.7.2",
- "eslint-plugin-import": "^2.20.2",
- "eslint-plugin-node": "^11.1.0",
- "eslint-plugin-promise": "^4.2.1",
- "eslint-plugin-standard": "^4.0.0",
- "eslint-plugin-vue": "^6.2.2",
- "node-sass": "^7.0.1",
- "sass-loader": "^8.0.2",
- "script-loader": "^0.7.2",
- "vue-template-compiler": "^2.6.11",
- "compression-webpack-plugin": "^5.0.1"
- },
- "eslintConfig": {
- "root": true,
- "env": {
- "node": true
+ "name": "smart-campus",
+ "version": "0.1.0",
+ "private": true,
+ "scripts": {
+ "serve": "vue-cli-service serve",
+ "build": "vue-cli-service build",
+ "lint": "vue-cli-service lint"
},
- "extends": [
- "plugin:vue/essential",
- "@vue/standard"
- ],
- "parserOptions": {
- "parser": "babel-eslint"
+ "dependencies": {
+ "@dvgis/dc-sdk": "^2.5.0",
+ "axios": "^0.22.0",
+ "core-js": "^3.6.5",
+ "echarts": "^5.2.1",
+ "element-ui": "^2.15.6",
+ "lodash": "^4.17.21",
+ "vue": "^2.6.11",
+ "vue-axios": "^3.3.7",
+ "vue-router": "^3.5.2",
+ "vuex": "^3.6.2"
},
- "rules": {
- "indent": "off",
- "eqeqeq": [
- "off"
- ]
- }
- },
- "browserslist": [
- "> 1%",
- "last 2 versions",
- "not dead"
- ]
+ "devDependencies": {
+ "@vue/cli-plugin-babel": "~4.5.0",
+ "@vue/cli-plugin-eslint": "~4.5.0",
+ "@vue/cli-plugin-router": "~4.5.0",
+ "@vue/cli-plugin-vuex": "~4.5.0",
+ "@vue/cli-service": "~4.5.0",
+ "@vue/eslint-config-standard": "^5.1.2",
+ "babel-eslint": "^10.1.0",
+ "eslint": "^6.7.2",
+ "eslint-plugin-import": "^2.20.2",
+ "eslint-plugin-node": "^11.1.0",
+ "eslint-plugin-promise": "^4.2.1",
+ "eslint-plugin-standard": "^4.0.0",
+ "eslint-plugin-vue": "^6.2.2",
+ "node-sass": "^4.12.0",
+ "sass-loader": "^8.0.2",
+ "script-loader": "^0.7.2",
+ "vue-template-compiler": "^2.6.11",
+ "compression-webpack-plugin": "^5.0.1"
+ },
+ "eslintConfig": {
+ "root": true,
+ "env": {
+ "node": true
+ },
+ "extends": [
+ "plugin:vue/essential",
+ "@vue/standard"
+ ],
+ "parserOptions": {
+ "parser": "babel-eslint"
+ },
+ "rules": {
+ "indent": "off",
+ "eqeqeq": [
+ "off"
+ ]
+ }
+ },
+ "browserslist": [
+ "> 1%",
+ "last 2 versions",
+ "not dead"
+ ]
}
diff --git a/src/components/mobilemap/index.vue b/src/components/mobilemap/index.vue
index 8c377cd..3d9f773 100644
--- a/src/components/mobilemap/index.vue
+++ b/src/components/mobilemap/index.vue
@@ -40,6 +40,7 @@
name: "mobilemapBox",
data() {
return {
+ butbut: null,
DC: "",
bigPopup: {
width: 0,
@@ -279,13 +280,150 @@
// if (height > 2000) {
// conBack(2000);
// }
- if (height < 0 && isSet) {
- conBack(0);
+ if (height <= 220 && isSet) {
+ conBack(220);
}
- if (height > 4000 && isSet) {
- conBack(4000);
+ // if (height > 220 && height <= 280 && isSet) {
+ // conBack(280);
+ // }
+ // if (height > 280 && height <= 340 && isSet) {
+ // conBack(340);
+ // }
+ // if (height > 340 && height <= 400 && isSet) {
+ // conBack(400);
+ // }
+ if (height > 400 && isSet) {
+ conBack(400);
}
});
+
+ // 按钮事件
+ that.butbut = function () {
+ //放大
+ document.querySelector(".dc-zoom-controller").children[0].onclick =
+ function () {
+ if (that.dimension == "2.5D") {
+ const height = Math.ceil(
+ viewer.camera.positionCartographic.height
+ );
+
+ if (height > 370) {
+ viewer.camera.setView({
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+ viewer.camera.positionCartographic.longitude,
+ viewer.camera.positionCartographic.latitude,
+ 340
+ ),
+ orientation: {
+ // 指向
+ heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0,
+ },
+ });
+
+ return;
+ }
+
+ if (height > 310) {
+ viewer.camera.setView({
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+ viewer.camera.positionCartographic.longitude,
+ viewer.camera.positionCartographic.latitude,
+ 280
+ ),
+ orientation: {
+ // 指向
+ heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0,
+ },
+ });
+
+ return;
+ }
+
+ if (height > 250) {
+ viewer.camera.setView({
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+ viewer.camera.positionCartographic.longitude,
+ viewer.camera.positionCartographic.latitude,
+ 220
+ ),
+ orientation: {
+ // 指向
+ heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0,
+ },
+ });
+ }
+ }
+ };
+ //缩小
+ document.querySelector(".dc-zoom-controller").children[2].onclick =
+ function () {
+ if (that.dimension == "2.5D") {
+ const height = Math.ceil(
+ viewer.camera.positionCartographic.height
+ );
+
+ if (height <= 250) {
+ viewer.camera.setView({
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+ viewer.camera.positionCartographic.longitude,
+ viewer.camera.positionCartographic.latitude,
+ 280
+ ),
+ orientation: {
+ // 指向
+ heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0,
+ },
+ });
+ }
+
+ if (height > 250 && height <= 310) {
+ viewer.camera.setView({
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+ viewer.camera.positionCartographic.longitude,
+ viewer.camera.positionCartographic.latitude,
+ 340
+ ),
+ orientation: {
+ // 指向
+ heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0,
+ },
+ });
+ }
+
+ if (height > 310 && height < 370) {
+ viewer.camera.setView({
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromRadians(
+ viewer.camera.positionCartographic.longitude,
+ viewer.camera.positionCartographic.latitude,
+ 400
+ ),
+ orientation: {
+ // 指向
+ heading: that.DC.Namespace.Cesium.Math.toRadians(0, 0),
+ // 视角
+ pitch: that.DC.Namespace.Cesium.Math.toRadians(-90),
+ roll: 0.0,
+ },
+ });
+ }
+ }
+ };
+ };
// 地图点击事件
// viewer.on(DC.MouseEventType.CLICK, (e) => {
@@ -643,7 +781,8 @@
};
that.dimension == "2.5D"
? doit2(
- [114.03928791, 27.62954732, 360.0],
+ [114.03928791, 27.62954732, 220.0],
+ // [114.04062292, 27.62666834, 220.0],
[
that.dimensionData.heading,
that.dimensionData.pitch,
@@ -826,6 +965,9 @@
}
DC.ready(initViewer);
+ setTimeout(() => {
+ that.butbut();
+ }, 0);
},
methods: {
openPopupS(position, lntLat, query) {
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 360b0e0..e4c1edd 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -203,11 +203,15 @@
// 视角旋转
state.mviewer.scene.screenSpaceCameraController.enableTilt = true;
} else if (data == "2.5D") {
+ console.log("2.5");
state.dimensionData = {
// 维度镜头数据
heading: 0,
pitch: -90,
roll: 0,
+ // heading: global.DC.Namespace.Cesium.Math.toRadians(-9),
+ // pitch: global.DC.Namespace.Cesium.Math.toRadians(-34.54),
+ // roll: 0,
};
//取消3D底图
state.mviewer.imageryLayers.remove(state.vecLayer);
@@ -220,11 +224,11 @@
state.startPointFn(); //移动默认视角
state.areaLayer.show = true; //绿布
//2.5D视角限制
- state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 0;
+ state.mviewer.scene.screenSpaceCameraController.minimumZoomDistance = 220;
// 最大
- state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 4000;
+ state.mviewer.scene.screenSpaceCameraController.maximumZoomDistance = 400;
// 设置相机缩小时的速率
- // state.mviewer.scene.screenSpaceCameraController._minimumZoomRate = 30000;
+ state.mviewer.scene.screenSpaceCameraController._minimumZoomRate = 2000;
// 设置相机放大时的速率
state.mviewer.scene.screenSpaceCameraController._maximumZoomRate = 5906376272000;
// 视角平移
diff --git a/src/store/modules/mobilePosition.js b/src/store/modules/mobilePosition.js
index 992e0bf..2614eaa 100644
--- a/src/store/modules/mobilePosition.js
+++ b/src/store/modules/mobilePosition.js
@@ -49,18 +49,18 @@
var lat = position.coords.latitude;
var lon = position.coords.longitude;
console.log("成功返回经纬度信息");
- Message({
- showClose: true,
- message:
- "成功返回经纬度信息(1)" +
- lon +
- "_" +
- lat +
- "--反应时间:" +
- times(startTime),
- type: "success",
- duration: 0,
- });
+ // Message({
+ // showClose: true,
+ // message:
+ // "成功返回经纬度信息(1)" +
+ // lon +
+ // "_" +
+ // lat +
+ // "--反应时间:" +
+ // times(startTime),
+ // type: "success",
+ // duration: 0,
+ // });
console.log(lon, lat, "成功");
outData([lon, lat]);
};
--
Gitblit v1.9.3