Selaa lähdekoodia

fix: 场景加载ok

xzw 2 vuotta sitten
vanhempi
commit
b640bbb0a8
3 muutettua tiedostoa jossa 127 lisäystä ja 327 poistoa
  1. 98 270
      public/static/lib/potree/potree.js
  2. 1 1
      public/static/lib/potree/potree.js.map
  3. 28 56
      src/sdk/laser/core/enter.js

+ 98 - 270
public/static/lib/potree/potree.js

@@ -70599,7 +70599,7 @@ void main()
 					  
 	                
 	                let addPow = viewer.mainViewport.view.isFlying() ? 0 : 0.5;  //0-0.5,正常原本是0. 数字越大近处加载越快。但会造成远处加载慢甚至因pointBudge限制不加载。  isFlying:漫游时需要尽量加载一下远处的点云
-	                addPow *= window.devicePixelRatio;    //devicePixelRatio高的手机需要优先加载最近的高级点云,减少远处的中高级点云。
+	                //addPow *= window.devicePixelRatio    //devicePixelRatio高的手机需要优先加载最近的高级点云,减少远处的中高级点云。
 					let distance = Math.pow(dd,0.5+addPow);//Math.sqrt(dd); //提高距离权重,为了提高近处加载速度。   某些场景近处加载慢优化明显,如SS-t-cqCAL6rJ5i 
 					
 					//let attenuateDis = 10;//add
@@ -70622,7 +70622,7 @@ void main()
 	                if( !sphere.containsPoint(camObjPos) ){ //add 优先加载屏幕中央的点云(手机端缩小离远效果明显,不会那么稀疏)
 	                    let dir = new Vector3().subVectors(center, camObjPos).normalize(); 
 	                    let cos = 1+dir.dot(camObjDir); //0-2
-	                    weight *= cos;//Math.pow(cos,0.5)   //幂越高,旁边的容易加载不到,出现缺块
+	                    weight *= cos/2;//Math.pow(cos,0.5)   //幂越高,旁边的容易加载不到,出现缺块
 	                } 
 	                
 					if(distance - radius < 0){
@@ -71292,7 +71292,7 @@ void main()
 	    viewer.setFOV(Potree.config.view.fov); 
 	     
 	    
-	     if(!Potree.settings.isOfficial){ 
+	    /* if(!Potree.settings.isOfficial){ 
 	        viewer.loadGUI(() => {
 	            viewer.setLanguage('en');
 	            //$("#menu_appearance").next().show();
@@ -71302,12 +71302,12 @@ void main()
 	            //$("#alignment").show();
 	            viewer.toggleSidebar();
 	        }); 
-	        Potree.settings.sizeFitToLevel = true;//当type为衰减模式时自动根据level调节大小。每长一级,大小就除以2
-	        Potree.settings.rotAroundPoint = false;
-	        if(/* Potree.settings.isTest && */ browser.isMobile()){
-	            changeLog();
+	        Potree.settings.sizeFitToLevel = true//当type为衰减模式时自动根据level调节大小。每长一级,大小就除以2
+	        Potree.settings.rotAroundPoint = false
+	        if( browser.isMobile()){
+	            changeLog()
 	        }
-	    }  
+	    } */  
 
 	    {
 	            
@@ -71325,7 +71325,7 @@ void main()
 	             
 	            //pointcloud.datasetData = dataset
 	            //pointcloud.dataset_id = dataset.id;//供漫游点找到属于的dataset点云
-	            pointcloud.hasDepthTex = Potree.settings.useDepthTex && (!!dataset.has_depth  ||  Potree.settings.isLocalhost && Potree.settings.number == 'SS-t-7DUfWAUZ3V'); //test   
+	            pointcloud.hasDepthTex = Potree.settings.useDepthTex;  
 	            material.minSize =  config.minSize;
 	            material.maxSize =  config.maxSize;   
 	            material.pointSizeType =/*   Potree.settings.isOfficial ?   */ config.pointSizeType;    /* : 'ADAPTIVE'    */   //Potree.PointSizeType[config.pointSizeType]//Potree.PointSizeType.ADAPTIVE;//FIXED
@@ -71337,10 +71337,7 @@ void main()
 	            //transformPointcloud(pointcloud,dataset)
 	            scene.addPointCloud(pointcloud);
 	            
-	            if(!Potree.settings.isOfficial){ 
-	                Potree.settings.floorplanEnables[dataset.id] = true;
-	                Potree.settings.floorplanType[dataset.id] = 'default';
-	            }
+	             
 	             
 	             
 	        
@@ -71358,11 +71355,7 @@ void main()
 	            
 	                if(!Potree.settings.UserPointDensity){
 	                    Potree.settings.UserPointDensity = 'high';//'middle' 
-	                }                                            
-	                 
-	                Potree.Log('loadPointCloudDone  点云加载完毕', {font:[null, 10]});  
-	                      
-	                 
+	                }  
 	                
 	                {//初始位置 
 	                   
@@ -71448,23 +71441,7 @@ void main()
 	  
 	 
 	 
-	window.buttonFunction = function(){
-	     
-	    viewer.scene.pointclouds.forEach(e=>e.predictNodeMaxLevel()); 
-	};
 	 
-	  
-	window.testTransform = function(locationLonLat, location1, location2){
-	    proj4.defs("NAVVIS:test", "+proj=tmerc +ellps=WGS84 +lon_0=" + locationLonLat[0].toPrecision(15) + " +lat_0=" + locationLonLat[1].toPrecision(15));
-	    
-	    let transform = proj4("WGS84", "NAVVIS:test"); //这个ok  navvis里也是这两种转换 见proj4Factory
-	    if(location1){//经纬度
-	        return transform.forward(location1) 
-	    }else {
-	        return transform.inverse(location2) 
-	    }            
-	        
-	};  
 	 
 	var changeLog = ()=>{  
 	         
@@ -71586,7 +71563,7 @@ void main()
 	    },
 	    
 	    transitionsTime:{
-	        flyMinTime : 400  ,  // 毫秒/米
+	        flyMinTime : 300  ,  // 毫秒/米
 	        flytimeDistanceMultiplier: 130 ,
 	        panoToPanoMax: 1800 , 
 	        flyIn:1000,
@@ -88001,7 +87978,7 @@ void main()
 	        
 	        let target = params.target || null;
 	        
-			const resolution = rtEDL ? new Vector2(rtEDL.width,rtEDL.height) : params.viewport ? params.viewport.resolution : this.viewer.renderer.getSize(new Vector2());//突然发现mobile用resolution2点云会放大
+			const resolution = rtEDL ? new Vector2(rtEDL.width,rtEDL.height) : params.viewport ? params.viewport.resolution2 : this.viewer.renderer.getSize(new Vector2());//突然发现mobile用resolution2点云会放大
 	        
 	        
 	        
@@ -91979,10 +91956,10 @@ ENDSEC
             
           
        
-            /* uniform sampler2D pano0Map;
-            uniform sampler2D pano1Map;    */   
-            uniform samplerCube pano0Map;
-            uniform samplerCube pano1Map;
+            uniform sampler2D pano0Map;
+            uniform sampler2D pano1Map;       
+            /* uniform samplerCube pano0Map;
+            uniform samplerCube pano1Map;*/
           
             
             varying vec2 vUv; 
@@ -92023,7 +92000,7 @@ ENDSEC
                 
                 vec2 getDepth(vec3 dir, sampler2D depthMap, float heightDown, float heightUp, vec4 eyePos){
                     vec2 depthValue = vec2(0.0, 0.0);
-                    vec2 uv2 = getSamplerCoord2(/* vWorldPosition12 */dir.xyz);  //暂时只用基于目标漫游点的方向
+                    vec2 uv2 = getSamplerCoord2( dir.xyz);  //暂时只用基于目标漫游点的方向
                     uv2.x -= 0.25;    //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移
                     vec4 depth = texture2D(depthMap, uv2);
                     //float distance = depth.r + 256. * (depth.g + 256. * depth.b);
@@ -92058,20 +92035,21 @@ ENDSEC
             #endif
             
             void main()
-            {
-                vec3 vWorldPosition0N = normalize(vWorldPosition0);
-                vec3 vWorldPosition1N = normalize(vWorldPosition1);
-                /* vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);
-                vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz);  
-                vec4 colorFromPano0=texture2D(pano0Map,samplerCoord0);
-                vec4 colorFromPano1=texture2D(pano1Map,samplerCoord1); */
+            { 
                 
+                vec3 vWorldPosition0N;
                 vec4 colorFromPano0 = vec4(0.0,0.0,0.0,0.0);
                 if(progress < 1.0){//通常是1
-                    colorFromPano0=textureCube(pano0Map,vWorldPosition0N.xyz);
+                    vWorldPosition0N = normalize(vWorldPosition0);
+                    vec3 vWorldPosition0N = normalize(vWorldPosition0);
+                    vec2 samplerCoord0 = getSamplerCoord2(vWorldPosition0N.xyz);
+                    colorFromPano0 = texture2D(pano0Map,samplerCoord0); 
                 }
-                vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1N.xyz);
- 
+                
+                vec3 vWorldPosition1N = normalize(vWorldPosition1);
+                vec2 samplerCoord1 = getSamplerCoord2(vWorldPosition1N.xyz);  
+                vec4 colorFromPano1 = texture2D(pano1Map,samplerCoord1);
+        
                 gl_FragColor=mix(colorFromPano0,colorFromPano1,progress);
               
               
@@ -92365,7 +92343,7 @@ ENDSEC
 	            this.quaternion = new Quaternion().copy(o.pose.rotation); 
 	            this.quaternion4dkk = math.convertVisionQuaternion(this.quaternion);//4dkk内使用的quaternion 
 	            this.quaternion2 = this.quaternion.clone();
-	            this.quaternion = new Quaternion().multiplyQuaternions(this.quaternion,  rot90);//全景图和Cube的水平采样起始坐标相差90度,cubeTex转90度
+	            //this.quaternion = new THREE.Quaternion().multiplyQuaternions(this.quaternion,  rot90);//全景图和Cube的水平采样起始坐标相差90度,cubeTex转90度
 	            
 	            this.rotation4dkk = new Euler().setFromQuaternion(this.quaternion4dkk);
 	            
@@ -92421,6 +92399,14 @@ ENDSEC
 	        //如果当前在全景模式且在这个点,需要切换显示吗? 目前用不到 
 	    }
 
+
+	    waitForLoad(){
+	        viewer.waitForLoad(this,  ()=>{//发送loading
+	            return this.depthTex && this.skyboxTex
+	        });
+	    }
+
+
 	    loadTex(){ 
 	        if(this.skyboxTex || this.texLoading)return
 	        this.texLoading = true;
@@ -92428,18 +92414,19 @@ ENDSEC
 	        //console.log('开始下载depthImg', this.id)
 	        let texture = texLoader$4.load( src, ()=>{
 	            this.skyboxTex = texture;
-	            this.images360.dispatchEvent({type:'loadedTex', pano:this, loaded:true});
+	            this.dispatchEvent({type:'loadedTex',   loaded:true});
 	            this.depthTexLoading = false;
 	            //viewer.dispatchEvent('content_changed') 
 	        },null,(e)=>{//error
 	            console.error('loadTex失败, 数据集sceneCode'+ this.pointcloud.sceneCode,  this.id );
 	             
-	            this.images360.dispatchEvent({type:'loadedTex', pano:this, });
+	            this.dispatchEvent({type:'loadedTex',   });
 	        });
 	        texture.wrapS = RepeatWrapping;
 	        texture.flipY = false; 
-	        texture.magFilter = LinearFilter;
-	        texture.minFilter = LinearFilter;
+	        texture.magFilter = LinearFilter;  
+	        texture.minFilter = LinearFilter; //防止边缘竖线
+	        texture.generateMipmaps = false;
 		}
 	    
 	    
@@ -92454,18 +92441,20 @@ ENDSEC
 	        //console.log('开始下载depthImg', this.id)
 	        let texture = texLoader$4.load( src, ()=>{
 	            this.depthTex = texture;
-	            this.images360.dispatchEvent({type:'loadedDepthImg', pano:this, loaded:true});
+	            this.dispatchEvent({type:'loadedDepthImg', pano:this, loaded:true});
 	            this.depthTexLoading = false;
+	            this.images360.updateDepthTex(this);
 	            //viewer.dispatchEvent('content_changed') 
 	        },null,(e)=>{//error
 	            console.error('loadDepthImg失败, 数据集sceneCode'+ this.pointcloud.sceneCode,  this.id );
 	            this.pointcloud.hasDepthTex = false;
-	            this.images360.dispatchEvent({type:'loadedDepthImg', pano:this, });
+	            this.dispatchEvent({type:'loadedDepthImg', pano:this, });
 	        });
 	        texture.wrapS = RepeatWrapping;
 	        texture.flipY = false; 
 	        texture.magFilter = LinearFilter;
 	        texture.minFilter = LinearFilter;
+	        texture.generateMipmaps = false;
 		}
 	 
 	    
@@ -92476,10 +92465,14 @@ ENDSEC
 	            //var quaternion = new THREE.Quaternion().multiplyQuaternions(this.quaternion,  rot901);//改  为球目全
 	            //quaternion.premultiply(rot90)
 	            this.panoMatrix = new Matrix4().makeRotationFromQuaternion(this.quaternion); 
-	            this.oriPanoMatrix = this.panoMatrix.clone();
+	            //this.oriPanoMatrix = this.panoMatrix.clone()
 	            
-	            if(this.quaternion2)this.oriPanoMatrix2 = new Matrix4().makeRotationFromQuaternion(this.quaternion2); 
-	         
+	            //if(this.quaternion2)this.oriPanoMatrix2 = new THREE.Matrix4().makeRotationFromQuaternion(this.quaternion2) 
+	            
+	        
+	            //补:全景图下和原来的一样
+	            this.panoMatrix2 = this.panoMatrix;  
+	            this.panoMatrix2Inverse = this.panoMatrix2.clone().invert(); 
 	        } 
 	         
 	        let marker = new Mesh(planeGeo$1, this.getMarkerMat() ); 
@@ -93052,9 +93045,7 @@ ENDSEC
 	        
 	        
 	        this.depthSampler = new DepthImageSampler(); 
-	        this.addEventListener('loadedDepthImg',(e)=>{
-	            e.loaded && this.updateDepthTex(e.pano);
-	        });
+	        
 	        
 	        
 	        
@@ -93085,12 +93076,8 @@ ENDSEC
 	                ||   Potree.settings.editType == 'merge' && !e.intersectPoint || viewer.inputHandler.hoveredElements[0] && viewer.inputHandler.hoveredElements[0].isModel && e.intersectPoint.distance > viewer.inputHandler.hoveredElements[0].distance
 	            )  return 
 	             
-	            if(Potree.settings.editType != 'pano' && Potree.settings.editType != 'merge'){
-	                if( e.hoverViewport == viewer.mapViewer.viewports[0]){
-	                    return viewer.mapViewer.dispatchEvent(e/* {type:'global_click',e } */) 
-	                }else if(e.hoverViewport != viewer.mainViewport){ //如数据集校准其他viewport
-	                    return
-	                }
+	            if(e.hoverViewport != viewer.mainViewport){ //如数据集校准其他viewport
+	                 return
 	            }
 	              
 	            if(!Potree.settings.dblToFocusPoint/*  && this.currentPano */){//双击不会focus点云 或者 已经focusPano了
@@ -93239,14 +93226,7 @@ ENDSEC
 	                                this.addEventListener('flyToPanoDone',wait);   //等待飞行完毕。flyToPano的callback可能不执行所以换这个。但也可能被cancel
 	                                this.flyToPano({
 	                                    pano: this.findNearestPano(),   
-	                                    //dealDoneWhenCancel:true,
-	                                    /* callback: ()=>{ 
-	                                        setTimeout(()=>{ //防止循环,所以延迟
-	                                           if(this.latestRequestMode == mode ){
-	                                                Potree.settings.displayMode = mode 
-	                                            } 
-	                                        },1)  
-	                                    } */
+	                                     
 	                                }); 
 	                                
 	                                return;
@@ -93261,25 +93241,23 @@ ENDSEC
 	                            
 	                        if(config2.showSkybox || config2.pointUsePanoTex){ 
 	                            let wait = (e)=> {
-	                                if(e.pano && e.pano != this.currentPano)return//loadedDepthImg
+	                                viewer.ifAllLoaded();                                         
+	                                //if(e.pano && e.pano != this.currentPano)return//loadedDepthImg
 	                                setTimeout( ()=>{
 	                                    if(this.latestRequestMode == mode ){
 	                                        Potree.settings.displayMode = mode; 
 	                                    }
-	                                },1);
-	                                this.removeEventListener('loadedDepthImg', wait);
+	                                },1); 
 	                            };
-	                            if(!this.currentPano.depthTex && this.currentPano.pointcloud.hasDepthTex){
-	                                this.addEventListener('loadedDepthImg', wait);           
-	                                return this.currentPano.loadDepthImg()
-	                            } 
+	                            /* 
 	                            //this.updateDepthTex()  
-	                            /* if(this.checkAndWaitForPanoLoad(this.currentPano,  this.basePanoSize, wait)){
+	                            if(this.checkAndWaitForPanoLoad(this.currentPano,  this.basePanoSize, wait)){
 	                                return
 	                            } */ 
 	                            if(!this.currentPano.skyboxTex){
-	                                this.addEventListener('loadedTex', wait, {once:true});     
-	                                this.currentPano.loadTex();
+	                                this.currentPano.waitForLoad(); 
+	                                this.currentPano.addEventListener('loadedTex', wait, {once:true});     
+	                                return this.currentPano.loadTex()
 	                            }                            
 	                        } 
 	                        
@@ -93626,19 +93604,19 @@ ENDSEC
 	        
 	        {//不飞的话是否不要执行这段?
 	            
-	            let wait = (e)=> {
-	                if(e.pano && this.latestToPano && e.pano != this.latestToPano.pano)return//loadedDepthImg
+	            let wait = ( )=> { 
+	                viewer.ifAllLoaded(); 
+	                if( this.latestToPano && pano != this.latestToPano.pano)return//loadedDepthImg
 	                if(this.latestToPano != toPano)return /* Potree.Log('已经取消') *///如果取消了
 	                setTimeout(()=>{ 
 	                    if(this.latestToPano != toPano)return
 	                    this.flyToPano(toPano); 
-	                },1);
-	                this.removeEventListener('loadedDepthImg', wait);
-	                this.removeEventListener('loadedTex', wait);
+	                },1);  
 	            };
 	            if(!pano.depthTex && pano.pointcloud.hasDepthTex){ //点云模式也要加载depthTex,因获取neighbour需要用到
 	                //console.log('等待加载depthtex')
-	                this.addEventListener('loadedDepthImg', wait);           
+	                pano.addEventListener('loadedDepthImg', wait, {once:true}); 
+	                pano.waitForLoad(); 
 	                return pano.loadDepthImg()
 	            }
 	            
@@ -93649,8 +93627,9 @@ ENDSEC
 	                }
 	                
 	                if(!pano.skyboxTex){
-	                    this.addEventListener('loadedTex', wait, {once:true});     
-	                    pano.loadTex();
+	                    pano.waitForLoad(); 
+	                    pano.addEventListener('loadedTex', wait, {once:true});     
+	                    return pano.loadTex()
 	                }
 	                /* if(this.checkAndWaitForPanoLoad(pano, toPano.basePanoSize || this.basePanoSize,  wait )){
 	                    return
@@ -94004,19 +93983,7 @@ ENDSEC
 	        t || (t = 0);
 	        option1 = void 0 !== option1 ? option1 : .75;
 	        var o = option2 ? "angle" : "direction";
-	        
-	        var floor = viewer.modules.SiteModel.currentFloor;
-	        var entity = viewer.modules.SiteModel.inEntity;
-	        
-	        var getHeightDis = (pano)=>{
-	            if(floor && !floor.panos.includes(pano) && pano.position.z < this.position.z){ //若是上方的漫游点,就正常走。因为一般不会点击天花板。
-	                return this.position.z - pano.position.z  
-	            }else {
-	                return 0
-	            }  
-	        }; 
-	        
-	        
+	         
 	        let disSquareMap = new Map();
 	        this.panos.forEach(pano=>{
 	            let dis2 = pano.position.distanceToSquared(this.position);  //距离目标点
@@ -94360,7 +94327,17 @@ ENDSEC
 	                          
 	      
 	                               
-	                                  
+	    getIntersect(pano, dir, origin){
+	        if(pano && pano.pointcloud.hasDepthTex ){
+	            return this.depthSampler.sample( {dir }, pano, true )
+	        }else {
+	            origin = origin || pano.position;
+	            return viewer.inputHandler.getIntersect(viewer.inputHandler.hoverViewport, true, null, null, true, {
+	                point: origin.clone().add(dir),
+	                cameraPos: origin
+	            })
+	        }
+	    }                           
 	                             
 	                                 
 	                                        
@@ -134787,8 +134764,7 @@ ENDSEC
 	        this.modules = { 
 	            
 	        };
-	        Potree.settings.useDepthTex = false;
-	        
+	         
 	       
 	            
 	        
@@ -135493,8 +135469,7 @@ ENDSEC
 	        let byTex=0,  byCloud=0;
 	        let len = shelterHistory.length;
 	        let waitCloud = [];
-	        let max = this.mainViewport.view.isFlying() ? 1 : Math.min(1/depthTiming, 10); //起飞时lastFrameChanged还是false,所以不用lastFrameChanged
-	        let maxTexCount = Common$1.getBestCount('shelterMaxDepthSample', 1,  max,   1,  13   /*  ,true */    ); 
+	        let maxTexCount = Common$1.getBestCount('shelterMaxDepthSample', 1,  50,   1,  13   /*  ,true */    ); 
 	        
 	        
 	        
@@ -138731,8 +138706,8 @@ ENDSEC
 	       
 	        performance.mark('loop-start') ;// 无论有没有reportTimings都要获取,因为getBestCound需要
 	        
-	        let depthTiming = Potree.timeCollect.depthSampler.median; 
-	        this.shelterCount = {byTex:0, byCloud:0,   maxByTex: MathUtils.clamp(0.2/depthTiming, 1, 10), maxByCloud:0   }; //清空 因ifPointBlockedByIntersect可能在任何时候触发,所以需要一开始就定义这个,且每次计算最大可计算次数太麻烦了就定义一个吧。
+	       
+	        this.shelterCount = {byTex:0, byCloud:0,   maxByTex: 100, maxByCloud:0   }; //清空 因ifPointBlockedByIntersect可能在任何时候触发,所以需要一开始就定义这个,且每次计算最大可计算次数太麻烦了就定义一个吧。
 	        
 
 
@@ -140377,135 +140352,22 @@ ENDSEC
 	    
 	    //查询: http://192.168.0.26:8080/doc.html#/default/filter-%E6%BC%AB%E6%B8%B8%E7%82%B9/filterUsingGET    
 	}
-
-	async function loadDatasets(callback,sceneCode,onError){//之后直接把path写进来
-	    let path; 
-	    sceneCode = sceneCode || Potree.settings.number;
-	    if(Potree.fileServer){
-	        path = `/laser/dataset/${sceneCode}/getDataSet`; 
-	    }else {
-	        
-	        //path = `${Potree.settings.urls.prefix2}/indoor/${Potree.settings.number}/api/datasets`
-	        //现在只能加载得了本地的了
-	        path = `${Potree.settings.urls.prefix}/laser/dataset/${sceneCode}/getDataSet`;
-	        //path = `${Potree.scriptPath}/data/${sceneCode}/getDataSet.json`
-	        
-	    }
-	    return loadFile(path, null, callback,onError)
-	    
-	}
-
-
-	//目前上传平面图后如果不点击保存按钮,数据还是旧的不生效
-	async function loadMapEntity(datasetId, force){ 
-	    if(!Potree.settings.floorplanEnable && !force && Potree.fileServer  )return /* 等待平面图类型定义好会加载 */
-	     
-	    
-	    let loaded = 0;
-	    
-	    let needLoads = datasetId == 'all' ? viewer.scene.pointclouds.map(e=>e.dataset_id) : [datasetId];
-	    
-	    
-	    let callback = (dataset_id, floorplanType, data  )=>{
-	        //要防止旧的比新的先获取到导致覆盖新的,因为两种type随时可能切换
-	        if(floorplanType != Potree.settings.floorplanType[dataset_id]) return //如果请求的floorplanType不是当前最新的floorplanType就返回
-	        
-	        var map = viewer.mapViewer.mapLayer.maps.find(e => e.name == 'floorplan_'+ dataset_id);
-	        if(map){  
-	            viewer.mapViewer.mapLayer.removeMap(map);
-	        } 
-	        
-	        var mapNew = viewer.mapViewer.mapLayer.addMapEntity(data.data || data,  dataset_id);
-	        if(map){
-	            mapNew.visibleReasons = map.visibleReasons; 
-	            mapNew.unvisibleReasons = map.unvisibleReasons; 
-	        }
-	        loaded ++; 
-	    }; 
-	    
-	    needLoads.forEach(dataset_id=>{
-	        let floorplanType = Potree.settings.floorplanType[dataset_id],  prefix = '';
-	        if(!Potree.fileServer){   
-	            prefix = Potree.settings.urls.prefix;
-	        }
-	        if(!floorplanType)return
-	        var path; 
-	        /* if(Potree.fileServer){ 
-	            path = `/laser/tiledMap/${Potree.settings.number}/tiledMap/${floorplanType}/${dataset_id}` 
-	        }else{
-	            path = `${Potree.settings.urls.prefix2}/indoor/${Potree.settings.number}/api/tiled_maps`
-	            
-	        } */
-	        path = `${prefix}/laser/tiledMap/${Potree.settings.number}/tiledMap/${floorplanType}/${dataset_id}`; 
-	        
-	        Potree.settings.floorplanRequests[dataset_id] = true; //开始加载了
-	        return loadFile(path, null, callback.bind(this,  dataset_id, floorplanType)  )
-	    });
-	    
-	     
-	    
-	}
 	 
 	async function loadPanos( callback){
 	    var path; 
 	    //let query = `?datasetId=${datasetId}`                  //`?lat=${center.lat}&lon=${center.lon}&radius=200000`
-	    if(Potree.fileServer){
-	        path = `vision.json`; 
-	    } 
+	    if(Potree.fileServer){ 
+	        path = 'vision.json';
+	    }else {
+	        path = `${Potree.settings.urls.prefix1}/vision.json`; 
+	    }
+	     
 	    return loadFile(path, { }, callback) 
 	    
 	}
 
-
 	 
 
-	//site_model
-	/* {
-	    "area": 2503.30551910935,
-	    "attributes": {},
-	    "center": [
-	        113.59568277455075,
-	        22.366566635195288,
-	        12.78751625
-	    ],
-	    "children": [],
-	    "geometry_hash": 1891071345,
-	    "id": 10,
-	    "name": "港湾一号",
-	    "parentId": null,
-	    "polygon": {
-	        "coordinates": [
-	            [
-	                [
-	                    113.59590810534583,
-	                    22.36679132753878
-	                ],
-	                [
-	                    113.59590810534583,
-	                    22.366807172528629
-	                ],
-	                [
-	                    113.59545610274934,
-	                    22.366807172528629
-	                ],
-	                [
-	                    113.59545610274934,
-	                    22.36679132753878
-	                ]
-	            ]
-	        ],
-	        "type": "Polygon"
-	    },
-	    "type": "BUILDING",
-	    "volume": null,
-	    "z_max": null,
-	    "z_min": null
-	}
-	 */
-
-
-
-
 	function Log$1(){ 
 	    
 	    let args = Array.from(arguments);
@@ -140570,39 +140432,7 @@ ENDSEC
 						resolve({type: 'pointcloud_loaded', pointcloud: pointcloud});
 					}
 				});
-			}/*  else if (path.indexOf('metadata.json') > 0) {  //部分浏览器(如uc)不支持NodeLoader中的1n的大数据写法
-				Potree.OctreeLoader.load(path).then(e => {
-					let geometry = e.geometry;
-
-					if(!geometry){
-						console.error(new Error(`failed to load point cloud from URL: ${path}`));
-					}else{
-						let pointcloud = new ExtendPointCloudOctree(geometry);
-
-						let aPosition = pointcloud.getAttribute("position");
-
-						let material = pointcloud.material;
-						material.elevationRange = [
-							aPosition.range[0][2],
-							aPosition.range[1][2],
-						];
-
-						// loaded(pointcloud);
-						resolve({type: 'pointcloud_loaded', pointcloud: pointcloud});
-					}
-				});
-
-				OctreeLoader.load(path, function (geometry) {
-					if (!geometry) {
-						//callback({type: 'loading_failed'});
-						console.error(new Error(`failed to load point cloud from URL: ${path}`));
-					} else {
-						let pointcloud = new ExtendPointCloudOctree(geometry);
-						// loaded(pointcloud);
-						resolve({type: 'pointcloud_loaded', pointcloud: pointcloud});
-					}
-				});
-			}  */else if (path.indexOf('.vpc') > 0) {
+			} else if (path.indexOf('.vpc') > 0) {
 				PointCloudArena4DGeometry.load(path, function (geometry) {
 					if (!geometry) {
 						//callback({type: 'loading_failed'});
@@ -140792,9 +140622,7 @@ ENDSEC
 	exports.config = config$1;
 	exports.debug = debug;
 	exports.framenumber = framenumber;
-	exports.loadDatasets = loadDatasets;
 	exports.loadFile = loadFile;
-	exports.loadMapEntity = loadMapEntity;
 	exports.loadPanos = loadPanos;
 	exports.loadPointCloud = loadPointCloud$1;
 	exports.loadProject = loadProject;

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
public/static/lib/potree/potree.js.map


+ 28 - 56
src/sdk/laser/core/enter.js

@@ -71,12 +71,8 @@ var enter = ({
     parameter.number = number;
     parameter.viewer = viewer;
     parameter.sceneBus = sceneBus; 
-
-    if (revision == "2.1.1") {
-        //旧版
-        Potree.settings.rotAroundPoint = false; //试验
-        //Potree.config.material.realPointSize = 0.4 //实际上的ui滑动条默认大小(兼容旧的版本) ?
-    }
+    //Potree.settings.rotAroundPoint = false; //试验
+        
 
     sceneBus.on("visible", (v) => {
         viewer.visible = v;
@@ -105,7 +101,7 @@ var enter = ({
                 rotate: camera.rotation,
                 //dataset: viewer.atDatasets.map((e) => e.dataset_id),
             });
-        } else if (e.viewport.name == "mapViewport") {}
+        } 
     };
     viewer.addEventListener("camera_changed", cameraChange);
     viewer.addEventListener("shelterComputed", () => {
@@ -262,10 +258,10 @@ var enter = ({
             getDatasetLocations: () => {
                 return measure.dataset_points;
             },
-            getDatasets: () => {
+            /*getDatasets: () => {
                 return measure.points_datasets;
             },
-            /* getDatasetId: () => {
+             getDatasetId: () => {
                 return measure.datasetId;
             }, */
 
@@ -352,8 +348,8 @@ var enter = ({
             getPointByScreen(pos2d) {
                 //获取当前画面鼠标所在位置的三维点(必须是点云点)
                 let position,
-                datasetId,
-                dataset_location,
+                /* datasetId,
+                dataset_location, */
                 intersect;
                 let Handler = viewer.inputHandler;
 
@@ -401,7 +397,7 @@ var enter = ({
                 };
             }, //全景模式一直获取会很卡
 
-            getPose(o = {}) {
+            /* getPose(o = {}) {
                 //获取相对于第一个数据集的初始画面。(当数据集校准后,如果初始画面设置在被修改的数据集上,且该数据集非初始数据集的话,还是会偏移的)
                 var deferred = o.deferred || $.Deferred();
                 console.log("getPose,转换前:", viewer.mainViewport.view.clone());
@@ -471,11 +467,7 @@ var enter = ({
 
                 var getQuaternion = () => {
                     view.pitch = o.pitch;
-                    view.yaw = o.yaw;
-
-                    /* var realRotation = Potree.Utils.datasetRotTransform({ fromDataset: true, rotation: view.rotation, getRotation: true, datasetId: Potree.settings.originDatasetId }) //拿第一个数据集
-                    view.rotation = realRotation */
-
+                    view.yaw = o.yaw; 
                     quaternion = Potree.Utils.datasetRotTransform({
                             fromDataset: true,
                             rotation: view.rotation,
@@ -543,7 +535,7 @@ var enter = ({
                 }
 
                 return deferred.promise();
-            },
+            }, */
 
             getPose2() {
                 const camera = viewer.scene.getActiveCamera();
@@ -861,10 +853,8 @@ var enter = ({
             ...parameter.sceneBus,
         },
 
-        /////////////////////////////////
-
-          
-        /////////////////////////////
+        /*
+        
         transformPoint(point, datasetId, dataset_location) {
             //获取由dataset_location转出的position
             var r = datasetId != void 0
@@ -877,7 +867,7 @@ var enter = ({
 
             return r;
         },
-        /*
+        
         // 坐标转换
         coordTransform: (originType, pos, targetType, datasetId) => {
             // pos 坐标的类型, 当类型为SCREEN时为 { x, y } 其余为 {x, y, z}
@@ -1160,45 +1150,23 @@ var enter = ({
    
         enterMeasurement() {
             //进入测量模块
-            viewer.setLimitFar(false);
-            //打开全部的平面图开关
-            /* let floorplanEnable = Potree.settings.floorplanEnable
-            this.fplanEnableOld = floorplanEnable
-            if(!floorplanEnable){
-            sdk.setFloorplanEnable(true)
-            }  */
+            viewer.setLimitFar(false); 
         },
         leaveMeasurement() {
             //退出测量模块
-            viewer.setLimitFar(true);
-            /* if(!this.fplanEnableOld){
-            sdk.setFloorplanEnable(false)
-            } */
+            viewer.setLimitFar(true); 
         },
         
- 
   
 
         loadModel(info) {
             info.moveWithPointcloud = true;
-            viewer.loadModel(info);
-            //https://uat-laser.4dkankan.com/uat/qianxunhtml?m=t-YLZ5XAALl7#/
-            //https://uat-laser.4dkankan.com/uat/qianxun.html?m=t-e2Kb2iU
+            viewer.loadModel(info); 
         },
-
-        /*  Emitter<{
-        // 取消移动模式
-        cancelMove: void,
-        // 取消放大缩小模式
-        cancelScale: void,
-        // 取消旋转模式
-        cancelRotate: void
-        // 取消排除模式
-        cancelExclude: void,
-        // 取消交集模式
-        cancelIntersect: void,
-        }>
-         */
+ 
+ 
+ 
+ 
         enterEditCrop() {
             //实时剪裁编辑模块
             const bus = mitt();
@@ -1309,11 +1277,8 @@ var enter = ({
 };
 
 export default enter;
-// axios.get('/laser/poi/:sceneCode/list', {})
-// axios.post('/laser/poi/:sceneCode/add', {})
+ 
 
-/*
-热点poi加载到的数据中,pos是错误的,只使用dataset_location
 
 
 
@@ -1323,6 +1288,13 @@ export default enter;
 
 
 
+
+ 
+/*
+热点poi加载到的数据中,pos是错误的,只使用dataset_location
+
+ 
+
 关于webgl context lost报错:
 
 已知有一iphoneX在创建shadowMap后才报错。