| 
					
				 | 
			
			
				@@ -36,6 +36,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import CutFillAnalysis from "./CutFillAnalysis.js" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 let cutFillAnalysis = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { getDsm } from '@/api/analse' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   name: "TerrainCutFillAnalysis", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   components: {}, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -83,14 +85,45 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         transparent: false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    smooth_ana(positions) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    coordsToWktPolygon(coords) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 检查坐标数组的长度是否为偶数   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (coords.length % 2 !== 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        throw new Error('Coordinate array length must be even.'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 构建WKT Polygon字符串   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      let wktPolygon = 'POLYGON(('; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      for (let i = 0; i < coords.length; i += 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 添加经度和纬度对   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        wktPolygon += `${coords[i]} ${coords[i + 1]}`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 如果不是最后一对坐标,则添加逗号   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (i + 2 < coords.length) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          wktPolygon += ', '; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 闭合多边形,添加第一个点   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      wktPolygon += `, ${coords[0]} ${coords[1]}))`; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log('wktPolygon: ', wktPolygon); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return wktPolygon; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    async smooth_ana(positions,positions_noHeight) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      let data = await getDsm({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        "geom": this.coordsToWktPolygon(positions_noHeight), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        'type': 'min' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log(data.data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       viewer.scene.globe.removeAllExcavationRegion(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       viewer.scene.globe.addExcavationRegion({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         name: 'ggg', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         position: positions, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        height: 100, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        height: data.data, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         transparent: false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.smooth_height = data.data.toFixed(2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     draw() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -144,6 +177,8 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         var positions = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        var positions_noHeight = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (var i = 0, len = array.length; i < len; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           var cartographic = Cesium.Cartographic.fromCartesian(array[i]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           var longitude = Cesium.Math.toDegrees(cartographic.longitude); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -153,6 +188,9 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             positions.push(longitude); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             positions.push(latitude); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             positions.push(h); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            positions_noHeight.push(longitude); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            positions_noHeight.push(latitude); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         let threeArray = null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -168,7 +206,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (that.radio == 'smooth') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          that.smooth_ana(threeArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          that.smooth_ana(positions, positions_noHeight); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else if (that.radio == 'cut') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (that.height < 0) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -262,14 +300,16 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // const terrainP = new Cesium.CesiumTerrainProvider({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   url: 'http://192.168.60.2:8090/iserver/services/3D-local3DCache-SanYaShi_GaoCheng_Level_16DataSource/rest/realspace/datas/%E4%B8%89%E4%BA%9A%E5%B8%82_%E9%AB%98%E7%A8%8B_Level_16%40DataSource', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      //   isSct: true//地形服务源自SuperMap iServer发布时需设置isSct为true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const terrainP = new Cesium.CesiumTerrainProvider({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        url: 'http://192.168.60.2:8090/iserver/services/3D-local3DCache-SanYaShi_GaoCheng_Level_16DataSource/rest/realspace/datas/%E4%B8%89%E4%BA%9A%E5%B8%82_%E9%AB%98%E7%A8%8B_Level_16%40DataSource', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        isSct: true//地形服务源自SuperMap iServer发布时需设置isSct为true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      viewer.terrainProvider = terrainP; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // viewer.terrainProvider = terrainP; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |