diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 1713eaa93f..b88fb07510 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -254,7 +254,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $id_networkmap = 0, $show_snmp_modules = 0, $cut_names = true, $relative = false, $text_filter = '', $ip_mask = null, $dont_show_subgroups = false, $strict_user = false, $size_canvas = null, - $old_mode = false) { + $old_mode = false, $map_filter = array()) { global $config; $nooverlap = 1; @@ -361,7 +361,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0, // Open Graph $graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, - $ranksep, $font_size, $size_canvas); + $ranksep, $font_size, $size_canvas, $map_filter); // Parse agents $nodes = array (); @@ -1396,7 +1396,7 @@ function networkmap_close_group () { // Opens a graph definition function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, - $ranksep, $font_size, $size_canvas) { + $ranksep, $font_size, $size_canvas, $map_filter = array()) { global $config; @@ -1422,22 +1422,66 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, if (!is_null($size_canvas)) { $size = ($size_canvas['x'] / 100) . "," . ($size_canvas['y'] / 100); } - + + // Graphviz custom values + if (isset($map_filter['node_sep'])) { + $node_sep = $map_filter['node_sep']; + } + else { + $node_sep = 0.25; + } + if (isset($map_filter['rank_sep'])) { + $rank_sep = $map_filter['rank_sep']; + } + else { + if ($layout == "radial") { + $rank_sep = 1.0; + } + else { + $rank_sep = 0.5; + } + } + if (isset($map_filter['mindist'])) { + $mindist = $map_filter['mindist']; + } + else { + $mindist = 1.0; + } + if (isset($map_filter['kval'])) { + $kval = $map_filter['kval']; + } + else { + $kval = 0.3; + } + // BEWARE: graphwiz DONT use single ('), you need double (") $head = "graph networkmap { dpi=100; bgcolor=\"transparent\"; labeljust=l; margin=0; pad=\"0.75,0.75\";"; if ($nooverlap != '') { - $head .= "ranksep=\"4\";"; + $head .= "overlap=\"false\";"; $head .= "outputorder=edgesfirst;"; } + if ($layout == 'flat' || $layout == 'spring1' || $layout == "spring2") { if ($nooverlap != '') { $head .= "overlap=\"scalexy\";"; } + if ($layout == 'flat') { + $head .= "ranksep=\"$rank_sep\";"; + } + if ($layout == 'spring2') { + $head .= "K=\"$kval\";"; + } + } + if ($layout == 'radial') { + $head .= "ranksep=\"$rank_sep\";"; + } + if ($layout == 'circular') { + $head .= "mindist=\"$mindist\";"; } $head .= "ratio=fill;"; $head .= "root=0;"; - $head .= "nodesep=\"0.=2\";"; + $head .= "nodesep=\"$node_sep\";"; $head .= "size=\"$size\";"; $head .= "\n"; diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index 6af64e1b8f..0e0b9787b1 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -231,7 +231,8 @@ function networkmap_process_networkmap($id = 0) { $dont_show_subgroups, false, null, - $old_mode); + $old_mode, + $map_filter); switch (PHP_OS) { case "WIN32": diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 3c401b2985..6549c63cb3 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -41,6 +41,10 @@ if ($new_networkmap) { $offset_x = ""; $offset_y = ""; $scale_z = 0.5; + $node_sep = 0.25; + $rank_sep = 1.0; + $mindist = 1.0; + $kval = 0.3; } $disabled_generation_method_select = false; @@ -82,6 +86,36 @@ if ($edit_networkmap) { $offset_x = $filter['x_offs']; $offset_y = $filter['y_offs']; $scale_z = $filter['z_dash']; + + if (isset($filter['node_sep'])) { + $node_sep = $filter['node_sep']; + } + else { + $node_sep = 0.25; + } + if (isset($filter['rank_sep'])) { + $rank_sep = $filter['rank_sep']; + } + else { + if ($values['generation_method'] == "twopi") { + $rank_sep = 1.0; + } + else { + $rank_sep = 0.5; + } + } + if (isset($filter['mindist'])) { + $mindist = $filter['mindist']; + } + else { + $mindist = 1.0; + } + if (isset($filter['kval'])) { + $kval = $filter['kval']; + } + else { + $kval = 0.3; + } $node_radius = $filter['node_radius']; @@ -244,7 +278,19 @@ else { $table->data[7][1] = html_print_select($methods, 'method', $method, '', '', 'twopi', true, false, true, '', $disabled_generation_method_select); + + $table->data['nodesep'][0] = __('Node separation'); + $table->data['nodesep'][1] = html_print_input_text ('node_sep', $node_sep, '', 5, 10,true, $disabled_source) . ui_print_help_tip (__('Separation between nodes. By default 0.25'), true); + $table->data['ranksep'][0] = __('Rank separation'); + $table->data['ranksep'][1] = html_print_input_text ('rank_sep', $rank_sep, '', 5, 10,true, $disabled_source) . ui_print_help_tip (__('Only flat and radial. Separation between arrows. By default 0.5 in flat and 1.0 in radial'), true); + + $table->data['mindist'][0] = __('Min nodes dist'); + $table->data['mindist'][1] = html_print_input_text ('mindist', $mindist, '', 5, 10,true, $disabled_source) . ui_print_help_tip (__('Only circular. Minimum separation between all nodes. By default 1.0'), true); + + $table->data['kval'][0] = __('Default ideal node separation'); + $table->data['kval'][1] = html_print_input_text ('kval', $kval, '', 5, 10,true, $disabled_source) . ui_print_help_tip (__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true); + echo '