zqq:遥感影像页绘制矩形

This commit is contained in:
qqGroup0 2023-04-25 10:14:11 +08:00
parent 5f025a2c8e
commit c587d3218a
1 changed files with 50 additions and 33 deletions

View File

@ -21,6 +21,8 @@ const map = ref()
let homeMap = null let homeMap = null
let featureLayerG_area = null let featureLayerG_area = null
let featureLayerG_point = null let featureLayerG_point = null
let layerRectangle = null
onMounted(() => { onMounted(() => {
homeMap = L.map(map.value, { homeMap = L.map(map.value, {
@ -374,9 +376,24 @@ const mapOperations = {
else { else {
console.log('error') console.log('error')
} }
}, },
drawRectangle: () => {
if (layerRectangle != null) {
homeMap.removeLayer(layerRectangle)
layerRectangle = null
}
homeMap.pm.enableDraw('Rectangle', {
snappable: true,
snapDistance: 20,
});
homeMap.on('pm:create', (e) => {
L.PM.reInitLayer(e.layer);
layerRectangle = e.layer
});
},
deleteRectangle: () => {
homeMap.removeLayer(layerRectangle)
}
} }
//omnivore.wkt.parse('POINT(-80 0)').addTo(homeMap); //omnivore.wkt.parse('POINT(-80 0)').addTo(homeMap);