xzw 2 ماه پیش
والد
کامیت
e048d28a16

+ 15 - 16
src/custom/modules/datasetAlignment/Alignment.js

@@ -151,9 +151,11 @@ var Alignment = {
                 } 
             })
             this.history.addEventListener('undo',()=>{
-                this.updateFakeMarker()
+                this.updateCtlDisplay()
+            })
+            this.history.addEventListener('redo',()=>{
+                this.updateCtlDisplay()
             })
-             
             
         }
         
@@ -497,25 +499,22 @@ var Alignment = {
         if(!this.editing)return  
         let selected = this.handleState == 'rotate' && this.selectedClouds.length > 0
         if(selected){
-            this.updateFakeMarker()
+            this.transformControls.attach(this.fakeMarkerForTran) 
+            let position = this.selectedClouds[0].translateUser
+            let quaternion = this.getDatasetQuaternion(this.selectedClouds[0])
+            this.fakeMarkerForTran.position.copy(position)
+            this.fakeMarkerForTran.quaternion.copy(quaternion)
+            this.fakeMarkerForTran.oldState = {
+                position: position.clone(),
+                quaternion: quaternion.clone() 
+            }
         }else{
             this.transformControls.detach()
         }
     },
     
-    updateFakeMarker(){
-        this.transformControls.attach(this.fakeMarkerForTran)
-  
-        let position = this.selectedClouds[0].translateUser
-        let quaternion = this.getDatasetQuaternion(this.selectedClouds[0])
-        this.fakeMarkerForTran.position.copy(position)
-        this.fakeMarkerForTran.quaternion.copy(quaternion)
-        this.fakeMarkerForTran.oldState = {
-            position: position.clone(),
-            quaternion: quaternion.clone() 
-        }
-    }
-    ,
+    
+    
     save: function(){//保存所有数据集的位置和旋转
         let callback = ()=>{//保存成功后
             this.originData = this.getTemp()   //this.saveTemp();

+ 1 - 0
src/custom/objects/tool/Measure.js

@@ -899,6 +899,7 @@ export class Measure extends ctrlPolygon{
             this.edgeLabels.splice(edgeIndex, 1);
         }
         this.expands.forEach(e=>e.removeMarker(index))
+        this.closed || this.points.length && (this.edges[this.points.length-1].visible = false)
         this.update({index: this.getIndex(index, -1)}); 
         this.dispatchEvent({type: 'marker_removed', measurement: this});
     }

+ 4 - 4
src/custom/objects/tool/ctrlPolygon.js

@@ -568,11 +568,11 @@ export class ctrlPolygon extends THREE.Object3D {
     
     }
     
-    getPoint2dInfo(points){ //在更新areaplane之前必须更新过point2dInfo (针对所有点在同一平面上的)
+    getPoint2dInfo(points=this.points){ //在更新areaplane之前必须更新过point2dInfo (针对所有点在同一平面上的)
         if(this.facePlane && (this.atPlane || Potree.settings.areaAtNotPlane)){
  
             let facePlane = this.getFacePlane()  
-            
+            if(!facePlane)return this.point2dInfo = null
             var originPoint0 = points[0].clone() 
             var qua = math.getQuaBetween2Vector(facePlane.normal, new THREE.Vector3(0,0,1), new THREE.Vector3(0,0,1));
             let points2d = points.map(e=>e.clone().applyQuaternion(qua))  
@@ -654,8 +654,8 @@ export class ctrlPolygon extends THREE.Object3D {
             this.remove(edge);
             this.edges.splice(edgeIndex, 1);
             edge.geometry.dispose()
-        }
-        this.point2dInfo && this.point2dInfo.points2d.splice(index, 1); //add
+        } 
+        index == 0 ? this.getPoint2dInfo() : this.point2dInfo?.points2d.splice(index, 1); //add
 
         this.dispatchEvent({type:'removeMarker',index,marker})
 		

+ 1 - 1
src/custom/start.js

@@ -23,7 +23,7 @@ var transformPointcloud = (pointcloud, dataset)=>{
     
     //dataset.orientation = 0
     let Alignment = viewer.modules.Alignment
-    Alignment.rotate(pointcloud, null, dataset.quaternion||dataset.orientation)   
+    Alignment.rotate(pointcloud, null, dataset.quaternion?.length == 4 ? dataset.quaternion : dataset.orientation)
     Alignment.translate(pointcloud, new THREE.Vector3(location[0], location[1],  dataset.location[2]-baseZ)) //要使初始数据集的z为0,所以要减去初始数据集的z
     
     pointcloud.updateMatrixWorld()

+ 1 - 0
src/custom/viewer/ViewerNew.js

@@ -5549,6 +5549,7 @@ export class Viewer extends ViewerBase{
         let judge = ()=>{
             if(!this.images360.currentPano?.depthTex && Potree.settings.displayMode == 'showPanos'){
                 Potree.Utils.updateVisible(mesh,'show',true)
+                updatePos()
             }else{ 
                 Potree.Utils.updateVisible(mesh,'show',false)
             }