Box check
This commit is contained in:
parent
6de8d22381
commit
3416333b42
101
package-lock.json
generated
101
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flightgear-airports",
|
||||
"version": "0.0.12",
|
||||
"version": "0.0.16",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -667,6 +667,20 @@
|
||||
"@turf/helpers": "^5.1.5",
|
||||
"@turf/intersect": "^5.1.5",
|
||||
"@turf/invariant": "^5.1.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/intersect": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@turf/intersect/-/intersect-5.1.6.tgz",
|
||||
"integrity": "sha512-KXyNv/GXdoGAOy03qZF53rgtXC2tNhF/4jLwTKiVRrBQH6kcEpipGStdJ+QkYIlarQPa8f7I9UlVAB19et4MfQ==",
|
||||
"requires": {
|
||||
"@turf/clean-coords": "^5.1.5",
|
||||
"@turf/helpers": "^5.1.5",
|
||||
"@turf/invariant": "^5.1.5",
|
||||
"@turf/truncate": "^5.1.5",
|
||||
"turf-jsts": "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@turf/interpolate": {
|
||||
@ -688,15 +702,28 @@
|
||||
}
|
||||
},
|
||||
"@turf/intersect": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@turf/intersect/-/intersect-5.1.6.tgz",
|
||||
"integrity": "sha512-KXyNv/GXdoGAOy03qZF53rgtXC2tNhF/4jLwTKiVRrBQH6kcEpipGStdJ+QkYIlarQPa8f7I9UlVAB19et4MfQ==",
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@turf/intersect/-/intersect-6.1.3.tgz",
|
||||
"integrity": "sha512-SeAJG/zPRRTeyK2OifkPoyLq60q8tv8prpPIH3R8ZhyF4MdLOnMv5MURaQ6kQd+3UTDrL+pYm6rqbPvln1zqIw==",
|
||||
"requires": {
|
||||
"@turf/clean-coords": "^5.1.5",
|
||||
"@turf/helpers": "^5.1.5",
|
||||
"@turf/invariant": "^5.1.5",
|
||||
"@turf/truncate": "^5.1.5",
|
||||
"turf-jsts": "*"
|
||||
"@turf/helpers": "6.x",
|
||||
"@turf/invariant": "6.x",
|
||||
"martinez-polygon-clipping": "^0.4.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": {
|
||||
"version": "6.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@turf/helpers/-/helpers-6.1.4.tgz",
|
||||
"integrity": "sha512-vJvrdOZy1ngC7r3MDA7zIGSoIgyrkWcGnNIEaqn/APmw+bVLF2gAW7HIsdTxd12s5wQMqEpqIQrmrbRRZ0xC7g=="
|
||||
},
|
||||
"@turf/invariant": {
|
||||
"version": "6.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@turf/invariant/-/invariant-6.1.2.tgz",
|
||||
"integrity": "sha512-WU08Ph8j0J2jVGlQCKChXoCtI50BB3yEH21V++V0T4cR1T27HKCxkehV2sYMwTierfMBgjwSwDIsxnR4/2mWXg==",
|
||||
"requires": {
|
||||
"@turf/helpers": "6.x"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@turf/invariant": {
|
||||
@ -1259,6 +1286,20 @@
|
||||
"@turf/helpers": "^5.1.5",
|
||||
"@turf/intersect": "^5.1.5",
|
||||
"@turf/invariant": "^5.1.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/intersect": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@turf/intersect/-/intersect-5.1.6.tgz",
|
||||
"integrity": "sha512-KXyNv/GXdoGAOy03qZF53rgtXC2tNhF/4jLwTKiVRrBQH6kcEpipGStdJ+QkYIlarQPa8f7I9UlVAB19et4MfQ==",
|
||||
"requires": {
|
||||
"@turf/clean-coords": "^5.1.5",
|
||||
"@turf/helpers": "^5.1.5",
|
||||
"@turf/invariant": "^5.1.5",
|
||||
"@turf/truncate": "^5.1.5",
|
||||
"turf-jsts": "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@turf/standard-deviational-ellipse": {
|
||||
@ -1355,6 +1396,20 @@
|
||||
"@turf/helpers": "^5.1.5",
|
||||
"@turf/intersect": "^5.1.5",
|
||||
"@turf/invariant": "^5.1.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/intersect": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@turf/intersect/-/intersect-5.1.6.tgz",
|
||||
"integrity": "sha512-KXyNv/GXdoGAOy03qZF53rgtXC2tNhF/4jLwTKiVRrBQH6kcEpipGStdJ+QkYIlarQPa8f7I9UlVAB19et4MfQ==",
|
||||
"requires": {
|
||||
"@turf/clean-coords": "^5.1.5",
|
||||
"@turf/helpers": "^5.1.5",
|
||||
"@turf/invariant": "^5.1.5",
|
||||
"@turf/truncate": "^5.1.5",
|
||||
"turf-jsts": "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@turf/truncate": {
|
||||
@ -1471,6 +1526,20 @@
|
||||
"@turf/union": "5.1.x",
|
||||
"@turf/unkink-polygon": "5.1.x",
|
||||
"@turf/voronoi": "5.1.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/intersect": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@turf/intersect/-/intersect-5.1.6.tgz",
|
||||
"integrity": "sha512-KXyNv/GXdoGAOy03qZF53rgtXC2tNhF/4jLwTKiVRrBQH6kcEpipGStdJ+QkYIlarQPa8f7I9UlVAB19et4MfQ==",
|
||||
"requires": {
|
||||
"@turf/clean-coords": "^5.1.5",
|
||||
"@turf/helpers": "^5.1.5",
|
||||
"@turf/invariant": "^5.1.5",
|
||||
"@turf/truncate": "^5.1.5",
|
||||
"turf-jsts": "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"@turf/union": {
|
||||
@ -12301,6 +12370,15 @@
|
||||
"object-visit": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"martinez-polygon-clipping": {
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/martinez-polygon-clipping/-/martinez-polygon-clipping-0.4.3.tgz",
|
||||
"integrity": "sha512-3ZNS0ksKhWTLsmCUkNf+/UimndZ5U2cVOS0I+IjiwF+M23E77TmeOZSmbRJbfCoQUog/vcQ42s3DXrhgOhgPqw==",
|
||||
"requires": {
|
||||
"splaytree": "^0.1.4",
|
||||
"tinyqueue": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"math-expression-evaluator": {
|
||||
"version": "1.2.17",
|
||||
"resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz",
|
||||
@ -16824,6 +16902,11 @@
|
||||
"integrity": "sha1-mHbb0qFp0xFUAtSObqYynIgWpQ0=",
|
||||
"dev": true
|
||||
},
|
||||
"splaytree": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/splaytree/-/splaytree-0.1.4.tgz",
|
||||
"integrity": "sha512-D50hKrjZgBzqD3FT2Ek53f2dcDLAQT8SSGrzj3vidNH5ISRgceeGVJ2dQIthKOuayqFXfFjXheHNo4bbt9LhRQ=="
|
||||
},
|
||||
"split": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
|
||||
|
@ -42,8 +42,14 @@
|
||||
"filter": [
|
||||
"**/dijkstra.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"from": "node_modules/@turf",
|
||||
"to": "workers/node_modules/@turf",
|
||||
"filter": [
|
||||
"**"
|
||||
]
|
||||
}
|
||||
|
||||
],
|
||||
"files": [
|
||||
"dist/electron/**/*"
|
||||
@ -79,6 +85,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/intersect": "^6.1.3",
|
||||
"@turf/turf": "^5.1.6",
|
||||
"axios": "^0.18.1",
|
||||
"coordinate-parser": "^1.0.3",
|
||||
|
@ -242,6 +242,10 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
},
|
||||
featuresMapper(o) {
|
||||
if (o instanceof L.ParkingSpot) {
|
||||
/*
|
||||
if( o.box === undefined ) {
|
||||
debugger;
|
||||
} */
|
||||
return { 'index': Number(o['id']),
|
||||
'_leaflet_id': o._leaflet_id,
|
||||
'type': 'parking',
|
||||
@ -249,7 +253,9 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
'name': o.options.attributes.name,
|
||||
'radius': String(o.options.attributes.radius),
|
||||
'lat': o._latlng.lat,
|
||||
'lng': o._latlng.lng };
|
||||
'lng': o._latlng.lng,
|
||||
'box': o.box!==undefined?o.box.getLatLngs():null
|
||||
};
|
||||
} else if (o instanceof L.RunwayNode) {
|
||||
console.log(o)
|
||||
return { 'index': Number(o['glueindex']), '_leaflet_id': o._leaflet_id, 'type': 'runway' };
|
||||
|
@ -41,8 +41,11 @@ L.ParkingSpot = L.Circle.extend({
|
||||
this.frontWheel.addTo(this.editor.editLayer);
|
||||
this.updateWheelPos();
|
||||
this.updateBox();
|
||||
const parkingSize = validRadii.indexOf(this.options.attributes.radius);
|
||||
if(parkingSize>=0) {
|
||||
this.setStyle({ opacity: 0, fill: false });
|
||||
}
|
||||
}
|
||||
},
|
||||
updateMiddleMarker: function() {
|
||||
if (this.editEnabled()) {
|
||||
|
@ -5,11 +5,15 @@ const winURL = process.env.NODE_ENV === 'development'
|
||||
|
||||
var path = require('path');
|
||||
const fs = require('fs');
|
||||
//debugger;
|
||||
var turf;
|
||||
|
||||
if(process.env.NODE_ENV === 'development') {
|
||||
importScripts('../../../node_modules/dijkstrajs/dijkstra.js');
|
||||
turf = require('../../../../../@turf/turf');
|
||||
} else {
|
||||
importScripts('dijkstra.js');
|
||||
turf = require('@turf/turf')
|
||||
}
|
||||
|
||||
const homedir = require('os').homedir();
|
||||
@ -47,10 +51,19 @@ async function checkGroundnet(data) {
|
||||
var runwayNodes = data.map(mapRunwayNodes).filter(n => n !== undefined);
|
||||
var pushbackNodes = data.map(mapPushbackNodes).filter(n => n !== undefined);
|
||||
var edges = data.map(mapEdges).filter(n => n !== undefined);
|
||||
|
||||
this.max = 4 * parkings.length * runwayNodes.length +
|
||||
3 * parkings.length;
|
||||
this.postMessage(['max', this.max]);
|
||||
|
||||
var boxes = {};
|
||||
//debugger;
|
||||
data.forEach(element => {
|
||||
if(element.box!==undefined && element.box!==null) {
|
||||
boxes[element.index] = element.box[0].map(latlng => [latlng.lat, latlng.lng] );
|
||||
boxes[element.index].push(boxes[element.index][0]);
|
||||
}
|
||||
});
|
||||
var graph = {};
|
||||
parkings.forEach(element => {
|
||||
graph[element] = {};
|
||||
@ -87,7 +100,7 @@ async function checkGroundnet(data) {
|
||||
}
|
||||
return Object.keys(graph[v]).filter( v => runwayNodes[v]).length === 0;
|
||||
}
|
||||
debugger;
|
||||
//debugger;
|
||||
runwayNodes = runwayNodes.filter(
|
||||
(v, i) => isLegitEnd(v)
|
||||
);
|
||||
@ -220,10 +233,19 @@ async function checkGroundnet(data) {
|
||||
if (parkingNode.index !== parkingNode1.index) {
|
||||
var d = distance([parkingNode.lng, parkingNode.lat],
|
||||
[parkingNode1.lng, parkingNode1.lat]);
|
||||
if (d < parkingNode.radius + parkingNode1.radius) {
|
||||
if (d < parkingNode.radius + parkingNode1.radius + 10) {
|
||||
// If bigger circles intersect we should check the boxes
|
||||
//debugger;
|
||||
var poly1 = turf.polygon([boxes[parkingNode.index]]);
|
||||
|
||||
var poly2 = turf.polygon([boxes[parkingNode1.index]]);
|
||||
|
||||
var intersection = turf.intersect(poly1, poly2);
|
||||
if( intersection !== null ) {
|
||||
overlappingParkings.push({ id: parkingNode.index, message: 'Overlapping parkings' });
|
||||
}
|
||||
}
|
||||
}
|
||||
this.postMessage(['progress', 1]);
|
||||
});
|
||||
});
|
||||
@ -338,13 +360,19 @@ var mapParkingNode = function (o) {
|
||||
// debugger;
|
||||
if (o.type === 'parking')
|
||||
return { index: o.index, lat: o.lat, lng: o.lng, name: o.name, radius: Number(o.radius), type: o.type, parkingType: o.parkingType };
|
||||
console.log(o);
|
||||
console.debug(o);
|
||||
}
|
||||
|
||||
var mapBoxes = function (o) {
|
||||
// debugger;
|
||||
if (o.type === 'parking')
|
||||
return { index: o.index };
|
||||
}
|
||||
|
||||
var mapRunwayNodes = function (o) {
|
||||
if (o.type === 'runway')
|
||||
return o.index;
|
||||
console.log(o);
|
||||
console.debug(o);
|
||||
}
|
||||
|
||||
var mapEdges = function (o) {
|
||||
@ -354,5 +382,5 @@ var mapEdges = function (o) {
|
||||
start: o.start, end: o.end, isPushBackRoute: o.isPushBackRoute !== undefined &&
|
||||
o.isPushBackRoute !== 0, latLngs: o.latLngs
|
||||
};
|
||||
console.log(o);
|
||||
console.debug(o);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user