Check for parking type
This commit is contained in:
parent
bd7530a9a1
commit
33421e5aab
@ -223,6 +223,7 @@
|
||||
return { 'index': Number(o['id']),
|
||||
'_leaflet_id': o._leaflet_id,
|
||||
'type': 'parking',
|
||||
'parkingType': o.options.attributes.type,
|
||||
'name': o.options.attributes.name,
|
||||
'radius': String(o.options.attributes.radius),
|
||||
'lat': o._latlng.lat,
|
||||
|
@ -103,6 +103,7 @@
|
||||
return { 'index': Number(o['id']),
|
||||
'_leaflet_id': o._leaflet_id,
|
||||
'type': 'parking',
|
||||
'parkingType': o.options.attributes.type,
|
||||
'name': o.options.attributes.name,
|
||||
'radius': String(o.options.attributes.radius),
|
||||
'lat': o._latlng.lat,
|
||||
|
@ -117,6 +117,8 @@ L.ParkingSpot = L.Circle.extend({
|
||||
}
|
||||
},
|
||||
select() {
|
||||
store.default.dispatch('setParking', this.options.attributes);
|
||||
store.default.dispatch('setParkingCoords', this.getLatLng().lat.toFixed(5) + ' ' + this.getLatLng().lng.toFixed(5));
|
||||
var style = {};
|
||||
style['color'] = 'red';
|
||||
this.setStyle(style);
|
||||
@ -176,8 +178,6 @@ L.ParkingSpot = L.Circle.extend({
|
||||
}
|
||||
});
|
||||
}
|
||||
store.default.dispatch('setParking', event.target.options.attributes);
|
||||
store.default.dispatch('setParkingCoords', event.target.getLatLng().lat.toFixed(5) + ' ' + event.target.getLatLng().lng.toFixed(5));
|
||||
this.select();
|
||||
});
|
||||
this.on('editable:vertex:clicked', function (event) {
|
||||
|
@ -73,26 +73,29 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
|
||||
this.options.attributes.selected = false;
|
||||
this.updateStyle();
|
||||
this.getLatLngs().forEach( element => {
|
||||
if (element.__vertex._icon != null) {
|
||||
element.__vertex._icon.style['background-color'] = 'white';
|
||||
} else if (element.vertex.icon != null) {
|
||||
if (element.__vertex.icon.style != null) {
|
||||
element.__vertex.icon.style['background-color'] = 'white';
|
||||
} else {
|
||||
element.__vertex.setStyle({ color: 'white' })
|
||||
}
|
||||
} else if (element.__vertex.options.icon != null) {
|
||||
if (element.__vertex.options.icon.style != null) {
|
||||
element.__vertex.options.icon.style['background-color'] = 'white';
|
||||
} else {
|
||||
element.__vertex.options.icon._setIconStyles({ color: 'white' })
|
||||
}
|
||||
}
|
||||
if (element.__vertex!==undefined) {
|
||||
if (element.__vertex._icon != null) {
|
||||
element.__vertex._icon.style['background-color'] = 'white';
|
||||
} else if (element.__vertex.icon != null) {
|
||||
if (element.__vertex.icon.style != null) {
|
||||
element.__vertex.icon.style['background-color'] = 'white';
|
||||
} else {
|
||||
element.__vertex.setStyle({ color: 'white' })
|
||||
}
|
||||
} else if (element.__vertex.options.icon != null) {
|
||||
if (element.__vertex.options.icon.style != null) {
|
||||
element.__vertex.options.icon.style['background-color'] = 'white';
|
||||
} else {
|
||||
element.__vertex.options.icon._setIconStyles({ color: 'white' })
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
taxiwaySegment.__proto__.addListeners = function () {
|
||||
this.on('click', function (event) {
|
||||
if (Number(store.default.state.Editable.index) >= 0) {
|
||||
if (Number(store.default.state.Editable.index) >= 0 &&
|
||||
this.featureLookup[store.default.state.Editable.index] !== undefined) {
|
||||
this.featureLookup[store.default.state.Editable.index].forEach(element => {
|
||||
element.deselect();
|
||||
});
|
||||
@ -286,14 +289,17 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
|
||||
style.color = '#3388ff';
|
||||
}
|
||||
this.setStyle(style);
|
||||
if (this.options.attributes.direction === 'forward') {
|
||||
this.setText(null);
|
||||
this.setText(' ⮞ ', { repeat: true, attributes: { fill: 'red', size: 30 } })
|
||||
} else if (this.options.attributes.direction === 'backward') {
|
||||
this.setText(null);
|
||||
this.setText(' ⮜ ', { repeat: true, attributes: { fill: 'red', size: 30 } })
|
||||
} else {
|
||||
this.setText(null);
|
||||
}
|
||||
if(this._map !== null) {
|
||||
if (this.options.attributes.direction === 'forward') {
|
||||
this.setText(null);
|
||||
this.setText(' ⮞ ', { repeat: true, attributes: { fill: 'red', size: 30 } })
|
||||
} else if (this.options.attributes.direction === 'backward') {
|
||||
this.setText(null);
|
||||
this.setText(' ⮜ ', { repeat: true, attributes: { fill: 'red', size: 30 } })
|
||||
} else {
|
||||
this.setText(null);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -6,7 +6,11 @@ const winURL = process.env.NODE_ENV === 'development'
|
||||
var path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
importScripts('dijkstra.js');
|
||||
if(process.env.NODE_ENV === 'development') {
|
||||
importScripts('../../../node_modules/dijkstrajs/dijkstra.js');
|
||||
} else {
|
||||
importScripts('dijkstra.js');
|
||||
}
|
||||
|
||||
const homedir = require('os').homedir();
|
||||
|
||||
@ -136,7 +140,6 @@ async function checkGroundnet(data) {
|
||||
);
|
||||
|
||||
|
||||
|
||||
okNodes = okNodes.filter((v, i) => okNodes.indexOf(v) === i);
|
||||
var notOkNodesParkings = parkings.filter(
|
||||
(v, i) => okNodes.indexOf(v) < 0
|
||||
@ -165,21 +168,10 @@ async function checkGroundnet(data) {
|
||||
).map(
|
||||
v => { return { id: Number(v[0]), message: 'Node not a legimate end' } }
|
||||
);
|
||||
notOkNodes = notOkNodes.concat(danglingEnds);
|
||||
notOkNodes = notOkNodes.concat(notOkNodesParkings);
|
||||
notOkNodes = notOkNodes.concat(notOkNodesRunways);
|
||||
|
||||
// Ends that are not on Runway and not a Parking or Pushback
|
||||
/*var wrongPushbackEnds = pushbackNodes.filter(
|
||||
(v, i) => allEnds.map(a => Number(a[0])).indexOf(Number(v)) < 0
|
||||
).map(
|
||||
v => { return { id: Number(v), message: 'Pushback node not an end' } }
|
||||
);
|
||||
notOkNodes = notOkNodes.concat(wrongPushbackEnds)*/
|
||||
notOkNodes = notOkNodes.concat(wrongPushbackRoutes);
|
||||
|
||||
var parkingNodes = data.map(mapParkingNode).filter(n => n !== undefined);
|
||||
|
||||
var overlappingParkings = [];
|
||||
// Check for intersecting radii
|
||||
parkingNodes.forEach(parkingNode => {
|
||||
parkingNodes.forEach(parkingNode1 => {
|
||||
@ -188,30 +180,30 @@ async function checkGroundnet(data) {
|
||||
var d = distance([parkingNode.lng, parkingNode.lat],
|
||||
[parkingNode1.lng, parkingNode1.lat]);
|
||||
if (d < parkingNode.radius + parkingNode1.radius) {
|
||||
notOkNodes.push({ id: parkingNode.index, message: 'Overlapping parkings' });
|
||||
overlappingParkings.push({ id: parkingNode.index, message: 'Overlapping parkings' });
|
||||
}
|
||||
}
|
||||
this.postMessage(['progress', 1]);
|
||||
});
|
||||
});
|
||||
// Check for name
|
||||
parkingNodes.forEach(parkingNode => {
|
||||
if (!parkingNode.name) {
|
||||
notOkNodes.push({ id: parkingNode.index, message: 'Name empty' });
|
||||
this.postMessage(['progress', 1]);
|
||||
}
|
||||
if (!parkingNode.type) {
|
||||
notOkNodes.push({ id: parkingNode.index, message: 'Parking type empty' });
|
||||
this.postMessage(['progress', 1]);
|
||||
}
|
||||
});
|
||||
var invalidParkings = [];
|
||||
// Check for name
|
||||
parkingNodes.forEach(parkingNode => {
|
||||
if (!parkingNode.name || /^\s*$/.test(parkingNode.name)) {
|
||||
notOkNodes.push({ id: parkingNode.index, message: 'Empty name' });
|
||||
invalidParkings.push({ id: parkingNode.index, message: 'Name empty' });
|
||||
this.postMessage(['progress', 1]);
|
||||
}
|
||||
if (!parkingNode.type) {
|
||||
invalidParkings.push({ id: parkingNode.index, message: 'Parking type empty' });
|
||||
this.postMessage(['progress', 1]);
|
||||
}
|
||||
if (['ga','cargo', 'gate', 'mil-fighter', 'mil-cargo' ].indexOf(parkingNode.parkingType)<0) {
|
||||
//debugger;
|
||||
invalidParkings.push({ id: parkingNode.index, message: `Parking type ${parkingNode.parkingType} not valid` });
|
||||
this.postMessage(['progress', 1]);
|
||||
}
|
||||
this.postMessage(['progress', 1]);
|
||||
});
|
||||
|
||||
//Check for dual pushback/runway nodes
|
||||
runwayNodes.forEach(runwayNode => {
|
||||
if (pushbackNodes.indexOf(runwayNode) >= 0) {
|
||||
@ -219,6 +211,12 @@ async function checkGroundnet(data) {
|
||||
}
|
||||
});
|
||||
|
||||
notOkNodes = notOkNodes.concat(invalidParkings);
|
||||
notOkNodes = notOkNodes.concat(overlappingParkings);
|
||||
notOkNodes = notOkNodes.concat(danglingEnds);
|
||||
notOkNodes = notOkNodes.concat(notOkNodesParkings);
|
||||
notOkNodes = notOkNodes.concat(notOkNodesRunways);
|
||||
notOkNodes = notOkNodes.concat(wrongPushbackRoutes);
|
||||
// check1(graph);
|
||||
// check2();
|
||||
// this.postMessage(['progress', 1]);
|
||||
@ -278,8 +276,9 @@ var mapParkings = function (o) {
|
||||
}
|
||||
|
||||
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 };
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user