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)
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 = "<div style='background-color:#4838cc;' class='marker-pin'></div><i class='fas fa-arrows-alt-h'></i>";
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)

View File

@ -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'] };
}
}