xzw 1 月之前
父節點
當前提交
55a77695a6
共有 3 個文件被更改,包括 35 次插入15 次删除
  1. 1 1
      src/custom/modules/panoEdit/panoEditor.js
  2. 9 11
      src/custom/start.js
  3. 25 3
      src/custom/viewer/ViewerNew.js

+ 1 - 1
src/custom/modules/panoEdit/panoEditor.js

@@ -441,7 +441,7 @@ class PanoEditor extends THREE.EventDispatcher{
             this.setTranMode(null)
             Alignment.history.clear() 
             
-            if(!viewer.images360.currentPano.enabled){//切换到可见点
+            if(!viewer.images360.currentPano?.enabled){//切换到可见点
                 let enabledPano = viewer.images360.findNearestPano() 
                 enabledPano && viewer.images360.flyToPano({pano:enabledPano, duration:0})
             }

+ 9 - 11
src/custom/start.js

@@ -744,7 +744,9 @@ export function realTimePanosStart(dom, number){//边拍边传,和点位编辑
     Potree.settings.urls.templates.panoTile = 'laser-data/testdata/{sceneCode}/data/preview/{id}/'
     const rotQua = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(1,0,0),  -Math.PI / 2  )    
     //new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0,0,1),  -Math.PI   )      
-    
+        
+const rotQua2 = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0,0,1),  -Math.PI   )  
+ 
     viewer.scene.add360Images(viewer.images360);
     const datasetId = 1
     
@@ -759,6 +761,8 @@ export function realTimePanosStart(dom, number){//边拍边传,和点位编辑
         if(!panoCount){
             return callback()
         }
+        
+        console.log('loadPanos',panoData)
         panoData.forEach((d,index)=>{
             let timeStamp = 0 
             let cloudPath = `laser-data/testdata/${number}/data/preview/${d.uuid}/webcloud/cloud.js`
@@ -806,16 +810,10 @@ export function realTimePanosStart(dom, number){//边拍边传,和点位编辑
                         let data = pano.panoData
                         let dataPosition = new THREE.Vector3().fromArray(data.pose3d.position) 
                         let qua = data.pose3d.rotation
-                            qua = [qua[1], qua[2], qua[3], qua[0]] 
-                            
-                        let dataQuaternion = new THREE.Quaternion().fromArray(qua)  
-                         
-                        pano.pointcloud.orientationUser = math.convertQuaternion.YupToZup(dataQuaternion)//new THREE.Quaternion().multiplyQuaternions(dataQuaternion, rotQua)  //math.convertQuaternion.YupToZup(dataQuaternion) //new THREE.Quaternion().multiplyQuaternions(dataQuaternion,rotQua2) 
-                        
-                        
-                        console.log('dataQuaternion', new THREE.Euler().setFromQuaternion(pano.pointcloud.orientationUser)) 
-                        
-                        pano.pointcloud.translateUser.copy(math.convertVector.YupToZup(dataPosition))
+                            qua = [qua[1], qua[2], qua[3], qua[0]]  
+                        let dataQuaternion = new THREE.Quaternion().fromArray(qua)   
+                        pano.pointcloud.orientationUser = new THREE.Quaternion().multiplyQuaternions(dataQuaternion,rotQua2)//新版
+                        pano.pointcloud.translateUser.copy(dataPosition)
                         Alignment.setMatrix(pano.pointcloud);
                     })
                     viewer.images360.loadDone() 

+ 25 - 3
src/custom/viewer/ViewerNew.js

@@ -291,8 +291,8 @@ export class Viewer extends ViewerBase{
             
         try{
             
-            if(!Potree.settings.isOfficial)  
-            { // generate missing dom hierarchy
+            if(!Potree.settings.isOfficial){
+             // generate missing dom hierarchy
                 if ($(domElement).find('#potree_map').length === 0) {
                     let potreeMap = $(`
                         <div id="potree_map" class="mapBox" style="position: absolute; left: 50px; top: 50px; width: 400px; height: 400px; display: none">
@@ -352,7 +352,29 @@ export class Viewer extends ViewerBase{
                     window.buttonFunction &&  window.buttonFunction()
                 }); 
                 domRoot.appendChild(elAttach[0]); */
-                 
+                
+                setTimeout(()=>{
+                    this.inputHandler.addEventListener('keydown', (e)=>{
+                        try{
+                        if(e.event.ctrlKey){
+                            if(e.event.key.toLowerCase() == 'c'){
+                                let info = JSON.stringify(  this.mainViewport.view.getJson() );
+                                console.log(`Copy view params: ${info}`),
+                                navigator.clipboard.writeText(info)  
+                                  
+                            }else if(e.event.key.toLowerCase() == 'v'){
+                                navigator.clipboard.readText().then(A=>{
+                                    let info = JSON.parse(A);
+                                    if(info.yaw != void 0){
+                                        this.mainViewport.view.applyJson(info) 
+                                        console.log(`pasteViewParams ${A}`) 
+                                    }
+                                })
+                            }  
+                        } 
+                        }catch(e){console.log(e)}
+                    }) 
+                },10)
             }
             
             this.tiles3dMemoryUsage = 0