2013-05-20 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_gis.php, operation/gis_maps/render_view.php,
	operation/agentes/gis_view.php: changed the code to set the agent
	icon with the original size.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8162 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-05-20 11:16:28 +00:00
parent ee9e85c1ec
commit 941252870f
4 changed files with 62 additions and 29 deletions

View File

@ -1,3 +1,9 @@
2013-05-20 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_gis.php, operation/gis_maps/render_view.php,
operation/agentes/gis_view.php: changed the code to set the agent
icon with the original size.
2013-05-20 Miguel de Dios <miguel.dedios@artica.es> 2013-05-20 Miguel de Dios <miguel.dedios@artica.es>
* extensions/net_tools.php: added a entry to godmode for set the * extensions/net_tools.php: added a entry to godmode for set the

View File

@ -463,8 +463,10 @@ function gis_get_layers($idMap) {
function gis_get_agent_icon_map($idAgent, $state = false, $status = null) { function gis_get_agent_icon_map($idAgent, $state = false, $status = null) {
global $config; global $config;
$row = db_get_row_sql('SELECT id_grupo, icon_path $row = db_get_row_sql('
FROM tagente WHERE id_agente = ' . $idAgent); SELECT id_grupo, icon_path
FROM tagente
WHERE id_agente = ' . $idAgent);
if (($row['icon_path'] === null) || (strlen($row['icon_path']) == 0)) { if (($row['icon_path'] === null) || (strlen($row['icon_path']) == 0)) {
if ($config['gis_default_icon'] != "") { if ($config['gis_default_icon'] != "") {
@ -874,11 +876,13 @@ function gis_get_conection_conf($idConnection) {
*/ */
function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $centerInAgent = true, $history_time = 86400) { function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $centerInAgent = true, $history_time = 86400) {
$defaultMap = db_get_all_rows_sql(" $defaultMap = db_get_all_rows_sql("
SELECT t1.*, t3.conection_name, t3.connection_type, t3.conection_data, t3.num_zoom_levels SELECT t1.*, t3.conection_name, t3.connection_type,
t3.conection_data, t3.num_zoom_levels
FROM tgis_map AS t1, FROM tgis_map AS t1,
tgis_map_has_tgis_map_connection AS t2, tgis_map_has_tgis_map_connection AS t2,
tgis_map_connection AS t3 tgis_map_connection AS t3
WHERE t1.default_map = 1 AND t2.tgis_map_id_tgis_map = t1.id_tgis_map WHERE t1.default_map = 1
AND t2.tgis_map_id_tgis_map = t1.id_tgis_map
AND t2.default_map_connection = 1 AND t2.default_map_connection = 1
AND t3.id_tmap_connection = t2.tgis_map_connection_id_tmap_connection"); AND t3.id_tmap_connection = t2.tgis_map_connection_id_tmap_connection");
@ -944,18 +948,28 @@ function gis_get_agent_map($agent_id, $heigth, $width, $show_history = false, $c
$defaultMap['initial_latitude'], $defaultMap['initial_latitude'],
$defaultMap['initial_longitude'], $baselayers, $controls); $defaultMap['initial_longitude'], $baselayers, $controls);
gis_make_layer("layer_for_agent_".$agent_name); gis_make_layer("layer_for_agent_" . $agent_name);
$agent_icon = gis_get_agent_icon_map($agent_id, true); $agent_icon = gis_get_agent_icon_map($agent_id, true);
$agent_icon_size = getimagesize($agent_icon);
$agent_icon_width = $agent_icon_size[0];
$agent_icon_height = $agent_icon_size[1];
$status = agents_get_status($agent_id); $status = agents_get_status($agent_id);
/* If show_history is true, show the path of the agent */ /* If show_history is true, show the path of the agent */
if ($show_history) { if ($show_history) {
$lastPosition = array('longitude' => $agentPositionLongitude, 'latitude' => $agentPositionLatitude); $lastPosition = array(
gis_add_path("layer_for_agent_".$agent_name,$agent_id, $lastPosition, $history_time); 'longitude' => $agentPositionLongitude,
'latitude' => $agentPositionLatitude);
gis_add_path("layer_for_agent_" . $agent_name,
$agent_id, $lastPosition, $history_time);
} }
gis_add_agent_point("layer_for_agent_".$agent_name, $agent_name, $agentPositionLatitude, $agentPositionLongitude, $agent_icon, 20, 20, $agent_id, $status, 'point_agent_info');
gis_add_agent_point("layer_for_agent_" . $agent_name,
$agent_name, $agentPositionLatitude, $agentPositionLongitude,
$agent_icon, $agent_icon_width, $agent_icon_height, $agent_id,
$status, 'point_agent_info');
if ($centerInAgent) { if ($centerInAgent) {
?> ?>

View File

@ -72,7 +72,9 @@ gis_activate_ajax_refresh(null, $timestampLastOperation);
gis_activate_select_control(); gis_activate_select_control();
if ($agentData === false) { if ($agentData === false) {
echo "<p>" . __("There is no GIS data for this agent, so it's positioned in default position of map.") . "</p>"; echo "<p>" .
__("There is no GIS data for this agent, so it's positioned in default position of map.") .
"</p>";
} }
echo "<br />"; echo "<br />";
@ -98,7 +100,9 @@ $countData = db_get_value_sql($sqlCount);
/* Get the elements to present in this page */ /* Get the elements to present in this page */
$sql = sprintf ("SELECT longitude, latitude, altitude, start_timestamp, end_timestamp, description, number_of_packages, manual_placement $sql = sprintf ("
SELECT longitude, latitude, altitude, start_timestamp,
end_timestamp, description, number_of_packages, manual_placement
FROM tgis_data_history FROM tgis_data_history
WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d) WHERE tagente_id_agente = %d AND end_timestamp > FROM_UNIXTIME(%d)
ORDER BY end_timestamp DESC ORDER BY end_timestamp DESC
@ -107,7 +111,8 @@ $result = db_get_all_rows_sql ($sql, true);
if ($result === false) { if ($result === false) {
echo "<div class='nf'>".__('This agent doesn\'t have any GIS data')."</div>"; echo "<div class='nf'>" .
__('This agent doesn\'t have any GIS data.') . "</div>";
} }
else { else {
ui_pagination ($countData, false) ; ui_pagination ($countData, false) ;

View File

@ -123,9 +123,11 @@ $status = array(
'ok' => __('Ok'), 'ok' => __('Ok'),
'default' => __('Other')); 'default' => __('Other'));
$buttons[]['text'] = '&nbsp;' . __('Show agents by state: ') . html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false) . "&nbsp;"; $buttons[]['text'] = '&nbsp;' . __('Show agents by state: ') .
html_print_select($status, 'show_status', 'all', 'changeShowStatus(this.value);', '', 0, true, false, false) . "&nbsp;";
ui_print_page_header(__('Map') . " &raquo; " . __('Map') . "&nbsp;" . $map['map_name'], "images/op_gis.png", false, "", false, $buttons); ui_print_page_header(__('Map') . " &raquo; " . __('Map') . "&nbsp;" . $map['map_name'],
"images/op_gis.png", false, "", false, $buttons);
if ($config["pure"] == 0) { if ($config["pure"] == 0) {
echo "<div id='map' style='width: 99%; height: 500px; border: 1px solid black;' ></div>"; echo "<div id='map' style='width: 99%; height: 500px; border: 1px solid black;' ></div>";
@ -172,11 +174,17 @@ if ($layers != false) {
$icon = gis_get_agent_icon_map($idAgent, true); $icon = gis_get_agent_icon_map($idAgent, true);
$icon_size = getimagesize($icon);
$icon_width = $icon_size[0];
$icon_height = $icon_size[1];
$status = agents_get_status($idAgent); $status = agents_get_status($idAgent);
$parent = db_get_value('id_parent', 'tagente', 'id_agente', $idAgent); $parent = db_get_value('id_parent', 'tagente', 'id_agente', $idAgent);
gis_add_agent_point($layer['layer_name'], io_safe_output($agentName), $coords['stored_latitude'], gis_add_agent_point($layer['layer_name'],
$coords['stored_longitude'], $icon, 20, 20, $idAgent, $status, 'point_agent_info', $parent); io_safe_output($agentName), $coords['stored_latitude'],
$coords['stored_longitude'], $icon, $icon_width,
$icon_height, $idAgent, $status, 'point_agent_info',
$parent);
} }
} }
gis_add_parent_lines(); gis_add_parent_lines();