Problem storing pushback hold points

This commit is contained in:
portree_kid 2020-09-28 22:38:55 +02:00
parent dbb60162a7
commit bf8f7002ae
2 changed files with 17 additions and 6 deletions

View File

@ -576,8 +576,8 @@ You should have received a copy of the GNU General Public License along with FG
console.log(event) console.log(event)
event.target.addTo(this.groundnetLayerGroup) event.target.addTo(this.groundnetLayerGroup)
var pt = event.sourceTarget._latlngs[event.sourceTarget._latlngs.length-1]; var pt = event.sourceTarget._latlngs[event.sourceTarget._latlngs.length-1];
pt.attributes.holdPointType = 'PushBack' pt.options.attributes['holdPointType'] = 'PushBack'
var nIndex = pt.attributes.index var nIndex = pt.options.attributes.index
var fa_icon = "<div style='background-color:#4838cc;' class='marker-pin'></div><i class='fas fa-arrows-alt-h'></i>"; var fa_icon = "<div style='background-color:#4838cc;' class='marker-pin'></div><i class='fas fa-arrows-alt-h'></i>";
const icon = new L.DivIcon({ const icon = new L.DivIcon({
className: 'custom-div-icon', 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.glueindex = nIndex;
node.addTo(this.groundnetLayerGroup); node.addTo(this.groundnetLayerGroup);
node.featureLookup = this.featureLookup; node.featureLookup = this.featureLookup;
node['holdPointType'] = 'PushBack'
this.featureLookup[nIndex].push(node); this.featureLookup[nIndex].push(node);
node.addListeners(); node.addListeners();
node.extensions(); node.extensions();
@ -952,7 +953,7 @@ You should have received a copy of the GNU General Public License along with FG
save () { save () {
var xml = [] var xml = []
this.groundnetLayerGroup.eachLayer(l => { this.groundnetLayerGroup.eachLayer(l => {
console.log(l) //console.debug(l)
xml.push(l) xml.push(l)
}) })
writeGroundnetXML(this.$store.state.Settings.settings.airportsDirectory, this.icao, xml) writeGroundnetXML(this.$store.state.Settings.settings.airportsDirectory, this.icao, xml)

View File

@ -18,6 +18,11 @@ var featureLookup = [];
var parkings = []; var parkings = [];
var pushBackNodeLookup = []; var pushBackNodeLookup = [];
/**
* Walk nodes until the pushback node is found.
* @param {*} index
*/
function findRouteToPushback (index) { function findRouteToPushback (index) {
if (featureLookup===undefined) { if (featureLookup===undefined) {
return return
@ -25,6 +30,7 @@ function findRouteToPushback (index) {
var walkedNodes = [index] var walkedNodes = [index]
var pushBackNodes = [] var pushBackNodes = []
walkPushbackRoute(index, walkedNodes, pushBackNodes) walkPushbackRoute(index, walkedNodes, pushBackNodes)
return pushBackNodes return pushBackNodes
} }
@ -62,6 +68,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
} }
if (f == null) if (f == null)
return; return;
pushBackNodeLookup = [];
console.debug(featureList); console.debug(featureList);
@ -79,8 +86,6 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
var version = new Date().toUTCString() + ' by FlightgearAirports'; var version = new Date().toUTCString() + ' by FlightgearAirports';
var name = store.default.state.Settings.settings.name; var name = store.default.state.Settings.settings.name;
featureLookup = []; 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 => {
@ -138,7 +143,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
}); });
// delete the parkings // Find the index of the pushback node
parkings.forEach(n => { parkings.forEach(n => {
nodes[n['@index']] = null; nodes[n['@index']] = null;
var pushBackNode = findRouteToPushback(Number(n['@index']))[0]; 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']); arcList = arcList.filter(a => a['@begin'] !== a['@end']);
nodes.sort((p, p2) => { return p['@index'] - p2['@index'] }); 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 uniqueNodes = nodes.filter((v, i, a) => a.indexOf(v) === i);
var approachList = store.default.state.Frequencies.items.filter(f => f.type === 'APPROACH').map(mapFrequency); 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) { var mapHoldPoint = function (o) {
if (o instanceof L.HoldNode) { if (o instanceof L.HoldNode) {
if( o['holdPointType'] === undefined )
{
console.error('Oh dear ' + o);
}
return { '@index': String(o['glueindex']), '@holdPointType': o['holdPointType'] }; return { '@index': String(o['glueindex']), '@holdPointType': o['holdPointType'] };
} }
} }