New maps in progress... (Document the code)

This commit is contained in:
Arturo Gonzalez 2016-03-22 12:48:28 +01:00
parent 62f4c058f4
commit ddbc922fad
2 changed files with 15 additions and 12 deletions

View File

@ -267,6 +267,11 @@ MapController.prototype.get_edges_from_node = function(id_graph) {
return return_edges; return return_edges;
} }
/**
* Function get_arrow_from_id
* Return void
* This function return an arrow from a specific id
*/
MapController.prototype.get_arrow_from_id = function(id) { MapController.prototype.get_arrow_from_id = function(id) {
var self = this; var self = this;
@ -288,6 +293,11 @@ MapController.prototype.get_arrow_from_id = function(id) {
} }
/**
* Function get_arrows_from_edges
* Return array[]
* This function returns a collection of arrows from edges (array)
*/
MapController.prototype.get_arrows_from_edges = function() { MapController.prototype.get_arrows_from_edges = function() {
var self = this; var self = this;
@ -777,9 +787,6 @@ MapController.prototype.paint_nodes = function() {
.attr("data-id", function(d) { return d['id'];}) .attr("data-id", function(d) { return d['id'];})
.attr("data-graph_id", function(d) { return d['graph_id'];}) .attr("data-graph_id", function(d) { return d['graph_id'];})
.attr("data-type", function(d) { return d['type'];}) .attr("data-type", function(d) { return d['type'];})
//~ .append("circle")
//~ .attr("style", "fill: rgb(50, 50, 128);")
//~ .attr("r", "15");
.append("rect") .append("rect")
.attr("style", "fill: rgb(50, 50, 128);") .attr("style", "fill: rgb(50, 50, 128);")
.attr("x", 0) .attr("x", 0)

View File

@ -232,6 +232,11 @@ NetworkmapController.prototype.get_arrows_AMA = function(id_to, id_from) {
} }
} }
/**
* Function get_arrow_AA
* Return array (arrow)
* This function returns an AA arrow
*/
NetworkmapController.prototype.get_arrow_AA = function(id_to, id_from) { NetworkmapController.prototype.get_arrow_AA = function(id_to, id_from) {
var self = this; var self = this;
var arrow_AA; var arrow_AA;
@ -284,7 +289,6 @@ NetworkmapController.prototype.exists_arrow = function(arrows, arrow) {
return true; // Continue return true; // Continue
} }
if (a['type'] == arrow['type']) { if (a['type'] == arrow['type']) {
var a_to = a['to']['graph_id']; var a_to = a['to']['graph_id'];
@ -357,8 +361,6 @@ NetworkmapController.prototype.paint_arrows = function() {
} }
}); });
console.log(clean_arrows);
//TO DO //TO DO
var arrow_layouts = self._viewport.selectAll(".arrow") var arrow_layouts = self._viewport.selectAll(".arrow")
.data(clean_arrows) .data(clean_arrows)
@ -387,7 +389,6 @@ NetworkmapController.prototype.paint_arrows = function() {
function create_arrow(arrow_layouts) { function create_arrow(arrow_layouts) {
arrow_layouts.each(function(d) { arrow_layouts.each(function(d) {
console.log(d['type']);
switch (d['type']) { switch (d['type']) {
case 'AA': case 'AA':
arrow_by_pieces(self._target + " svg", arrow_by_pieces(self._target + " svg",
@ -585,11 +586,6 @@ function arrow_by_pieces_AMMA(target, arrow_data, wait) {
/*---------------------------------------------*/ /*---------------------------------------------*/
/*-------- Resize the body arrow width --------*/ /*-------- Resize the body arrow width --------*/
/*---------------------------------------------*/ /*---------------------------------------------*/
//~ var arrow_head = arrow_layout.select(".head");
//~ var arrow_head_b = arrow_head.node().getBBox();
//~ var arrow_head_height = (arrow_head_b['height'] + arrow_head_b['y']);
//~ var arrow_head_width = (arrow_head_b['width'] + arrow_head_b['x']);
arrow_head_width = 0; //WIP arrow_head_width = 0; //WIP
var body_width = distance - arrow_head_width - radius_to - radius_from; var body_width = distance - arrow_head_width - radius_to - radius_from;