<template>
|
<div id="mapInfo" class="modelBox" v-drag>
|
<div>
|
<div class="modleTitle ">
|
<div>坐标拾取</div>
|
<div class="modelClose" @click="close"> X</div>
|
</div>
|
</div>
|
<div class="modelContent">
|
<div class="contentMessage" v-for="(item, index) in modelOption" :key="index">
|
<div>{{ item.lon }},{{ item.lat }}</div>
|
<div>{{ item.dis }}</div>
|
</div>
|
</div>
|
|
|
</div>
|
</template>
|
|
<script>
|
import model from '../../../assets/js/Layer/model';
|
import mapInfo from '../../../assets/js/Layer/mapInfo';
|
|
import * as turf from '@turf/turf'
|
import measure from '../../../assets/js/Layer/measure';
|
export default {
|
name: "modelEdit",
|
components: {
|
menuOpton: [],
|
},
|
computed: {
|
Obj() {
|
return this.$store.state.measureCoordObj;
|
},
|
proObj() {
|
return this.$store.state.isShowMeasureCoord;
|
}
|
},
|
watch: {
|
Obj(newVal, oldVal) {
|
if (newVal) {
|
this.setMeasureCoord(newVal);
|
}
|
},
|
proObj(newVal) {
|
if (newVal == false) {
|
this.modelOption = []
|
}
|
}
|
},
|
data() {
|
return {
|
modelOption: []
|
|
};
|
},
|
mounted() {
|
|
},
|
destroyed() {
|
|
},
|
methods: {
|
close() {
|
this.$store.state.isShowMeasureCoord = false
|
this.$store.state.isMeasureFlag = false
|
this.$store.state.measureCoordObj = false
|
measure.deleteImgLabel()
|
},
|
setMeasureCoord(res) {
|
var dis = null
|
if (this.modelOption.length > 0) {
|
var obj = this.modelOption[this.modelOption.length - 1]
|
var from = turf.point([obj.lon, obj.lat]);
|
var to = turf.point([res.longitude, res.latitude]);
|
var options = { units: 'meters' };
|
var distance = turf.distance(from, to, options);
|
dis = distance > 1000 ? parseFloat((distance / 1000)).toFixed(2) + "千米" : parseFloat((distance)).toFixed(2) + "米";
|
} else {
|
dis = '0米';
|
}
|
var obj={
|
lon: res.longitude,
|
lat: res.latitude,
|
dis: dis
|
}
|
this.modelOption.push(obj);
|
measure.addImgLabel(obj);
|
},
|
|
}
|
};
|
</script>
|
|
<style scoped lang="less">
|
.modelBox {
|
width: 360px;
|
height: 40%;
|
border: 1px solid white;
|
top: 30%;
|
right: 60px;
|
|
background-color: rgba(0, 0, 0, 0.6); // #0048fd69 !important
|
z-index: 9999;
|
position: absolute;
|
|
|
.modleTitle {
|
height: 42px;
|
width: 90%;
|
background: #0048fd69 !important;
|
border-bottom: 1px solid white;
|
color: white;
|
font-weight: 700px;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
padding: 0% 5%;
|
|
.modelClose {
|
height: 16px;
|
width: 16px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
background: rgba(128, 128, 128, 0.6);
|
font-size: 14x;
|
}
|
}
|
|
.modelContent {
|
width: 90%;
|
height: calc(95% - 42px);
|
margin: 5%;
|
// display: flex;
|
// justify-content: space-between;
|
overflow-y: auto;
|
overflow-x: hidden;
|
|
.contentMessage {
|
width: 100%;
|
color: white;
|
display: flex;
|
border: 1px solid white;
|
border-top: transparent;
|
|
div {
|
// width: 50%;
|
text-align: center;
|
// margin-bottom: 5%;
|
line-height: 50px;
|
}
|
|
div:first-child {
|
width: 59%;
|
border-right: 1px solid white;
|
|
}
|
|
div:last-child {
|
width: 40%;
|
border-right: 1px solid white;
|
|
}
|
}
|
|
.contentMessage:first-child {
|
border-top: 1px solid white;
|
;
|
}
|
}
|
|
|
}
|
</style>
|