Author: Lars Michelsen <[email protected]>
Date: Sat Mar 31 12:27:45 2012 +0200
Committer: Lars Michelsen <[email protected]>
Commit-Date: Sat Mar 31 12:27:45 2012 +0200
Improved automap a bit
* Added new render mode "undirected3" which uses the sfdp binary of
* graphviz
(Thanks to Pedro)
* Added new rankdir and overlap options (Thanks to Pedro)
---
ChangeLog | 5 +++
share/server/core/defines/matches.php | 4 ++-
share/server/core/sources/automap.php | 41 +++++++++++++++++++++++++++++
share/server/core/sources/automap_pos.php | 10 +++++++
4 files changed, 59 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 67e9910..4c7af74 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,11 +3,16 @@ Core
* Introducing the "map source" feature. Take a look at the docs for details
* Implemented geomaps using the new "map source" feature based on an Open
Street Map static map API
+
+Automap
* Removed the special map type "automap". The automaps have been replaced by
regular maps which use the "automap" source.
Migration Notes: We do not migrate the automap config files automatically.
if you like to have them migrated please move the files from etc/automaps
to etc/maps and add the parameter 'source="automap"' to the global section.
+ * Added new render mode "undirected3" which uses the sfdp binary of graphviz
+ (Thanks to Pedro)
+ * Added new rankdir and overlap options (Thanks to Pedro)
1.6.5
Core
diff --git a/share/server/core/defines/matches.php
b/share/server/core/defines/matches.php
index 891238e..cd1bf15 100644
--- a/share/server/core/defines/matches.php
+++ b/share/server/core/defines/matches.php
@@ -77,7 +77,9 @@ define('MATCH_VIEW_TYPE_SERVICE_EMPTY',
'/^(?:icon|line|gadget)*$/i');
define('MATCH_GET_OBJECT_TYPE', '/^(state|complete|summary)$/');
define('MATCH_GADGET_TYPE', '/^(?:img|html)$/i');
define('MATCH_OBJECT_TYPES', '/^(host|service|hostgroup|servicegroup|map)$/');
-define('MATCH_AUTOMAP_RENDER_MODE',
'/^(directed|undirected|radial|circular|undirected2)?$/');
+define('MATCH_AUTOMAP_RENDER_MODE',
'/^(directed|undirected|radial|circular|undirected2|undirected3)?$/');
+define('MATCH_AUTOMAP_RANKDIR', '/^(TB|LR|BT|RL)?$/');
+define('MATCH_AUTOMAP_OVERLAP',
'/^(true|false|scale|scalexy|ortho|orthoxy|orthoyx|compress|ipsep|vpsc)?$/');
define('MATCH_LINE_TYPE', '/^(10|11|12|13|14)?$/');
define('MATCH_LINE_ARROW', '/^(none|forward|back|both)?$/');
define('MATCH_USER_NAME', '/^[0-9A-Za-z_\-\.\@\s]+$/');
diff --git a/share/server/core/sources/automap.php
b/share/server/core/sources/automap.php
index c43e3a5..23553ff 100644
--- a/share/server/core/sources/automap.php
+++ b/share/server/core/sources/automap.php
@@ -13,6 +13,8 @@ $viewParams = array(
'parent_layers',
'ignore_hosts',
'margin',
+ 'rankdir',
+ 'overlap',
),
);
@@ -23,6 +25,31 @@ function list_automap_render_modes() {
'radial' => 'radial',
'circular' => 'circular',
'undirected2' => 'undirected2',
+ 'undirected3' => 'undirected3',
+ );
+}
+
+function list_automap_rankdirs() {
+ return Array(
+ 'TB' => l('Top to bottom'),
+ 'LR' => l('Left to right'),
+ 'BT' => l('Bottom to top'),
+ 'RL' => l('Right to left'),
+ );
+}
+
+function list_automap_overlaps() {
+ return array(
+ 'true' => l('true'),
+ 'false' => l('false'),
+ 'scale' => l('scale'),
+ 'scalexy' => l('scalexy'),
+ 'ortho' => l('ortho'),
+ 'orthoxy' => l('orthoxy'),
+ 'orthoyx' => l('orthoyx'),
+ 'compress' => l('compress'),
+ 'ipsep' => l('ipsep'),
+ 'vpsc' => l('vpsc'),
);
}
@@ -91,6 +118,20 @@ $configVars = array(
'default' => '50',
'match' => MATCH_FLOAT_EMPTY,
),
+ 'rankdir' => array(
+ 'must' => false,
+ 'default' => 'LR',
+ 'match' => MATCH_AUTOMAP_RANKDIR,
+ 'field_type' => 'dropdown',
+ 'list' => 'list_automap_rankdirs',
+ ),
+ 'overlap' => array(
+ 'must' => false,
+ 'default' => 'true',
+ 'match' => MATCH_AUTOMAP_OVERLAP,
+ 'field_type' => 'dropdown',
+ 'list' => 'list_automap_overlaps',
+ ),
);
/**
diff --git a/share/server/core/sources/automap_pos.php
b/share/server/core/sources/automap_pos.php
index 7a15198..c365be1 100644
--- a/share/server/core/sources/automap_pos.php
+++ b/share/server/core/sources/automap_pos.php
@@ -114,6 +114,7 @@ function graphviz_config(&$params, &$tree) {
$str .= 'margin='.graphviz_px2inch($params['margin']).', ';
//$str .= 'bgcolor="'.$this->MAPCFG->getValue(0, 'background_color').'", ';
$str .= 'root="'.$tree['object_id'].'", ';
+ $str .= 'rankdir="'.$params['rankdir'].'", ';
/* Directed (dot) only */
if($params['render_mode'] == 'directed') {
@@ -130,6 +131,12 @@ function graphviz_config(&$params, &$tree) {
$str .= 'ranksep="0.8", ';
}
+ /* All but directed (dot) */
+ if($params['render_mode'] != 'directed') {
+ //overlap:
true,false,scale,scalexy,ortho,orthoxy,orthoyx,compress,ipsep,vpsc
+ $str .= 'overlap="'.$params['overlap'].'", ';
+ }
+
$str .=
'size="'.graphviz_px2inch($params['width']).','.graphviz_px2inch($params['height']).'"];'."\n";
/**
@@ -184,6 +191,9 @@ function graphviz_run($map_name, &$params, $cfg) {
case 'undirected2':
$binary = 'fdp';
break;
+ case 'undirected3':
+ $binary = 'sfdp';
+ break;
default:
throw new NagVisException(l('unknownrender_mode', Array('MODE' =>
$params['render_mode'])));
break;
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins