2010-03-03 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_gis.php: add new parameter to function "addPath" the
	$lastPosition for paint the line to last position that this position is not
	in the table tgis_data_history. In function "getAgentMap" use the new
	parameter in the function "addPath".
	 
	* operation/gis_maps/render_view.php: tiny fix in the include javascript
	of google. And few stetic changes in the top menu. And add the new parameter
	to "addPath".


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2455 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2010-03-03 10:34:35 +00:00
parent 0c7b3d1648
commit 63ca79bf0a
3 changed files with 35 additions and 13 deletions

View File

@ -1,3 +1,14 @@
2010-03-03 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_gis.php: add new parameter to function "addPath" the
$lastPosition for paint the line to last position that this position is not
in the table tgis_data_history. In function "getAgentMap" use the new
parameter in the function "addPath".
* operation/gis_maps/render_view.php: tiny fix in the include javascript
of google. And few stetic changes in the top menu. And add the new parameter
to "addPath".
2010-03-03 Miguel de Dios <miguel.dedios@artica.es>
* operation/gis_maps/render_view.php: close in the end a unclose php tag.

View File

@ -543,11 +543,12 @@ function get_agent_icon_map($idAgent, $state = false, $status = null) {
*
* @param string $layerName String of layer.
* @param integer $idAgent The id of agent
* @param $history_time: Number of seconds in the past to show from where to start the history path.
* @param integer $history_time Number of seconds in the past to show from where to start the history path.
* @param array $lastPosition The last position of agent that is not in history table.
*
* @return None
*/
function addPath($layerName, $idAgent, $history_time = null) {
function addPath($layerName, $idAgent, $lastPosition = null, $history_time = null) {
if ($history_time === null) {
$where = '1 = 1';
@ -587,6 +588,10 @@ function addPath($layerName, $idAgent, $history_time = null) {
$first =false;
echo "new OpenLayers.Geometry.Point(" . $point['longitude'] . ", " . $point['latitude'] . ")";
}
if ($lastPosition !== null) {
echo ", new OpenLayers.Geometry.Point(" . $lastPosition['longitude'] . ", " . $lastPosition['latitude'] . ")";
}
echo "];";
}
?>
@ -598,7 +603,7 @@ function addPath($layerName, $idAgent, $history_time = null) {
<?php
if ($listPoints != false) {
foreach($listPoints as $point) {
if (end($listPoints) != $point)
if ((end($listPoints) != $point) || (($lastPosition !== null)))
addPointPath($layerName, $point['latitude'], $point['longitude'], $color, (int)$point['manual_placement'], $point['id_tgis_data']);
}
}
@ -892,11 +897,11 @@ function getAgentMap($agent_id, $heigth, $width, $show_history = false, $centerI
$agent_icon = get_agent_icon_map($agent_id, true);
$status = get_agent_status($agent_id);
/* If show_history is true, show the path of the agent */
if ($show_history) {
/* TODO: only show the last history_time part of the path */
addPath("layer_for_agent_".$agent_name,$agent_id, $history_time);
$lastPosition = array('longitude' => $agentPositionLongitude, 'latitude' => $agentPositionLatitude);
addPath("layer_for_agent_".$agent_name,$agent_id, $lastPosition, $history_time);
}
addAgentPoint("layer_for_agent_".$agent_name, $agent_name, $agentPositionLatitude, $agentPositionLongitude, $agent_icon, 20, 20, $agent_id, $status, 'point_agent_info');

View File

@ -66,7 +66,7 @@ if ($confMap !== false) {
}
if ($gmap_layer === true) {
?>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=falsei&key=<?php echo $gmap_key ?>" ></script>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=<?php echo $gmap_key ?>" ></script>
<?php
}
@ -106,11 +106,16 @@ $times = array(
$buttons[] = '&nbsp;' . __('Refresh: ') . print_select($times, 'refresh_time', 60, 'changeRefreshTime(this.value);', '', 0, true, false, false) . "&nbsp;";
$buttons[] = '<a id="button_status_all" href="javascript: changeShowStatus(\'all\');" style="border: 1px black solid;">' . __('All') . '</a>';
$buttons[] = '<a id="button_status_bad" href="javascript: changeShowStatus(\'bad\');"><img src="images/status_sets/default/agent_critical_ball.png" /> ' . __('Critical') . '</a>';
$buttons[] = '<a id="button_status_warning" href="javascript: changeShowStatus(\'warning\');"><img src="images/status_sets/default/agent_warning_ball.png" /> ' . __('Warning') . '</a>';
$buttons[] = '<a id="button_status_ok" href="javascript: changeShowStatus(\'ok\');"><img src="images/status_sets/default/agent_ok_ball.png" /> ' . __('Ok') . '</a>';
$buttons[] = '<a id="button_status_default" href="javascript: changeShowStatus(\'default\');"><img src="images/status_sets/default/agent_no_monitors_ball.png" /> ' . __('Other') . '</a>';
$buttons[] = '<a id="button_status_all" href="javascript: changeShowStatus(\'all\');" style="border: 1px black solid;">' .
__('All') . '</a>';
$buttons[] = '<a id="button_status_bad" href="javascript: changeShowStatus(\'bad\');"><div style="height: 18px;">' .
'<img src="images/status_sets/default/agent_critical_ball.png" title="' . __('Critical') . '"/></div></a>';
$buttons[] = '<a id="button_status_warning" href="javascript: changeShowStatus(\'warning\');"><div style="height: 18px;">' .
'<img src="images/status_sets/default/agent_warning_ball.png" title="' . __('Warning') . '"/></div></a>';
$buttons[] = '<a id="button_status_ok" href="javascript: changeShowStatus(\'ok\');"><div style="height: 18px;">' .
'<img src="images/status_sets/default/agent_ok_ball.png" title="' . __('Ok') . '"/></div></a>';
$buttons[] = '<a id="button_status_default" href="javascript: changeShowStatus(\'default\');"><div style="height: 18px;">' .
'<img src="images/status_sets/default/agent_no_monitors_ball.png" title="' . __('Other') . '"/></div></a>';
$buttons[] = __('Show agents in state: ');
@ -139,7 +144,8 @@ if ($layers != false) {
}
else {
if ($show_history == 'y') {
addPath($layer['layer_name'], $idAgent);
$lastPosition = array('longitude' => $coords['stored_longitude'], 'latitude' => $coords['stored_latitude']);
addPath($layer['layer_name'], $idAgent, $lastPosition);
}
}
$icon = get_agent_icon_map($idAgent, true);