mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Some changes that we need.
This commit is contained in:
parent
646a90211e
commit
e7b664dd63
@ -67,6 +67,7 @@ class Networkmap extends Map {
|
||||
|
||||
$nodes = array();
|
||||
$edges = array();
|
||||
$last_graph_id = 0;
|
||||
foreach ($nodes_and_edges as $node_or_edge) {
|
||||
$node_or_edge = trim($node_or_edge);
|
||||
|
||||
@ -104,10 +105,15 @@ class Networkmap extends Map {
|
||||
$type = ITEM_TYPE_AGENT_NETWORKMAP;
|
||||
}
|
||||
|
||||
$nodes[$graphviz_id] = array('id' => $id, 'type' => $type);
|
||||
$nodes[] = array('graph_id' => $graphviz_id,
|
||||
'id' => $id, 'type' => $type);
|
||||
|
||||
$last_graph_id = $graphviz_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($positions as $line) {
|
||||
//clean line a long spaces for one space caracter
|
||||
$line = preg_replace('/[ ]+/', ' ', $line);
|
||||
@ -116,20 +122,29 @@ class Networkmap extends Map {
|
||||
$items = explode(' ', $line);
|
||||
$graphviz_id = $items[1];
|
||||
|
||||
$nodes[$graphviz_id]['x'] = $items[2] * 100; //200 is for show more big
|
||||
$nodes[$graphviz_id]['y'] = $items[3] * 100;
|
||||
// We need a binary tree...in some future time.
|
||||
|
||||
foreach ($nodes as $i => $node) {
|
||||
if ($node['graph_id'] == $graphviz_id) {
|
||||
$nodes[$i]['x'] = $items[2] * 100; //200 is for show more big
|
||||
$nodes[$i]['y'] = $items[3] * 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($nodes as $graphviz_id => $node) {
|
||||
$this->nodes[$graphviz_id] = $node;
|
||||
foreach ($edges as $i => $edge) {
|
||||
$graph_id = $last_graph_id++;
|
||||
|
||||
$this->nodes[] = array(
|
||||
'graph_id' => $graph_id,
|
||||
'type' => ITEM_TYPE_EDGE_NETWORKMAP);
|
||||
$edge[$i]['graph_id'] = $graph_id;
|
||||
|
||||
}
|
||||
|
||||
foreach ($edges as $edge) {
|
||||
$this->nodes[] = array('type' => ITEM_TYPE_EDGE_NETWORKMAP);
|
||||
$edge['id_item'] = key(end($this->nodes));
|
||||
$this->edges[] = $edge;
|
||||
}
|
||||
$this->nodes = $nodes;
|
||||
$this->edges = $edges;
|
||||
}
|
||||
|
||||
protected function temp_parseParameters_generateDot() {
|
||||
|
@ -37,7 +37,8 @@ MapController.prototype.init_map = function() {
|
||||
|
||||
var viewport = svg
|
||||
.call(d3.behavior.zoom().scaleExtent([1/100, 100]).on("zoom", zoom))
|
||||
.append("g");
|
||||
.append("g")
|
||||
.attr("class", "viewport");
|
||||
|
||||
function zoom() {
|
||||
viewport
|
||||
@ -45,7 +46,7 @@ MapController.prototype.init_map = function() {
|
||||
}
|
||||
|
||||
this.paint_nodes(viewport);
|
||||
|
||||
//~
|
||||
//~ viewport.append("g").append("circle")
|
||||
//~ .attr("id", "node_10")
|
||||
//~ .attr("class", "node")
|
||||
@ -148,12 +149,15 @@ Return void
|
||||
This function manages mouse clicks and run events in consecuence
|
||||
*/
|
||||
MapController.prototype.click_event = function(event) {
|
||||
console.log(1111);
|
||||
var self = event.data.map;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
switch (event.which) {
|
||||
case 1:
|
||||
console.log(2222);
|
||||
if ($(event.currentTarget).hasClass("node")) {
|
||||
console.log(3333);
|
||||
self.tooltip_map_create(self, event);
|
||||
}
|
||||
else {
|
||||
@ -177,7 +181,7 @@ This function manages nodes tooltips
|
||||
MapController.prototype.tooltip_map_create = function(self, event, close) {
|
||||
var nodeR = parseInt($(event.currentTarget).attr("r"));
|
||||
var node_id = $(event.currentTarget).attr("id");
|
||||
|
||||
|
||||
if (this.containsTooltipId(node_id)) {
|
||||
$(event.currentTarget).tooltipster("show");
|
||||
}
|
||||
@ -189,7 +193,7 @@ MapController.prototype.tooltip_map_create = function(self, event, close) {
|
||||
offsetX: nodeR,
|
||||
theme: 'tooltipster-noir',
|
||||
multiple: true,
|
||||
content: $('<span>I\'M A FUCKING TOOLTIP!!</span>')
|
||||
content: $('<span class="mierdaca">I\'M A FUCKING TOOLTIP!!</span>')
|
||||
});
|
||||
|
||||
this._tooltipsID.push(node_id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user