From 295cfad7ed701e75ae154c73b2fa4ccb4a9efff8 Mon Sep 17 00:00:00 2001
From: qubiaobiao <3294694717@qq.com>
Date: Tue, 5 Mar 2024 17:58:42 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=82=B9=E5=87=BB=E5=9C=B0?=
=?UTF-8?q?=E7=82=B9=E6=A0=87=E7=82=B9=EF=BC=8C=E5=BC=B9=E7=AA=97=E5=9C=B0?=
=?UTF-8?q?=E7=82=B9=E4=BF=A1=E6=81=AF=E5=BC=B9=E7=AA=97=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 1 +
src/components/Earth.vue | 17 ++++++++++-------
src/components/HotLandmark.vue | 23 ++++++++++-------------
src/components/LandMarkShow.vue | 13 ++++++-------
src/components/LandMarkWindow.vue | 2 +-
src/components/LonlatForm.vue | 11 +++++++++++
src/components/Pin.vue | 3 +++
src/information/landmark.js | 2 +-
src/stores/flyto.js | 24 ++++++++++++++++++++++++
9 files changed, 67 insertions(+), 29 deletions(-)
create mode 100644 src/stores/flyto.js
diff --git a/.gitignore b/.gitignore
index 95aa5fe..494ac70 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ dist
dist-ssr
*.local
public/Cesium
+public/landmarkImg
# Editor directories and files
.vscode/*
diff --git a/src/components/Earth.vue b/src/components/Earth.vue
index a68f62d..85d271a 100644
--- a/src/components/Earth.vue
+++ b/src/components/Earth.vue
@@ -35,6 +35,7 @@
import Compass from '/@/components/Compass.vue'
import { usePointStore } from "/@/stores/point";
import { usePositionStore } from "/@/stores/position";
+import { useFlytoStore } from "/@/stores/flyto";
import {
VcViewer,
VcStatusBar,
@@ -91,13 +92,6 @@ const cartesian2Lonlat = (cartesian) => {
const position = usePositionStore();
position.$subscribe((_, state) => {
- // import { MutationType } from 'pinia' 改变触发的类型
- // mutation.type // 'direct' | 'patch object' | 'patch function'
- // same as cartStore.$id
- // mutation.storeId // 'cart'
- // only available with mutation.type === 'patch object'
- // mutation.payload // patch object passed to cartStore.$patch()
-
// 侦听到state变化时,把state存在localStorage中
// localStorage.setItem('cart', JSON.stringify(state))
if (!isLnglat(state)) return;
@@ -107,6 +101,15 @@ position.$subscribe((_, state) => {
});
});
+const flyto = useFlytoStore();
+flyto.$subscribe((_, state) => {
+ if (!isLnglat(state)) return;
+
+ viewer.camera.flyTo({
+ destination: Cesium.Cartesian3.fromDegrees(state.lng, state.lat, 2000.0),
+ });
+});
+
// 默认值 天安门广场经纬度 116.39140105, 39.90452844 高度 2000.0
const pointTo = () => {
let initialPosition = Cesium.Cartesian3.fromDegrees(position.lng?position.lng:116.39140105, position.lat?position.lat:39.90452844, 2000.0);
diff --git a/src/components/HotLandmark.vue b/src/components/HotLandmark.vue
index e36fe4e..a7533e0 100644
--- a/src/components/HotLandmark.vue
+++ b/src/components/HotLandmark.vue
@@ -6,7 +6,7 @@
style="position: absolute; top: -40px; right: 0; z-index: 99; cursor: pointer"
@click="showLandmark"
>
-
+