From 85e635307c8802e2d9f741906cb8b3ee88ad5cfb Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 15 Dec 2021 08:41:27 +0800
Subject: [PATCH] +
---
src/components/mobilemap/index.vue | 4 -
src/styles/mobile/popup.scss | 21 +++++++++-
src/store/modules/mobile.js | 1
src/components/mobileCortrol/index.vue | 62 +++++++++++++++++++++++-------
4 files changed, 67 insertions(+), 21 deletions(-)
diff --git a/src/components/mobileCortrol/index.vue b/src/components/mobileCortrol/index.vue
index a189ca4..689f8dc 100644
--- a/src/components/mobileCortrol/index.vue
+++ b/src/components/mobileCortrol/index.vue
@@ -1,28 +1,60 @@
<template>
<div class="m-left-control">
- <div class="m-l-inbut">+</div>
- <div class="m-l-inbut">-</div>
+ <div class="m-l-inbut" @click="zoomIn('+')">+</div>
+ <div class="m-l-inbut" @click="zoomIn('-')">-</div>
</div>
</template>
<script>
+import { mapGetters } from "vuex";
export default {
name: "mobileCortrol",
- computed: {},
- data() {
- return {
- viewer: null,
- DC: null,
- };
+ computed: {
+ ...mapGetters(["mviewer"]),
},
- created() {
- this.DC = global.DC;
- },
- mounted() {},
methods: {
- initialize(viewer) {
- viewer.scene.globe.depthTestAgainstTerrain = false;
- this.viewer = viewer;
+ zoomIn(val) {
+ let camera = this.mviewer.camera;
+ // console.log(camera.moveStart());
+ // this.mviewer.getImageryLayerInfo().then((res) => {
+ // console.log(res);
+ // });
+ var ellipsoid = this.mviewer.scene.globe.ellipsoid;
+ var cartesian3 = DC.Namespace.Cesium.cartesian3(
+ camera.position.x,
+ camera.position.y,
+ camera.position.z
+ );
+ // // var cartographic = ellipsoid.cartesianToCartographic(cartesian3);
+ // // var lat = Cesium.Math.toDegrees(cartograhphic.latitude);
+ // // var lng = Cesium.Math.toDegrees(cartograhpinc.longitude);
+ // // var alt = cartographic.height;
+ console.log(cartesian3);
+ // let position = camera.position;
+ // for (let k in position) {
+ // if (k == "x" || k == "y" || k == "z") {
+ // console.log(k, " : ", position[k]);
+ // }
+ // }
+ // if (val == "+") {
+ // camera.position.x -= 614.8521;
+ // camera.position.y -= 1002.9298;
+ // camera.position.z += 682.3683;
+ // } else if (val == "-") {
+ // camera.position.x += 614.8521;
+ // camera.position.y += 1002.9298;
+ // camera.position.z -= 682.3683;
+ // }
+ // camera.flyTo({
+ // destination: position,
+ // orientation: {
+ // heading: camera.heading,
+ // pitch: camera.pitch,
+ // roll: camera.roll,
+ // },
+ // duration: 0.5,
+ // convert: false,
+ // });
},
},
};
diff --git a/src/components/mobilemap/index.vue b/src/components/mobilemap/index.vue
index 637aae8..1953320 100644
--- a/src/components/mobilemap/index.vue
+++ b/src/components/mobilemap/index.vue
@@ -131,12 +131,10 @@
},
});
that.$refs.mobileLeftNav.initialize(viewer);
-
+ that.$store.commit("MSET_VIEWER", viewer);
const popup = viewer.popup;
popup.hide();
-
- that.$store.commit("MSET_VIEWER", viewer);
const baselayer = DC.ImageryLayerFactory.createArcGisImageryLayer({
url: "http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
diff --git a/src/store/modules/mobile.js b/src/store/modules/mobile.js
index 7933a3c..095fce9 100644
--- a/src/store/modules/mobile.js
+++ b/src/store/modules/mobile.js
@@ -4,7 +4,6 @@
},
mutations: {
MSET_VIEWER(state, viewer) {
- // console.log(viewer, 456)
state.mviewer = viewer
}
},
diff --git a/src/styles/mobile/popup.scss b/src/styles/mobile/popup.scss
index 39dc937..da0d69d 100644
--- a/src/styles/mobile/popup.scss
+++ b/src/styles/mobile/popup.scss
@@ -63,6 +63,23 @@
// 比例尺
.dc-distance-legend {
- position: relative;
- left: 30px;
+ right: 5px !important;
+ left: auto !important;
+}
+// 缩放控制
+.dc-zoom-controller {
+ left: 20px !important;
+ top: 20px !important;
+ .zoom-in .refresh .zoom-out {
+ width: 32px !important;
+ height: 32px !important;
+ background-color: #c9302c !important;
+ display: flex !important;
+ align-items: center !important;
+ justify-content: center !important;
+ color: white !important;
+ font-size: 22px !important;
+ margin-bottom: 12px !important;
+ border-radius: 5px !important;
+ }
}
--
Gitblit v1.9.3