[Nagvis-checkins] SF.net Git: nagvis: change calculation of y coordinate / add comment chars to geo
Brought to you by:
larsi-
From: Wolfgang <le...@us...> - 2013-03-20 20:53:37
|
Author: Wolfgang <wn...@gm...> Date: Wed Mar 20 21:49:41 2013 +0100 Committer: Wolfgang <wn...@gm...> Commit-Date: Wed Mar 20 21:49:41 2013 +0100 change calculation of y coordinate / add comment chars to geomap csv config file --- docs/de_DE/geomap.html | 2 ++ docs/en_US/geomap.html | 2 ++ share/server/core/sources/geomap.php | 5 ++++- 3 files changed, 8 insertions(+), 1 deletions(-) diff --git a/docs/de_DE/geomap.html b/docs/de_DE/geomap.html index 87818cd..3159b0a 100644 --- a/docs/de_DE/geomap.html +++ b/docs/de_DE/geomap.html @@ -57,6 +57,8 @@ muc-srv1;Munich Server1;48.1448353;11.5580067</pre> <p>Jede Zeile definiert einen Host, der zur Map hinzugefügt werden soll. Die Spalten werden durch <code>;</code>-Zeichen getrennt. Die ersten Spalte enthält den Host-Namen, die zweite einen optionalen Alias, die dritte die LAT-Koordinate (Breitengrad) und die vierte die LONG-Koordinate (Längengrad).</p> + <p><font color="red">(Ab Git-Version vom 21.03.2013)</font>: Zeilen, die mit den üblichen Kommentarzeichen beginnen + (<code>;</code>, <code>#</code> oder <code>//</code>), werden als Kommentar behandelt.</p> <p><font color="#ff0000">Neu in 1.7.4</font>: Es ist auch möglich, <code>source_type=backend</code> zu setzen, um das per <code>backend_id</code> eingestellte Backend für die Ermittlung der anzuzeigenden Hosts und ihrer diff --git a/docs/en_US/geomap.html b/docs/en_US/geomap.html index 09800c0..0a26538 100644 --- a/docs/en_US/geomap.html +++ b/docs/en_US/geomap.html @@ -60,6 +60,8 @@ muc-srv1;Munich Server1;48.1448353;11.5580067</pre> <p>Each line defines one host to be added to the map. The columns are separated by <code>;</code> signs. The first column contains the host-name, the second an optional alias, the third the LAT coordinate and the fourth the LONG coordinate.</p> + <p><font color="red">(starting with git-version as of 2013-03-21)</font>: Lines starting with the usual comment characters + (<code>;</code>, <code>#</code>, or <code>//</code>) are treated as comments.</p> <p><font color="#ff0000">New in 1.7.4</font>: It is also possible to set <code>source_type=backend</code> to use the backend set via <code>backend_id</code> to gather the list of hosts to be shown on the geomap diff --git a/share/server/core/sources/geomap.php b/share/server/core/sources/geomap.php index aca9bc5..50ec763 100644 --- a/share/server/core/sources/geomap.php +++ b/share/server/core/sources/geomap.php @@ -21,6 +21,9 @@ function geomap_read_csv($p) { throw new GeomapError(l('Location source file "[F]" does not exist.', Array('F' => $f))); foreach(file($f) AS $line) { + // skip lines beginning with any of the usual comment characters + if(preg_match('/^[;#\/]',$line)) + continue; $parts = explode(';', $line); $locations[] = array( 'name' => $parts[0], @@ -351,7 +354,7 @@ function process_geomap($MAPCFG, $map_name, &$map_config) { continue; // Calculate the lat (y) coords - $obj['y'] = round($params['height'] - ($lat_para * ($obj['lat'] - $img_down)) - ($icon_h / 2)); + $obj['y'] = round($lat_para * ($img_top - $obj['lat']) + ($icon_h / 2)); if($obj['y'] < 0) $obj['y'] = 0; |