Load Taxilines

This commit is contained in:
portree_kid 2020-03-30 21:40:00 +02:00
parent bf59d025f6
commit f515d6249f

View File

@ -5,6 +5,50 @@ const zlib = require('zlib');
const LatLonEllipsoidal = require( 'geodesy/latlon-ellipsoidal-vincenty.js').default; const LatLonEllipsoidal = require( 'geodesy/latlon-ellipsoidal-vincenty.js').default;
const fs = require('fs'); const fs = require('fs');
function createPoly(currentFeature) {
switch (module.exports.type) {
case 110:
var taxiwayPoly = new L.Polygon(currentFeature);
taxiwayPoly.setStyle({color: module.exports.colour, interactive: false});
taxiwayPoly.addTo(layerGroup);
break;
case 120:
var taxiwayPoly = new L.Polygon(currentFeature);
taxiwayPoly.setStyle({color: module.exports.colour, interactive: false});
taxiwayPoly.addTo(layerGroup);
break;
case 130:
var taxiwayPoly = new L.Polygon(currentFeature);
taxiwayPoly.setStyle({color: module.exports.colour, fillOpacity: .0, interactive: false});
taxiwayPoly.addTo(layerGroup);
break;
default:
break;
}
}
function createLineString(currentFeature) {
switch (module.exports.type) {
case 110:
var taxiwayPoly = new L.Polyline(currentFeature);
taxiwayPoly.setStyle({color: module.exports.colour, interactive: false});
taxiwayPoly.addTo(layerGroup);
break;
case 120:
var taxiwayPoly = new L.Polyline(currentFeature);
taxiwayPoly.setStyle({color: module.exports.colour, interactive: false});
taxiwayPoly.addTo(layerGroup);
break;
case 130:
var taxiwayPoly = new L.Polyline(currentFeature);
taxiwayPoly.setStyle({color: module.exports.colour, interactive: false});
taxiwayPoly.addTo(layerGroup);
break;
default:
break;
}
}
module.exports.readPavement = function (f, icao, cb) { module.exports.readPavement = function (f, icao, cb) {
console.log(f); console.log(f);
layerGroup = L.layerGroup(); layerGroup = L.layerGroup();
@ -37,6 +81,8 @@ module.exports.readPavement = function (f, icao, cb) {
} }
module.exports.isScanning = false; module.exports.isScanning = false;
module.exports.colour = 'grey';
module.exports.type = 0;
var scanMethods = { var scanMethods = {
@ -87,20 +133,32 @@ var scanMethods = {
return undefined; return undefined;
if(typeof currentFeature !== 'undefined') if(typeof currentFeature !== 'undefined')
{ {
var taxiwayPoly = new L.Polygon(currentFeature); createPoly(currentFeature);
taxiwayPoly.setStyle({color: 'grey', interactive: false});
taxiwayPoly.addTo(layerGroup);
} }
module.exports.colour = 'grey';
module.exports.type = 110;
return [[]]; return [[]];
}, },
120: (line, icao, layerGroup, currentFeature) => { 120: (line, icao, layerGroup, currentFeature) => {
if (!module.exports.isScanning) if (!module.exports.isScanning)
return undefined; return undefined;
if(typeof currentFeature !== 'undefined')
{
createPoly(currentFeature);
}
module.exports.colour = 'yellow';
module.exports.type = 120;
return [[]]; return [[]];
}, },
130: (line, icao, layerGroup, currentFeature) => { 130: (line, icao, layerGroup, currentFeature) => {
if (!module.exports.isScanning) if (!module.exports.isScanning)
return undefined; return undefined;
if(typeof currentFeature !== 'undefined')
{
createPoly(currentFeature);
}
module.exports.colour = 'black';
module.exports.type = 130;
return [[]]; return [[]];
}, },
111: (line, icao, layerGroup, currentFeature) => { 111: (line, icao, layerGroup, currentFeature) => {
@ -134,18 +192,15 @@ var scanMethods = {
115: (line, icao, layerGroup, currentFeature) => { 115: (line, icao, layerGroup, currentFeature) => {
if (!module.exports.isScanning) if (!module.exports.isScanning)
return; return;
currentFeature.slice(-1)[0].push([line[1], line[2]]); currentFeature.slice(-1)[0].push([line[1], line[2]]);
var taxiwayLine = new L.Polyline(currentFeature); createLineString(currentFeature);
taxiwayLine.setStyle({color: 'red'});
// taxiwayLine.addTo(layerGroup);
}, },
116: (line, icao, layerGroup, currentFeature) => { 116: (line, icao, layerGroup, currentFeature) => {
if (!module.exports.isScanning) if (!module.exports.isScanning)
return; return;
currentFeature.slice(-1)[0].push([line[1], line[2]]); currentFeature.slice(-1)[0].push([line[1], line[2]]);
var taxiwayLine = new L.Polyline(currentFeature); createLineString(currentFeature);
taxiwayLine.setStyle({color: 'red'}); // taxiwayLine.addTo(layerGroup);
// taxiwayLine.addTo(layerGroup);
}, },
99: (l) => { 99: (l) => {
console.log('Finished'); console.log('Finished');