xzw 4 месяцев назад
Родитель
Сommit
7fa3122e43

+ 2 - 2
src/custom/mergeStartTest.js

@@ -321,8 +321,8 @@ var start = function(dom, mapDom, number, fileServer, webSite){ //t-Zvd3w0m
                 
             
     let tilesetUrls = [  
-        `${Potree.resourcePath}/models/3dtiles/test/tileset.json`, 
-        'http://192.168.0.25/oss/manage/media-library/result/test/tileset.json',
+        //`${Potree.resourcePath}/models/3dtiles/test/tileset.json`, 
+        //'http://192.168.0.25/oss/manage/media-library/result/test/tileset.json',
         'https://4dkk.4dage.com/scene_view_data/SG-t-GvKLWIKfJGC/images/3dtiles/tileset.json?_=1742785956443', 
         'https://testgis.4dage.com/LVBADUI_qp/tileset.json', //村庄   含rtcCenter 
         'https://4dkk.4dage.com/fusion/test/b3dm/modelId_11947/tileset.json',//json有的包含多个materials,之前会花掉,现在解决了

+ 3 - 1
src/custom/objects/Tag.js

@@ -320,7 +320,6 @@ class Tag extends THREE.Shim.FollowRootObject{
         if(onMesh){//贴mesh上时不是sprite,且可设置旋转值
             this.add(this.spot)
             this.titleLabel.position.y = 0
-            this.spot.position.set(0,0,0.01)//在mesh之上偏移一点
             this.setNorQua() 
             this.spot.renderOrder = Potree.config.renderOrders.tag.onMesh.spot // 防止遮住线
             this.line.renderOrder = Potree.config.renderOrders.tag.onMesh.line
@@ -360,6 +359,9 @@ class Tag extends THREE.Shim.FollowRootObject{
         this.spot.quaternion.setFromRotationMatrix(new THREE.Matrix4().lookAt(this.normal, Vectors.ZERO, Vectors.UP)) //重算quaternion
         this.realFaceAngle = 0      //quaternion被重置了,所以再设置一下faceAngle
         this.setFaceAngle(this.faceAngle) 
+        
+        this.spot.position.copy(this.normal).multiplyScalar(0.01)    //在mesh之上偏移一点
+            
     }
     
     /* 

+ 1 - 1
src/custom/objects/tool/TagTool.js

@@ -40,7 +40,7 @@ export class TagTool extends THREE.EventDispatcher{
         let position = Potree.Utils.datasetPosTransform({ toDataset: true,  pointcloud:e.intersect.pointcloud,  object:e.intersect.object,  position:e.intersect.location })
         let normal = e.intersect.localNormal?.clone() 
         if(!normal){
-            normal = e.intersect.normal.clone().applyMatrix4(root.rotateInvMatrix) 
+            normal = e.intersect.normal?.clone().applyMatrix4(root.rotateInvMatrix) 
         }
         
         return {root,normal,position}

+ 14 - 11
src/custom/utils/Common.js

@@ -181,7 +181,7 @@ var Common = {
     }
     ,
     
-    ifSame : function(object1, object2, simpleEqualClass=[]){ //对于复杂的类对象,若能简单判断就直接写进simpleEqualClass 
+    ifSame : function(object1, object2, simpleEqualClass=[], orderRequest=true){ //对于复杂的类对象,若能简单判断就直接写进simpleEqualClass 
         if(object1 == object2  )return true // 0 != undefined  , 0 == ''
         else if(!object1 || !object2) return false 
         else if(object1.constructor != object2.constructor){
@@ -192,16 +192,19 @@ var Common = {
         }else if(object1 instanceof Array ) {
             if(object1.length != object2.length)return false;
             var _object2 = object2.slice(0);
-            
-            for(let i=0;i<object1.length;i++){ 
-                var u = _object2.find(e=>Common.ifSame(object1[i], e, simpleEqualClass));
-                if(u == void 0 && !_object2.includes(u) && !object1.includes(u))return false;
-                else{
-                    let index = _object2.indexOf(u);
-                    _object2.splice(index,1);
+            if(orderRequest){
+                for(let i=0;i<object1.length;i++){ 
+                    if(!Common.ifSame(object1[i], _object2[i], simpleEqualClass, orderRequest))return false
+                }
+            }else{
+                for(let i=0;i<object1.length;i++){ 
+                    var u = _object2.findIndex(e=>Common.ifSame(object1[i], e, simpleEqualClass, orderRequest));
+                    if(u == -1 )return false;
+                    else{
+                        _object2.splice(u,1);
+                    }
                 }
             }
-            
             return true
         }else if(object1.equals instanceof Function ){//复杂数据仅支持这种,其他的可能卡住?
             
@@ -214,10 +217,10 @@ var Common = {
         }else if(typeof object1 == "object"){
             var keys1 = Object.keys(object1)
             var keys2 = Object.keys(object2)
-            if(!Common.ifSame(keys1,keys2,simpleEqualClass))return false;
+            if(!Common.ifSame(keys1,keys2,simpleEqualClass, orderRequest))return false;
             
             for(let i in object1){
-                var same = Common.ifSame(object1[i], object2[i],simpleEqualClass);
+                var same = Common.ifSame(object1[i], object2[i], simpleEqualClass, orderRequest);
                 if(!same)return false
             }
             return true