Bugfix geo-coordinate-parser

This commit is contained in:
portree_kid
2020-05-26 20:40:17 +02:00
parent 93d6328dea
commit 2a7c8a735f
6 changed files with 107 additions and 23 deletions
+2 -2
View File
@@ -25,12 +25,12 @@ script:
deploy:
skip_cleanup: true
overwrite: true
name: '0.0.11'
name: '0.0.12'
provider: releases
api_key:
secure: Xm3z86gQmpSajvlXSVgG7mxcaS5K7GfE4HrARIDR4pQ4UguQ3/fFOenRyKAQImmH0kLCSIbVE21NMAQ3YI2F9El9I6GU7Wirccsg14TZZiBQAzKOTXZ+JsBloeBxuTOsR84SkO6pV8OT/pRnQd9frqyc1W7wzoX+0sQykMztXCNfI+1MXXGOAgMzlKuDMO1PVENz0V63mWipL/Mae/SyrHa1Bws+4LJKvv42m0HMKdN7ekt41vxcSUvLmN+YLlqUEVr/eUhQXUNCaWlmM0KxmfuzTedca5/1yzLvN8smEt2I2b0DFRM3Mi/QdI22fVRHs6XGpm8yqZRKmhySDXFspXKWBiuCF6AezX6NiIe/ZUh10gIukjkyLtrNk/o29qhj2WE9HJz4xhsGMAx3632cLSMPku5ALN7jv5scWjwCGNHs4ZeZyyePMeGM6Y6pje1uJPbxWGjwoV6iI4Y4esP+z3KcXvZdnzkpYMy2mzdT4gf7A7zieax1YwB6U/MEanXYKFBH4yzYK9+hx3ck2eLT3LcV/ChHN2bKmERJdf18h+zI8e5YKTzd3/kHLiUUv19N2a4TUYloGOyzrLwn2VD1Xm4jJVVLTIQvWbH5YK7cNkHYa4+PnsB+JppSoby7HiBcothw4OLpJO8eCMqXcPRU1n+cRAZTB7VOS7pWh8e8LFE=
file_glob: true
file: build/*
on:
branches: '0.0.11'
branches: '0.0.12'
repo: Portree-Kid/flightgear-airports
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "flightgear-airports",
"version": "0.0.11",
"version": "0.0.12",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -9179,9 +9179,9 @@
}
},
"geo-coordinates-parser": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/geo-coordinates-parser/-/geo-coordinates-parser-1.2.3.tgz",
"integrity": "sha512-d5yj0zfkN4K2tIE877cg0lWofCo+JnWIjX2JMtBOMVgU76DrqEWgKuxZnp0L+hbSkmi1bot22M7a7Go5TNEVJg=="
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/geo-coordinates-parser/-/geo-coordinates-parser-1.2.4.tgz",
"integrity": "sha512-mh5bKpiXCv5jMebvvFyQ2bterTt1hPYP5QDxsih+EkczYZtg+8x9QFNrr53LxCdJv6jkpQ9gkzt2keyUuAEPbQ=="
},
"geodesy": {
"version": "2.2.0",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "flightgear-airports",
"version": "0.0.11",
"version": "0.0.12",
"author": "portree_kid <keith.paterson@gmx.de>",
"description": "An software to design Flightgear groundnets",
"license": "GPL v3",
@@ -78,7 +78,7 @@
"element-ui": "^2.13.2",
"file-url": "^3.0.0",
"fs": "0.0.1-security",
"geo-coordinates-parser": "^1.2.3",
"geo-coordinates-parser": "^1.2.4",
"geodesy": "^2.2.0",
"idb": "^4.0.5",
"jquery": "^3.4.1",
@@ -0,0 +1,93 @@
/* eslint-disable */
const fs = require('fs');
const path = require('path');
/**http://wiki.openstreetmap.org/wiki/Zoom_levels*/
var metersPerPixel = function (latitude, zoomLevel) {
var earthCircumference = 40075017;
var latitudeRadians = latitude * (Math.PI / 180);
return earthCircumference * Math.cos(latitudeRadians) / Math.pow(2, zoomLevel + 8);
};
var pixelValue = function (latitude, meters, zoomLevel) {
return meters / metersPerPixel(latitude, zoomLevel);
};
function stripSVG(fName) {
var rx = /<\s*svg[^>]*>([\s\S]*)<\s*\/svg[^>]*>/gm;
var svg = fs.readFileSync(path.join(__static, '/', fName), 'utf8');
var svg2 = rx.exec(svg);
return svg2[0];
}
const airLinerSVGs = {
A: stripSVG('FGA_ACT_A_GA.svg'),
B: stripSVG('FGA_ACT_B_PROP.svg'),
C: stripSVG('FGA_ACT_C.svg'),
D: stripSVG('FGA_ACT_D.svg'),
E: stripSVG('FGA_ACT_E.svg'),
F: stripSVG('FGA_ACT_F.svg')
};
L.ParkingAircraftMarker = L.Marker.extend({
options: {
zIndexOffset: 10000,
},
initialize: function (latlng, options) {
L.Marker.prototype.initialize(latlng, options);
L.Util.setOptions(this, options);
this.heading = options.heading;
this.updateIcon();
this.isDragging = false;
},
updateProperties: function(properties) {
this.heading = properties.heading;
this.updateIcon();
},
updateIcon : function() {
if(this._map !== undefined && this._map !== null) {
var metersPP = metersPerPixel(this._map.getCenter().lat, this._map.getZoom());
console.log(metersPP);
var scale = 0.07 / metersPP;
this.setIcon(L.divIcon({
iconSize: null,
className: 'aircraft-marker-icon',
html: `<div style=\'transform: translateX(-10px) translateY(-10px); height: 20px; width: 20px; border: 1px red\'>${airLinerSVG}</div>`,
}));
this.getElement().children.item(0).children.item(0).style = `transform: translateX(-200px) translateY(-200px) scale(${scale},${scale}) rotate(${(this.heading)-45}deg)`;
}
else {
this.setIcon(L.divIcon({
iconSize: null,
className: 'aircraft-marker-icon',
html: `<div style=\'transform: rotate(${this.heading}deg) scale(0.001,0.001) \'>${airLinerSVG}</div>`,
}));
}
},
onAdd : function(map) {
var metersPP = metersPerPixel(map.getCenter().lat, map.getZoom());
console.log(metersPP);
console.log(this);
this.updateIcon();
},
});
//Builds a marker for a ai or multiplayer aircraft
module.exports.default = function (latlng, options) {
return new L.ParkingAircraftMarker(latlng, options);
}
/*
var l1 = feature.properties.callsign,
l2 = feature.properties.heading + 'T ' + feature.properties.speed + 'KTAS ' +
formatFL(feature.geometry.coordinates[2]),
l3 = feature.properties.departureAirportId + ' -> ' + feature.properties.arrivalAirportId;
*/
+4 -13
View File
@@ -28,15 +28,6 @@ function addFrequencies (type, value) {
})
}
/**
* Hack to avoid https://github.com/ianengelbrecht/geo-coordinates-parser/issues/1
* @param {*} coordinate
*/
function cleanCoord(coordinate) {
return coordinate.replace('0.000', '0.001')
}
exports.addFeature = function (feature) {
featureLookup[feature.id] = new Array();
}
@@ -125,10 +116,10 @@ exports.readGroundnetXML = function (fDir, icao, force) {
//attrs.lat
//console.log(n.attr('lat') + " " + n.attr('lon'));
try {
var latlon = convert(cleanCoord(n.attr('lat')) + " " + cleanCoord(n.attr('lon')));
var latlon = convert(n.attr('lat') + " " + n.attr('lon'));
} catch (error) {
console.warn(n.attr('lat') + " " + n.attr('lon'));
convert(cleanCoord(n.attr('lat')) + " " + cleanCoord(n.attr('lon')));
convert(n.attr('lat') + " " + n.attr('lon'));
}
//console.log(latlon.decimalLatitude);
@@ -181,8 +172,8 @@ exports.readGroundnetXML = function (fDir, icao, force) {
});
}
if (!bidirectional) {
var beginlatlon = convert(cleanCoord(beginNode.attr('lat')) + " " + cleanCoord(beginNode.attr('lon')));
var endlatlon = convert(cleanCoord(endNode.attr('lat')) + " " + cleanCoord(endNode.attr('lon')));
var beginlatlon = convert(beginNode.attr('lat') + " " + beginNode.attr('lon'));
var endlatlon = convert(endNode.attr('lat') + " " + endNode.attr('lon'));
var polyline = new L.Polyline([[beginlatlon.decimalLatitude, beginlatlon.decimalLongitude], [endlatlon.decimalLatitude, endlatlon.decimalLongitude]], { attributes: {} }).addTo(layerGroup);
extendTaxiSegment(polyline);
polyline.addListeners();
+2 -2
View File
@@ -26,7 +26,7 @@ function stripSVG(fName) {
const airLinerSVG = stripSVG('Airplane_silhouette.svg');
const gaSVG = stripSVG('Black_aircraft_icon.svg');
L.AircraftMarker = L.Marker.extend({
L.ParkingAircraftMarker = L.Marker.extend({
options: {
zIndexOffset: 10000,
},
@@ -75,7 +75,7 @@ L.AircraftMarker = L.Marker.extend({
//Builds a marker for a ai or multiplayer aircraft
module.exports.default = function (latlng, options) {
return new L.AircraftMarker(latlng, options);
return new L.ParkingAircraftMarker(latlng, options);
}
/*