diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index d2c98de..f8644ed 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -254,6 +254,15 @@ } }); }, + getParkings (){ + var parkings = [] + this.groundnetLayerGroup.eachLayer(l => { + if (l instanceof L.ParkingSpot) { + parkings.push(l) + } + }) + return parkings + }, removeNode (index) { if(this.featureLookup[index]===undefined) { console.error("Lookup " + index + " failed "); @@ -300,12 +309,13 @@ }) }, editedParking() { - console.log(this.$store.state.Editable.data.parking) + console.log('Edited Parking : ' + this.$store.state.Editable.data.parking) if (this.$store.state.Editable.index === undefined || this.$store.state.Editable.data.parking === undefined || this.featureLookup===undefined) { return } + this.$store.dispatch('updatedParking', this.$store.state.Editable.data.parking); this.featureLookup[this.$store.state.Editable.index].forEach((element,index) => { if (element instanceof L.ParkingSpot) { element.options.attributes = Object.assign({}, this.$store.state.Editable.data.parking) diff --git a/src/renderer/components/LeafletSidebar.vue b/src/renderer/components/LeafletSidebar.vue index e9c96d3..62ac26f 100644 --- a/src/renderer/components/LeafletSidebar.vue +++ b/src/renderer/components/LeafletSidebar.vue @@ -5,12 +5,13 @@ @@ -28,6 +29,9 @@ +
+ +
@@ -49,20 +53,21 @@ import '@fortawesome/fontawesome-free/css/all.css' import {} from 'leaflet-sidebar-v2' import L from 'leaflet' - import Help from './Help' import AirportEdit from './AirportEdit' - import CheckPanel from './CheckPanel' - import ParkingEdit from './ParkingEdit' import ArcEdit from './ArcEdit' + import CheckPanel from './CheckPanel' import FileSelect from './FileSelect' + import Help from './Help' import NodeEdit from './NodeEdit' + import ParkingEdit from './ParkingEdit' + import ParkingList from './ParkingList' import RunScan from './RunScan' import SettingsPanel from './SettingsPanel' import Search from './Search' export default { name: 'leaflet-sidebar', - components: { Help, AirportEdit, ArcEdit, CheckPanel, NodeEdit, ParkingEdit, SettingsPanel, RunScan, FileSelect, Search }, + components: { Help, AirportEdit, ArcEdit, CheckPanel, NodeEdit, ParkingEdit, ParkingList, RunScan, FileSelect, SettingsPanel, Search }, props: [], mounted () { this.add() diff --git a/src/renderer/components/ParkingEdit.vue b/src/renderer/components/ParkingEdit.vue index 3293c5e..aa6d08d 100644 --- a/src/renderer/components/ParkingEdit.vue +++ b/src/renderer/components/ParkingEdit.vue @@ -118,6 +118,11 @@ diff --git a/src/renderer/loaders/groundnet_loader.js b/src/renderer/loaders/groundnet_loader.js index be78348..c3a0501 100644 --- a/src/renderer/loaders/groundnet_loader.js +++ b/src/renderer/loaders/groundnet_loader.js @@ -100,6 +100,16 @@ exports.readGroundnetXML = function (fDir, icao, force) { layerGroup.maxId = Math.max(layerGroup.maxId, Number(n.attr('index'))) features.push(circle); }).sort(); + + store.default.dispatch('setParkings', parkingNodes.map( + p => ({index: Number(p.attrs.index), name: String(p.attrs.name), number: String(p.attrs.number)} + )).sort((p1, p2) => { + if (p1.name === p2.name) { + return p1.number.localeCompare(p2.number) + } else { + return p1.name.localeCompare(p2.name) + }})); + // Get all nodes into the lookup var taxiNodes = xml.find('groundnet/TaxiNodes/node'); taxiNodes.map(n => { @@ -164,7 +174,7 @@ exports.readGroundnetXML = function (fDir, icao, force) { polyline.addListeners(); polyline._latlngs[0].attributes = {}; $.each(beginNode.attrs, function (key, value) { - console.log(key + "\t" + value); + console.debug(key + "\t" + value); if (isNaN(value)) polyline._latlngs[0].attributes[key] = value; @@ -173,7 +183,7 @@ exports.readGroundnetXML = function (fDir, icao, force) { }); polyline._latlngs[1].attributes = {}; $.each(endNode.attrs, function (key, value) { - console.log(key + "\t" + value); + console.debug(key + "\t" + value); if (isNaN(value)) polyline._latlngs[1].attributes[key] = value; diff --git a/src/renderer/store/modules/Editable.js b/src/renderer/store/modules/Editable.js index 6bfd2fa..2df18a1 100644 --- a/src/renderer/store/modules/Editable.js +++ b/src/renderer/store/modules/Editable.js @@ -3,6 +3,7 @@ import Vue from 'vue' const state = { type: 'none', index: 'none', + editing: false, data: {airports: {}, parking: {}, arc: {}, node: {}, runway: {}} } diff --git a/src/renderer/store/modules/Parkings.js b/src/renderer/store/modules/Parkings.js new file mode 100644 index 0000000..bd069e4 --- /dev/null +++ b/src/renderer/store/modules/Parkings.js @@ -0,0 +1,34 @@ +import Vue from 'vue' + +const state = { items: [] } + +const mutations = { + ADD_PARKING: (state, item) => { + state.items.push(item) + }, + UPDATE_PARKING: (state, item) => { + const existingItem = state.items.find((i) => i.index === item.index) + Object.assign(existingItem, item) + }, + SET_PARKINGS (state, parkings) { + Vue.set(state, 'items', parkings) + } +} + +const actions = { + async addParking (context, p) { + context.commit('ADD_FREADD_PARKINGQUENCY', p) + }, + async updatedParking (context, p) { + context.commit('UPDATE_PARKING', p) + }, + async setParkings (context, parkings) { + context.commit('SET_PARKINGS', parkings) + } +} + +export default { + state, + mutations, + actions +}