From bf8f7002ae892f124740c28ad6f79f04db3da75c Mon Sep 17 00:00:00 2001 From: portree_kid Date: Mon, 28 Sep 2020 22:38:55 +0200 Subject: [PATCH] Problem storing pushback hold points --- src/renderer/components/EditLayer.vue | 7 ++++--- src/renderer/loaders/groundnet_writer.js | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index dd99afe..8f7c026 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -576,8 +576,8 @@ You should have received a copy of the GNU General Public License along with FG console.log(event) event.target.addTo(this.groundnetLayerGroup) var pt = event.sourceTarget._latlngs[event.sourceTarget._latlngs.length-1]; - pt.attributes.holdPointType = 'PushBack' - var nIndex = pt.attributes.index + pt.options.attributes['holdPointType'] = 'PushBack' + var nIndex = pt.options.attributes.index var fa_icon = "
"; const icon = new L.DivIcon({ className: 'custom-div-icon', @@ -589,6 +589,7 @@ You should have received a copy of the GNU General Public License along with FG node.glueindex = nIndex; node.addTo(this.groundnetLayerGroup); node.featureLookup = this.featureLookup; + node['holdPointType'] = 'PushBack' this.featureLookup[nIndex].push(node); node.addListeners(); node.extensions(); @@ -952,7 +953,7 @@ You should have received a copy of the GNU General Public License along with FG save () { var xml = [] this.groundnetLayerGroup.eachLayer(l => { - console.log(l) + //console.debug(l) xml.push(l) }) writeGroundnetXML(this.$store.state.Settings.settings.airportsDirectory, this.icao, xml) diff --git a/src/renderer/loaders/groundnet_writer.js b/src/renderer/loaders/groundnet_writer.js index 38eb272..4d51578 100644 --- a/src/renderer/loaders/groundnet_writer.js +++ b/src/renderer/loaders/groundnet_writer.js @@ -18,6 +18,11 @@ var featureLookup = []; var parkings = []; var pushBackNodeLookup = []; +/** + * Walk nodes until the pushback node is found. + * @param {*} index + */ + function findRouteToPushback (index) { if (featureLookup===undefined) { return @@ -25,6 +30,7 @@ function findRouteToPushback (index) { var walkedNodes = [index] var pushBackNodes = [] walkPushbackRoute(index, walkedNodes, pushBackNodes) + return pushBackNodes } @@ -62,6 +68,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) { } if (f == null) return; + pushBackNodeLookup = []; console.debug(featureList); @@ -79,8 +86,6 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) { var version = new Date().toUTCString() + ' by FlightgearAirports'; var name = store.default.state.Settings.settings.name; - - featureLookup = []; // Loaded segments featureList.filter(o => o instanceof L.TaxiwaySegment).filter(n => n).forEach(element => { @@ -138,7 +143,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) { }); - // delete the parkings + // Find the index of the pushback node parkings.forEach(n => { nodes[n['@index']] = null; var pushBackNode = findRouteToPushback(Number(n['@index']))[0]; @@ -151,6 +156,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) { arcList = arcList.filter(a => a['@begin'] !== a['@end']); nodes.sort((p, p2) => { return p['@index'] - p2['@index'] }); + //console.debug(util.inspect(nodes)); var uniqueNodes = nodes.filter((v, i, a) => a.indexOf(v) === i); var approachList = store.default.state.Frequencies.items.filter(f => f.type === 'APPROACH').map(mapFrequency); @@ -221,6 +227,10 @@ var mapRunwayNodes = function (o) { var mapHoldPoint = function (o) { if (o instanceof L.HoldNode) { + if( o['holdPointType'] === undefined ) + { + console.error('Oh dear ' + o); + } return { '@index': String(o['glueindex']), '@holdPointType': o['holdPointType'] }; } }