pushbackRoute

This commit is contained in:
portree_kid 2020-03-24 07:56:51 +01:00
parent 62f24201b2
commit 4ed58fc7fa
6 changed files with 116 additions and 23 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -1,9 +1,9 @@
{
"name": "flightgear-airports",
"version": "0.0.1",
"version": "0.2.0",
"author": "portree_kid <keith.paterson@gmx.de>",
"description": "An software to design Flightgear groundnets",
"license": null,
"license": "GPL v3",
"main": "./dist/electron/main.js",
"scripts": {
"build": "node .electron-vue/build.js && electron-builder",

View File

@ -173,6 +173,36 @@
console.log('Remove : ' + this.$store.state.Editable.type)
}
},
findRouteToPushback (index) {
if (this.featureLookup===undefined) {
return
}
var parking = this.featureLookup[index].filter(n => n instanceof L.ParkingSpot)
var walkedNodes = [index]
var pushBackNodes = []
this.walkPushbackRoute(index, walkedNodes, pushBackNodes)
return pushBackNodes
},
walkPushbackRoute (index, walkedNodes, pushBackNodes) {
var polyLines = this.featureLookup[index].filter(n => n instanceof L.Polyline)
var holdNodes = this.featureLookup[index].filter(n => n instanceof L.HoldNode)
holdNodes.forEach(n => {
pushBackNodes.push(Number(n.glueindex));
});
polyLines.forEach(l => {
if( l.options.attributes.isPushBackRoute === 1 ) {
if (Number(l.begin) === index && walkedNodes.indexOf(Number(l.end)) < 0) {
walkedNodes.push(Number(l.end))
pushBackNodes.concat(this.walkPushbackRoute(Number(l.end), walkedNodes, pushBackNodes))
}
if (Number(l.end) === index && walkedNodes.indexOf(Number(l.begin)) < 0 ) {
walkedNodes.push(Number(l.begin))
pushBackNodes.concat(this.walkPushbackRoute(Number(l.begin), walkedNodes, pushBackNodes))
}
}
});
},
removeArc (arc) {
console.log(arc);
var arcLayer = this.groundnetLayerGroup.getLayer(this.$store.state.Editable.index);

View File

@ -28,10 +28,18 @@
<el-tooltip content="PIPER PA-31/CESSNA 404 Titan" placement="top" effect="light">
<el-radio :label="15">A</el-radio>
</el-tooltip>
<el-tooltip content="BOMBARDIER Regional Jet CRJ-200/DE HAVILLAND CANADA DHC-6" placement="top" effect="light">
<el-tooltip
content="BOMBARDIER Regional Jet CRJ-200/DE HAVILLAND CANADA DHC-6"
placement="top"
effect="light"
>
<el-radio :label="24">B</el-radio>
</el-tooltip>
<el-tooltip content="BOEING 737-700/AIRBUS A-320/EMBRAER ERJ 190-100" placement="top" effect="light">
<el-tooltip
content="BOEING 737-700/AIRBUS A-320/EMBRAER ERJ 190-100"
placement="top"
effect="light"
>
<el-radio :label="36">C</el-radio>
</el-tooltip>
<el-tooltip content="B767 Series/AIRBUS A-310" placement="top" effect="light">
@ -50,25 +58,29 @@
<el-col :span="7">
<span class="demo-input-label">Aircraft :</span>
</el-col>
<el-col :span="15">{{type}}</el-col>
</el-row>
<el-row>
<el-col :span="7">
<span class="demo-input-label">Parking Type :</span>
</el-col>
<el-col :span="15">
{{type}}
<el-select v-model="parking_type" placeholder="Select">
<el-option
v-for="type in options"
:key="type.value"
:label="type.label"
:value="type.value"
></el-option>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="7">
<span class="demo-input-label">Parking Type :</span>
</el-col>
<el-col :span="15">
<el-select v-model="parking_type" placeholder="Select">
<el-option
v-for="type in options"
:key="type.value"
:label="type.label"
:value="type.value"
></el-option>
</el-select>
</el-col>
</el-row>
<el-row>
<el-col :span="7">
<span class="demo-input-label">Pushback Route End :</span>
</el-col>
<el-col :span="15">{{pushbackEnd}}</el-col>
</el-row>
</div>
</template>
@ -98,6 +110,9 @@
this.$store.commit('SET_EDIT_PARKING_RADIUS', newValue / 2)
}
},
pushbackEnd: function () {
return this.$parent.$parent.$parent.$refs.editLayer.findRouteToPushback(this.$store.state.Editable.index)
},
type: function () {
switch (this.$store.state.Editable.data.parking.radius * 2) {
case 15:

View File

@ -15,6 +15,40 @@ const mathjs = require('mathjs');
var builder = require('xmlbuilder');
var featureLookup = [];
var parkings = [];
var pushBackNodeLookup = [];
function findRouteToPushback (index) {
if (featureLookup===undefined) {
return
}
var walkedNodes = [index]
var pushBackNodes = []
walkPushbackRoute(index, walkedNodes, pushBackNodes)
return pushBackNodes
}
function walkPushbackRoute (index, walkedNodes, pushBackNodes) {
var polyLines = featureLookup[index];
if (pushBackNodeLookup[index]!==undefined) {
pushBackNodes.push(pushBackNodeLookup[index]['@index']);
}
polyLines.forEach(l => {
if( l['@isPushBackRoute'] === '1' ) {
if (Number(l['@begin']) === index && walkedNodes.indexOf(Number(l['@end'])) < 0) {
walkedNodes.push(Number(l['@end']))
pushBackNodes.concat(walkPushbackRoute(Number(l['@end']), walkedNodes, pushBackNodes))
}
if (Number(l['@end']) === index && walkedNodes.indexOf(Number(l['@begin'])) < 0 ) {
walkedNodes.push(Number(l['@begin']))
pushBackNodes.concat(walkPushbackRoute(Number(l['@begin']), walkedNodes, pushBackNodes))
}
}
});
}
exports.writeGroundnetXML = function (fDir, icao, featureList) {
try {
@ -27,7 +61,11 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
var parkings = featureList.map(mapParkings).filter(n => n);
var runwayNodes = featureList.map(mapRunwayNodes).filter(n => n);
var holdNodes = featureList.map(mapHoldPoint).filter(n => n);
holdNodes.forEach(n => {
pushBackNodeLookup[n['@index']] = n;
});
var nodes = [];
var arcList = [];
var frequencies = [];
@ -37,7 +75,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
var featureLookup = [];
featureLookup = [];
// Loaded segments
featureList.filter(o => o instanceof L.TaxiwaySegment).filter(n => n).forEach(element => {
var begin = mapBeginNode(element);
@ -88,6 +126,10 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
// delete the parkings
parkings.forEach(n => {
nodes[n['@index']] = null;
var pushBackNode = findRouteToPushback(Number(n['@index']))[0];
if (pushBackNode!==undefined) {
n['@pushBackRoute'] = pushBackNode;
}
});
nodes = nodes.filter(n => n);
@ -133,7 +175,7 @@ var mapParkings = function (o) {
var lat = convertLat(o.getLatLng());
var lon = convertLon(o.getLatLng());
// <Parking index="0" type="gate" name="GA_Parking" lat="S9 25.739923" lon="E160 2.927602" heading="67" radius="44" airlineCodes="" />
return { '@index': String(o['id']), '@type': o.options.attributes.type, '@name': o.options.attributes.name, '@lat': lat, '@lon': lon, '@heading': Number(o.options.attributes.heading%360), '@radius': String(o.options.attributes.radius) };
return { '@index': String(o['id']), '@type': o.options.attributes.type, '@name': o.options.attributes.name, '@lat': lat, '@lon': lon, '@heading': Number(o.options.attributes.heading%360).toFixed(1), '@radius': String(o.options.attributes.radius) };
}
}
@ -147,6 +189,12 @@ var mapRunwayNodes = function (o) {
}
}
var mapHoldPoint = function (o) {
if (o instanceof L.HoldNode) {
return { '@index': String(o['glueindex']), '@holdPointType': o['holdPointType'] };
}
}
var mapBeginNode = function (o) {
if (o instanceof L.TaxiwaySegment) {
console.log(o);