Select and delete Parkings

This commit is contained in:
portree_kid 2020-02-13 11:39:26 +01:00
parent 3772717291
commit 7c61fedbec
3 changed files with 32 additions and 2 deletions

View File

@ -144,8 +144,23 @@
switch (this.$store.state.Editable.type) { switch (this.$store.state.Editable.type) {
case 'node': case 'node':
this.removeNode(this.$store.state.Editable.index) this.removeNode(this.$store.state.Editable.index)
break;
case 'parking':
this.removeParking(this.$store.state.Editable.index)
break;
} }
}, },
removeParking (index) {
if(this.featureLookup[index]===undefined) {
console.error("Lookup " + index + " failed ");
return;
}
this.featureLookup[index].forEach((element, i) => {
if (element instanceof L.ParkingSpot) {
element.removeFrom(this.groundnetLayerGroup);
}
});
},
removeNode (index) { removeNode (index) {
if(this.featureLookup[index]===undefined) { if(this.featureLookup[index]===undefined) {
console.error("Lookup " + index + " failed "); console.error("Lookup " + index + " failed ");
@ -205,6 +220,9 @@
}, },
editedNode() { editedNode() {
if (this.$store.state.Editable.data.node===undefined) {
return;
}
var isOnRunway = Number(this.$store.state.Editable.data.node.isOnRunway); var isOnRunway = Number(this.$store.state.Editable.data.node.isOnRunway);
var isHoldPoint = this.$store.state.Editable.data.node.holdPointType !== 'none' && var isHoldPoint = this.$store.state.Editable.data.node.holdPointType !== 'none' &&
this.$store.state.Editable.data.node.holdPointType !== undefined; this.$store.state.Editable.data.node.holdPointType !== undefined;

View File

@ -113,6 +113,15 @@ L.ParkingSpot = L.Circle.extend({
console.log("Click : " + event.target); console.log("Click : " + event.target);
store.default.dispatch('setParking', event.target.options.attributes); store.default.dispatch('setParking', event.target.options.attributes);
}); });
this.on('editable:vertex:clicked', function (event) {
console.log(this.featureLookup[event.vertex.glueindex]);
if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){
event.vertex._icon.style['background-color'] = 'red';
store.default.dispatch('setParking', event.target.options.attributes);
}
});
this.on('editable:disable', function (event) { this.on('editable:disable', function (event) {
event.target.removeDirection(); event.target.removeDirection();
}); });

View File

@ -15,19 +15,22 @@ const mutations = {
state.type = 'airport' state.type = 'airport'
}, },
SET_EDIT_PARKING (state, parking) { SET_EDIT_PARKING (state, parking) {
state.data.parking[parking.index] = parking state.data = {}
state.data.parking = parking
state.index = parking.index state.index = parking.index
state.type = 'parking' state.type = 'parking'
}, },
'SET_EDIT_NODE' (state, node) { 'SET_EDIT_NODE' (state, node) {
state.data = {}
state.data.node = node state.data.node = node
state.index = node.index state.index = node.index
state.type = 'node' state.type = 'node'
}, },
SET_EDIT_ARC (state, arc) { SET_EDIT_ARC (state, arc) {
state.data = {}
state.data.arc = arc state.data.arc = arc
if (state.data.arc.name === undefined) { if (state.data.arc.name === undefined) {
state.data.arc.name = 'X' state.data.arc.name = ''
} }
state.index = arc.index state.index = arc.index
state.type = 'arc' state.type = 'arc'