|
@@ -29,6 +29,7 @@
|
|
|
<input type="text" class="form-control" value="300" id="moveHeight" style="height: 25px;">
|
|
|
</div>
|
|
|
<div style="display: flex;justify-content: end;">
|
|
|
+ <button id="automaticDig" class="button black" type="button">自动开挖</button>
|
|
|
<button id="dig" class="button black" type="button">开挖</button>
|
|
|
<button id="clear" class="button black" type="button" style="margin-right: 0">清除</button>
|
|
|
</div>
|
|
@@ -94,9 +95,8 @@
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- iconList,
|
|
|
- queryMap,
|
|
|
- getDeviceList
|
|
|
+ getDeviceList,queryMap,
|
|
|
+ iconList
|
|
|
} from '@/api/components/supermap.js'
|
|
|
import Cookies from 'js-cookie'
|
|
|
import {
|
|
@@ -379,6 +379,7 @@ export default {
|
|
|
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
|
},
|
|
|
})
|
|
|
+
|
|
|
that.$emit('setPositioning', longitude, latitude);
|
|
|
}
|
|
|
}, SuperMap3D.ScreenSpaceEventType.LEFT_CLICK);
|
|
@@ -1087,24 +1088,11 @@ export default {
|
|
|
var h = cartographic.height;
|
|
|
positionsDegrees = positionsDegrees.concat([lon, lat, h]);
|
|
|
}
|
|
|
- extract(positionsDegrees);
|
|
|
+ that.extract(positionsDegrees);
|
|
|
that.handlerExcavation.clear();
|
|
|
that.handlerExcavation.deactivate();
|
|
|
tooltip.setVisible(false);
|
|
|
})
|
|
|
- //地形抽出部分
|
|
|
- function extract(positions) {
|
|
|
- that.viewer.scene.globe.removeAllExtractRegion();
|
|
|
- that.viewer.scene.globe.addExtractRegion({
|
|
|
- name: 'extract', //名称
|
|
|
- position: positions, //区域
|
|
|
- height: $('#depth').val(), //开挖深度
|
|
|
- transparent: false, //封边是否透明
|
|
|
- extractHeight: Number($('#moveHeight').val()), //抽出高度
|
|
|
- granularity: 1 //精度
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
//清除剖切结果
|
|
|
$('#clear').click(function() {
|
|
|
tooltip.setVisible(false);
|
|
@@ -1115,10 +1103,88 @@ export default {
|
|
|
$("#dig").click(function() {
|
|
|
that.handlerExcavation.activate();
|
|
|
});
|
|
|
+ $("#automaticDig").click(function() {
|
|
|
+ that.automaticExcavationCalculation(124.3486419476308,43.168731902748924);
|
|
|
+ });
|
|
|
|
|
|
$('#loadingbar').remove();
|
|
|
}, 1000)
|
|
|
},
|
|
|
+ //自动挖选点
|
|
|
+ // automaticExcavation(){
|
|
|
+ // this.setIsObtainLaAndLon(true)
|
|
|
+ // },
|
|
|
+ //自动挖选计算
|
|
|
+ automaticExcavationCalculation(longitude, latitude) {
|
|
|
+ // 地球半径,单位:米
|
|
|
+ const EARTH_RADIUS = 6371000;
|
|
|
+
|
|
|
+ // 将经纬度转换为弧度
|
|
|
+ const latRad = latitude * Math.PI / 180;
|
|
|
+ const lonRad = longitude * Math.PI / 180;
|
|
|
+
|
|
|
+ // 矩形半边长,单位:米
|
|
|
+ const halfSide = 2;
|
|
|
+
|
|
|
+ // 计算经度和纬度的变化量(近似)
|
|
|
+ const dLat = halfSide / EARTH_RADIUS;
|
|
|
+ const dLon = halfSide / (EARTH_RADIUS * Math.cos(latRad));
|
|
|
+
|
|
|
+ // 将弧度转换回角度
|
|
|
+ const dLatDeg = dLat * 180 / Math.PI;
|
|
|
+ const dLonDeg = dLon * 180 / Math.PI;
|
|
|
+
|
|
|
+ const points = [
|
|
|
+ longitude - dLonDeg,
|
|
|
+ latitude + dLatDeg,
|
|
|
+ 0,
|
|
|
+ longitude + dLonDeg,
|
|
|
+ latitude + dLatDeg,
|
|
|
+ 0,
|
|
|
+ longitude + dLonDeg,
|
|
|
+ latitude - dLatDeg,
|
|
|
+ 0,
|
|
|
+ longitude - dLonDeg,
|
|
|
+ latitude - dLatDeg,
|
|
|
+ 0
|
|
|
+ ]
|
|
|
+ // // 计算四个角点的经纬度
|
|
|
+ // const points = {
|
|
|
+ // // 左上角
|
|
|
+ // topLeft: {
|
|
|
+ // latitude: latitude + dLatDeg,
|
|
|
+ // longitude: longitude - dLonDeg
|
|
|
+ // },
|
|
|
+ // // 右上角
|
|
|
+ // topRight: {
|
|
|
+ // latitude: latitude + dLatDeg,
|
|
|
+ // longitude: longitude + dLonDeg
|
|
|
+ // },
|
|
|
+ // // 左下角
|
|
|
+ // bottomLeft: {
|
|
|
+ // latitude: latitude - dLatDeg,
|
|
|
+ // longitude: longitude - dLonDeg
|
|
|
+ // },
|
|
|
+ // // 右下角
|
|
|
+ // bottomRight: {
|
|
|
+ // latitude: latitude - dLatDeg,
|
|
|
+ // longitude: longitude + dLonDeg
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ this.extract(points);
|
|
|
+ },
|
|
|
+ //地形抽出部分
|
|
|
+ extract(positions) {
|
|
|
+ this.viewer.scene.globe.removeAllExtractRegion();
|
|
|
+ this.viewer.scene.globe.addExtractRegion({
|
|
|
+ name: 'extract', //名称
|
|
|
+ position: positions, //区域
|
|
|
+ height: $('#depth').val(), //开挖深度
|
|
|
+ transparent: false, //封边是否透明
|
|
|
+ extractHeight: Number($('#moveHeight').val()), //抽出高度
|
|
|
+ granularity: 1 //精度
|
|
|
+ });
|
|
|
+ },
|
|
|
//填开挖分析
|
|
|
excavationAnalyze(){
|
|
|
let that = this
|
|
@@ -1620,11 +1686,15 @@ export default {
|
|
|
this.scene.layers.find(k).removeObjsColor(selectedObjs[k]);
|
|
|
}
|
|
|
}
|
|
|
- this.boxSelectionTooltip.setVisible(false);
|
|
|
- this.handlerBoxSelection.removeInputAction(SuperMap3D.ScreenSpaceEventType.LEFT_DOWN, SuperMap3D.KeyboardEventModifier.SHIFT)
|
|
|
- this.handlerBoxSelection.removeInputAction(SuperMap3D.ScreenSpaceEventType.MOUSE_MOVE, SuperMap3D.KeyboardEventModifier.SHIFT)
|
|
|
- this.handlerBoxSelection.removeInputAction(SuperMap3D.ScreenSpaceEventType.LEFT_UP, SuperMap3D.KeyboardEventModifier.SHIFT)
|
|
|
- this.handlerBoxSelection.removeInputAction(SuperMap3D.ScreenSpaceEventType.LEFT_UP)
|
|
|
+ if(this.boxSelectionTooltip){
|
|
|
+ this.boxSelectionTooltip.setVisible(false);
|
|
|
+ }
|
|
|
+ if(this.handlerBoxSelection){
|
|
|
+ this.handlerBoxSelection.removeInputAction(SuperMap3D.ScreenSpaceEventType.LEFT_DOWN, SuperMap3D.KeyboardEventModifier.SHIFT)
|
|
|
+ this.handlerBoxSelection.removeInputAction(SuperMap3D.ScreenSpaceEventType.MOUSE_MOVE, SuperMap3D.KeyboardEventModifier.SHIFT)
|
|
|
+ this.handlerBoxSelection.removeInputAction(SuperMap3D.ScreenSpaceEventType.LEFT_UP, SuperMap3D.KeyboardEventModifier.SHIFT)
|
|
|
+ this.handlerBoxSelection.removeInputAction(SuperMap3D.ScreenSpaceEventType.LEFT_UP)
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* 切换地图
|