This commit is contained in:
Generated
+14
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flightgear-airports",
|
||||
"version": "0.0.18",
|
||||
"version": "0.0.21",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -7706,6 +7706,11 @@
|
||||
"integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==",
|
||||
"dev": true
|
||||
},
|
||||
"esm": {
|
||||
"version": "3.2.25",
|
||||
"resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz",
|
||||
"integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA=="
|
||||
},
|
||||
"espree": {
|
||||
"version": "3.5.4",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
|
||||
@@ -17899,6 +17904,14 @@
|
||||
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
|
||||
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
|
||||
},
|
||||
"tiny-worker": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/tiny-worker/-/tiny-worker-2.3.0.tgz",
|
||||
"integrity": "sha512-pJ70wq5EAqTAEl9IkGzA+fN0836rycEuz2Cn6yeZ6FRzlVS5IDOkFHpIoEsksPRQV34GDqXm65+OlnZqUSyK2g==",
|
||||
"requires": {
|
||||
"esm": "^3.2.25"
|
||||
}
|
||||
},
|
||||
"tinyqueue": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-1.2.3.tgz",
|
||||
|
||||
+3
-1
@@ -18,6 +18,7 @@
|
||||
"pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
|
||||
"pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
|
||||
"test": "npm run unit && npm run e2e",
|
||||
"mocha": "SET NODE_ENV=mocha&& mocha test/mocha/**/*.js",
|
||||
"unit": "karma start test/unit/karma.conf.js",
|
||||
"postinstall": ""
|
||||
},
|
||||
@@ -106,6 +107,7 @@
|
||||
"lokijs": "^1.5.8",
|
||||
"mathjs": "^6.2.5",
|
||||
"path": "^0.12.7",
|
||||
"tiny-worker": "^2.3.0",
|
||||
"vue": "^2.5.16",
|
||||
"vue-electron": "^1.0.6",
|
||||
"vue-idb": "^0.2.0",
|
||||
@@ -134,7 +136,7 @@
|
||||
"babel-register": "^6.26.0",
|
||||
"babili-webpack-plugin": "^0.1.2",
|
||||
"cfonts": "^2.1.2",
|
||||
"chai": "^4.1.2",
|
||||
"chai": "^4.2.0",
|
||||
"chalk": "^2.4.1",
|
||||
"copy-webpack-plugin": "^4.5.1",
|
||||
"cross-env": "^5.1.6",
|
||||
|
||||
@@ -300,7 +300,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
console.log(o)
|
||||
//_latlngs[""0""].__vertex.glueindex
|
||||
var latLngs = o.getLatLngs().map(l => ({lat: l.lat, lng: l.lng, index: l.glueindex}));
|
||||
return { 'start': Number(o['begin']), 'end': Number(o['end']), '_leaflet_id': o._leaflet_id, 'type': 'poly', 'isPushBackRoute': o.options.attributes.isPushBackRoute, latLngs: latLngs };
|
||||
return { 'start': Number(o['begin']), 'end': Number(o['end']), '_leaflet_id': o._leaflet_id, 'type': 'poly', 'direction': o.options.attributes.direction, 'isPushBackRoute': o.options.attributes.isPushBackRoute, latLngs: latLngs };
|
||||
} else {
|
||||
console.log('Unknown Type ')
|
||||
console.log(typeof o)
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
} else if (o instanceof L.Polyline) {
|
||||
console.log(o)
|
||||
var latLngs = o.getLatLngs().map(l => ({lat: l.lat, lng: l.lng, index: l.attributes.index}));
|
||||
return { 'start': Number(o['begin']), 'end': Number(o['end']), '_leaflet_id': o._leaflet_id, 'type': 'poly', 'isPushBackRoute': o.options.attributes.isPushBackRoute, latLngs: latLngs };
|
||||
return { 'start': Number(o['begin']), 'end': Number(o['end']), '_leaflet_id': o._leaflet_id, 'type': 'poly', 'direction': o.options.attributes.direction, 'isPushBackRoute': o.options.attributes.isPushBackRoute, latLngs: latLngs };
|
||||
} else {
|
||||
console.log('Unknown Type ')
|
||||
console.log(typeof o)
|
||||
|
||||
+33
-15
@@ -8,9 +8,14 @@ const fs = require('fs');
|
||||
//debugger;
|
||||
var turf;
|
||||
|
||||
console.log(process.resourcesPath);
|
||||
|
||||
if(process.env.NODE_ENV === 'development') {
|
||||
importScripts('../../../node_modules/dijkstrajs/dijkstra.js');
|
||||
turf = require('./node_modules/@turf/turf');
|
||||
} else if (process.env.NODE_ENV === 'mocha') {
|
||||
importScripts('../../../node_modules/dijkstrajs/dijkstra.js');
|
||||
turf = require('../../../node_modules/@turf/turf')
|
||||
} else {
|
||||
importScripts('dijkstra.js');
|
||||
turf = require('@turf/turf')
|
||||
@@ -19,7 +24,7 @@ if(process.env.NODE_ENV === 'development') {
|
||||
const homedir = require('os').homedir();
|
||||
|
||||
importScripts('logger.js');
|
||||
importScripts('haversine.js');
|
||||
importScripts('haversine.js');
|
||||
|
||||
function errorReceiver(event) {
|
||||
throw event.data;
|
||||
@@ -66,6 +71,8 @@ async function checkGroundnet(data) {
|
||||
}
|
||||
});
|
||||
var graph = {};
|
||||
|
||||
console.log(parkings);
|
||||
parkings.forEach(element => {
|
||||
graph[element] = {};
|
||||
});
|
||||
@@ -74,26 +81,37 @@ async function checkGroundnet(data) {
|
||||
});
|
||||
var notOkNodes = [];
|
||||
|
||||
console.log(edges);
|
||||
if(edges===undefined) {
|
||||
resolve({});
|
||||
}
|
||||
edges.forEach(edge => {
|
||||
graph[edge.start] = {};
|
||||
graph[edge.end] = {};
|
||||
// Check if there are segments > 2km
|
||||
edge.latLngs.forEach((latLng, index, arr) => {
|
||||
if (index>0) {
|
||||
var d = distance([arr[index-1].lng, arr[index-1].lat], [latLng.lng, latLng.lat]);
|
||||
if(d>2000) {
|
||||
notOkNodes.push({ id: Number(arr[index-1].index), message: `Start of long route ${d.toFixed(2)}` });
|
||||
notOkNodes.push({ id: Number(arr[index].index), message: `End of long route ${d.toFixed(2)}` });
|
||||
}
|
||||
//console.log(d);
|
||||
}
|
||||
});
|
||||
if(edge.latLngs !== undefined) {
|
||||
// Check if there are segments > 2km
|
||||
edge.latLngs.forEach((latLng, index, arr) => {
|
||||
if (index>0) {
|
||||
var d = distance([arr[index-1].lng, arr[index-1].lat], [latLng.lng, latLng.lat]);
|
||||
if(d>2000) {
|
||||
notOkNodes.push({ id: Number(arr[index-1].index), message: `Start of long route ${d.toFixed(2)}` });
|
||||
notOkNodes.push({ id: Number(arr[index].index), message: `End of long route ${d.toFixed(2)}` });
|
||||
}
|
||||
//console.log(d);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
// Add edges to graph
|
||||
edges.forEach(element => {
|
||||
var node1 = graph[element.start];
|
||||
node1[Number(element.end)] = 1;
|
||||
var node2 = graph[element.end];
|
||||
node2[Number(element.start)] = 1;
|
||||
if( element.direction === 'bi-directional' || element.direction === 'forward') {
|
||||
node1[Number(element.end)] = 1;
|
||||
}
|
||||
if( element.direction === 'bi-directional' || element.direction === 'backward') {
|
||||
node2[Number(element.start)] = 1;
|
||||
}
|
||||
});
|
||||
var isLegitEnd = function(v) {
|
||||
if( Object.keys(graph[v]).length <= 1 ) {
|
||||
@@ -396,7 +414,7 @@ var mapEdges = function (o) {
|
||||
// debugger;
|
||||
return {
|
||||
start: o.start, end: o.end, isPushBackRoute: o.isPushBackRoute !== undefined &&
|
||||
o.isPushBackRoute !== 0, latLngs: o.latLngs
|
||||
o.isPushBackRoute !== 0, direction: o.direction, latLngs: o.latLngs
|
||||
};
|
||||
console.debug(o);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
'use strict'
|
||||
|
||||
// Set BABEL_ENV to use proper env config
|
||||
process.env.BABEL_ENV = 'test'
|
||||
|
||||
// Enable use of ES6+ on required files
|
||||
require('babel-register')({
|
||||
ignore: /node_modules/
|
||||
})
|
||||
|
||||
// Attach Chai APIs to global scope
|
||||
const { expect, should, assert } = require('chai')
|
||||
global.expect = expect
|
||||
global.should = should
|
||||
global.assert = assert
|
||||
|
||||
// Require all JS files in `./specs` for Mocha to consume
|
||||
require('require-dir')('./specs')
|
||||
@@ -0,0 +1,188 @@
|
||||
var assert = require('chai').assert;
|
||||
var Worker = require("tiny-worker");
|
||||
|
||||
process.chdir('src/renderer/utils');
|
||||
|
||||
describe("Test Check", function() {
|
||||
it("Not legitimate End", function(done) {
|
||||
var data = [
|
||||
{ 'start': 1, 'end': 2, '_leaflet_id': 1, 'type': 'poly', 'isPushBackRoute': true}
|
||||
];
|
||||
var worker = new Worker('check.js');
|
||||
worker.onmessage = function (e) {
|
||||
if (e.data === 'checkStarted') {
|
||||
} else if (e.data[0] === 'DONE') {
|
||||
console.log('DONE')
|
||||
worker.terminate()
|
||||
if(e.data[1].length===0) {
|
||||
done('Crashed')
|
||||
} else {
|
||||
console.log(e.data[1]);
|
||||
console.log(e.data[1].filter(m => m.id === 1));
|
||||
assert.lengthOf(e.data[1].filter(m => m.id === 1).filter(m => m.message=== 'Node not a legimate end'), 1);
|
||||
assert.lengthOf(e.data[1].filter(m => m.id === 2).filter(m => m.message=== 'Node not a legimate end'), 1);
|
||||
done()
|
||||
}
|
||||
} else if (e.data.length > 0) {
|
||||
}
|
||||
};
|
||||
worker.postMessage(['check', data]);
|
||||
});
|
||||
it("Legitimate End Runway", function(done) {
|
||||
var data = [
|
||||
{ 'start': 1, 'end': 2, '_leaflet_id': 1, 'type': 'poly', 'isPushBackRoute': true},
|
||||
{ 'index': 1, '_leaflet_id': 2, 'type': 'runway' }
|
||||
];
|
||||
var worker = new Worker('check.js');
|
||||
worker.onmessage = function (e) {
|
||||
if (e.data === 'checkStarted') {
|
||||
} else if (e.data[0] === 'DONE') {
|
||||
console.log('DONE')
|
||||
worker.terminate()
|
||||
if(e.data[1].length===0) {
|
||||
done('Crashed')
|
||||
} else {
|
||||
console.log(e.data[1]);
|
||||
console.log(e.data[1].filter(m => m.id === 1));
|
||||
assert.lengthOf(e.data[1].filter(m => m.id === 1).filter(m => m.message=== 'No way from runway to each parking'), 1);
|
||||
assert.lengthOf(e.data[1].filter(m => m.id === 2).filter(m => m.message=== 'Node not a legimate end'), 1);
|
||||
done()
|
||||
}
|
||||
} else if (e.data.length > 0) {
|
||||
}
|
||||
};
|
||||
worker.postMessage(['check', data]);
|
||||
});
|
||||
|
||||
it("From Parking to Runway bi-directional", function(done) {
|
||||
var data = [
|
||||
{ 'start': 1, 'end': 2, '_leaflet_id': 1, 'type': 'poly', 'isPushBackRoute': true, direction: 'bi-directional'},
|
||||
{ 'index': 1, '_leaflet_id': 2, 'type': 'runway' },
|
||||
{ 'index': 2, '_leaflet_id': 3, 'name': 'name', parkingType:'gate', 'type': 'parking' }
|
||||
];
|
||||
var worker = new Worker('check.js');
|
||||
worker.onmessage = function (e) {
|
||||
if (e.data === 'checkStarted') {
|
||||
} else if (e.data[0] === 'DONE') {
|
||||
console.log('DONE')
|
||||
worker.terminate()
|
||||
if(e.data[1].length===0) {
|
||||
done('Crashed')
|
||||
} else {
|
||||
console.log(e.data[1]);
|
||||
console.log(e.data[1].filter(m => m.id === 1));
|
||||
assert.lengthOf(e.data[1].filter(m => m.id === -1).filter(m => m.message=== 'Routes from runways OK'), 1);
|
||||
done()
|
||||
}
|
||||
} else if (e.data.length > 0) {
|
||||
}
|
||||
};
|
||||
worker.postMessage(['check', data]);
|
||||
});
|
||||
|
||||
it("From Parking to Runway forward OK", function(done) {
|
||||
var data = [
|
||||
{ 'start': 1, 'end': 2, '_leaflet_id': 1, 'type': 'poly', 'isPushBackRoute': true, direction: 'forward'},
|
||||
{ 'index': 1, '_leaflet_id': 3, 'name': 'name', parkingType:'gate', 'type': 'parking' },
|
||||
{ 'index': 2, '_leaflet_id': 2, 'type': 'runway' }
|
||||
];
|
||||
var worker = new Worker('check.js');
|
||||
worker.onmessage = function (e) {
|
||||
if (e.data === 'checkStarted') {
|
||||
} else if (e.data[0] === 'DONE') {
|
||||
console.log('DONE')
|
||||
worker.terminate()
|
||||
|
||||
if(e.data[1].length===0) {
|
||||
done('Crashed')
|
||||
} else {
|
||||
console.log(e.data[1]);
|
||||
console.log(e.data[1].filter(m => m.id === 1));
|
||||
assert.lengthOf(e.data[1].filter(m => m.id === -1).filter(m => m.message=== 'Routes from runways OK'), 1);
|
||||
done()
|
||||
}
|
||||
} else if (e.data.length > 0) {
|
||||
}
|
||||
};
|
||||
worker.postMessage(['check', data]);
|
||||
});
|
||||
|
||||
it("From Parking to Runway forward Not Ok", function(done) {
|
||||
var data = [
|
||||
{ 'start': 1, 'end': 2, '_leaflet_id': 1, 'type': 'poly', 'isPushBackRoute': true, direction: 'forward'},
|
||||
{ 'index': 2, '_leaflet_id': 3, 'name': 'name', parkingType:'gate', 'type': 'parking' },
|
||||
{ 'index': 1, '_leaflet_id': 2, 'type': 'runway' }
|
||||
];
|
||||
var worker = new Worker('check.js');
|
||||
worker.onmessage = function (e) {
|
||||
if (e.data === 'checkStarted') {
|
||||
} else if (e.data[0] === 'DONE') {
|
||||
console.log('DONE')
|
||||
worker.terminate()
|
||||
|
||||
if(e.data[1].length===0) {
|
||||
done('Crashed')
|
||||
} else {
|
||||
console.log(e.data[1]);
|
||||
console.log(e.data[1].filter(m => m.id === 1));
|
||||
assert.lengthOf(e.data[1].filter(m => m.id === -1).filter(m => m.message=== 'Routes from runways OK'), 0);
|
||||
done()
|
||||
}
|
||||
} else if (e.data.length > 0) {
|
||||
}
|
||||
};
|
||||
worker.postMessage(['check', data]);
|
||||
});
|
||||
|
||||
it("From Parking to Runway reverse OK", function(done) {
|
||||
var data = [
|
||||
{ 'start': 1, 'end': 2, '_leaflet_id': 1, 'type': 'poly', 'isPushBackRoute': true, direction: 'backward'},
|
||||
{ 'index': 2, '_leaflet_id': 3, 'name': 'name', parkingType:'gate', 'type': 'parking' },
|
||||
{ 'index': 1, '_leaflet_id': 2, 'type': 'runway' }
|
||||
];
|
||||
var worker = new Worker('check.js');
|
||||
worker.onmessage = function (e) {
|
||||
if (e.data === 'checkStarted') {
|
||||
} else if (e.data[0] === 'DONE') {
|
||||
console.log('DONE')
|
||||
worker.terminate()
|
||||
if(e.data[1].length===0) {
|
||||
done('Crashed')
|
||||
} else {
|
||||
console.log(e.data[1]);
|
||||
console.log(e.data[1].filter(m => m.id === 1));
|
||||
assert.lengthOf(e.data[1].filter(m => m.id === -1).filter(m => m.message=== 'Routes from runways OK'), 1);
|
||||
done()
|
||||
}
|
||||
} else if (e.data.length > 0) {
|
||||
}
|
||||
};
|
||||
worker.postMessage(['check', data]);
|
||||
});
|
||||
|
||||
it("From Parking to Runway reverse Not OK", function(done) {
|
||||
var data = [
|
||||
{ 'start': 1, 'end': 2, '_leaflet_id': 1, 'type': 'poly', 'isPushBackRoute': true, direction: 'backward'},
|
||||
{ 'index': 1, '_leaflet_id': 3, 'name': 'name', parkingType:'gate', 'type': 'parking' },
|
||||
{ 'index': 2, '_leaflet_id': 2, 'type': 'runway' }
|
||||
];
|
||||
var worker = new Worker('check.js');
|
||||
worker.onmessage = function (e) {
|
||||
if (e.data === 'checkStarted') {
|
||||
} else if (e.data[0] === 'DONE') {
|
||||
console.log('DONE')
|
||||
worker.terminate()
|
||||
if(e.data[1].length===0) {
|
||||
done('Crashed')
|
||||
} else {
|
||||
console.log(e.data[1]);
|
||||
console.log(e.data[1].filter(m => m.id === 1));
|
||||
assert.lengthOf(e.data[1].filter(m => m.id === -1).filter(m => m.message=== 'Routes from runways OK'), 0);
|
||||
done()
|
||||
}
|
||||
} else if (e.data.length > 0) {
|
||||
}
|
||||
};
|
||||
worker.postMessage(['check', data]);
|
||||
});
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
Vue.config.devtools = false
|
||||
Vue.config.productionTip = false
|
||||
|
||||
// require all test files (files that ends with .spec.js)
|
||||
const testsContext = require.context('./specs', true, /\.spec$/)
|
||||
testsContext.keys().forEach(testsContext)
|
||||
|
||||
// require all src files except main.js for coverage.
|
||||
// you can also change this to match only the subset of files that
|
||||
// you want coverage for.
|
||||
const srcContext = require.context('../../src/renderer', true, /^\.\/(?!main(\.js)?$)/)
|
||||
srcContext.keys().forEach(srcContext)
|
||||
@@ -1,62 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const path = require('path')
|
||||
const merge = require('webpack-merge')
|
||||
const webpack = require('webpack')
|
||||
|
||||
const baseConfig = require('../../.electron-vue/webpack.renderer.config')
|
||||
const projectRoot = path.resolve(__dirname, '../../src/renderer')
|
||||
|
||||
// Set BABEL_ENV to use proper preset config
|
||||
process.env.BABEL_ENV = 'test'
|
||||
|
||||
let webpackConfig = merge(baseConfig, {
|
||||
devtool: '#inline-source-map',
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': '"testing"'
|
||||
})
|
||||
]
|
||||
})
|
||||
|
||||
// don't treat dependencies as externals
|
||||
delete webpackConfig.entry
|
||||
delete webpackConfig.externals
|
||||
delete webpackConfig.output.libraryTarget
|
||||
|
||||
// apply vue option to apply isparta-loader on js
|
||||
webpackConfig.module.rules
|
||||
.find(rule => rule.use.loader === 'vue-loader').use.options.loaders.js = 'babel-loader'
|
||||
|
||||
module.exports = config => {
|
||||
config.set({
|
||||
browsers: ['visibleElectron'],
|
||||
client: {
|
||||
useIframe: false
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: './coverage',
|
||||
reporters: [
|
||||
{ type: 'lcov', subdir: '.' },
|
||||
{ type: 'text-summary' }
|
||||
]
|
||||
},
|
||||
customLaunchers: {
|
||||
'visibleElectron': {
|
||||
base: 'Electron',
|
||||
flags: ['--show']
|
||||
}
|
||||
},
|
||||
frameworks: ['mocha', 'chai'],
|
||||
files: ['./index.js'],
|
||||
preprocessors: {
|
||||
'./index.js': ['webpack', 'sourcemap']
|
||||
},
|
||||
reporters: ['spec', 'coverage'],
|
||||
singleRun: true,
|
||||
webpack: webpackConfig,
|
||||
webpackMiddleware: {
|
||||
noInfo: true
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import LandingPage from '@/components/LandingPage'
|
||||
|
||||
describe('LandingPage.vue', () => {
|
||||
it('should render correct contents', () => {
|
||||
const vm = new Vue({
|
||||
el: document.createElement('div'),
|
||||
render: h => h(LandingPage)
|
||||
}).$mount()
|
||||
|
||||
expect(vm.$el.querySelector('.title').textContent).to.contain('Welcome to your new project!')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user