This commit is contained in:
parent
2ff284df5c
commit
939322471d
@ -56,7 +56,7 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
<el-popover
|
<el-popover
|
||||||
placement="top-start"
|
placement="top-start"
|
||||||
title="Description"
|
title="Description"
|
||||||
width="200"
|
width="50"
|
||||||
trigger="hover"
|
trigger="hover"
|
||||||
content="Edit"
|
content="Edit"
|
||||||
>
|
>
|
||||||
|
@ -5,7 +5,7 @@ var L = require('leaflet');
|
|||||||
const store = require('../store');
|
const store = require('../store');
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
|
|
||||||
exports.extendTaxiSegment = function (taxiwaySegment) {
|
const extendTaxiSegment = function (taxiwaySegment) {
|
||||||
taxiwaySegment.__proto__.begin;
|
taxiwaySegment.__proto__.begin;
|
||||||
taxiwaySegment.__proto__.end;
|
taxiwaySegment.__proto__.end;
|
||||||
taxiwaySegment.__proto__.bidirectional;
|
taxiwaySegment.__proto__.bidirectional;
|
||||||
@ -145,8 +145,12 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
|
|||||||
this.follow(dragIndex, event);
|
this.follow(dragIndex, event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.on('editable:middlemarker:mousedown', event => {
|
||||||
|
console.debug('editable:middlemarker:mousedown' + util.inspect(event));
|
||||||
|
} ),
|
||||||
this.on('editable:vertex:new', event => {
|
this.on('editable:vertex:new', event => {
|
||||||
console.debug('editable:vertex:new ' + util.inspect(event));
|
|
||||||
|
console.debug('editable:vertex:new ' + event.vertex.getIndex() + '\t' + event.vertex.getLastIndex() + '\t');
|
||||||
// Find nearest node
|
// Find nearest node
|
||||||
let closest = this.editLayer.closestLayerSnap(event.latlng, 5)
|
let closest = this.editLayer.closestLayerSnap(event.latlng, 5)
|
||||||
let taxiwaySegment = event.latlng.__vertex.editor.feature;
|
let taxiwaySegment = event.latlng.__vertex.editor.feature;
|
||||||
@ -154,39 +158,75 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
|
|||||||
taxiwaySegment.options.attributes = { direction: 'bi-directional' };
|
taxiwaySegment.options.attributes = { direction: 'bi-directional' };
|
||||||
}
|
}
|
||||||
taxiwaySegment.updateStyle();
|
taxiwaySegment.updateStyle();
|
||||||
// Glue to another node
|
if(event.vertex.getIndex() !== 0 && event.vertex.getIndex() !== event.vertex.getLastIndex()) {
|
||||||
if (closest) {
|
var nextIndex = ++taxiwaySegment.editLayer.groundnetLayerGroup.maxId;
|
||||||
event.latlng['glueindex'] = Number(closest.glueindex);
|
var splitOffNodes = taxiwaySegment.getLatLngs().splice(-1);
|
||||||
event.latlng.__vertex.setLatLng(closest.latlng);
|
var remainingNodes = taxiwaySegment.getLatLngs();
|
||||||
event.latlng.attributes = { index: event.latlng.glueindex, isOnRunway: 0 };
|
splitOffNodes.unshift(L.latLng(remainingNodes[1].lat, remainingNodes[1].lng, remainingNodes[1].alt));
|
||||||
// Push Vertex to lookup
|
remainingNodes[1]['glueindex'] = nextIndex;
|
||||||
this.editLayer.featureLookup[event.latlng.glueindex].push(event.latlng.__vertex);
|
remainingNodes[1].attributes = { index: nextIndex, isOnRunway: 0 };
|
||||||
if (taxiwaySegment.options.attributes.begin === undefined) {
|
taxiwaySegment.options.attributes.end = nextIndex;
|
||||||
taxiwaySegment.options.attributes.begin = event.latlng['glueindex']
|
splitOffNodes[0]['glueindex'] = nextIndex;
|
||||||
} else {
|
splitOffNodes[0].attributes = { index: nextIndex, isOnRunway: 0 };
|
||||||
taxiwaySegment.options.attributes.end = event.latlng['glueindex']
|
taxiwaySegment.setLatLngs(remainingNodes);
|
||||||
}
|
//taxiwaySegment.editor.refresh();
|
||||||
if (taxiwaySegment.getLatLngs().length === 1) {
|
|
||||||
taxiwaySegment.begin = closest.glueindex;
|
|
||||||
}
|
|
||||||
taxiwaySegment.end = closest.glueindex;
|
|
||||||
console.log(`Closest : ${closest}`)
|
|
||||||
} else {
|
|
||||||
event.vertex.latlng['glueindex'] = ++this.editLayer.groundnetLayerGroup.maxId;
|
|
||||||
event.vertex.latlng.attributes = { index: event.vertex.latlng.glueindex, isOnRunway: 0 };
|
|
||||||
this.editLayer.featureLookup[event.vertex.latlng.glueindex] = [];
|
|
||||||
this.editLayer.featureLookup[event.vertex.latlng.glueindex].push(event.vertex);
|
|
||||||
this.editLayer.featureLookup[event.vertex.latlng.glueindex].push(taxiwaySegment);
|
|
||||||
// taxiwaySegment.editor.refresh();
|
|
||||||
//taxiwaySegment.editor.reset();
|
//taxiwaySegment.editor.reset();
|
||||||
if (taxiwaySegment.options.attributes.begin === undefined) {
|
if( splitOffNodes.length>1) {
|
||||||
taxiwaySegment.options.attributes.begin = event.vertex.latlng['glueindex']
|
var polyline = new L.Polyline(splitOffNodes, { attributes: {} });
|
||||||
taxiwaySegment.begin = event.vertex.latlng.glueindex;
|
polyline.addTo(taxiwaySegment.editLayer.groundnetLayerGroup);
|
||||||
} else if (taxiwaySegment.options.attributes.end === undefined ||
|
extendTaxiSegment(polyline);
|
||||||
(taxiwaySegment.getLatLngs()[taxiwaySegment.getLatLngs().length - 1].glueindex &&
|
polyline.addListeners();
|
||||||
Number(taxiwaySegment.getLatLngs()[taxiwaySegment.getLatLngs().length - 1].glueindex) !== taxiwaySegment.options.attributes.end)) {
|
polyline.setEditlayer(taxiwaySegment.editLayer);
|
||||||
taxiwaySegment.options.attributes.end = event.vertex.latlng['glueindex']
|
polyline.enableEdit();
|
||||||
taxiwaySegment.end = Number(event.vertex.latlng.glueindex);
|
//polyline.editor.refresh();
|
||||||
|
//polyline.editor.reset();
|
||||||
|
polyline.featureLookup = this.featureLookup;
|
||||||
|
polyline.options.attributes.name = taxiwaySegment.options.attributes.name;
|
||||||
|
polyline.options.attributes.direction = taxiwaySegment.options.attributes.direction;
|
||||||
|
polyline.options.attributes.begin = nextIndex;
|
||||||
|
polyline.options.attributes.end = taxiwaySegment.end;
|
||||||
|
polyline.begin = nextIndex;
|
||||||
|
polyline.end = taxiwaySegment.end;
|
||||||
|
taxiwaySegment.end = nextIndex;
|
||||||
|
this.editLayer.featureLookup[nextIndex] = [];
|
||||||
|
this.featureLookup[nextIndex].push(taxiwaySegment);
|
||||||
|
this.featureLookup[nextIndex].push(polyline);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Glue to another node
|
||||||
|
if (closest) {
|
||||||
|
event.latlng['glueindex'] = Number(closest.glueindex);
|
||||||
|
event.latlng.__vertex.setLatLng(closest.latlng);
|
||||||
|
event.latlng.attributes = { index: event.latlng.glueindex, isOnRunway: 0 };
|
||||||
|
// Push Vertex to lookup
|
||||||
|
this.editLayer.featureLookup[event.latlng.glueindex].push(event.latlng.__vertex);
|
||||||
|
if (taxiwaySegment.options.attributes.begin === undefined) {
|
||||||
|
taxiwaySegment.options.attributes.begin = event.latlng['glueindex']
|
||||||
|
} else {
|
||||||
|
taxiwaySegment.options.attributes.end = event.latlng['glueindex']
|
||||||
|
}
|
||||||
|
if (taxiwaySegment.getLatLngs().length === 1) {
|
||||||
|
taxiwaySegment.begin = closest.glueindex;
|
||||||
|
}
|
||||||
|
taxiwaySegment.end = closest.glueindex;
|
||||||
|
console.log(`Closest : ${closest}`)
|
||||||
|
} else {
|
||||||
|
event.vertex.latlng['glueindex'] = ++this.editLayer.groundnetLayerGroup.maxId;
|
||||||
|
event.vertex.latlng.attributes = { index: event.vertex.latlng.glueindex, isOnRunway: 0 };
|
||||||
|
this.editLayer.featureLookup[event.vertex.latlng.glueindex] = [];
|
||||||
|
this.editLayer.featureLookup[event.vertex.latlng.glueindex].push(event.vertex);
|
||||||
|
this.editLayer.featureLookup[event.vertex.latlng.glueindex].push(taxiwaySegment);
|
||||||
|
// taxiwaySegment.editor.refresh();
|
||||||
|
//taxiwaySegment.editor.reset();
|
||||||
|
if (taxiwaySegment.options.attributes.begin === undefined) {
|
||||||
|
taxiwaySegment.options.attributes.begin = event.vertex.latlng['glueindex']
|
||||||
|
taxiwaySegment.begin = event.vertex.latlng.glueindex;
|
||||||
|
} else if (taxiwaySegment.options.attributes.end === undefined ||
|
||||||
|
(taxiwaySegment.getLatLngs()[taxiwaySegment.getLatLngs().length - 1].glueindex &&
|
||||||
|
Number(taxiwaySegment.getLatLngs()[taxiwaySegment.getLatLngs().length - 1].glueindex) !== taxiwaySegment.options.attributes.end)) {
|
||||||
|
taxiwaySegment.options.attributes.end = event.vertex.latlng['glueindex']
|
||||||
|
taxiwaySegment.end = Number(event.vertex.latlng.glueindex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//this.splitShape(taxiwaySegment.getLatLngs(), )
|
//this.splitShape(taxiwaySegment.getLatLngs(), )
|
||||||
@ -253,38 +293,41 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
|
|||||||
});
|
});
|
||||||
this.on('editable:vertex:dragend', function (event) {
|
this.on('editable:vertex:dragend', function (event) {
|
||||||
console.log("Dragend : ", event.vertex);
|
console.log("Dragend : ", event.vertex);
|
||||||
if (dragIndex > 0) {
|
try {
|
||||||
event.target.featureLookup[dragIndex].forEach(element => {
|
if (dragIndex > 0) {
|
||||||
if (element instanceof L.ParkingSpot) {
|
event.target.featureLookup[dragIndex].forEach(element => {
|
||||||
//element.setLatLng(event);
|
if (element instanceof L.ParkingSpot) {
|
||||||
console.log(element);
|
//element.setLatLng(event);
|
||||||
}
|
console.log(element);
|
||||||
});
|
}
|
||||||
}
|
|
||||||
dragIndex = -1;
|
|
||||||
var parking = this.featureLookup[event.vertex.latlng.glueindex].filter(n => n instanceof L.ParkingSpot);
|
|
||||||
if (parking.length > 0) {
|
|
||||||
parking[0].selectParking();
|
|
||||||
} else {
|
|
||||||
if( Number(event.vertex.latlng.glueindex) !== store.default.state.Editable.index) {
|
|
||||||
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 => {
|
|
||||||
if(element.deselect !== undefined) {
|
|
||||||
element.deselect();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
store.default.dispatch('setNode', event.vertex.latlng)
|
|
||||||
}
|
|
||||||
var lines = this.featureLookup[event.vertex.latlng.glueindex].filter(n => n instanceof L.Polyline);
|
|
||||||
Vue.default.nextTick(function () {
|
|
||||||
lines.forEach( line => {
|
|
||||||
line.selectVertex(store.default.state.Editable.index)
|
|
||||||
});
|
});
|
||||||
})
|
}
|
||||||
|
dragIndex = -1;
|
||||||
|
var parking = this.featureLookup[event.vertex.latlng.glueindex].filter(n => n instanceof L.ParkingSpot);
|
||||||
|
if (parking.length > 0) {
|
||||||
|
parking[0].selectParking();
|
||||||
|
} else {
|
||||||
|
if( Number(event.vertex.latlng.glueindex) !== store.default.state.Editable.index) {
|
||||||
|
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 => {
|
||||||
|
if(element.deselect !== undefined) {
|
||||||
|
element.deselect();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
store.default.dispatch('setNode', event.vertex.latlng)
|
||||||
|
}
|
||||||
|
var lines = this.featureLookup[event.vertex.latlng.glueindex].filter(n => n instanceof L.Polyline);
|
||||||
|
Vue.default.nextTick(function () {
|
||||||
|
lines.forEach( line => {
|
||||||
|
line.selectVertex(store.default.state.Editable.index)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -365,3 +408,5 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.extendTaxiSegment = extendTaxiSegment;
|
@ -85,8 +85,12 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
|||||||
// Loaded segments
|
// Loaded segments
|
||||||
featureList.filter(o => o instanceof L.TaxiwaySegment).filter(n => n).forEach(element => {
|
featureList.filter(o => o instanceof L.TaxiwaySegment).filter(n => n).forEach(element => {
|
||||||
var begin = mapBeginNode(element);
|
var begin = mapBeginNode(element);
|
||||||
|
if(begin['@index']==="")
|
||||||
|
console.warn("Begin missing");
|
||||||
nodes[begin['@index']] = begin;
|
nodes[begin['@index']] = begin;
|
||||||
var end = mapEndNode(element);
|
var end = mapEndNode(element);
|
||||||
|
if(end['@index']==="")
|
||||||
|
console.warn("End missing");
|
||||||
nodes[end['@index']] = end;
|
nodes[end['@index']] = end;
|
||||||
});
|
});
|
||||||
// New segments
|
// New segments
|
||||||
@ -117,8 +121,13 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
|||||||
arcList.push(arc);
|
arcList.push(arc);
|
||||||
featureLookup[latlng.glueindex][startIndex] = arc;
|
featureLookup[latlng.glueindex][startIndex] = arc;
|
||||||
}
|
}
|
||||||
|
if (currentArc.direction === '' || !currentArc.direction) {
|
||||||
|
console.error( "Arc without direction " + util.inspect(currentArc) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
startIndex = latlng.glueindex;
|
startIndex = latlng.glueindex;
|
||||||
|
} else {
|
||||||
|
console.error( "LatLng without glueindex " + util.inspect(latlng) );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -241,7 +250,7 @@ var mapVertexNode = function (l) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var convertLat = function (latlng) {
|
var convertLat = function (latlng) {
|
||||||
console.debug(latlng.lat);
|
//console.debug(latlng.lat);
|
||||||
var NS = latlng.lat > 0 ? 'N' : 'S';
|
var NS = latlng.lat > 0 ? 'N' : 'S';
|
||||||
var deg = mathjs.floor(mathjs.abs(latlng.lat));
|
var deg = mathjs.floor(mathjs.abs(latlng.lat));
|
||||||
var min = (mathjs.abs(latlng.lat) - deg) * 60;
|
var min = (mathjs.abs(latlng.lat) - deg) * 60;
|
||||||
@ -250,7 +259,7 @@ var convertLat = function (latlng) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var convertLon = function (latlng) {
|
var convertLon = function (latlng) {
|
||||||
console.debug(latlng.lng);
|
//console.debug(latlng.lng);
|
||||||
var NS = latlng.lng > 0 ? 'E' : 'W';
|
var NS = latlng.lng > 0 ? 'E' : 'W';
|
||||||
var deg = mathjs.floor(mathjs.abs(latlng.lng));
|
var deg = mathjs.floor(mathjs.abs(latlng.lng));
|
||||||
var min = (mathjs.abs(latlng.lng) - deg) * 60;
|
var min = (mathjs.abs(latlng.lng) - deg) * 60;
|
||||||
@ -259,7 +268,7 @@ var convertLon = function (latlng) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var styleArc = function (attributes, arc) {
|
var styleArc = function (attributes, arc) {
|
||||||
console.debug(attributes);
|
//console.debug(attributes);
|
||||||
if(attributes !== undefined){
|
if(attributes !== undefined){
|
||||||
if (attributes.isPushBackRoute !== undefined && Number(attributes.isPushBackRoute) === 1 ) {
|
if (attributes.isPushBackRoute !== undefined && Number(attributes.isPushBackRoute) === 1 ) {
|
||||||
arc['@isPushBackRoute'] = "1";
|
arc['@isPushBackRoute'] = "1";
|
||||||
|
Loading…
Reference in New Issue
Block a user