Kaynağa Gözat

Merge branch 'v1.7.0' of http://192.168.0.115:3000/bill/fuse-code into v1.7.0

xzw 11 ay önce
ebeveyn
işleme
1aa1387734

+ 0 - 3
src/api/setting.ts

@@ -6,7 +6,6 @@ import axios from "./instance";
 type ServeSetting = {
   settingsId?: string;
   pose?: string;
-  lonlat?: number[];
   cover?: string;
   back?: string;
 };
@@ -25,7 +24,6 @@ export type Setting = {
   };
   cover: string;
   back: string;
-  lonlat: number[];
   fov?: number;
   openCompass?: boolean;
 };
@@ -34,7 +32,6 @@ const toLocal = (serviceSetting: ServeSetting): Setting => ({
   id: serviceSetting.settingsId,
   pose: serviceSetting.pose && JSON.parse(serviceSetting.pose),
   cover: serviceSetting.cover || defaultCover,
-  lonlat: serviceSetting.lonlat || [113.600356, 22.364093],
   back: serviceSetting.back || "none",
 });
 

+ 3 - 0
src/api/sys.ts

@@ -50,6 +50,7 @@ export type FireProject = {
   projectSite: string;
   projectSiteCode: string;
   projectSn: string;
+  
   status: FireStatus;
   statusDesc: string;
   updateTime: string;
@@ -58,6 +59,8 @@ export type FireProject = {
 
 export interface Case {
   caseTitle: string;
+  latAndLong: string,
+  mapUrl: string
   tmProject?: FireProject;
 }
 

+ 0 - 1
src/app.vue

@@ -61,7 +61,6 @@ const stopWatch = watch(
     }
     stopWatch();
     loaded.value = true;
-    console.log(loaded.value);
   },
   { immediate: true }
 );

+ 54 - 52
src/layout/edit/fuse-edit.vue

@@ -6,7 +6,6 @@
         <component :is="Component" />
       </keep-alive>
     </router-view>
-    
 
     <SelectModel v-else>
       <ui-button type="primary" class="add-fuse-model">
@@ -17,78 +16,81 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, watch, watchEffect, nextTick } from 'vue'
-import { currentMeta, router, RoutesName } from '@/router'
-import { showLeftPanoStack, showRightPanoStack } from '@/env'
-import { togetherCallback } from '@/utils'
-import { loadModel, fuseModel } from '@/model'
-import { 
-  enterEdit, 
-  isOld, 
-  save, 
+import { ref, watch, watchEffect, nextTick } from "vue";
+import { currentMeta, router, RoutesName } from "@/router";
+import { showLeftPanoStack, showRightPanoStack } from "@/env";
+import { asyncTimeout, togetherCallback } from "@/utils";
+import { loadModel, fuseModel } from "@/model";
+import {
+  enterEdit,
+  isOld,
+  save,
   fuseModels,
   initialFuseModels,
   initialScenes,
-  initialTaggingStyles, 
-  initialTaggings, 
-  initialGuides, 
+  initialTaggingStyles,
+  initialTaggings,
+  initialGuides,
   initialMeasures,
-  fuseModelsLoaded
-} from '@/store'
+  fuseModelsLoaded,
+} from "@/store";
 
-import Header from './header/index.vue'
-import SelectModel from './scene-select.vue'
+import Header from "./header/index.vue";
+import SelectModel from "./scene-select.vue";
 
-const loaded = ref(false)
+const loaded = ref(false);
 const initialSys = async () => {
-  await Promise.all([
-    initialFuseModels(),
-    initialScenes()
-  ])
+  await Promise.all([initialFuseModels(), initialScenes()]);
   await Promise.all([
     initialTaggingStyles(),
     initialTaggings(),
     initialGuides(),
-    initialMeasures()
-  ])
-  await loadModel(fuseModel)
+    initialMeasures(),
+  ]);
+  await loadModel(fuseModel);
   const stop = watchEffect(() => {
     if (fuseModelsLoaded.value) {
-      loaded.value = true
-      nextTick(() => stop())
+      loaded.value = true;
+      nextTick(() => stop());
     }
-  })
-}
-initialSys()
+  });
+};
+initialSys();
 
 router.beforeEach(async (to, from, next) => {
   if (to.params.save && isOld.value) {
-    await save()
+    await save();
   }
-  next()
-})
-watch(router.currentRoute, (_n, _, onClean) => {
-  const meta = currentMeta.value
-  if (meta && 'full' in meta && (meta as any).full) {
-    enterEdit(() => {
-      if (!history.state.back) {
-        router.replace({ name: RoutesName.merge })
-      } else {
-        router.back()
-      }
-    })
-    onClean(togetherCallback([
-      showLeftPanoStack.push(ref(false)),
-      showRightPanoStack.push(ref(false)),
-    ]))
-  }
-}, { flush: 'post', immediate: true })
+  next();
+});
+watch(
+  router.currentRoute,
+  (_n, _, onClean) => {
+    const meta = currentMeta.value;
+    if (meta && "full" in meta && (meta as any).full) {
+      enterEdit(() => {
+        if (!history.state.back) {
+          router.replace({ name: RoutesName.merge });
+        } else {
+          router.back();
+        }
+      });
+      onClean(
+        togetherCallback([
+          showLeftPanoStack.push(ref(false)),
+          showRightPanoStack.push(ref(false)),
+        ])
+      );
+    }
+  },
+  { flush: "post", immediate: true }
+);
 
 watchEffect((onCleanup) => {
   if (!fuseModels.value.length) {
-    onCleanup(showRightPanoStack.push(ref(false)))
+    onCleanup(showRightPanoStack.push(ref(false)));
   }
-})
+});
 </script>
 
 <style lang="scss" scoped>
@@ -104,4 +106,4 @@ watchEffect((onCleanup) => {
     margin-right: 4px;
   }
 }
-</style>
+</style>

+ 17 - 19
src/layout/edit/scene-edit.vue

@@ -14,31 +14,29 @@
 </template>
 
 <script setup lang="ts">
-import Header from './header/index.vue'
-import SceneList from '../scene-list/index.vue'
-import { LeftPano } from '@/layout'
-import { custom } from '@/env'
-import { onMounted, ref } from 'vue'
-import { currentModel, loadModel, fuseModel } from '@/model'
-import { initialFuseModels, initialScenes } from '@/store'
+import Header from "./header/index.vue";
+import SceneList from "../scene-list/index.vue";
+import { LeftPano } from "@/layout";
+import { custom } from "@/env";
+import { onMounted, ref } from "vue";
+import { currentModel, loadModel, fuseModel } from "@/model";
+import { initialFuseModels, initialScenes } from "@/store";
+import { asyncTimeout } from "@/utils";
 
-
-const loaded = ref(false)
+const loaded = ref(false);
 const initialSys = async () => {
-  await Promise.all([
-    initialFuseModels(),
-    initialScenes()
-  ])
-  loaded.value = true
-}
-initialSys()
+  await Promise.all([initialFuseModels(), initialScenes()]);
+  await loadModel(fuseModel);
+  await asyncTimeout(1000);
+  loaded.value = true;
+};
+initialSys();
 
-onMounted(() => loadModel(fuseModel))
-custom.showLeftPano = true
+custom.showLeftPano = true;
 </script>
 
 <style>
 :root {
   --editor-menu-width: 0px;
 }
-</style>
+</style>

+ 7 - 1
src/layout/model-list/index.vue

@@ -1,5 +1,11 @@
 <template>
-  <List :title="title" rawKey="id" :data="modelList" :showContent="showContent">
+  <List
+    :title="title"
+    rawKey="id"
+    class="scene-model-list"
+    :data="modelList"
+    :showContent="showContent"
+  >
     <template #action>
       <slot name="action" />
     </template>

+ 1 - 0
src/layout/model-list/sign.vue

@@ -12,6 +12,7 @@
           type="show_roaming_n"
           @click.stop="$emit('click', 'pano')"
           class="icon"
+          :class="{ active: custom.showMode === 'pano' && active }"
           v-if="getSceneModel(props.model)?.supportPano()"
         />
         <ui-input

+ 4 - 0
src/layout/model-list/style.scss

@@ -25,6 +25,10 @@
   align-items: center;
   flex       : none;
 
+  .active {
+    color: var(--colors-primary-base) !important;
+  }
+
   >* {
     margin-left: 20px;
   }

+ 42 - 39
src/layout/scene-list/index.vue

@@ -4,28 +4,26 @@
       <slot name="action" />
     </template>
     <template #atom="{ item }">
-      <div v-if="item.raw === fuseModel" 
-        @click="updateCurrent(item.raw)"
-      >
+      <div v-if="item.raw === fuseModel" @click="updateCurrent(item.raw)">
         <ModelList
           class="scene-model-list"
-          :class="{active: current === fuseModel}"
+          :class="{ active: current === fuseModel }"
           :title="getModelTypeDesc(fuseModel as any)"
           :show-content="showModelList"
         >
           <template #action>
-            <ui-icon 
-              :type="`pull-${showModelList ? 'up' : 'down'}`" 
+            <ui-icon
+              :type="`pull-${showModelList ? 'up' : 'down'}`"
               @click="showModelList = !showModelList"
-              ctrl 
+              ctrl
             />
           </template>
         </ModelList>
       </div>
-      <div 
-        class="scene" 
-        :class="{disabled: item.raw.status !== SceneStatus.SUCCESS}" 
-        @click="updateCurrent(item.raw)" 
+      <div
+        class="scene"
+        :class="{ disabled: item.raw.status !== SceneStatus.SUCCESS }"
+        @click="updateCurrent(item.raw)"
         v-else
       >
         <p>{{ item.raw.name }}</p>
@@ -36,47 +34,52 @@
 </template>
 
 <script lang="ts" setup>
-import { computed, nextTick, ref, watch } from 'vue'
-import { scenes, SceneType, SceneTypeDesc, fuseModels, SceneStatus } from '@/store'
-import List from '@/components/list/index.vue'
-import ModelList from '../model-list/index.vue'
-import { fuseModel, getModelTypeDesc } from '@/model'
+import { computed, nextTick, ref, watch } from "vue";
+import { scenes, SceneType, SceneTypeDesc, fuseModels, SceneStatus } from "@/store";
+import List from "@/components/list/index.vue";
+import ModelList from "../model-list/index.vue";
+import { fuseModel, getModelTypeDesc } from "@/model";
 
-import type { ModelType, FuseModelType } from '@/model'
-import type { Scene } from '@/store'
+import type { ModelType, FuseModelType } from "@/model";
+import type { Scene } from "@/store";
 
-const emit = defineEmits<{ (e: 'update:current', data: ModelType): void }>()
-const props = defineProps<{ current: ModelType }>()
-const showModelList = ref(true)
+const emit = defineEmits<{ (e: "update:current", data: ModelType): void }>();
+const props = defineProps<{ current: ModelType }>();
+const showModelList = ref(true);
 
 const list = computed(() => {
-  const sceneList = scenes.value.map(scene => ({
+  const sceneList = scenes.value.map((scene) => ({
     raw: scene,
-    select: props.current !== fuseModel 
-      && (props.current.num === scene.num )
-      && props.current.type === scene.type
-  }))
+    select:
+      props.current !== fuseModel &&
+      props.current.num === scene.num &&
+      props.current.type === scene.type,
+  }));
   if (fuseModels.value.length) {
-    return [{ raw: fuseModel }, ...sceneList]
+    return [{ raw: fuseModel }, ...sceneList];
   } else {
-    return sceneList
+    return sceneList;
   }
-})
+});
 
 const updateCurrent = (scene: FuseModelType | Scene) => {
   if (scene === fuseModel) {
-    emit('update:current', scene)
+    emit("update:current", scene);
   } else {
-    emit('update:current', { type: scene.type, num: scene.num })
+    emit("update:current", { type: scene.type, num: scene.num });
   }
-}
+};
 
-const stopWatch = watch(list, () => {
-  if (!list.value.some(model => model.raw === fuseModel) && list.value.length) {
-    updateCurrent(list.value[0].raw as any)
-    nextTick(() => stopWatch())
-  }
-}, { immediate: true })
+const stopWatch = watch(
+  list,
+  () => {
+    if (!list.value.some((model) => model.raw === fuseModel) && list.value.length) {
+      updateCurrent(list.value[0].raw as any);
+      nextTick(() => stopWatch());
+    }
+  },
+  { immediate: true }
+);
 </script>
 
 <style lang="scss">
@@ -105,7 +108,7 @@ const stopWatch = watch(list, () => {
     h3 {
       font-size: 20px;
       font-weight: bold;
-      color: #FFFFFF;
+      color: #ffffff;
     }
   }
 

+ 41 - 35
src/layout/show/index.vue

@@ -1,10 +1,13 @@
 <template>
   <template v-if="loaded">
-    <div :class="{ hideLeft: !custom.showLeftPano }" :style="hasSingle ? {'--left-pano-left': '0px'} : ''">
-      <SlideMenu 
+    <div
+      :class="{ hideLeft: !custom.showLeftPano }"
+      :style="hasSingle ? { '--left-pano-left': '0px' } : ''"
+    >
+      <SlideMenu
         v-if="!hasSingle"
-        :activeName="(router.currentRoute.value.name as RoutesName)" 
-        @change-item="item => router.push({ name: item.name })"
+        :activeName="(router.currentRoute.value.name as RoutesName)"
+        @change-item="(item) => router.push({ name: item.name })"
       />
 
       <router-view v-slot="{ Component }">
@@ -12,23 +15,23 @@
           <component :is="Component" />
         </keep-alive>
       </router-view>
-
     </div>
   </template>
 </template>
 
 <script lang="ts" setup>
-import { custom, params } from '@/env'
-import { computed, nextTick, ref, watch, watchEffect } from 'vue'
-import { router, RoutesName } from '@/router'
-import { loadModel, fuseModel } from '@/model'
-import SlideMenu from './slide-menu.vue'
-import { 
-  initialFloders, 
-  initialFloderTypes, 
-  initialFuseModels, 
-  initialRecords, 
-  initialScenes, 
+import { custom, params } from "@/env";
+import { computed, nextTick, ref, watch, watchEffect } from "vue";
+import { router, RoutesName } from "@/router";
+import { loadModel, fuseModel } from "@/model";
+import { asyncTimeout } from "@/utils";
+import SlideMenu from "./slide-menu.vue";
+import {
+  initialFloders,
+  initialFloderTypes,
+  initialFuseModels,
+  initialRecords,
+  initialScenes,
   initialViews,
   defTitle,
   initialTaggingStyles,
@@ -37,12 +40,12 @@ import {
   initialGuides,
   scenes,
   fuseModels,
-  appEl
-} from '@/store'
+  appEl,
+} from "@/store";
 
-const hasSingle = new URLSearchParams(location.search).has("single")
+const hasSingle = new URLSearchParams(location.search).has("single");
 
-const loaded = ref(false)
+const loaded = ref(false);
 const initialSys = async () => {
   await Promise.all([
     initialFuseModels(),
@@ -53,23 +56,24 @@ const initialSys = async () => {
     initialFloderTypes(),
     initialTaggingStyles(),
     initialTaggings(),
-    initialGuides()
-  ])
-  await initialMeasures()
-  loaded.value = true
-  loadModel(fuseModel)
-  custom.showLeftPano = true
-}
-initialSys()
-defTitle.value = ''
-initialScenes()
+    initialGuides(),
+  ]);
+  await initialMeasures();
+  await loadModel(fuseModel);
+  await asyncTimeout(1000);
+  loaded.value = true;
+  custom.showLeftPano = true;
+};
+initialSys();
+defTitle.value = "";
+initialScenes();
 
 watchEffect((onCleanup) => {
   if (loaded.value && appEl.value && scenes.value.length && !fuseModels.value.length) {
-      loadModel(scenes.value[0] as any)
-      custom.showLeftPano = true
+    loadModel(scenes.value[0] as any);
+    custom.showLeftPano = true;
   }
-})
+});
 </script>
 
 <style>
@@ -80,6 +84,8 @@ watchEffect((onCleanup) => {
 
 .hideLeft {
   --editor-menu-left: calc(-1 * var(--editor-menu-width));
-  --left-pano-left: calc(var(--editor-menu-left) + var(--editor-menu-width) - var(--left-pano-width)) !important
+  --left-pano-left: calc(
+    var(--editor-menu-left) + var(--editor-menu-width) - var(--left-pano-width)
+  ) !important;
 }
-</style>
+</style>

+ 66 - 64
src/model/app.vue

@@ -8,56 +8,56 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, ref, watchEffect, computed, watch, nextTick } from 'vue'
-import { SceneType } from '@/store'
-import { params } from '@/env'
-import { fuseModel, modelProps } from './index'
-import { modelSDKFactory } from './platform'
+import { defineComponent, ref, watchEffect, computed, watch, nextTick } from "vue";
+import { SceneType } from "@/store";
+import { params } from "@/env";
+import { fuseModel, modelProps } from "./index";
+import { modelSDKFactory } from "./platform";
 
 const typeChange = () => {
-  const oldType = modelProps.type
-  let stopWatch = null as unknown as () => void
+  const oldType = modelProps.type;
+  let stopWatch = (null as unknown) as () => void;
 
   const typePromise = new Promise((_, reject) => {
     stopWatch = watchEffect(() => {
       if (modelProps.type !== oldType) {
-        reject(new Error('当前模型未加载完已切换到下个'))
-        stopWatch!()
+        reject(new Error("当前模型未加载完已切换到下个"));
+        stopWatch!();
       }
-    })
-  })
-  return { typePromise, typeCleanup: stopWatch }
-}
+    });
+  });
+  return { typePromise, typeCleanup: stopWatch };
+};
 
 export const Model = defineComponent({
-  name: 'model',
+  name: "model",
   setup() {
-    const scene = computed(() => modelProps.type !== fuseModel && modelProps.type)
-    const url = ref("")
+    const scene = computed(() => modelProps.type !== fuseModel && modelProps.type);
+    const url = ref("");
     const setUrl = (newURL: string) => {
       if (newURL !== url.value) {
         setTimeout(() => {
-          const hook = (iframeRef.value?.contentWindow as any)?.beforeDestroy
+          const hook = (iframeRef.value?.contentWindow as any)?.beforeDestroy;
           if (hook) {
             try {
-              hook()
-            } catch(e) {
-              console.error(e)
+              hook();
+            } catch (e) {
+              console.error(e);
             }
-            url.value = ""
-            setTimeout(() => url.value = newURL, 300)
+            url.value = "";
+            setTimeout(() => (url.value = newURL), 300);
           } else {
-            url.value = newURL
+            url.value = newURL;
           }
-        })
+        });
       }
-    }
+    };
 
     watchEffect(() => {
       if (!scene.value) {
         return setUrl("");
       }
-      const type = scene.value.type
+      const type = scene.value.type;
       const urls = {
         [SceneType.SWKK]: `/swkk/spg.html?m=${scene.value.num}`,
         [SceneType.SWKJ]: `/swkk/spg.html?m=${scene.value.num}`,
@@ -66,14 +66,12 @@ export const Model = defineComponent({
         [SceneType.SWMX]: `index.html?caseId=${params.caseId}&app=${params.app}&modelId=${scene.value.num}&share=1#sign-model`,
         [SceneType.SWYDSS]: `/swss/index.html?m=${scene.value.num}`,
         [SceneType.SWYDMX]: `/swkk/spg.html?m=${scene.value.num}`,
-      }
-      setUrl(urls[type])
-    })
-
-
+      };
+      setUrl(urls[type]);
+    });
 
-    const fuseRef = ref<HTMLDivElement>()
-    const iframeRef = ref<HTMLIFrameElement>()
+    const fuseRef = ref<HTMLDivElement>();
+    const iframeRef = ref<HTMLIFrameElement>();
 
     watch(
       () => [modelProps.type, url.value],
@@ -81,47 +79,51 @@ export const Model = defineComponent({
         if (type !== fuseModel && !url) {
           return;
         }
-        const callback = modelProps.callback
-
-        await nextTick()
-        const { typePromise, typeCleanup } = typeChange()
-        const modelPromise = modelSDKFactory(type as any, type === fuseModel ? fuseRef.value! : iframeRef.value!)
-        let result: any = null, error = null
+        const callback = modelProps.callback;
+
+        await nextTick();
+        const { typePromise, typeCleanup } = typeChange();
+        const modelPromise = modelSDKFactory(
+          type as any,
+          type === fuseModel ? fuseRef.value! : iframeRef.value!
+        );
+        let result: any = null,
+          error = null;
         try {
-          result = await Promise.race([typePromise, modelPromise])
+          result = await Promise.race([typePromise, modelPromise]);
         } catch (err: any) {
-          error = err
+          error = err;
         }
-        typeCleanup()
-        callback && callback(result, error)
-      }, 
-      { immediate: true, flush: 'post' }
-    )
+        typeCleanup();
+        callback && callback(result, error);
+      },
+      { immediate: true, flush: "post" }
+    );
 
     // 处理iframe 定制页面
     watch(
-      () => [scene.value && scene.value.type, url.value], 
+      () => [scene.value && scene.value.type, url.value],
       ([type], oldType, onCleanup) => {
         if (type === false) {
           // 手动渲染融合场景
           console.log("手动渲染!");
           setTimeout(() => {
-            (window as any).viewer.setDisplay(true)
-          }, 100)
-        };
+            (window as any).viewer.setDisplay(true);
+          }, 100);
+        }
 
         const interval = setInterval(async () => {
-          let doc: Document | undefined
+          let doc: Document | undefined;
           try {
-            doc = iframeRef.value?.contentWindow?.document!
+            doc = iframeRef.value?.contentWindow?.document!;
           } catch {
             clearInterval(interval);
           }
           if (!doc || !doc.querySelector("div")) return;
-          console.error(doc, doc.head)
-          const target = doc.head
+          console.error(doc, doc.head);
+          const target = doc.head;
           clearInterval(interval);
-          ;(window as any).iframeCreated && (window as any).iframeCreated(iframeRef.value);
+          (window as any).iframeCreated && (window as any).iframeCreated(iframeRef.value);
           if (type === SceneType.SWSS) {
             const $style = document.createElement("style");
             $style.type = "text/css";
@@ -135,19 +137,19 @@ export const Model = defineComponent({
           }
         }, 16);
         onCleanup(() => clearInterval(interval));
-      }, 
-      {flush: 'post', immediate: true}
-    )
+      },
+      { flush: "post", immediate: true }
+    );
 
     return {
       iframeRef,
       fuseRef,
-      url
-    }
-  }
-})
+      url,
+    };
+  },
+});
 
-export default Model
+export default Model;
 </script>
 
 <style scoped lang="scss">
@@ -180,6 +182,6 @@ export default Model
   right: calc(var(--editor-menu-right) + var(--editor-toolbox-width)) !important;
   top: calc(var(--header-top) + var(--editor-head-height)) !important;
   margin: 10px;
-  transition: top .3s ease, right .3s ease;
+  transition: top 0.3s ease, right 0.3s ease;
 }
 </style>

+ 10 - 10
src/model/platform.ts

@@ -1,7 +1,7 @@
 import { watchEffect, nextTick } from 'vue'
-import { fuseModelsLoaded, scenes, SceneType, setting } from '@/store'
+import { fuseModelsLoaded, scenes, SceneType, setting, caseProject } from '@/store'
 import { fuseModel } from './'
-import { initialSDK, initialed as fuseInitialed, sdk as fuseSDK } from '@/sdk'
+import { initialSDK, initialed as fuseInitialed, sdk as fuseSDK, analysisPose, analysisPoseInfo } from '@/sdk'
 import { asyncTimeout } from '@/utils'
 import { aMapToWgs84 } from "@/utils/coord";
 
@@ -12,15 +12,15 @@ export async function modelSDKFactory (
   type: ModelType, 
   dom: HTMLDivElement | HTMLIFrameElement
 ): Promise<ModelExpose> {
-  console.log(type, dom)
-
+  const lonlatStr = caseProject.value?.latAndLong || '22.364093,113.600356'
+  const lonlat = lonlatStr.split(',').map(Number)
   const center = aMapToWgs84({
-    x: setting.value!.lonlat![0],
-    y: setting.value!.lonlat![1],
+    x: lonlat[1],
+    y: lonlat[0],
   });
   if (type === fuseModel) {
     if (!fuseInitialed) {
-      await initialSDK({ layout: dom, scenes: scenes.value, lonlat: [center.y, center.y] })
+      await initialSDK({ layout: dom, scenes: scenes.value, lonlat: [center.x, center.y] })
     }
     return exposeFactory(fuseModel)
   } else {
@@ -50,7 +50,7 @@ export async function modelSDKFactory (
 }
 
 
-const findObjectAttr = <T, K extends keyof T>(data: T, key: K): Promise<T[K]> => {
+const findObjectAttr = <T extends {}, K extends keyof T>(data: T, key: K): Promise<T[K]> => {
   return new Promise<T[K]>(resolve => {
     const query = () => {
       if (key in data) {
@@ -90,14 +90,14 @@ export async function exposeFactory(type: ModelType, win?: any): Promise<ModelEx
           const dataURL = await sdk.screenshot(260, 160)
           const res = await fetch(dataURL)
           const image = await res.blob()
-          const pose = sdk.getPose()
+          const pose = analysisPose(sdk.getPose())
           return {
             image,
             flyData: JSON.stringify(pose)
           }
         },
         async setView(flyData: string) {
-          const pose = JSON.parse(flyData)
+          const pose = analysisPoseInfo(JSON.parse(flyData))
           sdk.comeTo({ dur: 300, ...pose })
         }
       }

+ 17 - 10
src/sdk/association/index.ts

@@ -10,18 +10,25 @@ import { associationMessaures } from "./measure"
 export const getSupperPanoModel = () => {
   const supperModel = ref<FuseModel | null>(null);
 
-  sdk.sceneBus.on("cameraChange", () => {
-    const data = sdk.canTurnToPanoMode();
-    if (data?.model) {
-      for (const [f, s] of sceneModelMap.entries()) {
-        if (toRaw(data.model) === toRaw(s)) {
-          supperModel.value = f;
-          return;
+  
+  const interval = setInterval(() => {
+    if (!sdk) return;
+    clearInterval(interval)
+
+    sdk.sceneBus.on("cameraChange", () => {
+      const data = sdk.canTurnToPanoMode();
+      if (data?.model) {
+        for (const [f, s] of sceneModelMap.entries()) {
+          if (toRaw(data.model) === toRaw(s)) {
+            supperModel.value = f;
+            return;
+          }
         }
       }
-    }
-    supperModel.value = null;
-  });
+      supperModel.value = null;
+    });
+  }, 16)
+  
 
   return supperModel;
 };

+ 2 - 5
src/sdk/association/setting.ts

@@ -10,11 +10,8 @@ export const associationSetting = (sdk: SDK, mountEl: HTMLDivElement) => {
 
   const stopWatchPose = watchEffect(() => {
     if (!setting.value?.pose) return;
-    if (sdk.setPose) {
-      sdk.setPose(analysisPoseInfo(setting.value.pose))
-    } else {
-      sdk.comeTo(setting.value.pose);
-    }
+    console.error('comeTo', analysisPoseInfo(setting.value.pose))
+    sdk.comeTo(analysisPoseInfo(setting.value.pose));
     nextTick(() => stopWatchPose());
   });
 

+ 1 - 1
src/sdk/sdk.ts

@@ -178,7 +178,6 @@ export interface SDK {
   ) => ScreenPos | null;
   screenshot: (width: number, height: number) => Promise<string>;
   getPose: () => Pose;
-  setPose: (pose: Pose &{dur?: number}) => void
   comeTo: (pos: CameraComeToProps) => void;
   enterSceneGuide: (data: SceneGuidePath[]) => SceneGuide;
 
@@ -196,6 +195,7 @@ export type InialSDKProps = {
   scenes: Scene[];
   lonlat?: number[];
 };
+
 export let initialed = false;
 export const initialSDK = async (props: InialSDKProps) => {
   if (initialed) return sdk;

+ 1 - 5
src/views/guide/edit-paths.vue

@@ -196,11 +196,7 @@ const deleteAll = async () => {
 };
 
 const changeCurrent = (path: GuidePath) => {
-  if (sdk.setPose) {
-    sdk.setPose({ dur: 300, ...path, ...analysisPoseInfo(path) });
-  } else {
-    sdk.comeTo({ dur: 300, ...path });
-  }
+  sdk.comeTo({ dur: 300, ...path, ...analysisPoseInfo(path) });
   current.value = path;
 };
 

+ 86 - 68
src/views/merge/index.vue

@@ -1,24 +1,29 @@
 <template>
-  <RightPano v-if="custom.currentModel && active" class="merge-layout">
+  <RightPano
+    v-if="custom.currentModel && active && custom.showMode === 'fuse'"
+    class="merge-layout"
+  >
     <ui-group>
       <template #header>
         <Actions class="edit-header" :items="actionItems" v-model:current="currentItem" />
       </template>
       <ui-group-option label="等比缩放">
         <template #icon>
-          <a class="set-prop" 
-            :class="{disabled: isOld || currentItem}"
+          <a
+            class="set-prop"
+            :class="{ disabled: isOld || currentItem }"
             @click="router.push({ 
               name: RoutesName.proportion, 
               params: { id: custom.currentModel!.id, save: '1' },
             })"
-          >设置比例</a>
+            >设置比例</a
+          >
         </template>
-        <ui-input 
-          type="range" 
-          v-model="custom.currentModel.scale" 
-          v-bind="modelRange.scaleRange" 
-          :ctrl="false" 
+        <ui-input
+          type="range"
+          v-model="custom.currentModel.scale"
+          v-bind="modelRange.scaleRange"
+          :ctrl="false"
           width="100%"
         >
           <template #icon>%</template>
@@ -36,25 +41,26 @@
         </ui-input>
       </ui-group-option> -->
       <ui-group-option label="模型不透明度">
-        <ui-input 
-          type="range" 
-          v-model="custom.currentModel.opacity" 
-          v-bind="modelRange.opacityRange" 
-          :ctrl="false" 
+        <ui-input
+          type="range"
+          v-model="custom.currentModel.opacity"
+          v-bind="modelRange.opacityRange"
+          :ctrl="false"
           width="100%"
         >
           <template #icon>%</template>
         </ui-input>
       </ui-group-option>
       <ui-group-option>
-          <!-- :disabled="currentItem"  -->
-        <ui-button 
-          :class="{disabled: isOld}"
+        <!-- :disabled="currentItem"  -->
+        <ui-button
+          :class="{ disabled: isOld }"
           @click="router.push({ 
             name: RoutesName.registration, 
             params: {id: custom.currentModel!.id, save: '1' } 
           })"
-        >配准</ui-button>
+          >配准</ui-button
+        >
       </ui-group-option>
       <ui-group-option>
         <ui-button @click="reset">恢复默认</ui-button>
@@ -64,79 +70,92 @@
 </template>
 
 <script lang="ts" setup>
-import { RoutesName, router } from '@/router'
-import { RightPano } from '@/layout'
-import { autoSaveFuseModels, defaultFuseModelAttrs, isOld } from '@/store'
-import { togetherCallback } from '@/utils'
-import { sdk, getSceneModel, modelRange } from '@/sdk'
-import { useViewStack, useActive } from '@/hook'
-import { showLeftPanoStack, custom, modelsChangeStoreStack, showRightPanoStack } from '@/env'
-import { ref, nextTick, watchEffect, computed, watch } from 'vue'
-import { Dialog } from 'bill/expose-common'
+import { RoutesName, router } from "@/router";
+import { RightPano } from "@/layout";
+import { autoSaveFuseModels, defaultFuseModelAttrs, isOld } from "@/store";
+import { togetherCallback } from "@/utils";
+import { sdk, getSceneModel, modelRange } from "@/sdk";
+import { useViewStack, useActive } from "@/hook";
+import {
+  showLeftPanoStack,
+  custom,
+  modelsChangeStoreStack,
+  showRightPanoStack,
+} from "@/env";
+import { ref, nextTick, watchEffect, computed, watch } from "vue";
+import { Dialog } from "bill/expose-common";
 
-import Actions from '@/components/actions/index.vue'
+import Actions from "@/components/actions/index.vue";
 
-import type { ActionsProps, ActionsItem } from '@/components/actions/index.vue'
+import type { ActionsProps, ActionsItem } from "@/components/actions/index.vue";
 
-const active = useActive()
-const actionItems: ActionsProps['items'] = [
+const active = useActive();
+const actionItems: ActionsProps["items"] = [
   {
-    icon: 'move',
-    text: '移动',
+    icon: "move",
+    text: "移动",
     action: () => {
-      getSceneModel(custom.currentModel)?.enterMoveMode()
-      return () => getSceneModel(custom.currentModel)?.leaveTransform()
-    }
+      getSceneModel(custom.currentModel)?.enterMoveMode();
+      return () => getSceneModel(custom.currentModel)?.leaveTransform();
+    },
   },
   {
-    icon: 'flip',
-    text: '旋转',
+    icon: "flip",
+    text: "旋转",
     action: () => {
-      getSceneModel(custom.currentModel)?.enterRotateMode()
+      getSceneModel(custom.currentModel)?.enterRotateMode();
       return () => {
-        getSceneModel(custom.currentModel)?.leaveTransform()
-      }
-    }
+        getSceneModel(custom.currentModel)?.leaveTransform();
+      };
+    },
   },
-]
-
+];
 
-const currentItem = ref<ActionsItem | null>(null)
+const currentItem = ref<ActionsItem | null>(null);
 watchEffect(() => {
   if (!custom.currentModel) {
-    currentItem.value = null
+    currentItem.value = null;
   }
-})
+});
 
 watch(
-  () => custom.currentModel, 
+  () => custom.currentModel,
   () => {
-    console.log('???')
+    console.log("???");
     currentItem.value = null;
   }
-)
+);
 
 const reset = async () => {
-  if (custom.currentModel && await Dialog.confirm('确定恢复默认?此操作无法撤销')) {
-    Object.assign(custom.currentModel, defaultFuseModelAttrs)
-    await nextTick()
-    custom.currentModel && (custom.currentModel.bottom = 0)
+  if (custom.currentModel && (await Dialog.confirm("确定恢复默认?此操作无法撤销"))) {
+    Object.assign(custom.currentModel, defaultFuseModelAttrs);
+    await nextTick();
+    custom.currentModel && (custom.currentModel.bottom = 0);
   }
-}
-useViewStack(() => togetherCallback([
-  showLeftPanoStack.push(ref(true)),
-  showRightPanoStack.push(computed(() => !!custom.currentModel)),
-  modelsChangeStoreStack.push(ref(true)),
-  () => currentItem.value = null
-]))
-useViewStack(autoSaveFuseModels)
+};
+useViewStack(() =>
+  togetherCallback([
+    showLeftPanoStack.push(ref(true)),
+    showRightPanoStack.push(computed(() => !!custom.currentModel)),
+    modelsChangeStoreStack.push(ref(true)),
+    () => (currentItem.value = null),
+  ])
+);
+useViewStack(autoSaveFuseModels);
 
 useViewStack(() => {
-  sdk.showGrid()
+  const stopWatch = watchEffect(() => {
+    if (custom.showMode === "fuse") {
+      sdk.showGrid();
+    } else {
+      sdk.hideGrid();
+    }
+  });
   return () => {
-    sdk.hideGrid()
-  }
-})
+    sdk.hideGrid();
+    stopWatch();
+  };
+});
 </script>
 
 <style lang="scss">
@@ -150,8 +169,7 @@ useViewStack(() => {
   }
 }
 
-
 .set-prop {
   cursor: pointer;
 }
-</style>
+</style>