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 endPoint = [Number(line[1]), Number(line[2])];
|
||||
|
||||
if(module.exports.debug) {
|
||||
if (module.exports.debug) {
|
||||
L.polyline([startPoint, endPoint], { color: 'fuchsia' }).addTo(layerGroup);
|
||||
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.addTo(layerGroup);
|
||||
}
|
||||
}
|
||||
|
||||
var control = [Number(line[3]), Number(line[4])];
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
points = deCasteljau([
|
||||
@ -82,11 +82,11 @@ function bezier(line, icao, layerGroup, currentFeature) {
|
||||
if (module.exports.debug) {
|
||||
L.polyline([startPoint, exports.bezierPoint, controlReflected, endPoint], { color: 'purple' }).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);
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
@ -276,6 +276,12 @@ module.exports.readPavement = function (f, icao, cb) {
|
||||
|
||||
store.default.dispatch('setPavementLoaded', false);
|
||||
|
||||
if (!fs.existsSync(f)) {
|
||||
store.default.dispatch('setPavementLoaded', true);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
fs.accessSync(f, fs.constants.R_OK);
|
||||
lineReader.createInterface({
|
||||
input: fs.createReadStream(f).pipe(zlib.createGunzip())
|
||||
}).on('line', function (line) {
|
||||
@ -306,6 +312,11 @@ module.exports.readPavement = function (f, icao, cb) {
|
||||
console.log("End");
|
||||
cb(pavementLayerGroup);
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('no access!');
|
||||
store.default.dispatch('setPavementLoaded', true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.debug = false;
|
||||
@ -329,14 +340,14 @@ var scanMethods = {
|
||||
10: (line, icao, layerGroup) => {
|
||||
if (module.exports.isScanning) {
|
||||
var pointMiddle = new LatLonEllipsoidal(Number(line[1]), Number(line[2]));
|
||||
var point1 = pointMiddle.destinationPoint(line[5]/6.562, line[4]);
|
||||
var point2 = pointMiddle.destinationPoint(line[5]/6.562, line[4]-180);
|
||||
var point1 = pointMiddle.destinationPoint(line[5] / 6.562, line[4]);
|
||||
var point2 = pointMiddle.destinationPoint(line[5] / 6.562, line[4] - 180);
|
||||
|
||||
var runwayPoints = [];
|
||||
|
||||
var bearing = point1.initialBearingTo(point2);
|
||||
// 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(point2.destinationPoint(runwayWidth / 2, (bearing + 90)));
|
||||
@ -369,10 +380,10 @@ var scanMethods = {
|
||||
runwayPoly.addTo(layerGroup);
|
||||
|
||||
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]);
|
||||
runwayLine.setStyle({ color: 'yellow', stroke: true, dashArray: [50,50] });
|
||||
runwayLine.setStyle({ color: 'yellow', stroke: true, dashArray: [50, 50] });
|
||||
runwayLine.addTo(layerGroup);
|
||||
|
||||
var t1 = new L.Polyline([displacedEnd1.destinationPoint(runwayWidth / 2, (bearing - 90)),
|
||||
|
Loading…
Reference in New Issue
Block a user