This commit is contained in:
parent
00132e46fb
commit
7c8cc0e705
@ -41,12 +41,12 @@ function bezier(line, icao, layerGroup, currentFeature) {
|
|||||||
var startPoint = [Number(previous[0]), Number(previous[1])];
|
var startPoint = [Number(previous[0]), Number(previous[1])];
|
||||||
var endPoint = [Number(line[1]), Number(line[2])];
|
var endPoint = [Number(line[1]), Number(line[2])];
|
||||||
|
|
||||||
if(module.exports.debug) {
|
if (module.exports.debug) {
|
||||||
L.polyline([startPoint, endPoint], { color: 'fuchsia' }).addTo(layerGroup);
|
L.polyline([startPoint, endPoint], { color: 'fuchsia' }).addTo(layerGroup);
|
||||||
var marker = new L.marker(endPoint, { title: 'endpoint', color: 'fuchsia' });
|
var marker = new L.marker(endPoint, { title: 'endpoint', color: 'fuchsia' });
|
||||||
marker.bindTooltip(String(currentFeature.slice(-1)[0].length + ' ' + line), { className: "my-label", offset: [0, 0] });
|
marker.bindTooltip(String(currentFeature.slice(-1)[0].length + ' ' + line), { className: "my-label", offset: [0, 0] });
|
||||||
marker.addTo(layerGroup);
|
marker.addTo(layerGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
var control = [Number(line[3]), Number(line[4])];
|
var control = [Number(line[3]), Number(line[4])];
|
||||||
if (!isNaN(control[0]) && control[0] !== undefined && !isNaN(control[1]) && control[1] !== undefined) {
|
if (!isNaN(control[0]) && control[0] !== undefined && !isNaN(control[1]) && control[1] !== undefined) {
|
||||||
@ -71,7 +71,7 @@ function bezier(line, icao, layerGroup, currentFeature) {
|
|||||||
L.polyline([startPoint, controlReflected, endPoint], { color: 'purple' }).addTo(layerGroup);
|
L.polyline([startPoint, controlReflected, endPoint], { color: 'purple' }).addTo(layerGroup);
|
||||||
|
|
||||||
var marker = new L.marker(controlReflected, { title: 'control First' });
|
var marker = new L.marker(controlReflected, { title: 'control First' });
|
||||||
marker.bindTooltip(String(currentFeature.slice(-1)[0].length + ' ' + line), {className: "my-label", offset: [0, 0] });
|
marker.bindTooltip(String(currentFeature.slice(-1)[0].length + ' ' + line), { className: "my-label", offset: [0, 0] });
|
||||||
marker.addTo(layerGroup);
|
marker.addTo(layerGroup);
|
||||||
}
|
}
|
||||||
points = deCasteljau([
|
points = deCasteljau([
|
||||||
@ -82,11 +82,11 @@ function bezier(line, icao, layerGroup, currentFeature) {
|
|||||||
if (module.exports.debug) {
|
if (module.exports.debug) {
|
||||||
L.polyline([startPoint, exports.bezierPoint, controlReflected, endPoint], { color: 'purple' }).addTo(layerGroup);
|
L.polyline([startPoint, exports.bezierPoint, controlReflected, endPoint], { color: 'purple' }).addTo(layerGroup);
|
||||||
var marker = new L.marker(exports.bezierPoint, { title: 'exports.bezierPoint' }).addTo(layerGroup);
|
var marker = new L.marker(exports.bezierPoint, { title: 'exports.bezierPoint' }).addTo(layerGroup);
|
||||||
marker.bindTooltip(String(currentFeature.slice(-1)[0].length + ' ' + line), {className: "my-label", offset: [0, 10] });
|
marker.bindTooltip(String(currentFeature.slice(-1)[0].length + ' ' + line), { className: "my-label", offset: [0, 10] });
|
||||||
marker.addTo(layerGroup);
|
marker.addTo(layerGroup);
|
||||||
|
|
||||||
var marker1 = new L.marker(controlReflected, { title: 'controlReflected' }).addTo(layerGroup);
|
var marker1 = new L.marker(controlReflected, { title: 'controlReflected' }).addTo(layerGroup);
|
||||||
marker1.bindTooltip(String(currentFeature.slice(-1)[0].length + ' ' + line), {className: "my-label", offset: [0, -10] });
|
marker1.bindTooltip(String(currentFeature.slice(-1)[0].length + ' ' + line), { className: "my-label", offset: [0, -10] });
|
||||||
marker1.addTo(layerGroup);
|
marker1.addTo(layerGroup);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -276,36 +276,47 @@ module.exports.readPavement = function (f, icao, cb) {
|
|||||||
|
|
||||||
store.default.dispatch('setPavementLoaded', false);
|
store.default.dispatch('setPavementLoaded', false);
|
||||||
|
|
||||||
lineReader.createInterface({
|
if (!fs.existsSync(f)) {
|
||||||
input: fs.createReadStream(f).pipe(zlib.createGunzip())
|
store.default.dispatch('setPavementLoaded', true);
|
||||||
}).on('line', function (line) {
|
return;
|
||||||
try {
|
}
|
||||||
var fields = line.split(/[ ]+/);
|
try {
|
||||||
// var fields = line.match('([0-9]+)');
|
fs.accessSync(f, fs.constants.R_OK);
|
||||||
if (fields == null)
|
lineReader.createInterface({
|
||||||
return;
|
input: fs.createReadStream(f).pipe(zlib.createGunzip())
|
||||||
var scanMethod = scanMethods[fields[0]];
|
}).on('line', function (line) {
|
||||||
if (scanMethod != null) {
|
try {
|
||||||
currentFeature = scanMethod(fields, icao, pavementLayerGroup, currentFeature);
|
var fields = line.split(/[ ]+/);
|
||||||
}
|
// var fields = line.match('([0-9]+)');
|
||||||
else {
|
if (fields == null)
|
||||||
if (fields[0] == '99') {
|
return;
|
||||||
lineReader.close();
|
var scanMethod = scanMethods[fields[0]];
|
||||||
|
if (scanMethod != null) {
|
||||||
|
currentFeature = scanMethod(fields, icao, pavementLayerGroup, currentFeature);
|
||||||
}
|
}
|
||||||
// console.log('Ignored:', line);
|
else {
|
||||||
|
if (fields[0] == '99') {
|
||||||
|
lineReader.close();
|
||||||
|
}
|
||||||
|
// console.log('Ignored:', line);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error reading : ' + line + error);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
}).on('error', function (err) {
|
||||||
console.error('Error reading : ' + line + error);
|
store.default.dispatch('setPavementLoaded', true);
|
||||||
}
|
console.error(err);
|
||||||
}).on('error', function (err) {
|
lr.close();
|
||||||
|
}).on('close', function () {
|
||||||
|
store.default.dispatch('setPavementLoaded', true);
|
||||||
|
console.log("End");
|
||||||
|
cb(pavementLayerGroup);
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.error('no access!');
|
||||||
store.default.dispatch('setPavementLoaded', true);
|
store.default.dispatch('setPavementLoaded', true);
|
||||||
console.error(err);
|
return;
|
||||||
lr.close();
|
}
|
||||||
}).on('close', function () {
|
|
||||||
store.default.dispatch('setPavementLoaded', true);
|
|
||||||
console.log("End");
|
|
||||||
cb(pavementLayerGroup);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.debug = false;
|
module.exports.debug = false;
|
||||||
@ -328,24 +339,24 @@ var scanMethods = {
|
|||||||
// APTDAT 715 Segment
|
// APTDAT 715 Segment
|
||||||
10: (line, icao, layerGroup) => {
|
10: (line, icao, layerGroup) => {
|
||||||
if (module.exports.isScanning) {
|
if (module.exports.isScanning) {
|
||||||
var pointMiddle = new LatLonEllipsoidal(Number(line[1]), Number(line[2]));
|
var pointMiddle = new LatLonEllipsoidal(Number(line[1]), Number(line[2]));
|
||||||
var point1 = pointMiddle.destinationPoint(line[5]/6.562, line[4]);
|
var point1 = pointMiddle.destinationPoint(line[5] / 6.562, line[4]);
|
||||||
var point2 = pointMiddle.destinationPoint(line[5]/6.562, line[4]-180);
|
var point2 = pointMiddle.destinationPoint(line[5] / 6.562, line[4] - 180);
|
||||||
|
|
||||||
var runwayPoints = [];
|
var runwayPoints = [];
|
||||||
|
|
||||||
var bearing = point1.initialBearingTo(point2);
|
var bearing = point1.initialBearingTo(point2);
|
||||||
// Width in ft
|
// Width in ft
|
||||||
var runwayWidth = Number(line[8])/3.281;
|
var runwayWidth = Number(line[8]) / 3.281;
|
||||||
|
|
||||||
runwayPoints.push(point1.destinationPoint(runwayWidth / 2, (bearing + 90)));
|
runwayPoints.push(point1.destinationPoint(runwayWidth / 2, (bearing + 90)));
|
||||||
runwayPoints.push(point2.destinationPoint(runwayWidth / 2, (bearing + 90)));
|
runwayPoints.push(point2.destinationPoint(runwayWidth / 2, (bearing + 90)));
|
||||||
runwayPoints.push(point2.destinationPoint(runwayWidth / 2, (bearing - 90)));
|
runwayPoints.push(point2.destinationPoint(runwayWidth / 2, (bearing - 90)));
|
||||||
runwayPoints.push(point1.destinationPoint(runwayWidth / 2, (bearing - 90)));
|
runwayPoints.push(point1.destinationPoint(runwayWidth / 2, (bearing - 90)));
|
||||||
|
|
||||||
var runwayPoly = buildTaxiwayPoly(runwayPoints);
|
var runwayPoly = buildTaxiwayPoly(runwayPoints);
|
||||||
runwayPoly.addTo(layerGroup);
|
runwayPoly.addTo(layerGroup);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Runway
|
// Runway
|
||||||
100: (line, icao, layerGroup) => {
|
100: (line, icao, layerGroup) => {
|
||||||
@ -369,19 +380,19 @@ var scanMethods = {
|
|||||||
runwayPoly.addTo(layerGroup);
|
runwayPoly.addTo(layerGroup);
|
||||||
|
|
||||||
var displacedEnd1 = point1.destinationPoint(Number(line[20]), bearing)
|
var displacedEnd1 = point1.destinationPoint(Number(line[20]), bearing)
|
||||||
var displacedEnd2 = point2.destinationPoint(Number(line[20]), bearing-180)
|
var displacedEnd2 = point2.destinationPoint(Number(line[20]), bearing - 180)
|
||||||
|
|
||||||
var runwayLine = new L.Polyline([displacedEnd1, displacedEnd2]);
|
var runwayLine = new L.Polyline([displacedEnd1, displacedEnd2]);
|
||||||
runwayLine.setStyle({ color: 'yellow', stroke: true, dashArray: [50,50] });
|
runwayLine.setStyle({ color: 'yellow', stroke: true, dashArray: [50, 50] });
|
||||||
runwayLine.addTo(layerGroup);
|
runwayLine.addTo(layerGroup);
|
||||||
|
|
||||||
var t1 = new L.Polyline([displacedEnd1.destinationPoint(runwayWidth / 2, (bearing - 90)),
|
var t1 = new L.Polyline([displacedEnd1.destinationPoint(runwayWidth / 2, (bearing - 90)),
|
||||||
displacedEnd1.destinationPoint(runwayWidth / 2, (bearing + 90))]);
|
displacedEnd1.destinationPoint(runwayWidth / 2, (bearing + 90))]);
|
||||||
t1.setStyle({ color: 'yellow' });
|
t1.setStyle({ color: 'yellow' });
|
||||||
t1.addTo(layerGroup);
|
t1.addTo(layerGroup);
|
||||||
|
|
||||||
var t2 = new L.Polyline([displacedEnd2.destinationPoint(runwayWidth / 2, (bearing - 90)),
|
var t2 = new L.Polyline([displacedEnd2.destinationPoint(runwayWidth / 2, (bearing - 90)),
|
||||||
displacedEnd2.destinationPoint(runwayWidth / 2, (bearing + 90))]);
|
displacedEnd2.destinationPoint(runwayWidth / 2, (bearing + 90))]);
|
||||||
t2.setStyle({ color: 'yellow' });
|
t2.setStyle({ color: 'yellow' });
|
||||||
t2.addTo(layerGroup);
|
t2.addTo(layerGroup);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user