浏览代码

Merge branch 'master' of http://192.168.0.115:3000/bill/traffic-laser

xushiting 2 年之前
父节点
当前提交
05006d2e95
共有 3 个文件被更改,包括 68 次插入41 次删除
  1. 64 38
      public/static/lib/potree/potree.js
  2. 1 1
      public/static/lib/potree/potree.js.map
  3. 3 2
      src/sdk/laser/core/enter.js

+ 64 - 38
public/static/lib/potree/potree.js

@@ -90348,16 +90348,19 @@ void main()
 	        viewer.updateScreenSize({forceUpdateSize:true});        
 	    }
 	    
+	    
 	    viewportFitBound(viewport,  bound,  center, duration=0, margin){
 	        let view = viewport.view;
 	        let info = {bound}; 
-	        let {boundSize, boundCenter} = this.getViewBound(viewport);
+	                                                                  
+	         
+	        let {boundSize, boundCenter} = this.getViewBound(viewport, bound );
 	        
-	        this.setShiftTarget(viewport, boundCenter);
-	        /* 
-	        viewport.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), boundCenter )  
-	        viewport.targetPlane.projectPoint(center, viewport.shiftTarget)  //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
-	         */
+	        //this.setShiftTarget(viewport, boundCenter)
+	     
+	        viewport.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), boundCenter );  
+	        viewport.targetPlane.projectPoint(center, viewport.shiftTarget);  //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
+	         
 	        info.endPosition = this.getPosOutOfModel(viewport, boundSize); 
 	        
 	        //if(viewport.name == 'mapViewport')info.endPosition.z = Math.max(Potree.config.map.cameraHeight, info.endPosition.z) 
@@ -90367,10 +90370,17 @@ void main()
 	    } 
 	    
 	    
-	    getViewBound(viewport){
-	        let {boundSize, center} = viewer.bound;
+	    getViewBound(viewport, boundingBox){
+	        if(boundingBox){
+	            boundSize = boundingBox.getSize(new Vector3);
+	            center = boundingBox.getCenter(new Vector3);
+	        }else {
+	            var {boundSize, center, boundingBox} = viewer.bound;
+	        }
+	        
+	        
 	        if(viewport.viewContainsPoints){//视野范围内必须要包含的点,直接算入模型区域。这时候得到的boundCenter和模型中心不重合
-	            let boundingBox = viewer.bound.boundingBox.clone();
+	            boundingBox = boundingBox.clone();
 	            viewport.viewContainsPoints.forEach(point=>{
 	                boundingBox.expandByPoint(point);
 	            });
@@ -91525,25 +91535,24 @@ void main()
 	                
 	                //不过平板无hover事件
 	                faceMesh.addEventListener('mouseover', (e)=>{
-	                    if(this.changingView)return
+	                    if(navCubeViewer.changingView)return
 	                    faceMesh.material.uniforms.faceColor.value.set(Colors.blue);
 	                    //console.log('变', name)
 	                    navCubeViewer.dispatchEvent('content_changed');
 	                });
 	                faceMesh.addEventListener('mouseleave', (e)=>{
-	                    if(this.changingView)return
+	                    if(navCubeViewer.changingView)return
 	                    faceMesh.material.uniforms.faceColor.value.set(Colors.black);
 	                    //console.log('回', name)
 	                    navCubeViewer.dispatchEvent('content_changed');
 	                });
 	                
-	                faceMesh.addEventListener('click', (e)=>{
-	                    this.changingView = true; 
-	                    faceMesh.material.uniforms.faceColor.value.set(Colors.blue); 
-	                    navCubeViewer.switchView('ortho', directions[name] ,   ()=>{
-	                        this.changingView = false;
+	                faceMesh.addEventListener('click', (e)=>{  
+	                    if(navCubeViewer.switchView('ortho', directions[name] ,   ()=>{ 
 	                        faceMesh.material.uniforms.faceColor.value.set(Colors.black);
-	                    }); 
+	                    }) ){
+	                        faceMesh.material.uniforms.faceColor.value.set(Colors.blue); 
+	                    }
 	                }); 
 	                 
 	                if(name == 'Top'){
@@ -91776,6 +91785,7 @@ void main()
 	        }
 	    } */
 	    switchView(type, {yaw, pitch, dir}={}, done){
+	        if(this.changingView)return
 	        let view = viewer.mainViewport.view;
 	        this.lastView = view.clone();
 	        if(viewer.mainViewport.camera.type == 'OrthographicCamera'){
@@ -91808,14 +91818,16 @@ void main()
 	                viewer.scene.cameraO.updateProjectionMatrix();
 	                    
 	            }
-	            
+	            console.log('变成正交');
 	            viewer.focusOnObject(viewer.bound, 'boundingBox', 1000, {
 	                endPitch: pitch, endYaw: yaw , dir,  startCamera, endCamera
 	            }).promise.done(()=>{  
-	                viewer.dispatchEvent('reachTopView');
+	                //viewer.dispatchEvent('reachTopView')
+	                this.changingView = false;
 	                done && done();
 	                navCubeViewer.dispatchEvent('content_changed');
 	            });
+	            this.changingView = true;
 	        }else {
 	            
 	            if(viewer.mainViewport.camera == viewer.scene.cameraO){
@@ -91836,17 +91848,19 @@ void main()
 	                let position = new Vector3().copy(viewer.mainViewport.shiftTarget).sub(view.direction.clone().multiplyScalar(dis)); 
 	                //view.position.copy(viewer.mainViewport.shiftTarget).sub(view.direction.clone().multiplyScalar(dis)); 
 	                this.controls.setEnable(true);
-	                viewer.dispatchEvent('leaveTopView');
-
+	                //viewer.dispatchEvent('leaveTopView')
+	                console.log('变回透视');
 	                view.tranCamera(viewer.mainViewport,  { position ,   
 	                    callback:()=>{ 
 	                        done && done();
+	                        this.changingView = false;
 	                    }, startCamera:viewer.scene.cameraO, endCamera:viewer.scene.cameraP, midCamera:viewer.scene.cameraBasic
 	                }, 500);
-
+	                this.changingView = true;
 	                
 	            } 
 	        }
+	        return this.changingView
 	    } 
 	    
 	    
@@ -91854,22 +91868,22 @@ void main()
 	    
 	    
 	    switchView2(viewInfo){ //直接输入view改变
+	        if(this.changingView)return
 	        let view = viewer.mainViewport.view;
 	        let startCamera, endCamera; 
-	    
+	        this.changingView = true;
 	    
 	        if(viewInfo.isOrtho){
-	            if(viewer.mainViewport.camera != viewer.scene.cameraO){
-	                 
+	            if(viewer.mainViewport.camera != viewer.scene.cameraO){ 
 	                startCamera = viewer.scene.cameraP;
 	                endCamera = viewer.scene.cameraO;
-	                
-	                
+	                 
 	            }else {
+	                
 	                view.moveOrthoCamera(viewer.mainViewport,  {endPosition:viewInfo.position,
 	                    endPitch: viewInfo.pitch, endYaw: viewInfo.yaw ,  zoom: viewInfo.zoom, 
 	                    callback:()=>{ 
-	                        
+	                        this.changingView = false;
 	                    }, 
 	                }, 500);
 	            }
@@ -91878,11 +91892,12 @@ void main()
 	                startCamera = viewer.scene.cameraO;
 	                endCamera = viewer.scene.cameraP; 
 	            }else {
+	                 
 	                view.setView(viewer.mainViewport,  { position:view.position,
 	                    endPitch: viewInfo.pitch, endYaw: viewInfo.yaw ,   
 	                    startCamera,  endCamera,            
 	                    callback:()=>{ 
-	                        
+	                        this.changingView = false;
 	                    }, 
 	                }, 500);
 	            }
@@ -91890,12 +91905,12 @@ void main()
 	        }
 	        
 	        
-	        if(startCamera){
+	        if(startCamera){ 
 	            view.tranCamera(viewer.mainViewport,  { position:viewInfo.position,
 	                endPitch: viewInfo.pitch, endYaw: viewInfo.yaw ,   
 	                startCamera,   endCamera,   midCamera:viewer.scene.cameraBasic ,            
 	                callback:()=>{ 
-	                    
+	                    this.changingView = false;
 	                }, 
 	            }, 500);
 	        } 
@@ -96151,8 +96166,8 @@ ENDSEC
 	        this.marker = marker; 
 	        
 	        this.images360.node.add(marker);
-	        Potree.settings.isTest && this.addLabel();
-	        //this.addLabel2() 
+	        //Potree.settings.isTest && this.addLabel()
+	        this.addLabel2(); 
 	         
 	        marker.addEventListener('mouseover', this.hoverOn.bind(this));  
 	        marker.addEventListener('mouseleave', this.hoverOff.bind(this)); 
@@ -96211,15 +96226,15 @@ ENDSEC
 	    getMarkerMat(){
 	        if(!markerTex) {
 	            markerTex = {
-	                default:texLoader$4.load( Potree.resourcePath+'/textures/marker.png' ),
+	                //default:texLoader.load( Potree.resourcePath+'/textures/marker.png' ),
 	                ring:texLoader$4.load( Potree.resourcePath+'/textures/marker2.png' )
 	            };
-	            markerTex.default.anisotropy = 4; // 各向异性过滤 .防止倾斜模糊
+	            //markerTex.default.anisotropy = 4 // 各向异性过滤 .防止倾斜模糊
 	            markerTex.ring.anisotropy = 4;  
 	            //有可能被点云遮住吗。 
 	         
 	        } 
-	        return  new DepthBasicMaterial({opacity: markerOpacitys.default, side: DoubleSide , map:markerTex.default ,transparent:true, 
+	        return  new DepthBasicMaterial({opacity: markerOpacitys.default, side: DoubleSide , map:markerTex.ring/* .default */ ,transparent:true, 
 	            clipDistance: 2,  occlusionDistance:1,  //不能设置太短,因为过渡时深度不准确 
 	            useDepth:  !!(Potree.settings.useDepthTex && this.pointcloud.hasDepthTex),
 	            autoDepthTest:true
@@ -96283,7 +96298,18 @@ ENDSEC
 	        this.images360.node.add(this.label);
 	        this.floorPosition && this.label.position.copy(this.floorPosition);
 	    }
-	    
+	    addLabel2(){  
+	        if(this.label2)return
+	        this.label2 = new TextSprite$2(Object.assign({},
+	           labelProp2, {text: /* this.originID  */   parseInt(this.id)+1   }) //{text: `id:${this.id}, dataset:${this.pointcloud.name}, 4dkkId:${this.originID}`}
+	        ); 
+	        this.images360.node.add(this.label2);
+	        this.floorPosition && this.label2.position.copy(this.floorPosition);
+	        let s = 0.4;
+	        this.label2.scale.set(s,s,s);
+	        //Potree.Utils.updateVisible(this.label2, 'notDisplay', false)
+	        Potree.Utils.updateVisible(this.label2, 'panoVisi', this.visible);
+	    }
 	     
 	    
 	    removeTextLabel(){
@@ -135191,7 +135217,7 @@ ENDSEC
 	                    }else{ */
 	                    direction = this.viewer.inputHandler.getMouseDirection().direction;  //定点缩放
 	                     
-	                    if(e.intersect){//和intersect的墙越接近,速度越慢,便于focus细节
+	                    if(e.intersect && e.intersect.location){//和intersect的墙越接近,速度越慢,便于focus细节
 	                        let dis = camera.position.distanceTo(e.intersect.location);
 	                        
 	                        speed = MathUtils$1.clamp(dis * 0.1,  0.3, speed); 

文件差异内容过多而无法显示
+ 1 - 1
public/static/lib/potree/potree.js.map


+ 3 - 2
src/sdk/laser/core/enter.js

@@ -100,12 +100,12 @@ var enter = ({
         });
     });
     
-    viewer.addEventListener("reachTopView", (e) => {
+    /* viewer.addEventListener("reachTopView", (e) => {
          sceneBus.emit("enterTopView") 
     });
     viewer.addEventListener("leaveTopView", (e) => {
          sceneBus.emit("leaveTopView") 
-    });
+    }); */
 
     let cameraChange = (e) => {
         var camera = e.viewport.camera;
@@ -729,6 +729,7 @@ var enter = ({
                     finishPromise
                 } = viewer.startScreenshot({
                         type: "default",
+                        hideMarkers:true,
                         hideMeasures:true,
                     },
                         width,