|
@@ -1,7 +1,19 @@
|
|
|
<template>
|
|
|
-<div>
|
|
|
- dasdasd
|
|
|
-</div>
|
|
|
+ <div v-show="isCutFill" class="cut_fill_box">
|
|
|
+ <div class="cut_fill_centent1">
|
|
|
+ 设计高度:
|
|
|
+ <el-input v-model="height" placeholder=""></el-input>
|
|
|
+
|
|
|
+ 土石方里(立方米):
|
|
|
+ <el-input v-model="result" placeholder=""></el-input>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div class="cut_fill_Buttons">
|
|
|
+ <el-button>绘制</el-button>
|
|
|
+ <el-button>清楚</el-button>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
@@ -11,10 +23,16 @@ export default {
|
|
|
name: "TerrainCutFillAnalysis",
|
|
|
components: {},
|
|
|
data() {
|
|
|
- return {};
|
|
|
+
|
|
|
+ return { input: '', sharedState: store.state,height:300,result:null };
|
|
|
},
|
|
|
//监听属性 类似于data概念
|
|
|
- computed: {},
|
|
|
+ computed: {
|
|
|
+
|
|
|
+ isCutFill: function () {
|
|
|
+ return this.sharedState.terrain[4];
|
|
|
+ },
|
|
|
+ },
|
|
|
//监控data中的数据变化
|
|
|
watch: {},
|
|
|
//方法集合
|
|
@@ -22,8 +40,86 @@ export default {
|
|
|
beforeCreate() { }, //生命周期 - 创建之前
|
|
|
created() {
|
|
|
console.log(123123);
|
|
|
-
|
|
|
- }, //生命周期 - 创建完成(可以访问当前this实例)
|
|
|
+ // http://www.supermapol.com/realspace/services/3D-dixingyingxiang/rest/realspace/datas/DatasetDEM
|
|
|
+ // http://192.168.60.3:8099/iserver/services/3D-local3DCache-SanYaDSMHuanCun/rest/realspace/datas/dsm@dsm
|
|
|
+
|
|
|
+
|
|
|
+ // terrainProvider: new Cesium.CesiumTerrainProvider({
|
|
|
+ // url: 'http://192.168.60.3:8099/iserver/services/3D-local3DCache-SanYaDSMHuanCun/rest/realspace/datas/dsm@dsm',
|
|
|
+ // isSct: true//地形服务源自SuperMap iServer发布时需设置isSct为true
|
|
|
+ // }),
|
|
|
+
|
|
|
+ const terrainP = new Cesium.CesiumTerrainProvider({
|
|
|
+ url: 'http://192.168.60.3:8099/iserver/services/3D-local3DCache-SanYaDSMHuanCun/rest/realspace/datas/dsm@dsm',
|
|
|
+ isSct: true//地形服务源自SuperMap iServer发布时需设置isSct为true
|
|
|
+ });
|
|
|
+ viewer.terrainProvider = terrainP;
|
|
|
+
|
|
|
+ viewer.scene.globe.depthTestAgainstTerrain = false;
|
|
|
+
|
|
|
+
|
|
|
+ //绘制多边形
|
|
|
+ var handlerPolygon = new Cesium.DrawHandler(viewer, Cesium.DrawMode.Polygon, 0);
|
|
|
+ handlerPolygon.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');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ handlerPolygon.movingEvt.addEventListener(function (windowPosition) {
|
|
|
+ if (windowPosition.x < 200 && windowPosition.y < 150) {
|
|
|
+ tooltip.setVisible(false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (handlerPolygon.isDrawing) {
|
|
|
+ tooltip.showAt(windowPosition, '<p>点击确定开挖区域中间点</p><p>右键单击结束绘制,进行开挖</p>');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ tooltip.showAt(windowPosition, '<p>点击绘制开挖区域第一个点</p>');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ handlerPolygon.drawEvt.addEventListener(function (result) {
|
|
|
+ if (!result.object.positions) {
|
|
|
+ tooltip.showAt(result, '<p>请绘制正确的多边形</p>');
|
|
|
+ handlerPolygon.polygon.show = false;
|
|
|
+ handlerPolygon.polyline.show = false;
|
|
|
+ handlerPolygon.deactivate();
|
|
|
+ handlerPolygon.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();
|
|
|
+ viewer.scene.globe.addExcavationRegion({
|
|
|
+ name: 'ggg',
|
|
|
+ position: positions,
|
|
|
+ height: 500,
|
|
|
+ transparent: false
|
|
|
+ });
|
|
|
+ handlerPolygon.polygon.show = false;
|
|
|
+ handlerPolygon.polyline.show = false;
|
|
|
+ handlerPolygon.deactivate();
|
|
|
+ handlerPolygon.activate();
|
|
|
+ });
|
|
|
+ handlerPolygon.activate();
|
|
|
+ }, //生命周期 - 创建完成(可以访问当前this实例)
|
|
|
beforeMount() { }, //生命周期 - 挂载之前
|
|
|
mounted() { }, //生命周期 - 挂在完成
|
|
|
beforeUpdate() { }, //生命周期 - 更新之前
|
|
@@ -34,6 +130,8 @@ export default {
|
|
|
deactivated() { } //若组件实例是 <KeepAlive> 缓存树的一部分,当组件从 DOM 中被移除时调用。
|
|
|
};
|
|
|
</script>
|
|
|
-<style scoped>
|
|
|
-
|
|
|
+<style lang="scss" scoped>
|
|
|
+.cut_fill_centent1 {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
</style>
|