New maps in progress... (Document the code)
This commit is contained in:
parent
4f4f8538a4
commit
2e04732f75
|
@ -214,6 +214,11 @@ MapController.prototype.minimap_get_size = function() {
|
|||
return minimap_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function get_node
|
||||
* Return node
|
||||
* This function returns a node
|
||||
*/
|
||||
MapController.prototype.get_node = function(id_graph) {
|
||||
var return_node = null;
|
||||
|
||||
|
@ -227,6 +232,11 @@ MapController.prototype.get_node = function(id_graph) {
|
|||
return return_node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function get_node_type
|
||||
* Return node type
|
||||
* This function returns a node type (module, agent or edge)
|
||||
*/
|
||||
MapController.prototype.get_node_type = function(id_graph) {
|
||||
var self = this;
|
||||
|
||||
|
@ -239,6 +249,11 @@ MapController.prototype.get_node_type = function(id_graph) {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function get_edges_from_node
|
||||
* Return array[edge]
|
||||
* This function returns the edges of a node
|
||||
*/
|
||||
MapController.prototype.get_edges_from_node = function(id_graph) {
|
||||
var edges = [];
|
||||
|
||||
|
@ -264,7 +279,6 @@ MapController.prototype.get_arrow = function(id_to, id_from) {
|
|||
|
||||
var i = 0;
|
||||
$.each(nodes, function(i, node) {
|
||||
|
||||
if (node['graph_id'] == id_to) {
|
||||
|
||||
arrow['nodes']['to'] = node;
|
||||
|
@ -278,7 +292,6 @@ MapController.prototype.get_arrow = function(id_to, id_from) {
|
|||
});
|
||||
|
||||
if (i == 2) {
|
||||
|
||||
$.each(arrows, function(i, arrow) {
|
||||
if (arrow['to'] == arrow['nodes']['to'] &&
|
||||
arrow['from'] == arrow['nodes']['from']) {
|
||||
|
@ -465,9 +478,7 @@ MapController.prototype.paint_minimap = function() {
|
|||
var map_size = d3.select(self._target + " .viewport").node().getBBox();
|
||||
|
||||
var minimap_map_width = (map_size.width + map_size.x) / RELATION_MINIMAP;
|
||||
//~ var minimap_map_width = (map_size.width) / RELATION_MINIMAP;
|
||||
var minimap_map_height = (map_size.height + map_size.y) / RELATION_MINIMAP;
|
||||
//~ var minimap_map_height = (map_size.height) / RELATION_MINIMAP;
|
||||
|
||||
var minimap = d3.select(self._target + " .minimap");
|
||||
var svg = d3.select(self._target + " svg");
|
||||
|
@ -508,9 +519,6 @@ MapController.prototype.paint_minimap = function() {
|
|||
.attr("class", "map")
|
||||
.attr("transform", transform.toString());
|
||||
|
||||
|
||||
|
||||
|
||||
minimap_layer.append("rect")
|
||||
.attr("class", "viewport")
|
||||
.attr("style", "fill: #dddddd; stroke: #aaaaaa; stroke-width: 1;")
|
||||
|
@ -1359,27 +1367,6 @@ MapController.prototype.init_events = function(principalObject) {
|
|||
|
||||
self.remove_resize_square();
|
||||
}
|
||||
|
||||
//~ //For to catch the keyevent for the ctrl key
|
||||
//~ d3.select(document)
|
||||
//~ .on("keydown", function() {
|
||||
//~
|
||||
//~ if (d3.event.keyCode == key_multiple_selection) {
|
||||
//~ flag_multiple_selection = true;
|
||||
//~ disabled_drag_zoom = true;
|
||||
//~ }
|
||||
//~ })
|
||||
//~ .on("keyup", function() {
|
||||
//~
|
||||
//~ if (d3.event.keyCode == key_multiple_selection) {
|
||||
//~ flag_multiple_selection = false;
|
||||
//~ disabled_drag_zoom = false;
|
||||
//~ flag_multiple_selection_running = false;
|
||||
//~
|
||||
//~ d3.select("#selection_rectangle")
|
||||
//~ .style("display", "none");
|
||||
//~ }
|
||||
//~ });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -133,10 +133,7 @@ NetworkmapController.prototype.is_arrow_AMA = function(id_to, id_from) {
|
|||
$.each(edges, function(i, edge) {
|
||||
if ((edge['to'] == module['graph_id']) ||
|
||||
(edge['from'] == module['graph_id'])) {
|
||||
|
||||
if (edge['graph_id'] != arrow['arrow']['graph_id']) {
|
||||
|
||||
|
||||
var_return = true;
|
||||
return false; //Break
|
||||
}
|
||||
|
@ -147,6 +144,11 @@ NetworkmapController.prototype.is_arrow_AMA = function(id_to, id_from) {
|
|||
return var_return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function get_arrow_AMMA
|
||||
* Return array (arrow)
|
||||
* This function returns an AMMA arrow
|
||||
*/
|
||||
NetworkmapController.prototype.get_arrow_AMMA = function(id_to, id_from) {
|
||||
var self = this;
|
||||
|
||||
|
@ -185,7 +187,6 @@ NetworkmapController.prototype.get_arrow_AMMA = function(id_to, id_from) {
|
|||
|
||||
if (arrow_to !== null && arrow_from !== null) {
|
||||
// There is one arrow for A-M-M-A
|
||||
|
||||
arrow_to = self.get_arrow(arrow_to['id_to'], arrow_to['id_from']);
|
||||
arrow_from = self.get_arrow(arrow_from['id_to'], arrow_from['id_from']);
|
||||
|
||||
|
@ -218,7 +219,11 @@ NetworkmapController.prototype.get_arrow_AMMA = function(id_to, id_from) {
|
|||
return return_var;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function get_arrow_AMA
|
||||
* Return array (arrow)
|
||||
* This function returns an AMA arrow
|
||||
*/
|
||||
NetworkmapController.prototype.get_arrows_AMA = function(id_to, id_from) {
|
||||
var self = this;
|
||||
|
||||
|
@ -268,57 +273,17 @@ NetworkmapController.prototype.get_arrows_AMA = function(id_to, id_from) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TRASH
|
||||
//~
|
||||
//~ if (edges_from != null) {
|
||||
//~ $.each(edges_from, function(i, edge) {
|
||||
//~
|
||||
//~ if ((edge['to'] != id_to) && (edge['from'] != id_from)) {
|
||||
//~
|
||||
//~ }
|
||||
//~
|
||||
//~
|
||||
//~ if (arrow['nodes']['from']['id_graph'] == id_from) {
|
||||
//~ if (arrow['nodes']['to']['type'] == ITEM_TYPE_AGENT_NETWORKMAP) {
|
||||
//~ var temp = {};
|
||||
//~
|
||||
//~ temp['graph_id'] =
|
||||
//~ arrow['arrow']['graph_id'] + "" +
|
||||
//~ arrow_AM['arrow']['graph_id'] + "";
|
||||
//~
|
||||
//~ temp['AMMA'] = 0;
|
||||
//~ temp['AMA'] = 1;
|
||||
//~
|
||||
//~
|
||||
//~ temp['to'] = id_to;
|
||||
//~ if (arrow['nodes']['from']['type'] == ITEM_TYPE_AGENT_NETWORKMAP) {
|
||||
//~ temp['from'] = arrow['nodes']['from']['id_graph'];
|
||||
//~ }
|
||||
//~ else {
|
||||
//~ temp['from'] = arrow['nodes']['to']['id_graph'];
|
||||
//~ }
|
||||
//~
|
||||
//~
|
||||
//~ temp['to_module'] = arrow_AM['nodes']['from']['id'];
|
||||
//~ temp['from_module'] = null;
|
||||
//~
|
||||
//~ arrows.push(temp);
|
||||
//~ }
|
||||
//~ }
|
||||
//~ });
|
||||
//~ }
|
||||
//~ else if (edges_to != null) {
|
||||
//~ $.each(arrows_to, function(i, arrow) {
|
||||
//~
|
||||
//~ });
|
||||
//~ }
|
||||
}
|
||||
});
|
||||
|
||||
return var_return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function exists_arrow
|
||||
* Return bool
|
||||
* This function returns if the arrow exists
|
||||
*/
|
||||
NetworkmapController.prototype.exists_arrow = function(arrows, arrow) {
|
||||
var var_return = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue