【类 型】:feat 关闭点飞窗口时 也同时删除 点飞的图标
【原 因】: 【过 程】: 【影 响】: # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
bfe0a6ae3c
commit
caa837daf8
@ -21,6 +21,7 @@ export default {
|
|||||||
takeoffLonLats: [], // 航线 第一个航点 起点 最后一个航点
|
takeoffLonLats: [], // 航线 第一个航点 起点 最后一个航点
|
||||||
isflow: false, // 飞机经纬度变化时是否跟随飞机
|
isflow: false, // 飞机经纬度变化时是否跟随飞机
|
||||||
currentStyleIndex: 0, // 当前选中的地图样式索引
|
currentStyleIndex: 0, // 当前选中的地图样式索引
|
||||||
|
guidedMarker: null, // 指点飞行地图标记
|
||||||
// 地图样式
|
// 地图样式
|
||||||
mapStyles: [
|
mapStyles: [
|
||||||
// mapbox官方样式 卫星地图
|
// mapbox官方样式 卫星地图
|
||||||
@ -234,7 +235,7 @@ export default {
|
|||||||
lat: this.map.unproject(currentPoint).lat
|
lat: this.map.unproject(currentPoint).lat
|
||||||
}
|
}
|
||||||
this.$emit('longPress', lonLat) // 将经纬度信息传递到组件外部
|
this.$emit('longPress', lonLat) // 将经纬度信息传递到组件外部
|
||||||
this.makeGuidedMarker(lonLat, this.map) // 创建标记
|
this.makeGuidedMarker(lonLat) // 创建标记
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// 触摸屏操作
|
// 触摸屏操作
|
||||||
@ -256,7 +257,7 @@ export default {
|
|||||||
lat: this.map.unproject(currentPoint).lat
|
lat: this.map.unproject(currentPoint).lat
|
||||||
}
|
}
|
||||||
this.$emit('longPress', lonLat) // 将经纬度信息传递到组件外部
|
this.$emit('longPress', lonLat) // 将经纬度信息传递到组件外部
|
||||||
this.makeGuidedMarker(lonLat, this.map) // 创建标记
|
this.makeGuidedMarker(lonLat) // 创建标记
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -559,20 +560,26 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* @abstract 创建指点飞行标记
|
* @abstract 创建指点飞行标记
|
||||||
* @param {Array} lonLat - 经纬度数组,格式为 [longitude, latitude]
|
* @param {Array} lonLat - 经纬度数组,格式为 [longitude, latitude]
|
||||||
* @param {Object} map - mapboxgl 的地图实例
|
|
||||||
*/
|
*/
|
||||||
makeGuidedMarker (lonLat, map) {
|
makeGuidedMarker (lonLat) {
|
||||||
// 删除之前的所有标记
|
// 删除之前的所有标记
|
||||||
if (this.guidedMarker) {
|
this.delGuidedMarker()
|
||||||
this.guidedMarker.remove()
|
|
||||||
this.guidedMarker = null // 清除当前标记
|
|
||||||
}
|
|
||||||
// 创建一个标记对象
|
// 创建一个标记对象
|
||||||
this.guidedMarker = new mapboxgl.Marker({
|
this.guidedMarker = new mapboxgl.Marker({
|
||||||
draggable: false// 关闭拖拽
|
draggable: false// 关闭拖拽
|
||||||
})
|
})
|
||||||
.setLngLat(lonLat)
|
.setLngLat(lonLat)
|
||||||
.addTo(map)
|
.addTo(this.map)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @abstract 删除指点飞行标记
|
||||||
|
*/
|
||||||
|
delGuidedMarker () {
|
||||||
|
if (this.guidedMarker) {
|
||||||
|
this.guidedMarker.remove()
|
||||||
|
this.guidedMarker = null // 清除当前标记
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @description: 创建飞机轨迹 ps:原理删除之前的轨迹 重新绘制
|
* @description: 创建飞机轨迹 ps:原理删除之前的轨迹 重新绘制
|
||||||
|
@ -14,11 +14,12 @@
|
|||||||
@open="openCallback">
|
@open="openCallback">
|
||||||
<!-- 点飞设置弹出框 -->
|
<!-- 点飞设置弹出框 -->
|
||||||
<template v-if="dialogItem == 'guidedBox'">
|
<template v-if="dialogItem == 'guidedBox'">
|
||||||
<template>
|
<el-form label-position="left">
|
||||||
<font>高度设置</font>
|
<el-form-item label="高度设置" label-width="80px">
|
||||||
<el-input-number v-model="guidedAlt" label="高度设置"></el-input-number>
|
<el-input-number v-model="guidedAlt" label="高度设置"></el-input-number>
|
||||||
<font class="m-l-5">米</font>
|
<font class="m-l-5">米</font>
|
||||||
</template>
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
<span slot="footer" class="dialog-footer">
|
<span slot="footer" class="dialog-footer">
|
||||||
<el-button size="medium" @click="dialogVisible = false">关闭</el-button>
|
<el-button size="medium" @click="dialogVisible = false">关闭</el-button>
|
||||||
<el-button size="medium" type="primary"
|
<el-button size="medium" type="primary"
|
||||||
@ -83,6 +84,9 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
/** 弹出框 关闭事件回调 */
|
/** 弹出框 关闭事件回调 */
|
||||||
closeCallback () {
|
closeCallback () {
|
||||||
|
if (this.dialogItem === 'guidedBox') { // 关闭点飞窗口时
|
||||||
|
this.$refs.mapbox.delGuidedMarker()// 删除所有点飞的地图标记
|
||||||
|
}
|
||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
this.dialogItem = ''
|
this.dialogItem = ''
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user