|
@@ -85,11 +85,34 @@ export default {
|
|
|
transparent: false
|
|
|
});
|
|
|
},
|
|
|
- async 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": 'POLYGON ((109.18020596442221 18.342545956313714, 109.18020596442221 18.329888585511824, 109.2010763671721 18.329888585511824, 109.2010763671721 18.342545956313714, 109.18020596442221 18.342545956313714))',
|
|
|
+ "geom": this.coordsToWktPolygon(positions_noHeight),
|
|
|
'type': 'min'
|
|
|
});
|
|
|
+ console.log(data.data);
|
|
|
|
|
|
|
|
|
viewer.scene.globe.removeAllExcavationRegion();
|
|
@@ -100,7 +123,7 @@ export default {
|
|
|
transparent: false
|
|
|
});
|
|
|
|
|
|
- this.smooth_height = data.data
|
|
|
+ this.smooth_height = data.data.toFixed(2)
|
|
|
},
|
|
|
draw() {
|
|
|
|
|
@@ -154,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);
|
|
@@ -163,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;
|
|
@@ -178,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) {
|