Fixed the open networkmap topology.

This commit is contained in:
mdtrooper 2016-04-11 17:21:04 +02:00
parent 74805b0862
commit 21adfa79b8
2 changed files with 28 additions and 14 deletions

View File

@ -170,18 +170,8 @@ abstract class Map {
<div class="home_zoom">H</div>
</div>
<?php
if ($this->width == 0) {
$width = "100%";
}
else {
$width = $this->width . "px";
}
if ($this->height == 0) {
$height = "500px";
}
else {
$height = $this->height . "px";
}
$width = "100%";
$height = "500px";
?>

View File

@ -189,13 +189,37 @@ class Networkmap extends Map {
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;
$nodes[$i]['x'] = $items[2];
$nodes[$i]['y'] = $items[3];
}
}
}
}
if (($this->width > 0) && ($this->height > 0)) {
$max_x = 0;
$max_y = 0;
foreach ($nodes as $node) {
if ($max_x < $node['x']) {
$max_x = $node['x'];
}
if ($max_y < $node['y']) {
$max_y = $node['y'];
}
}
$sep_x = $this->width / $max_x;
$sep_y = $this->height / $max_y;
foreach ($nodes as $i => $node) {
$nodes[$i]['x'] *= $sep_x;
$nodes[$i]['y'] *= $sep_y;
}
}
foreach ($edges as $i => $edge) {
$graph_id = ++$last_graph_id;