Store Frequencies

pull/36/head
portree_kid 5 years ago
parent 7d6be33150
commit 43f8aeb9d6

@ -30,19 +30,33 @@
<div v-if="airport">
<el-row>
<el-col :span="7">AWOS :</el-col>
<el-col :span="15"><el-input placeholder="Please input AWOS frequency" v-model="AWOS" v-bind:class="{ invalid: !awosOk}">></el-input></el-col>
<el-col :span="15"><el-input placeholder="Please input AWOS frequency" v-model="AWOS"
:disabled="!editing"
v-bind:class="{ invalid: !awosOk && editing}">></el-input></el-col>
</el-row>
<el-row>
<el-col :span="7">Ground :</el-col>
<el-col :span="15"><el-input placeholder="Please input GROUND frequency" v-model="GROUND" v-bind:class="{ invalid: !groundOk}"></el-input></el-col>
<el-col :span="15"><el-input placeholder="Please input GROUND frequency" v-model="GROUND"
:disabled="!editing"
v-bind:class="{ invalid: !groundOk && editing}"></el-input></el-col>
</el-row>
<el-row>
<el-col :span="7">Tower :</el-col>
<el-col :span="15"><el-input placeholder="Please input TOWER frequency" v-model="TOWER" v-bind:class="{ invalid: !towerOk}"></el-input></el-col>
<el-col :span="15"><el-input placeholder="Please input TOWER frequency" v-model="TOWER"
:disabled="!editing"
v-bind:class="{ invalid: !towerOk && editing}"></el-input></el-col>
</el-row>
<el-row>
<el-col :span="7">Approach :</el-col>
<el-col :span="15"><el-input placeholder="Please input APPROACH frequency" v-model="APPROACH" v-bind:class="{ invalid: !approachOk}"></el-input></el-col>
<el-col :span="15"><el-input placeholder="Please input APPROACH frequency" v-model="APPROACH"
:disabled="!editing"
v-bind:class="{ invalid: !approachOk && editing}"></el-input></el-col>
</el-row>
<el-row>
<el-col :span="7">Departure :</el-col>
<el-col :span="15"><el-input placeholder="Please input DEPARTURE frequency" v-model="DEPARTURE"
:disabled="!editing"
v-bind:class="{ invalid: !departureOk && editing}"></el-input></el-col>
</el-row>
</div>
</div>
@ -51,7 +65,7 @@
<script lang="js">
export default {
data () {
return { awosOk: true, groundOk: true, towerOk: true, approachOk: true }
return { awosOk: true, groundOk: true, towerOk: true, approachOk: true, departureOk: true }
},
methods: {
isValid (frequency) {
@ -79,6 +93,9 @@
}
},
computed: {
editing: function () {
return this.$parent.$parent.$parent.$refs.editLayer.editing
},
icao: function () {
return this.$store.state.Editable.data.airport.icao
},
@ -151,6 +168,19 @@
this.approachOk = this.isValid(newValue)
this.$store.dispatch('setApproach', newValue * 100)
}
},
DEPARTURE: {
// getter
get: function () {
let newValue = (this.$store.state.Frequencies.DEPARTURE / 100).toFixed(3)
this.departureOk = this.isValid(newValue)
return newValue
},
// setter
set: function (newValue) {
this.departureOk = this.isValid(newValue)
this.$store.dispatch('setDeparture', newValue * 100)
}
}
}
}

@ -67,7 +67,7 @@
},
data () {
return {
maxId: 1, icao: String, checking: false
maxId: 1, icao: String, checking: false, editing: false
}
},
methods: {
@ -134,6 +134,7 @@
},
enableEdit () {
this.editable = true
this.editing = true
this.featureLookup = [];
this.groundnetLayerGroup.eachLayer(l => {
l.enableEdit()
@ -149,6 +150,7 @@
},
disableEdit () {
this.editable = false
this.editing = false
this.groundnetLayerGroup.eachLayer(l => {
l.disableEdit()
})

@ -31,7 +31,16 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
var nodes = [];
var arcList = [];
var featureLookup = [];
//Frequencies
var frequencies = {
'AWOS': store.default.state.Frequencies.AWOS,
'GROUND': store.default.state.Frequencies.GROUND,
'TOWER': store.default.state.Frequencies.TOWER,
'APPROACH': store.default.state.Frequencies.APPROACH,
'DEPARTURE': store.default.state.Frequencies.DEPARTURE
};
var featureLookup = [];
// Loaded segments
featureList.filter(o => o instanceof L.TaxiwaySegment).filter(n => n).forEach(element => {
var begin = mapBeginNode(element);
@ -90,7 +99,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
var maxId = uniqueNodes.slice(-1)[0]['@index'];
var xmlObj = { groundnet: { version: 1, parkingList: { Parking: parkings }, TaxiNodes: { node: uniqueNodes }, TaxiWaySegments: { arc: arcList } } };
var xmlObj = { groundnet: { version: 1, frequencies, parkingList: { Parking: parkings }, TaxiNodes: { node: uniqueNodes }, TaxiWaySegments: { arc: arcList } } };
xmlString = builder.create(xmlObj).end({ pretty: true });
fs.writeFileSync(f, xmlString);

@ -19,6 +19,9 @@ const mutations = {
},
'SET_APPROACH' (state, frequency) {
Vue.set(state, 'APPROACH', frequency)
},
'SET_DEPARTURE' (state, frequency) {
Vue.set(state, 'DEPARTURE', frequency)
}
}
@ -34,6 +37,9 @@ const actions = {
},
async setApproach (context, frequency) {
context.commit('SET_APPROACH', frequency)
},
async setDeparture (context, frequency) {
context.commit('SET_DEPARTURE', frequency)
}
}

Loading…
Cancel
Save