xzw 2 年之前
父节点
当前提交
7e1c2a490d
共有 3 个文件被更改,包括 27 次插入15 次删除
  1. 20 3
      src/components/header/index.vue
  2. 2 1
      src/utils/ConvertViews.js
  3. 5 11
      src/utils/sync.js

+ 20 - 3
src/components/header/index.vue

@@ -43,6 +43,8 @@ import { ref, defineProps, onMounted } from 'vue'
 import { http } from '@/utils/request'
 import browser from '@/utils/browser'
 import Login from './Login'
+import sync from '@/utils/sync'
+
 const props = defineProps({
     project: Object,
     showAdjust: Boolean,
@@ -53,13 +55,28 @@ const user = ref(null)
 const points = ref({ p1: null, p2: null })
 const showLogin = ref(false)
 
-const onSetP1 = () => {
-    points.value.p1 = { id: 0, position: { x: 1, y: 1, z: 1 } }
+const getCurPosInfo = ()=>{
+    let app = sync.sourceInst
+    let id  
+    if(app.sceneType == 'laser'){
+        id = app.viewer.images360.currentPano.id 
+    }else{
+        id = app.app.core.get('Player').currentPano.id 
+    }
+    let info = sync.targetInst.viewer.getCameraStatus()
+    let position = info.position
+    return {id, position}
+}
+
+const onSetP1 = () => { 
+    points.value.p1 = getCurPosInfo()
+    console.log(points.value.p1)
     emits('update','p1')
 
 }
 const onSetP2 = () => {
-    points.value.p2 = { id: 0, position: { x: 1, y: 1, z: 1 } }
+    points.value.p2 = getCurPosInfo()
+    console.log(points.value.p2)
     emits('update','p2')
 }
 

+ 2 - 1
src/utils/ConvertViews.js

@@ -233,13 +233,14 @@ export default class ConvertViews extends THREE.EventDispatcher{
         this.needConvertAxis = sourceApp.sceneType == 'kankan' && targetApp.sceneType == 'bim'// Y朝上需要转换
         
         this.lastCamStatus = bimViewer.getCameraStatus()
-        this.computeShift(sourcePano, targetPano)
+        targetPano && this.computeShift(sourcePano, targetPano)
         
         bimViewer.setNavigationMode(targetApp.Glodon.Bimface.Viewer.NavigationMode3D.Walk)
         bimViewer.setFlySpeedRate(5)
         bimViewer.getViewer().setTransitionAnimationState(false) //setCameraStatus瞬间变化相机 ,or setCameraAnimation?
          
         bimViewer.addEventListener('Rendered', (e)=>{//反向改变左侧相机
+             
             let info = bimViewer.getCameraStatus() 
             let poseChanged = !math.closeTo(this.lastCamStatus.position, info.position)
                 || !math.closeTo(this.lastCamStatus.target, info.target)

+ 5 - 11
src/utils/sync.js

@@ -9,10 +9,10 @@ let sourceApp = null,
 const isEdit = browser.urlHasValue('adjust')
 
 
-/* let targetPano = isEdit ? [//targetPano
+let targetPano = isEdit ? null : [//targetPano
                         {position: new THREE.Vector3( -5.313605730801787,  -4.889868407960505,  1.237447893355817),},
                         {position: new THREE.Vector3( -5.337403524084278,  -2.5012228235167737, 1.2808838933558175),} 
-                    ] : */
+                    ]   
 
 const initConvertView = (isSwitchScene) => { 
 
@@ -20,17 +20,14 @@ const initConvertView = (isSwitchScene) => {
 
     if (sourceApp && targetApp) {
         if(targetApp.sceneType == 'bim'){
-        
+            if(isEdit)return
         
             if(sourceApp.sceneType == 'laser'){ 
                 views.bindWithBim(
                     sourceApp,
                     targetApp,
                     sourceApp.viewer.images360.panos.slice(0, 2),
-                    [//targetPano
-                        {position: new THREE.Vector3( -5.313605730801787,  -4.889868407960505,  1.237447893355817),},
-                        {position: new THREE.Vector3( -5.337403524084278,  -2.5012228235167737, 1.2808838933558175),} 
-                    ],
+                    targetPano
                      
                 )
                 sourceApp.Potree.settings.rotAroundPoint = false
@@ -41,10 +38,7 @@ const initConvertView = (isSwitchScene) => {
                     sourceApp,
                     targetApp,
                     sourceApp.app.core.get('Player').model.panos.list.slice(0, 2), 
-                    [//targetPano
-                        {position: new THREE.Vector3( -5.313605730801787,  -4.889868407960505,  1.237447893355817),},
-                        {position: new THREE.Vector3( -5.337403524084278,  -2.5012228235167737, 1.2808838933558175),} 
-                    ],
+                    targetPano,
                      
                 )