Parking List

This commit is contained in:
portree_kid 2020-03-30 14:17:38 +02:00
parent 4b564798ab
commit d5f68613a1
7 changed files with 126 additions and 8 deletions

View File

@ -254,6 +254,15 @@
} }
}); });
}, },
getParkings (){
var parkings = []
this.groundnetLayerGroup.eachLayer(l => {
if (l instanceof L.ParkingSpot) {
parkings.push(l)
}
})
return parkings
},
removeNode (index) { removeNode (index) {
if(this.featureLookup[index]===undefined) { if(this.featureLookup[index]===undefined) {
console.error("Lookup " + index + " failed "); console.error("Lookup " + index + " failed ");
@ -300,12 +309,13 @@
}) })
}, },
editedParking() { 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 || if (this.$store.state.Editable.index === undefined ||
this.$store.state.Editable.data.parking === undefined || this.$store.state.Editable.data.parking === undefined ||
this.featureLookup===undefined) { this.featureLookup===undefined) {
return return
} }
this.$store.dispatch('updatedParking', this.$store.state.Editable.data.parking);
this.featureLookup[this.$store.state.Editable.index].forEach((element,index) => { this.featureLookup[this.$store.state.Editable.index].forEach((element,index) => {
if (element instanceof L.ParkingSpot) { if (element instanceof L.ParkingSpot) {
element.options.attributes = Object.assign({}, this.$store.state.Editable.data.parking) element.options.attributes = Object.assign({}, this.$store.state.Editable.data.parking)

View File

@ -5,12 +5,13 @@
<ul role="tablist"> <!-- top aligned tabs --> <ul role="tablist"> <!-- top aligned tabs -->
<li><a href="#home" role="tab"><i class="fa fa-bars"></i></a></li> <li><a href="#home" role="tab"><i class="fa fa-bars"></i></a></li>
<li><a href="#edit" role="tab"><i class="fas fa-edit"></i></a></li> <li><a href="#edit" role="tab"><i class="fas fa-edit"></i></a></li>
<li><a href="#parking" role="tab"><i class="fas fa-parking"></i></a></li>
<li><a href="#search" role="tab"><i class="fa fa-search"></i></a></li> <li><a href="#search" role="tab"><i class="fa fa-search"></i></a></li>
<li><a href="#scan" role="tab"><i class="fa fa-sync"></i></a></li>
<li><a href="#check" role="tab"><i class="far fa-check-square"></i></a></li> <li><a href="#check" role="tab"><i class="far fa-check-square"></i></a></li>
</ul> </ul>
<ul role="tablist"> <!-- bottom aligned tabs --> <ul role="tablist"> <!-- bottom aligned tabs -->
<li><a href="#scan" role="tab"><i class="fa fa-sync"></i></a></li>
<li><a href="#settings" role="tab"><i class="fas fa-cog"></i></a></li> <li><a href="#settings" role="tab"><i class="fas fa-cog"></i></a></li>
</ul> </ul>
</div> </div>
@ -28,6 +29,9 @@
<ArcEdit></ArcEdit> <ArcEdit></ArcEdit>
<NodeEdit></NodeEdit> <NodeEdit></NodeEdit>
</div> </div>
<div class="leaflet-sidebar-pane" id="parking">
<ParkingList></ParkingList>
</div>
<div class="leaflet-sidebar-pane" id="search"> <div class="leaflet-sidebar-pane" id="search">
<Search></Search> <Search></Search>
</div> </div>
@ -49,20 +53,21 @@
import '@fortawesome/fontawesome-free/css/all.css' import '@fortawesome/fontawesome-free/css/all.css'
import {} from 'leaflet-sidebar-v2' import {} from 'leaflet-sidebar-v2'
import L from 'leaflet' import L from 'leaflet'
import Help from './Help'
import AirportEdit from './AirportEdit' import AirportEdit from './AirportEdit'
import CheckPanel from './CheckPanel'
import ParkingEdit from './ParkingEdit'
import ArcEdit from './ArcEdit' import ArcEdit from './ArcEdit'
import CheckPanel from './CheckPanel'
import FileSelect from './FileSelect' import FileSelect from './FileSelect'
import Help from './Help'
import NodeEdit from './NodeEdit' import NodeEdit from './NodeEdit'
import ParkingEdit from './ParkingEdit'
import ParkingList from './ParkingList'
import RunScan from './RunScan' import RunScan from './RunScan'
import SettingsPanel from './SettingsPanel' import SettingsPanel from './SettingsPanel'
import Search from './Search' import Search from './Search'
export default { export default {
name: 'leaflet-sidebar', 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: [], props: [],
mounted () { mounted () {
this.add() this.add()

View File

@ -118,6 +118,11 @@
<script lang="js"> <script lang="js">
/* eslint-disable */ /* eslint-disable */
export default { export default {
methods: {
show (idx) {
this.$parent.$parent.$parent.$refs.editLayer.show(idx)
}
},
computed: { computed: {
parking: function () { parking: function () {
return this.$store.state.Editable.type === 'parking' return this.$store.state.Editable.type === 'parking'

View File

@ -0,0 +1,53 @@
<template>
<div>
<h1 class="leaflet-sidebar-header">
Parking List
<div class="leaflet-sidebar-close">
<i class="fa fa-caret-left"></i>
</div>
</h1>
<el-container direction="vertical">
<el-row>
<li v-for="p in parkings" v-bind:key="p.index">
<el-link type="primary" @click="show(p.index)">{{p.name}} {{p.number}}</el-link>
</li>
</el-row>
</el-container>
</div>
</template>
<script lang="js">
export default {
name: 'parking-list',
props: [],
data () {
return {
}
},
methods: {
show (idx) {
this.$parent.$parent.$parent.$refs.editLayer.show(idx)
}
},
computed: {
parkings: {
// getter
get: function () {
if (this.$store.state.Parkings.items !== undefined) {
return this.$store.state.Parkings.items.sort((p1, p2) => {
if (p1.name === p2.name) {
return p1.number.localeCompare(p2.number)
} else {
return p1.name.localeCompare(p2.name)
}
})
}
},
// setter
set: function (newValue) {
}
}
}
}
</script>

View File

@ -100,6 +100,16 @@ exports.readGroundnetXML = function (fDir, icao, force) {
layerGroup.maxId = Math.max(layerGroup.maxId, Number(n.attr('index'))) layerGroup.maxId = Math.max(layerGroup.maxId, Number(n.attr('index')))
features.push(circle); features.push(circle);
}).sort(); }).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 // Get all nodes into the lookup
var taxiNodes = xml.find('groundnet/TaxiNodes/node'); var taxiNodes = xml.find('groundnet/TaxiNodes/node');
taxiNodes.map(n => { taxiNodes.map(n => {
@ -164,7 +174,7 @@ exports.readGroundnetXML = function (fDir, icao, force) {
polyline.addListeners(); polyline.addListeners();
polyline._latlngs[0].attributes = {}; polyline._latlngs[0].attributes = {};
$.each(beginNode.attrs, function (key, value) { $.each(beginNode.attrs, function (key, value) {
console.log(key + "\t" + value); console.debug(key + "\t" + value);
if (isNaN(value)) if (isNaN(value))
polyline._latlngs[0].attributes[key] = value; polyline._latlngs[0].attributes[key] = value;
@ -173,7 +183,7 @@ exports.readGroundnetXML = function (fDir, icao, force) {
}); });
polyline._latlngs[1].attributes = {}; polyline._latlngs[1].attributes = {};
$.each(endNode.attrs, function (key, value) { $.each(endNode.attrs, function (key, value) {
console.log(key + "\t" + value); console.debug(key + "\t" + value);
if (isNaN(value)) if (isNaN(value))
polyline._latlngs[1].attributes[key] = value; polyline._latlngs[1].attributes[key] = value;

View File

@ -3,6 +3,7 @@ import Vue from 'vue'
const state = { const state = {
type: 'none', type: 'none',
index: 'none', index: 'none',
editing: false,
data: {airports: {}, parking: {}, arc: {}, node: {}, runway: {}} data: {airports: {}, parking: {}, arc: {}, node: {}, runway: {}}
} }

View File

@ -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
}