New maps in progress... (Fixed "delete arrows" with new data)

This commit is contained in:
Arturo Gonzalez 2016-03-30 12:45:47 +02:00
parent 07928af596
commit 3e399356d3
2 changed files with 20 additions and 3 deletions

View File

@ -293,6 +293,22 @@ MapController.prototype.get_edges_from_node = function(id_graph) {
return return_edges; return return_edges;
} }
/**
* Function update_edges_from_clean_arrows
* Return void
* This function updates the graph id of the edges
*/
MapController.prototype.update_edges_from_clean_arrows = function(clean_arrows) {
newEdges = [];
clean_arrows.forEach(function(arrow, index) {
newEdges[index] = [];
newEdges[index]['from'] = arrow['from']['graph_id'];
newEdges[index]['to'] = arrow['to']['graph_id'];
newEdges[index]['graph_id'] = arrow['graph_id'];
});
edges = newEdges;
}
/** /**
* Function get_arrow_from_id * Function get_arrow_from_id
* Return void * Return void

View File

@ -346,7 +346,6 @@ NetworkmapController.prototype.paint_arrows = function() {
var arrows_AA; var arrows_AA;
$.each(edges, function(i, edge) { $.each(edges, function(i, edge) {
var arrow_AA = self.get_arrow_AA(edge['to'], edge['from']); var arrow_AA = self.get_arrow_AA(edge['to'], edge['from']);
if (arrow_AA !== null) { if (arrow_AA !== null) {
if (!self.exists_arrow(clean_arrows, arrow_AA)) { if (!self.exists_arrow(clean_arrows, arrow_AA)) {
@ -371,6 +370,8 @@ NetworkmapController.prototype.paint_arrows = function() {
} }
}); });
MapController.prototype.update_edges_from_clean_arrows(clean_arrows);
var arrow_layouts = self._viewport.selectAll(".arrow") var arrow_layouts = self._viewport.selectAll(".arrow")
.data(clean_arrows) .data(clean_arrows)
.enter() .enter()