|
@@ -7,7 +7,7 @@
|
|
|
}}</label> -->
|
|
|
|
|
|
<div class="boxchild">
|
|
|
- <el-button type="primary" size="mini" @click="analysis"
|
|
|
+ <el-button type="primary" size="mini" @click="createSmashing"
|
|
|
>倾斜压平</el-button
|
|
|
>
|
|
|
<el-button type="primary" size="mini" @click="clear">{{
|
|
@@ -19,19 +19,19 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// var skyline;
|
|
|
-// let myChart, s3mInstance;
|
|
|
+let cutFillAnalysis = null;
|
|
|
|
|
|
export default {
|
|
|
name: "Sm3dSmashing",
|
|
|
- props: {
|
|
|
- // spatialAnalysisUrl: {
|
|
|
- // type: String,
|
|
|
- // },
|
|
|
- },
|
|
|
+ props: {},
|
|
|
data() {
|
|
|
return {
|
|
|
sharedState: store.state,
|
|
|
+ handler_Cut_fill: new Cesium.DrawHandler(
|
|
|
+ viewer,
|
|
|
+ Cesium.DrawMode.Polygon,
|
|
|
+ 0
|
|
|
+ ),
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -44,7 +44,82 @@ export default {
|
|
|
},
|
|
|
beforeDestroy() {},
|
|
|
mounted() {},
|
|
|
- methods: {},
|
|
|
+ methods: {
|
|
|
+ createSmashing() {
|
|
|
+ //绘制多边形
|
|
|
+ const that = this;
|
|
|
+ that.handler_Cut_fill.clear();
|
|
|
+ viewer.scene.globe.removeAllExcavationRegion();
|
|
|
+
|
|
|
+ that.handler_Cut_fill.activeEvt.addEventListener(function (isActive) {
|
|
|
+ if (isActive == true) {
|
|
|
+ viewer.enableCursorStyle = false;
|
|
|
+ viewer._element.style.cursor = "";
|
|
|
+ // $('body').removeClass('drawCur').addClass('drawCur');
|
|
|
+ } else {
|
|
|
+ viewer.enableCursorStyle = true;
|
|
|
+ // $('body').removeClass('drawCur');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ that.handler_Cut_fill.movingEvt.addEventListener(function (
|
|
|
+ windowPosition
|
|
|
+ ) {
|
|
|
+ if (windowPosition.x < 200 && windowPosition.y < 150) {
|
|
|
+ tooltip.setVisible(false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (that.handler_Cut_fill.isDrawing) {
|
|
|
+ tooltip.showAt(
|
|
|
+ windowPosition,
|
|
|
+ "<p>点击确定开挖区域中间点</p><p>右键单击结束绘制,进行开挖</p>"
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ tooltip.showAt(windowPosition, "<p>点击绘制开挖区域第一个点</p>");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ that.handler_Cut_fill.drawEvt.addEventListener(function (result) {
|
|
|
+ if (!result.object.positions) {
|
|
|
+ tooltip.showAt(result, "<p>请绘制正确的多边形</p>");
|
|
|
+ that.handler_Cut_fill.polygon.show = false;
|
|
|
+ that.handler_Cut_fill.polyline.show = false;
|
|
|
+ that.handler_Cut_fill.deactivate();
|
|
|
+ that.handler_Cut_fill.activate();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var array = [].concat(result.object.positions);
|
|
|
+
|
|
|
+ tooltip.setVisible(false);
|
|
|
+ var positions = [];
|
|
|
+ for (var i = 0, len = array.length; i < len; i++) {
|
|
|
+ var cartographic = Cesium.Cartographic.fromCartesian(array[i]);
|
|
|
+ var longitude = Cesium.Math.toDegrees(cartographic.longitude);
|
|
|
+ var latitude = Cesium.Math.toDegrees(cartographic.latitude);
|
|
|
+ var h = cartographic.height;
|
|
|
+
|
|
|
+ if (
|
|
|
+ positions.indexOf(longitude) == -1 &&
|
|
|
+ positions.indexOf(latitude) == -1
|
|
|
+ ) {
|
|
|
+ positions.push(longitude);
|
|
|
+ positions.push(latitude);
|
|
|
+ positions.push(h);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ viewer.scene.globe.removeAllExcavationRegion();
|
|
|
+ console.log(positions, "positions");
|
|
|
+ store.state.tempLatData.addFlattenRegion({
|
|
|
+ position: positions,
|
|
|
+ name: "flatten" + Math.random(),
|
|
|
+ });
|
|
|
+ that.handler_Cut_fill.polygon.show = false;
|
|
|
+ that.handler_Cut_fill.polyline.show = false;
|
|
|
+ that.handler_Cut_fill.deactivate();
|
|
|
+ // that.handler_Cut_fill.activate();
|
|
|
+ });
|
|
|
+ that.handler_Cut_fill.activate();
|
|
|
+ },
|
|
|
+ },
|
|
|
watch: {},
|
|
|
};
|
|
|
</script>
|