|
@@ -30,7 +30,8 @@ export default {
|
|
|
input: '', sharedState: store.state,
|
|
|
height: 300,
|
|
|
result: null,
|
|
|
- handler_Cut_fill: new Cesium.DrawHandler(viewer, Cesium.DrawMode.Polygon, 0)
|
|
|
+ handler_Cut_fill: null,
|
|
|
+ array3D: []
|
|
|
};
|
|
|
},
|
|
|
//监听属性 类似于data概念
|
|
@@ -45,22 +46,13 @@ export default {
|
|
|
//方法集合
|
|
|
methods: {
|
|
|
draw() {
|
|
|
-
|
|
|
-
|
|
|
- const that = this;
|
|
|
- that.clear();
|
|
|
- // that.handler_Cut_fill.clear();
|
|
|
- // that.handler_Cut_fill.deactivate();
|
|
|
|
|
|
|
|
|
+ const that = this;
|
|
|
+ if (that.handler_Cut_fill == null) {
|
|
|
+ that.handler_Cut_fill = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Polygon, 0);
|
|
|
+ }
|
|
|
|
|
|
- // if (that.handler_Cut_fill.polyline) {
|
|
|
- // that.handler_Cut_fill.polyline.show = false;
|
|
|
- // }
|
|
|
- // if (that.handler_Cut_fill.polyline) {
|
|
|
- // that.handler_Cut_fill.polygon.show = false;
|
|
|
- // }
|
|
|
- // viewer.scene.globe.removeAllExcavationRegion();
|
|
|
var tooltip = createTooltip(viewer._element);
|
|
|
//绘制多边形
|
|
|
that.handler_Cut_fill.activeEvt.addEventListener(function (isActive) {
|
|
@@ -97,6 +89,7 @@ export default {
|
|
|
};
|
|
|
var array = [].concat(result.object.positions);
|
|
|
tooltip.setVisible(false);
|
|
|
+ that.array = array
|
|
|
var positions = [];
|
|
|
for (var i = 0, len = array.length; i < len; i++) {
|
|
|
var cartographic = Cesium.Cartographic.fromCartesian(array[i]);
|
|
@@ -121,14 +114,24 @@ export default {
|
|
|
that.handler_Cut_fill.polyline.show = false;
|
|
|
that.handler_Cut_fill.deactivate();
|
|
|
// that.handler_Cut_fill.activate();
|
|
|
+ console.log(Number(that.height));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ let cutVolume = cutFillAnalysis.VolumeAnalysis(that.array, -that.height);
|
|
|
+ that.result = cutVolume;
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
that.handler_Cut_fill.activate();
|
|
|
+
|
|
|
},
|
|
|
clear() {
|
|
|
const that = this;
|
|
|
that.handler_Cut_fill.clear();
|
|
|
viewer.scene.globe.removeAllExcavationRegion();
|
|
|
-
|
|
|
+ that.handler_Cut_fill.deactivate();
|
|
|
+ that.handler_Cut_fill = null
|
|
|
that.result = null;
|
|
|
|
|
|
}
|