Parkingspot Edit

This commit is contained in:
portree_kid
2020-01-08 19:41:58 +01:00
parent 7f3bdc8de8
commit 9a59509638
4 changed files with 75 additions and 37 deletions
+8 -2
View File
@@ -4,8 +4,8 @@
<EditButton icon="fas fa-undo" v-on:click="undo" :show="editing" tooltip="Undo"></EditButton>
<EditButton icon="fas fa-save" v-on:click="save" :show="editing" tooltip="Save"></EditButton>
<EditButton icon="fas fa-draw-polygon" :show="editing" tooltip="Draw Taxiline"></EditButton>
<EditButton icon="fas fas fa-parking" :show="editing" tooltip="Draw Parking"></EditButton>
<EditButton icon="fas fa-draw-polygon" v-on:click="drawPolyline" :show="editing" tooltip="Draw Taxiline"></EditButton>
<EditButton icon="fas fas fa-parking" v-on:click="drawParking" :show="editing" tooltip="Draw Parking"></EditButton>
</div>
</template>
@@ -30,6 +30,12 @@
save () {
this.editing = false
this.$parent.$parent.$refs.editLayer.disableEdit()
},
drawPolyline () {
this.$parent.$parent.$refs.editLayer.drawPolyline()
},
drawParking () {
this.$parent.$parent.$refs.editLayer.drawParking()
}
},
computed: {
+25 -4
View File
@@ -8,7 +8,7 @@
import { LMap, LMarker } from 'vue2-leaflet'
import L from 'leaflet'
import LEdit from 'leaflet-editable/src/Leaflet.Editable.js'
import {readGroundnetXML} from '../loaders/groundnet_loader'
import {readGroundnetXML, addFeature} from '../loaders/groundnet_loader'
export default {
name: 'edit-layer',
@@ -26,6 +26,7 @@
},
data () {
return {
maxId: 1
}
},
methods: {
@@ -34,6 +35,8 @@
this.groundnet.removeFrom(this.$parent.mapObject)
}
this.groundnet = readGroundnetXML(this.$store.state.Settings.settings.airportsDirectory, icao)
console.log(this.groundnet.maxId)
this.groundnet.addTo(this.$parent.mapObject)
},
visible (feature) {
@@ -73,6 +76,27 @@
this.groundnet.eachLayer(l => {
l.disableEdit()
})
},
drawPolyline () {
this.$parent.mapObject.editTools.startPolyline()
},
drawParking () {
this.$parent.mapObject.on('click', this.addParking)
},
addParking (event) {
console.log(event.latlng)
if (event.latlng === undefined) {
return
}
const circle = new L.ParkingSpot(event.latlng, {attributes: {radius: 20, heading: 0}})
circle.id = (++this.groundnet.maxId)
circle.addTo(this.groundnet)
circle.enableEdit()
circle.extensions()
circle.addListeners()
addFeature(circle)
// console.log(this.groundnet)
this.$parent.mapObject.off('click', this.addParking)
}
},
@@ -88,7 +112,4 @@
</script>
<style scoped lang="scss">
.edit-layer {
}
</style>