Store Frequencies

This commit is contained in:
portree_kid 2020-03-13 08:36:36 +01:00
parent 7d6be33150
commit 43f8aeb9d6
4 changed files with 55 additions and 8 deletions

View File

@ -30,19 +30,33 @@
<div v-if="airport"> <div v-if="airport">
<el-row> <el-row>
<el-col :span="7">AWOS :</el-col> <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-row> <el-row>
<el-col :span="7">Ground :</el-col> <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-row> <el-row>
<el-col :span="7">Tower :</el-col> <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-row> <el-row>
<el-col :span="7">Approach :</el-col> <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> </el-row>
</div> </div>
</div> </div>
@ -51,7 +65,7 @@
<script lang="js"> <script lang="js">
export default { export default {
data () { data () {
return { awosOk: true, groundOk: true, towerOk: true, approachOk: true } return { awosOk: true, groundOk: true, towerOk: true, approachOk: true, departureOk: true }
}, },
methods: { methods: {
isValid (frequency) { isValid (frequency) {
@ -79,6 +93,9 @@
} }
}, },
computed: { computed: {
editing: function () {
return this.$parent.$parent.$parent.$refs.editLayer.editing
},
icao: function () { icao: function () {
return this.$store.state.Editable.data.airport.icao return this.$store.state.Editable.data.airport.icao
}, },
@ -151,6 +168,19 @@
this.approachOk = this.isValid(newValue) this.approachOk = this.isValid(newValue)
this.$store.dispatch('setApproach', newValue * 100) 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)
}
} }
} }
} }

View File

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

View File

@ -31,7 +31,16 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
var nodes = []; var nodes = [];
var arcList = []; 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 // Loaded segments
featureList.filter(o => o instanceof L.TaxiwaySegment).filter(n => n).forEach(element => { featureList.filter(o => o instanceof L.TaxiwaySegment).filter(n => n).forEach(element => {
var begin = mapBeginNode(element); var begin = mapBeginNode(element);
@ -90,7 +99,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
var maxId = uniqueNodes.slice(-1)[0]['@index']; 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 }); xmlString = builder.create(xmlObj).end({ pretty: true });
fs.writeFileSync(f, xmlString); fs.writeFileSync(f, xmlString);

View File

@ -19,6 +19,9 @@ const mutations = {
}, },
'SET_APPROACH' (state, frequency) { 'SET_APPROACH' (state, frequency) {
Vue.set(state, 'APPROACH', 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) { async setApproach (context, frequency) {
context.commit('SET_APPROACH', frequency) context.commit('SET_APPROACH', frequency)
},
async setDeparture (context, frequency) {
context.commit('SET_DEPARTURE', frequency)
} }
} }