فهرست منبع

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

# Conflicts:
#	src/graphic/Geometry/Furniture.js
#	src/graphic/Geometry/Line.js
#	src/graphic/Geometry/Tag.js
#	src/graphic/History/Change.js
#	src/graphic/History/History.js
#	src/graphic/History/HistoryUtil.js
#	src/graphic/Service/ComponentService.js
#	src/graphic/Service/FurnitureService.js
#	src/graphic/Service/KeyService.js
#	src/graphic/Service/SymbolService.js
xushiting 2 سال پیش
والد
کامیت
5add74e827

+ 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;

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1 - 1
public/static/lib/potree/potree.js.map


+ 2 - 2
src/graphic/Controls/AddRoad.js

@@ -1,10 +1,10 @@
 import { listenLayer } from "../ListenLayer";
 import Constant from "../Constant";
-import { mathUtil } from "../MathUtil";
+// import { mathUtil } from "../MathUtil";
 import { dataService } from "../Service/DataService";
 import { pointService } from "../Service/PointService";
 import { elementService } from "../Service/ElementService";
-import { wallService } from "../Service/WallService";
+// import { wallService } from "../Service/WallService";
 import { stateService } from "../Service/StateService";
 import { symbolService } from "../Service/SymbolService";
 import VectorType from "../enum/VectorType";

+ 1 - 1
src/graphic/Controls/MoveTag.js

@@ -1,5 +1,5 @@
 import { dataService } from "../Service/DataService";
-import { mathUtil } from "../MathUtil.js";
+// import { mathUtil } from "../MathUtil.js";
 
 export default class MoveTag {
   constructor() {}

+ 8 - 5
src/graphic/Controls/UIControl.js

@@ -10,13 +10,13 @@ import { historyService } from "../Service/HistoryService.js";
 import { symbolService } from "../Service/SymbolService.js";
 import { componentService } from "../Service/ComponentService.js";
 import { elementService } from "../Service/ElementService";
-import { mathUtil } from "../MathUtil.js";
-import { wallService } from "../Service/WallService.js";
+// import { mathUtil } from "../MathUtil.js";
+// import { wallService } from "../Service/WallService.js";
 import { tagService } from "../Service/TagService.js";
 import Constant from "../Constant";
-import { roomsUtil } from "../Room/RoomsUtil.js";
+// import { roomsUtil } from "../Room/RoomsUtil.js";
 import { addRoad } from "../Controls/AddRoad";
-import { floorplanData } from "../VectorData.js";
+// import { floorplanData } from "../VectorData.js";
 import { furnitureService } from "../Service/FurnitureService.js";
 
 export default class UIControl {
@@ -32,7 +32,10 @@ export default class UIControl {
   /**
    * 设置选中要操作的UI
    */
-  set currentUI(value) {}
+  set currentUI(value) {
+    console.log(value);
+    this.value = value;
+  }
 
   //点击左侧栏后,更新事件
   updateEventNameForSelectUI() {

+ 2 - 2
src/graphic/Coordinate.js

@@ -1,6 +1,6 @@
 import { dataService } from "./Service/DataService.js";
-import { floorplanData } from "./VectorData.js";
-import { mathUtil } from "./Util/MathUtil.js/index.js";
+// import { floorplanData } from "./VectorData.js";
+// import { mathUtil } from "./Util/MathUtil.js/index.js";
 import Constant from "./Constant";
 
 const defaultZoom = 100;

+ 302 - 0
src/graphic/Geometry/Furniture.js

@@ -0,0 +1,302 @@
+import Geometry from "./Geometry";
+// import { mathUtil } from "../Util/MathUtil.js/index.js";
+import SelectState from "../enum/SelectState.js";
+import VectorType from "../enum/VectorType.js";
+import Constant from "../Constant.js";
+import { coordinate } from "../Coordinate";
+
+export default class Furniture extends Geometry {
+  constructor(center, vectorId, type) {
+    super();
+    this.center = center;
+    this.geoType = type;
+    //this.boundingVertexs = []
+    this.angle = 0; //逆时针为负,顺时针为正。单位是:°
+    this.zoom = 1; //缩放比例
+    this.setId(vectorId);
+  }
+
+  isContain(position) {
+    // const dis = mathUtil.getDistance(position, this.center)
+    // let len = this.getScale() * this.zoom
+    // if (dis < len / 2) {
+    //     return SelectState.Select
+    // } else {
+    //     return null
+    // }
+    const points2d = this.getBoundingVertexs(this.center);
+    return mathUtil.isPointInPoly(position, points2d);
+  }
+
+  getScale() {
+    switch (this.geoType) {
+      case VectorType.TV: //电视
+        return 1.3;
+      case VectorType.CombinationSofa: //组合沙发
+        return 3.4;
+      case VectorType.SingleSofa: //单人沙发
+        return 1;
+      case VectorType.TeaTable: //茶几
+        return 0.8;
+      case VectorType.Carpet: //地毯
+        return 2;
+      case VectorType.Plant: //植物
+        return 1;
+      case VectorType.DiningTable: //餐桌
+        return 2.4;
+      case VectorType.DoubleBed: //双人床
+        return 2;
+      case VectorType.SingleBed: //单人床
+        return 2;
+      case VectorType.Wardrobe: //衣柜
+        return 1.2;
+      case VectorType.Dresser: //梳妆台
+        return 0.8;
+      case VectorType.BedsideCupboard: //床头柜
+        return 0.4;
+      case VectorType.Pillow: //抱枕
+        return 0.6;
+      case VectorType.GasStove: //燃气灶
+        return 1;
+      case VectorType.Cupboard: //橱柜
+        return 1.2;
+      case VectorType.Bathtub: //浴缸
+        return 1.6;
+      case VectorType.Closestool: //马桶
+        return 0.63;
+      case VectorType.Washstand: //洗漱台
+        return 0.8;
+      case VectorType.Desk: //书桌
+        return 1.2;
+      case VectorType.BalconyChair: //阳台椅
+        return 2;
+      case VectorType.Elevator: //电梯
+        return 1.5;
+    }
+  }
+
+  getLengthWidth() {
+    switch (this.geoType) {
+      case VectorType.TV: //电视
+        return {
+          length: 32,
+          width: 10,
+        };
+      case VectorType.CombinationSofa: //组合沙发
+        return {
+          length: 32,
+          width: 28,
+        };
+      case VectorType.SingleSofa: //单人沙发
+        return {
+          length: 26,
+          width: 20,
+        };
+      case VectorType.TeaTable: //茶几
+        return {
+          length: 30,
+          width: 16,
+        };
+      case VectorType.Carpet: //地毯
+        return {
+          length: 32,
+          width: 20,
+        };
+      case VectorType.Plant: //植物
+        return {
+          length: 28,
+          width: 28,
+        };
+      case VectorType.DiningTable: //餐桌
+        return {
+          length: 28,
+          width: 26,
+        };
+      case VectorType.DoubleBed: //双人床
+        return {
+          length: 24,
+          width: 26,
+        };
+      case VectorType.SingleBed: //单人床
+        return {
+          length: 18,
+          width: 26,
+        };
+      case VectorType.Wardrobe: //衣柜
+        return {
+          length: 30,
+          width: 18,
+        };
+      case VectorType.Dresser: //梳妆台
+        return {
+          length: 28,
+          width: 26,
+        };
+      case VectorType.BedsideCupboard: //床头柜
+        return {
+          length: 28,
+          width: 28,
+        };
+      case VectorType.Pillow: //抱枕
+        return {
+          length: 26,
+          width: 26,
+        };
+      case VectorType.GasStove: //燃气灶
+        return {
+          length: 32,
+          width: 20,
+        };
+      case VectorType.Cupboard: //橱柜
+        return {
+          length: 12,
+          width: 32,
+        };
+      case VectorType.Bathtub: //浴缸
+        return {
+          length: 32,
+          width: 18,
+        };
+      case VectorType.Closestool: //马桶
+        return {
+          length: 22,
+          width: 28,
+        };
+      case VectorType.Washstand: //洗漱台
+        return {
+          length: 28,
+          width: 20,
+        };
+      case VectorType.Desk: //书桌
+        return {
+          length: 26,
+          width: 20,
+        };
+      case VectorType.BalconyChair: //阳台椅
+        return {
+          length: 32,
+          width: 10,
+        };
+      case VectorType.Elevator: //电梯
+        return {
+          length: 28,
+          width: 28,
+        };
+    }
+  }
+
+  /*
+    getBoundingVertexs(center) {
+        //this.boundingVertexs = []
+        const boundingVertexs = []
+        //const width = (((this.getScale() * Constant.furnitureWidth) / coordinate.res) * this.zoom)
+        const width = this.getScale() * this.zoom
+
+        const minX = center.x - width / 2
+        const minY = center.y - width / 2
+        const maxX = center.x + width / 2
+        const maxY = center.y + width / 2
+
+        const point1 = this.rotatePoint(
+            {
+                x: minX,
+                y: maxY,
+            },
+            center,
+            this.angle
+        )
+
+        const point2 = this.rotatePoint(
+            {
+                x: maxX,
+                y: maxY,
+            },
+            center,
+            this.angle
+        )
+
+        const point3 = this.rotatePoint(
+            {
+                x: maxX,
+                y: minY,
+            },
+            center,
+            this.angle
+        )
+
+        const point4 = this.rotatePoint(
+            {
+                x: minX,
+                y: minY,
+            },
+            center,
+            this.angle
+        )
+
+        boundingVertexs.push(point1)
+        boundingVertexs.push(point2)
+        boundingVertexs.push(point3)
+        boundingVertexs.push(point4)
+
+        return boundingVertexs
+    }
+    */
+  getBoundingVertexs(center) {
+    //this.boundingVertexs = []
+    const boundingVertexs = [];
+    const rec = this.getLengthWidth();
+    //const width = (((this.getScale() * Constant.furnitureWidth) / coordinate.res) * this.zoom)
+    const length =
+      (this.getScale() * rec.length * this.zoom) / Constant.furnitureWidth;
+    const width =
+      (this.getScale() * rec.width * this.zoom) / Constant.furnitureWidth;
+
+    const minX = center.x - length / 2;
+    const minY = center.y - width / 2;
+    const maxX = center.x + length / 2;
+    const maxY = center.y + width / 2;
+
+    const point1 = this.rotatePoint(
+      {
+        x: minX,
+        y: maxY,
+      },
+      center,
+      this.angle
+    );
+
+    const point2 = this.rotatePoint(
+      {
+        x: maxX,
+        y: maxY,
+      },
+      center,
+      this.angle
+    );
+
+    const point3 = this.rotatePoint(
+      {
+        x: maxX,
+        y: minY,
+      },
+      center,
+      this.angle
+    );
+
+    const point4 = this.rotatePoint(
+      {
+        x: minX,
+        y: minY,
+      },
+      center,
+      this.angle
+    );
+
+    boundingVertexs.push(point1);
+    boundingVertexs.push(point2);
+    boundingVertexs.push(point3);
+    boundingVertexs.push(point4);
+
+    return boundingVertexs;
+  }
+}

+ 1 - 1
src/graphic/Geometry/Geometry.js

@@ -1,5 +1,5 @@
 import { dataService } from "../Service/DataService";
-import { mathUtil } from "../Util/MathUtil.js/index.js";
+// import { mathUtil } from "../Util/MathUtil.js/index.js";
 import SymbolEvents from "../enum/SymbolEvents.js";
 
 export default class Geometry {

+ 1 - 1
src/graphic/History/HistoryUtil.js

@@ -1,4 +1,4 @@
-import { mathUtil } from "../MathUtil";
+import { mathUtil } from "../Util/MathUtil";
 import { dataService } from "../Service/DataService";
 import { tagService } from "../Service/TagService";
 

+ 7 - 6
src/graphic/Layer.js

@@ -9,7 +9,7 @@ import { historyService } from "./Service/HistoryService";
 
 import UIControl from "./Controls/UIControl";
 
-import { moveRectangle } from "./Controls/MoveRectangle";
+// import { moveRectangle } from "./Controls/MoveRectangle";
 import { moveTag } from "./Controls/MoveTag";
 import { addRoad } from "./Controls/AddRoad";
 import { moveRoad } from "./Controls/MoveRoad";
@@ -17,23 +17,24 @@ import { coordinate } from "./Coordinate";
 import Render from "./Renderer/Render";
 import { draw } from "./Renderer/Draw";
 import { listenLayer } from "./ListenLayer";
-import { floorplanData } from "./VectorData";
+// import { floorplanData } from "./VectorData";
 
 import LayerEvents from "./enum/LayerEvents.js";
 import UIEvents from "./enum/UIEvents.js";
 import SelectState from "./enum/SelectState.js";
 import Constant from "./Constant";
 import VectorType from "./enum/VectorType";
-import { mathUtil } from "./MathUtil";
-import { wallService } from "./Service/WallService";
+// import { mathUtil } from "./MathUtil";
+// import { wallService } from "./Service/WallService";
 import { componentService } from "./Service/ComponentService";
 import History from "./History/History";
+import mitt from "mitt";
 
-import { roomsUtil } from "./Room/RoomsUtil";
+// import { roomsUtil } from "./Room/RoomsUtil";
 import { furnitureService } from "./Service/FurnitureService";
 import { keyService } from "./Service/KeyService";
 
-export default class Layer extends KanKan.MITT.Emiter {
+export default class Layer extends mitt {
   constructor(canvas) {
     super();
     this.canvas = canvas;

+ 2 - 2
src/graphic/ListenLayer.js

@@ -1,7 +1,7 @@
-import { mathUtil } from "./MathUtil.js";
+// import { mathUtil } from "./MathUtil.js";
 import { dataService } from "./Service/DataService.js";
 import { stateService } from "./Service/StateService.js";
-import { wallService } from "./Service/WallService.js";
+// import { wallService } from "./Service/WallService.js";
 import Constant from "./Constant.js";
 import VectorType from "./enum/VectorType.js";
 import SelectState from "./enum/SelectState.js";

+ 3 - 3
src/graphic/Load.js

@@ -1,13 +1,13 @@
-import { floorplanData } from "./VectorData";
+// import { floorplanData } from "./VectorData";
 import { dataService } from "./Service/DataService.js";
-import { wallService } from "./Service/WallService.js";
+// import { wallService } from "./Service/WallService.js";
 import { stateService } from "./Service/StateService.js";
 import { symbolService } from "./Service/SymbolService.js";
 import { componentService } from "./Service/ComponentService.js";
 import { coordinate } from "./Coordinate.js";
 import Constant from "./Constant";
 import { tagService } from "./Service/TagService";
-import { mathUtil } from "./MathUtil";
+// import { mathUtil } from "./MathUtil";
 import { measureService } from "./Service/MeasureService";
 import { cameraService } from "./Service/CameraService";
 import { furnitureService } from "./Service/FurnitureService";

+ 2 - 2
src/graphic/Renderer/Draw.js

@@ -6,10 +6,10 @@ import { coordinate } from "../Coordinate.js";
 import Style from "../Style.js";
 import VectorType from "../enum/VectorType.js";
 import SelectState from "../enum/SelectState.js";
-import { mathUtil } from "../MathUtil.js";
+// import { mathUtil } from "../MathUtil.js";
 import ElementEvents from "../enum/ElementEvents.js";
 import Constant from "../Constant.js";
-import { roomService } from "../Service/RoomService.js";
+// import { roomService } from "../Service/RoomService.js";
 import { compassService } from "../Service/CompassService";
 import { uoMService } from "../Service/UoMService";
 import { furnitureService } from "../Service/FurnitureService.js";

+ 3 - 3
src/graphic/Renderer/Render.js

@@ -4,9 +4,9 @@ import { elementService } from "../Service/ElementService.js";
 import { measureService } from "../Service/MeasureService";
 import { coordinate } from "../Coordinate.js";
 import { draw } from "./Draw.js";
-import { roomService } from "../Service/RoomService.js";
-import { roomsUtil } from "../Room/RoomsUtil.js";
-import { floorplanData } from "../VectorData.js";
+// import { roomService } from "../Service/RoomService.js";
+// import { roomsUtil } from "../Room/RoomsUtil.js";
+// import { floorplanData } from "../VectorData.js";
 import { furnitureService } from "../Service/FurnitureService.js";
 
 export default class Render {

+ 107 - 0
src/graphic/Service/ComponentService.js

@@ -0,0 +1,107 @@
+import VectorType from "../enum/VectorType.js";
+// import Beam from "../Geometry/Beam.js";
+// import Flue from "../Geometry/Flue.js";
+// import Corridor from "../Geometry/Corridor.js";
+import { dataService } from "./DataService.js";
+
+export class ComponentService {
+  constructor() {
+    this.sideWidth = 0.65;
+    this.sideThickness = 0.65;
+  }
+
+  // 新建component
+  createComponent(position, geoType, vectorId) {
+    let component = null;
+    switch (geoType) {
+      case VectorType.Beam:
+        component = new Beam(position, vectorId);
+        break;
+      case VectorType.Flue:
+        component = new Flue(position, vectorId);
+        break;
+      case VectorType.Corridor:
+        component = new Corridor(position, vectorId);
+        break;
+    }
+
+    component.setPoints2d();
+    dataService.addComponent(component);
+    return component;
+  }
+
+  isComponent(geoType) {
+    switch (geoType) {
+      case VectorType.Beam:
+        return true;
+      case VectorType.Flue:
+        return true;
+      case VectorType.Corridor:
+        return true;
+    }
+    return false;
+  }
+
+  setComponentInfo(componentInfo) {
+    let component = dataService.getComponent(componentInfo.vectorId);
+    component.vectorId = componentInfo.vectorId;
+    component.angle = componentInfo.angle;
+    component.center = JSON.parse(JSON.stringify(componentInfo.center));
+    component.points2d = JSON.parse(JSON.stringify(componentInfo.points2d));
+  }
+
+  getBoundingVertexs(componentId, center) {
+    let component = dataService.getComponent(componentId);
+    const minX = center.x - component.sideWidth / 2;
+    const minY = center.y - component.sideThickness / 2;
+    const maxX = center.x + component.sideWidth / 2;
+    const maxY = center.y + component.sideThickness / 2;
+
+    const point1 = component.rotatePoint(
+      {
+        x: minX,
+        y: maxY,
+      },
+      center,
+      component.angle
+    );
+
+    const point2 = component.rotatePoint(
+      {
+        x: maxX,
+        y: maxY,
+      },
+      center,
+      component.angle
+    );
+
+    const point3 = component.rotatePoint(
+      {
+        x: maxX,
+        y: minY,
+      },
+      center,
+      component.angle
+    );
+
+    const point4 = component.rotatePoint(
+      {
+        x: minX,
+        y: minY,
+      },
+      center,
+      component.angle
+    );
+
+    const boundingVertexs = [];
+    boundingVertexs.push(point1);
+    boundingVertexs.push(point2);
+    boundingVertexs.push(point3);
+    boundingVertexs.push(point4);
+
+    return boundingVertexs;
+  }
+}
+
+const componentService = new ComponentService();
+export { componentService };

+ 2 - 2
src/graphic/Service/ElementService.js

@@ -4,8 +4,8 @@ import ElementEvents from "../enum/ElementEvents.js";
 import { listenLayer } from "../ListenLayer";
 import Constant from "../Constant";
 import { dataService } from "./DataService.js";
-import { mathUtil } from "../MathUtil.js";
-import { wallService } from "./WallService.js";
+// import { mathUtil } from "../MathUtil.js";
+// import { wallService } from "./WallService.js";
 import { coordinate } from "../Coordinate.js";
 
 export class ElementService {

+ 178 - 0
src/graphic/Service/FurnitureService.js

@@ -0,0 +1,178 @@
+import VectorType from "../enum/VectorType.js";
+import Furniture from "../Geometry/Furniture.js";
+import { dataService } from "./DataService.js";
+// import { Furnitures } from "../enum/UIEvents";
+
+export class FurnitureService {
+  constructor() {
+    this.$app = null;
+    this.furnitures = null;
+  }
+  fetchFurnitures() {
+    if (this.furnitures) {
+      return;
+    }
+    this.furnitures = {};
+    for (let key in Furnitures) {
+      // 测试代码
+      if (key != Furnitures.TV) {
+        continue;
+      }
+
+      this.$app.store
+        .getAppImage(`images/cad/furnitures/${Furnitures[key]}.svg`)
+        .then((img) => {
+          this.furnitures[Furnitures[key]] = img;
+          console.log(this.furnitures);
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    }
+  }
+
+  // 新建component
+  createFurniture(position, geoType, vectorId) {
+    let furniture = null;
+    switch (geoType) {
+      case VectorType.TV:
+        furniture = new Furniture(position, vectorId, VectorType.TV);
+        break;
+      case VectorType.CombinationSofa:
+        furniture = new Furniture(
+          position,
+          vectorId,
+          VectorType.CombinationSofa
+        );
+        break;
+      case VectorType.SingleSofa:
+        furniture = new Furniture(position, vectorId, VectorType.SingleSofa);
+        break;
+      case VectorType.TeaTable:
+        furniture = new Furniture(position, vectorId, VectorType.TeaTable);
+        break;
+      case VectorType.Carpet:
+        furniture = new Furniture(position, vectorId, VectorType.Carpet);
+        break;
+      case VectorType.Plant:
+        furniture = new Furniture(position, vectorId, VectorType.Plant);
+        break;
+      case VectorType.DiningTable:
+        furniture = new Furniture(position, vectorId, VectorType.DiningTable);
+        break;
+
+      case VectorType.DoubleBed:
+        furniture = new Furniture(position, vectorId, VectorType.DoubleBed);
+        break;
+      case VectorType.SingleBed:
+        furniture = new Furniture(position, vectorId, VectorType.SingleBed);
+        break;
+      case VectorType.Wardrobe:
+        furniture = new Furniture(position, vectorId, VectorType.Wardrobe);
+        break;
+      case VectorType.Dresser:
+        furniture = new Furniture(position, vectorId, VectorType.Dresser);
+        break;
+      case VectorType.BedsideCupboard:
+        furniture = new Furniture(
+          position,
+          vectorId,
+          VectorType.BedsideCupboard
+        );
+        break;
+      case VectorType.Pillow:
+        furniture = new Furniture(position, vectorId, VectorType.Pillow);
+        break;
+
+      case VectorType.GasStove:
+        furniture = new Furniture(position, vectorId, VectorType.GasStove);
+        break;
+      case VectorType.Cupboard:
+        furniture = new Furniture(position, vectorId, VectorType.Cupboard);
+        break;
+      case VectorType.Bathtub:
+        furniture = new Furniture(position, vectorId, VectorType.Bathtub);
+        break;
+      case VectorType.Closestool:
+        furniture = new Furniture(position, vectorId, VectorType.Closestool);
+        break;
+      case VectorType.Washstand:
+        furniture = new Furniture(position, vectorId, VectorType.Washstand);
+        break;
+
+      case VectorType.Desk:
+        furniture = new Furniture(position, vectorId, VectorType.Desk);
+        break;
+      case VectorType.BalconyChair:
+        furniture = new Furniture(position, vectorId, VectorType.BalconyChair);
+        break;
+      case VectorType.Elevator:
+        furniture = new Furniture(position, vectorId, VectorType.Elevator);
+        break;
+    }
+
+    dataService.addFurniture(furniture);
+    return furniture;
+  }
+
+  isFurniture(geoType) {
+    switch (geoType) {
+      case VectorType.TV:
+        return true;
+      case VectorType.CombinationSofa:
+        return true;
+      case VectorType.SingleSofa:
+        return true;
+      case VectorType.TeaTable:
+        return true;
+      case VectorType.Carpet:
+        return true;
+      case VectorType.Plant:
+        return true;
+      case VectorType.DiningTable:
+        return true;
+      case VectorType.DoubleBed:
+        return true;
+      case VectorType.SingleBed:
+        return true;
+      case VectorType.Wardrobe:
+        return true;
+      case VectorType.Dresser:
+        return true;
+      case VectorType.BedsideCupboard:
+        return true;
+      case VectorType.Pillow:
+        return true;
+      case VectorType.GasStove:
+        return true;
+      case VectorType.Cupboard:
+        return true;
+      case VectorType.Bathtub:
+        return true;
+      case VectorType.Closestool:
+        return true;
+      case VectorType.Washstand:
+        return true;
+      case VectorType.Desk:
+        return true;
+      case VectorType.BalconyChair:
+        return true;
+      case VectorType.Elevator:
+        return true;
+    }
+    return false;
+  }
+
+  setFurnitureInfo(furnitureInfo) {
+    let furniture = dataService.getFurniture(furnitureInfo.vectorId);
+    furniture.vectorId = furnitureInfo.vectorId;
+    furniture.angle = furnitureInfo.angle;
+    furniture.center = JSON.parse(JSON.stringify(furnitureInfo.center));
+  }
+  getFurniture(name) {
+    return this.furnitures[name];
+  }
+}
+
+const furnitureService = new FurnitureService();
+export { furnitureService };

+ 104 - 0
src/graphic/Service/KeyService.js

@@ -0,0 +1,104 @@
+import Constant from "../Constant";
+import { dataService } from "./DataService";
+import { stateService } from "./StateService";
+import { elementService } from "./ElementService";
+import { coordinate } from "../Coordinate";
+import VectorType from "../enum/VectorType";
+import SelectState from "../enum/SelectState.js";
+import LayerEvents from "../enum/LayerEvents.js";
+import { componentService } from "./ComponentService";
+import { symbolService } from "./SymbolService";
+import { furnitureService } from "./FurnitureService";
+import { tagService } from "./TagService";
+import { addRoad } from "../Controls/AddRoad";
+import UIEvents from "../enum/UIEvents.js";
+// import { wallService } from "./WallService";
+// import { moveRectangle } from "../Controls/MoveRectangle";
+
+export default class KeyService {
+  constructor() {
+    this.wallLineStyle = null;
+    this.targetItem = null;
+  }
+
+  clearTargetItem() {
+    this.targetItem = null;
+  }
+
+  copy(focusItem, mousePosition) {
+    if (focusItem && focusItem.type) {
+      this.targetItem = {
+        vectorId: focusItem.vectorId,
+        type: focusItem.type,
+      };
+    }
+
+    this.paste(mousePosition);
+    this.clearTargetItem();
+  }
+
+  //复制
+  paste(mousePosition) {
+    let flag = false;
+    const position = coordinate.getXYFromScreen(mousePosition);
+
+    // if (this.targetItem && componentService.isComponent(this.targetItem.type)) {
+    //     const component = dataService.getComponent(this.targetItem.vectorId)
+    //     const newComponent = componentService.createComponent(position, this.targetItem.type)
+    //     newComponent.angle = component.angle
+    //     newComponent.sideWidth = component.sideWidth
+    //     newComponent.sideThickness = component.sideThickness
+    //     stateService.setSelectItem(newComponent.vectorId, this.targetItem.type, SelectState.All)
+    //     stateService.setDraggingItem(stateService.selectItem)
+    //     stateService.setEventName(LayerEvents.MoveComponent)
+    //     flag = true
+    // } else if (this.targetItem && this.targetItem.type == VectorType.Tag) {
+    //     let tag = dataService.getTag(this.targetItem.vectorId)
+    //     const newTag = tagService.createTag(position)
+    //     newTag.title = tag.title
+    //     newTag.des = tag.des
+    //     newTag.unit = tag.unit
+    //     newTag.adding = tag.adding
+    //     newTag.name = tag.name
+
+    //     stateService.setSelectItem(newTag.vectorId, this.targetItem.type, SelectState.All)
+    //     stateService.setDraggingItem(stateService.selectItem)
+    //     stateService.setEventName(LayerEvents.MoveTag)
+    //     flag = true
+    // } else if (this.targetItem && furnitureService.isFurniture(this.targetItem.type)) {
+    //     const furniture = dataService.getFurniture(this.targetItem.vectorId)
+    //     const newFurniture = furnitureService.createFurniture(position, this.targetItem.type)
+    //     newFurniture.angle = furniture.angle
+    //     newFurniture.zoom = furniture.zoom
+    //     stateService.setSelectItem(newFurniture.vectorId, this.targetItem.type, SelectState.All)
+    //     stateService.setDraggingItem(stateService.selectItem)
+    //     stateService.setEventName(LayerEvents.MoveFurniture)
+    //     moveRectangle.clear()
+    //     flag = true
+    // }
+
+    if (this.targetItem && furnitureService.isFurniture(this.targetItem.type)) {
+      const furniture = dataService.getFurniture(this.targetItem.vectorId);
+      const newFurniture = furnitureService.createFurniture(
+        position,
+        this.targetItem.type
+      );
+      newFurniture.angle = furniture.angle;
+      newFurniture.zoom = furniture.zoom;
+      stateService.setSelectItem(
+        newFurniture.vectorId,
+        this.targetItem.type,
+        SelectState.All
+      );
+      stateService.setDraggingItem(stateService.selectItem);
+      stateService.setEventName(LayerEvents.MoveFurniture);
+      moveRectangle.clear();
+      flag = true;
+    }
+    stateService.clearFocusItem();
+    return flag;
+  }
+}
+
+const keyService = new KeyService();
+export { keyService };

+ 1 - 1
src/graphic/Service/MeasureService.js

@@ -1,5 +1,5 @@
 import { dataService } from "./DataService";
-import { mathUtil } from "../MathUtil.js";
+// import { mathUtil } from "../MathUtil.js";
 import { coordinate } from "../Coordinate";
 import Constant from "../Constant";
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1149 - 0
src/graphic/Service/SymbolService.js


+ 2 - 2
src/graphic/Service/TagService.js

@@ -1,8 +1,8 @@
 import Tag from "../Geometry/Tag.js";
 import { dataService } from "./DataService.js";
-import { floorplanData } from "../VectorData.js";
+// import { floorplanData } from "../VectorData.js";
 import { measureService } from "./MeasureService.js";
-import { mathUtil } from "../MathUtil.js";
+// import { mathUtil } from "../MathUtil.js";
 import { uoMService } from "./UoMService.js";
 
 export default class TagService {

+ 8 - 3
src/graphic/index.js

@@ -1,5 +1,10 @@
+import Layer from "./Layer";
+import UIControl from "./Controls/UIControl";
+
 export const structureDraw = (canvas) => {
-  const ctx = canvas.getContext("2d");
-  ctx.fillStyle = "#000";
-  ctx.fillRect(0, 0, 100, 100);
+  console.log("???");
+  const layer = new Layer(canvas);
+  const control = new UIControl(layer);
+
+  return { layer, control };
 };

+ 0 - 3
src/hook/custom/preset.ts

@@ -70,15 +70,12 @@ export enum CustomCom {
   FullView = "full",
   SpiltView = "split",
   MagnifierMode = "magnifier",
-  Coord = "coord",
   CustomMouseMenu = "cMoseMenu",
   ResidenMouseMenu = "rMouseMenu",
-  coordOutType = "coordOutType",
   CarryView = "carryView",
   SysView = "sysView",
   boxWidth = "boxWidth",
   autoMarginLeft = "autoMarginLeft",
-  showInfo = "showInfo",
   fullCtrl = "fullCtrl",
 }
 

+ 0 - 6
src/hook/custom/setup.ts

@@ -3,7 +3,6 @@ import { watchEffect, watch, ref } from "vue";
 import { Router } from "vue-router";
 import { useCustom, useDisabled } from "./hook";
 import {
-  laserModeStack,
   disabledMap,
   hotDisabledStack,
   mapDisabledStack,
@@ -92,11 +91,6 @@ export const setupSDK = (sdk: SDK) => {
   watchEffect(() =>
     sdk.carry.setShowMeasures(!disabledMap[DisabledCom.Measure])
   );
-  watchEffect(() =>
-    sdk.carry.setCoordType(
-      disabledMap[DisabledCom.Coord] ? null : customMap[CustomCom.Coord]
-    )
-  );
 
   fullScreenSetting(sdk);
   spliceSetting(sdk);

+ 1 - 1
src/hook/useGraphic.ts

@@ -1,7 +1,7 @@
 import { ref } from "vue";
 import { structureDraw } from "../graphic/index.js";
 
-const drawRef = ref();
+export const drawRef = ref<ReturnType<typeof structureDraw>>();
 
 export const setCanvas = (canvas: HTMLCanvasElement) => {
   drawRef.value = structureDraw(canvas);

+ 3 - 16
src/preset/main.vue

@@ -223,23 +223,10 @@ onMounted(async () => {
     }
     throw e;
   }
+  await presetLogin();
 
-  let preClear;
-  watch(
-    isLogin,
-    async () => {
-      preClear && preClear();
-      if (isLogin.value) {
-        preClear = await presetLogin();
-      } else {
-        preClear = await presetDelogin();
-      }
-
-      loaded.value = true;
-    },
-    { immediate: true }
-  );
-
+  loaded.value = true;
+  console.log("???");
   watch(router.currentRoute, () => {
     putCtrl.value = false;
   });

+ 1 - 0
src/preset/traffic-main.vue

@@ -143,6 +143,7 @@ onMounted(async () => {
     throw e;
   }
   await presetLogin();
+  loaded.value = true;
   watch(router.currentRoute, () => {
     putCtrl.value = false;
   });

+ 33 - 60
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", () => {
@@ -263,11 +259,11 @@ var enter = ({
                 return measure.dataset_points;
             },
             getDatasets: () => {
-                return measure.points_datasets;
+                return [1]//measure.points_datasets;
             },
-            /* getDatasetId: () => {
-                return measure.datasetId;
-            }, */
+            getDatasetId: () => {
+                return 1//measure.datasetId;
+            }, 
 
             getArea: () => {
                 return measure.area; //{value:area, string:..}
@@ -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,12 +853,10 @@ var enter = ({
             ...parameter.sceneBus,
         },
 
-        /////////////////////////////////
-
-          
-        /////////////////////////////
+         
+        
         transformPoint(point, datasetId, dataset_location) {
-            //获取由dataset_location转出的position
+            /* //获取由dataset_location转出的position
             var r = datasetId != void 0
                  ? Potree.Utils.datasetPosTransform({
                     fromDataset: true,
@@ -875,9 +865,10 @@ var enter = ({
                 })
                  : point;
 
-            return r;
+            return r; */
+            return point
         },
-        /*
+        
         // 坐标转换
         coordTransform: (originType, pos, targetType, datasetId) => {
             // pos 坐标的类型, 当类型为SCREEN时为 { x, y } 其余为 {x, y, z}
@@ -1160,45 +1151,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 +1278,8 @@ var enter = ({
 };
 
 export default enter;
-// axios.get('/laser/poi/:sceneCode/list', {})
-// axios.post('/laser/poi/:sceneCode/add', {})
+ 
 
-/*
-热点poi加载到的数据中,pos是错误的,只使用dataset_location
 
 
 
@@ -1323,6 +1289,13 @@ export default enter;
 
 
 
+
+ 
+/*
+热点poi加载到的数据中,pos是错误的,只使用dataset_location
+
+ 
+
 关于webgl context lost报错:
 
 已知有一iphoneX在创建shadowMap后才报错。

+ 6 - 4
src/store/hot.ts

@@ -48,10 +48,12 @@ const assembly = (styles: HotStylesRaw, list: HotsRaw) => {
 };
 
 export const requestData = async () => {
-  const [ohots, ostyles] = await Promise.all([
-    axios.get(URL.hotlist),
-    axios.get(URL.stylelist),
-  ]);
+  // const [ohots, ostyles] = await Promise.all([
+  //   axios.get(URL.hotlist),
+  //   axios.get(URL.stylelist),
+  // ]);
+  const ohots = { list: [] };
+  const ostyles = { list: [] };
   styles.value = ostyles.list;
   list.value = assembly(
     styles.value,

+ 2 - 1
src/store/measure.ts

@@ -39,7 +39,8 @@ export const recovery = () => {
 };
 
 export const requestData = async () => {
-  const res = await axios.get(URL.measureList);
+  // const res = await axios.get(URL.measureList);
+  const res = { list: [] };
   list.value = res.list.map((item) => {
     return {
       ...item,

+ 26 - 3
src/views/drawGraphic/index.vue

@@ -1,12 +1,24 @@
 <template>
   <div class="draw-layout">
-    <canvas ref="drawCanvasRef" class="draw-canvas" />
+    <div class="draw-slide">
+      <div
+        v-for="menu in menus"
+        :key="menu.key"
+        @click="activeMenu = menu.key"
+        :class="{ active: menu.key === activeMenu }"
+      >
+        {{ menu.text }}
+      </div>
+    </div>
+    <div class="canvas-layout">
+      <canvas ref="drawCanvasRef" class="draw-canvas" />
+    </div>
   </div>
 </template>
 
 <script lang="ts" setup>
-import { onMounted, onUnmounted, ref } from "vue";
-import { setCanvas } from "@/hook/useGraphic";
+import { onMounted, onUnmounted, ref, watchEffect } from "vue";
+import { setCanvas, drawRef } from "@/hook/useGraphic";
 
 const drawCanvasRef = ref<HTMLCanvasElement>();
 const setCanvasSize = () => {
@@ -14,11 +26,22 @@ const setCanvasSize = () => {
   drawCanvasRef.value.height = drawCanvasRef.value.offsetHeight;
 };
 
+const menus = ref([
+  { key: "road", text: "道路" },
+  { key: "tag", text: "标注" },
+]);
+const activeMenu = ref<string>(null);
+
 // window.addEventListener("resize", setCanvasSize);
 
 onMounted(() => {
   setCanvasSize();
   setCanvas(drawCanvasRef.value);
+
+  watchEffect(() => {
+    drawRef.value.control.currentUI = activeMenu.value as any;
+    drawRef.value.control.updateEventNameForSelectUI();
+  });
 });
 
 onUnmounted(() => {

+ 32 - 1
src/views/drawGraphic/style.scss

@@ -1,5 +1,36 @@
-.draw-canvas,
 .draw-layout {
+  width  : 100%;
+  height : 100%;
+  display: flex;
+}
+
+.draw-slide {
+  flex        : 0 0 100px;
+  padding     : 10px 0;
+  border-right: 1px solid #ccc;
+
+  >div {
+    font-size  : 14px;
+    text-align : center;
+    cursor     : pointer;
+    line-height: 30px;
+
+    &:hover {
+      color: #1890ff;
+    }
+
+    &.active {
+      background-color: #e6f7ff;
+    }
+  }
+}
+
+
+.draw-layout {
+  flex: 1;
+}
+
+.draw-canvas {
   width : 100%;
   height: 100%;
 }