Deleting nodes
This commit is contained in:
parent
79088be6f6
commit
da1509ae82
@ -138,9 +138,26 @@
|
||||
})
|
||||
},
|
||||
deleteFeature () {
|
||||
this.groundnetLayerGroup.eachLayer(l => {
|
||||
l.on('click', this.removeLayerClick)
|
||||
})
|
||||
switch (this.$store.state.Editable.type) {
|
||||
case 'node':
|
||||
this.removeNode(this.$store.state.Editable.index)
|
||||
}
|
||||
},
|
||||
removeNode (index) {
|
||||
this.featureLookup[index].forEach((element, i) => {
|
||||
if (element instanceof L.Polyline) {
|
||||
// element.latlngs.forEach();
|
||||
element._latlngs.forEach((e1, index1) => {
|
||||
console.log(e1);
|
||||
e1.__vertex.removeFrom(element.editor.editLayer);
|
||||
element._latlngs.splice(index1,1);
|
||||
if (element._latlngs.length==1) {
|
||||
this.featureLookup[index].splice(i,1);
|
||||
element.removeFrom(this.groundnetLayerGroup);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
drawPolyline () {
|
||||
var polyLine = this.$parent.mapObject.editTools.startPolyline()
|
||||
|
@ -47,6 +47,12 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
|
||||
this.follow(dragIndex, event);
|
||||
}
|
||||
});
|
||||
this.on('editable:vertex:clicked', function (event) {
|
||||
console.log(this.featureLookup[event.vertex.glueindex]);
|
||||
|
||||
store.default.dispatch('setNode', event.vertex.latlng.attributes)
|
||||
event.vertex._icon.style['background-color'] = 'red';
|
||||
});
|
||||
var dragIndex = -1;
|
||||
this.on('editable:vertex:dragstart', function (event) {
|
||||
console.log("Event Target : ", event.target);
|
||||
|
@ -39,13 +39,6 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
var end = mapEndNode(element);
|
||||
nodes[end['@index']] = end;
|
||||
});
|
||||
runwayNodes.forEach(element => {
|
||||
if (nodes[element['@index']] != undefined) {
|
||||
nodes[element['@index']]['@isOnRunway'] = "1";
|
||||
} else {
|
||||
nodes[element['@index']] = element;
|
||||
}
|
||||
});
|
||||
// New segments
|
||||
featureList.filter(o => o instanceof L.Polyline).filter(n => n).forEach(arcElement => {
|
||||
// element._latlngs.forEach(latlng => { nodes[latlng.__vertex.glueindex] = mapVertexNode(latlng) });
|
||||
@ -74,8 +67,13 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
startIndex = latlng.__vertex.glueindex;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
runwayNodes.forEach(element => {
|
||||
if (nodes[element['@index']] != undefined) {
|
||||
nodes[element['@index']]['@isOnRunway'] = "1";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// delete the parkings
|
||||
parkings.forEach(n => {
|
||||
@ -88,39 +86,6 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
|
||||
var maxId = uniqueNodes.slice(-1)[0]['@index'];
|
||||
|
||||
/*
|
||||
featureList.filter(o => o instanceof L.TaxiwaySegment).filter(n => n).forEach(element => {
|
||||
|
||||
if (element.getLatLngs().length > 2) {
|
||||
let middlePoints = element.getLatLngs().slice(1, -1);
|
||||
let startIndex = element.begin;
|
||||
middlePoints.forEach(latlng => {
|
||||
uniqueNodes.push({ '@index': String(++maxId), '@lat': convertLat(latlng), '@lon': convertLon(latlng) });
|
||||
arc = { '@begin': startIndex, '@end': String(maxId) };
|
||||
arcList.push(arc);
|
||||
arc = { '@begin': String(maxId), '@end': startIndex };
|
||||
arcList.push(arc);
|
||||
startIndex = maxId;
|
||||
});
|
||||
arc = { '@begin': String(startIndex), '@end': element.end };
|
||||
arcList.push(arc);
|
||||
arc = { '@begin': element.end, '@end': String(startIndex) };
|
||||
arcList.push(arc);
|
||||
console.log('We have a edited line');
|
||||
}
|
||||
else {
|
||||
arc = { '@begin': element.begin, '@end': element.end };
|
||||
arcList.push(arc);
|
||||
if (element.bidirectional) {
|
||||
arc = { '@begin': element.end, '@end': element.begin };
|
||||
arcList.push(arc);
|
||||
}
|
||||
}
|
||||
// <arc begin="0" end="161" isPushBackRoute="1" name="" />
|
||||
});
|
||||
|
||||
*/
|
||||
|
||||
var xmlObj = { groundnet: { version: 1, parkingList: { Parking: parkings }, TaxiNodes: { node: uniqueNodes }, TaxiWaySegments: { arc: arcList } } };
|
||||
|
||||
xmlString = builder.create(xmlObj).end({ pretty: true });
|
||||
|
Loading…
Reference in New Issue
Block a user