xzw 1 rok temu
rodzic
commit
0ab0b57a88

+ 9 - 5
src/custom/objects/tool/Measure.js

@@ -288,7 +288,7 @@ export class Measure extends ctrlPolygon{
                 this.edges[index].distance_ = distance
                 edgeLabel.shouldVisi = (index < lastIndex || this.isRect || this.closed && !this.isNew ) && distance>0 
                 //this.closed || edgeLabel.setVisible(edgeLabel.shouldVisi)  //closed的在setEdgesDisplay中设置
-                Utils.updateVisible(edgeLabel, 'shouldVisi', edgeLabel.shouldVisi)
+                Utils.updateVisible(edgeLabel, 'shouldVisi', edgeLabel.shouldVisi, 2)
                 if(edgeLabel.shouldVisi){
                     edgeLabel.lineDir = new THREE.Vector3().subVectors(point,nextPoint).normalize() //[point,nextPoint]
                     setEdgeLabel(edgeLabel,point,nextPoint,distance)
@@ -415,12 +415,10 @@ export class Measure extends ctrlPolygon{
             this.showTotalDis = show
         }  
         /* 连续测量:
-        1. ≥2次测量,单个距离<15cm时,居中显示总长
+        1. ≥2次测量,单个距离<15cm时,居中显示总长, hover、选中时显示每段长度
         2. 若连续测量的线段中,大于等于1段超出15cm,所有线段均显示长度
         -------------------
-        所有连续测量共用逻辑:
-        选中或者鼠标悬浮时,显示所有单个线段的长度(第1点不同,选中或悬浮也显示总长)
-        离开时,均显示总长 */
+       */
     }
 
     clearEdgeLabelVisi(){//修改点位置后清空,下次render时会自动getEdgeLabelVisi
@@ -757,6 +755,12 @@ export class Measure extends ctrlPolygon{
     setEdgesDisplay(state, ignoreGuideLine){ 
         this.closed && this.edgeLabels.forEach(e=>Utils.updateVisible(e,'hover',state)) 
         
+        
+        if(this.totalDisLabel){
+            this.edgeLabels.forEach(e=> Utils.updateVisible(e, 'hover', state,  1, state ? 'add' : 'cancel'))     
+        }
+    
+        
         if(!ignoreGuideLine && this.measureType == 'Distance'){
             this.horEdgeLabel.visible = this.verEdgeLabel.visible = this.horGuideEdge.visible = this.verGuideEdge.visible = !!(state && this.shouldShowHorVerGuide)
         }

+ 3 - 3
src/custom/potree.shim.js

@@ -994,10 +994,10 @@ BinaryLoader.prototype.load = function(node, callback){//解析点云
                 let buffer = xhr.response;
                 this.parse(node, buffer, callback); 
             } else {
-                //console.error(`Failed to load file! HTTP status: ${xhr.status}, file: ${url}`);
-                throw new Error(`Failed to load file! HTTP status: ${xhr.status}, file: ${url}`);
                 node.loadFailed = 'status:'+xhr.status+",url:"+url
                 Potree.numNodesLoading--;
+                //console.error(`Failed to load file! HTTP status: ${xhr.status}, file: ${url}`);
+                throw new Error(`Failed to load file! HTTP status: ${xhr.status}, file: ${url}`); 
             }
         }
     };
@@ -1005,9 +1005,9 @@ BinaryLoader.prototype.load = function(node, callback){//解析点云
     try {
         xhr.send(null);
     } catch (e) {
-        console.error('加载点云node出错 ', url, e  );
         node.loadFailed = 'catchError'
         Potree.numNodesLoading--;
+        console.error('加载点云node出错 ', url, e  ); 
     }
 }
 

+ 12 - 4
src/custom/start.js

@@ -278,7 +278,7 @@ export function start(dom, mapDom, number ){ //t-Zvd3w0m
             //dataset.orientation = 0
             
             Alignment.rotate(pointcloud, null, dataset.orientation)   
-            Alignment.translate(pointcloud, new THREE.Vector3(location[0], location[1], dataset.location[2])) 
+            Alignment.translate(pointcloud, new THREE.Vector3(location[0], location[1],  dataset.location[2]-originDataset.location[2])) 
             
             pointcloud.updateMatrixWorld()
             
@@ -292,15 +292,23 @@ export function start(dom, mapDom, number ){ //t-Zvd3w0m
         }
         
         if(!Potree.settings.originDatasetId)Potree.settings.originDatasetId = data[0].id
-        var originDataset =  data.find(e=>e.id == Potree.settings.originDatasetId)  
+        var originDataset = data.find(e=>e.id == Potree.settings.originDatasetId)  
+        /* originDataset.location[0] = 113.60608878174709
+        originDataset.location[1] = 22.381189423935155
+         
+        
+        let ano = data.find(e=>e.name == 'SG-t-Jw0xyhL6oSY')
+        ano.location[0] = 113.6060509967498
+        ano.location[1] = 22.381061273279244 */
         
+         
         {//拿初始数据集作为基准。它的位置是000
             var locationLonLat = originDataset.location.slice(0,2)
             
             if(window.AMapWith84){//需要转换为高德的,但该函数不准确,转入后再转出,和原来的有偏差.    navvis的我看data中存的globalLocation直接输入到高德地图后的定位和其要展示的定位一致,而我们要转为高德后才一致,猜测是navvis后台转为了高德可用的经纬度。 若不转的话,其他看起来没问题,仅高德地图定位不准确,因其为被加密后的火星坐标系。
                 locationLonLat = AMapWith84.wgs84ToAMap({x:locationLonLat[0], y:locationLonLat[1]})
                 locationLonLat = [locationLonLat.x,locationLonLat.y] 
-            } 
+            }  
             
             proj4.defs("LOCAL", "+proj=tmerc +ellps=WGS84 +lon_0=" + locationLonLat[0].toPrecision(15) + " +lat_0=" + locationLonLat[1].toPrecision(15)); //高德坐标系
             proj4.defs("LOCAL_MAP", "+proj=tmerc +ellps=WGS84 +lon_0=" + locationLonLat[0].toPrecision(15) + " +lat_0=" + locationLonLat[1].toPrecision(15)); //地图和本地一样
@@ -351,7 +359,7 @@ export function start(dom, mapDom, number ){ //t-Zvd3w0m
                 for(let f in viewer.transform){
                     change(viewer.transform[f]) 
                 }  
-            }
+            } 
             
             
             

+ 5 - 1
src/custom/utils/math.js

@@ -50,7 +50,11 @@ var math = {
     getVec2Cos :  function(dir1,dir2){ 
         return dir1.dot(dir2) / dir1.length() / dir2.length()    
     },
-    getAngle:function(vec1, vec2, axis){//带方向的角度 vector3
+    getAngle:function(vec1, vec2, axis='z'){//带方向的角度 vector3
+        if(!vec1.isVector3){
+            vec1 = new THREE.Vector3(vec1.x, vec1.y, 0)
+            vec2 = new THREE.Vector3(vec2.x, vec2.y, 0)
+        }
         var angle = vec1.angleTo(vec2)
         var axis_ = vec1.clone().cross(vec2);
         if(typeof axis == 'string'){

+ 6 - 5
src/custom/viewer/ViewerNew.js

@@ -1167,10 +1167,11 @@ export class Viewer extends ViewerBase{
     updatePanosVisibles(currentFloor){//显示当前楼层的所有panos  
         if(!Potree.settings.ifShowMarker)return
         let inEntity = currentFloor
-        if(!inEntity) inEntity = this.atDatasets[0] 
+        
         
         viewer.images360.panos.forEach(pano=>{
-            let visible = inEntity && inEntity.panos.includes(pano) 
+            let visible = inEntity ? inEntity.panos.includes(pano) : this.atDatasets.some(e=>e.panos.includes(pano))
+            
             Potree.Utils.updateVisible(pano, 'buildingChange', visible, 2)  
         })
         this.dispatchEvent('content_changed')
@@ -3252,7 +3253,7 @@ export class Viewer extends ViewerBase{
                     }else{
                         this.renderer.setViewport(left, bottom, width, height) //规定视口,影响图形变换(画布的使用范围) 
                     }
-                    scissorTest && console.log('setScissor', left, bottom, width, height)
+                    //scissorTest && console.log('setScissor', left, bottom, width, height)
                     scissorTest && this.renderer.setScissor( left, bottom, width, height );//规定渲染范围
                     this.renderer.setScissorTest( scissorTest );//开启WebGL剪裁测试功能,如果不开启,.setScissor方法设置的范围不起作用 | width==1且height==1时开启会只有鼠标的地方刷新,很奇怪
                     
@@ -3888,7 +3889,7 @@ export class Viewer extends ViewerBase{
                 updateCamera() 
                 if(useMap){
                     let waitMap = ()=>{
-                        console.log('waitMap: '+sid, Date.now(), this.mapViewer.mapLayer.loadingInProgress )  
+                        console.log('waitMap: '+startTime, Date.now(), this.mapViewer.mapLayer.loadingInProgress )  
                         this.mapViewer.waitLoadDone(screenshot.bind(this))//等待地图所有加载完 
                     }   
                     this.waitPointLoad(waitMap,info.maxTimeForPointLoad) 
@@ -3899,7 +3900,7 @@ export class Viewer extends ViewerBase{
             
             let {promise} = this.focusOnObject(info.measurement, 'measure', 0, {
                 basePanoSize:1024,  gotoBestView:true,
-                minMapWidth: THREE.Math.clamp(Math.min(viewer.bound.boundSize.x,  viewer.bound.boundSize.y) / (this.mapViewer.mapLayer.maps.find(e=>e.name == 'map').disabled ? 6 : 3),  2, 25)           //有地图的话为了显示出名字需要更大范围
+                minMapWidth: THREE.Math.clamp(Math.min(viewer.bound.boundSize.x,  viewer.bound.boundSize.y) / (8/* this.mapViewer.mapLayer.maps.find(e=>e.name == 'map').disabled  ? 6 : 3*/),  2, 25)           //有地图的话为了显示出名字需要更大范围
             })//注意:不同角度截图 得到三维的会不一样,因为focusOnObject是根据方向的
             promise.done(()=>{  
                 //console.log('promise.done')