From 8d301b885c7c433300b5bbeb47a0864eb738fad4 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期五, 23 十二月 2022 17:51:11 +0800 Subject: [PATCH] q --- src/components/MapView/mapSpacePop.vue | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 50 insertions(+), 10 deletions(-) diff --git a/src/components/MapView/mapSpacePop.vue b/src/components/MapView/mapSpacePop.vue index 483521c..3686c5e 100644 --- a/src/components/MapView/mapSpacePop.vue +++ b/src/components/MapView/mapSpacePop.vue @@ -1,8 +1,12 @@ <template> <div class="menuPop"> - + <div style="padding: 5px"> - <el-form :inline="true" :model="formInline" class="demo-form-inline"> + <el-form + :inline="true" + :model="formInline" + class="demo-form-inline" + > <el-form-item> <el-select v-model="formInline.name" @@ -42,8 +46,14 @@ ></el-input> </el-form-item> <el-form-item> - <el-button plain @click="setSpaceTableLayer">鏌ヨ</el-button> - <el-button plain @click="restSpacePopLayer">閲嶇疆</el-button> + <el-button + plain + @click="setSpaceTableLayer" + >鏌ヨ</el-button> + <el-button + plain + @click="restSpacePopLayer" + >閲嶇疆</el-button> </el-form-item> </el-form> <div class="centTable"> @@ -59,7 +69,11 @@ label="搴忓彿" width="50" /> - <el-table-column label="瀹氫綅" width="100" align="center"> + <el-table-column + label="瀹氫綅" + width="100" + align="center" + > <template slot-scope="scope"> <el-button icon="el-icon-map-location" @@ -322,9 +336,9 @@ var val1 = decr(data.result); if (val1) { - if (this.imagePoint != null) { - sgworld.Creator.DeleteObject(this.imagePoint); - this.imagePoint = null; + if (this.$store.state.primitLayer != null) { + sgworld.Creator.DeleteObject(this.$store.state.primitLayer); + this.$store.state.primitLayer = null; } var wkt = this.$wkt.parse(val1); this.setMapLoaction(wkt); @@ -339,9 +353,13 @@ this.getSpaceTableLayer(); }, setMapLoaction(res) { + if (this.$store.state.primitLayer != null) { + sgworld.Creator.DeleteObject(this.$store.state.primitLayer); + this.$store.state.primitLayer = null; + } var coord = res.coordinates; if (res.type == 'Point') { - this.imagePoint = sgworld.Creator.CreateLabel( + this.$store.state.primitLayer = sgworld.Creator.CreateLabel( { X: coord[0], Y: coord[1], Altitude: 2000 }, '', SmartEarthRootUrl + 'Workers/image/mark.png', @@ -352,7 +370,29 @@ 0, '宸℃鐐�' ); - sgworld.Navigate.flyToObj(this.imagePoint.item); + sgworld.Navigate.flyToObj(this.$store.state.primitLayer.item); + } else if (res.type == 'MultiPolygon') { + var val = res.coordinates[0][0]; + var std = []; + for (var i in val) { + + std.push({ x: val[i][0], y: val[i][1], z: 1000 }) + } + this.$store.state.primitLayer = sgworld.Creator.createPolygon(std, { + fillColor: '#ffff00', + outlineColor: '#fff', + outlineWidth: 2 + }, 1, 0, "闈�"); + sgworld.Navigate.flyToObj(this.$store.state.primitLayer.item); + } else if (res.type == 'MultiLineString') { + var line = res.coordinates[0]; + var std = []; + for (var i in line) { + + std.push({ x: line[i][0], y: line[i][1], z: 1000 }) + } + this.$store.state.primitLayer = sgworld.Creator.createPolyline(std, "#ffff00", 1, 0, "绾�"); + sgworld.Navigate.flyToObj(this.$store.state.primitLayer.item); } }, }, -- Gitblit v1.9.3