2013-02-28 Miguel de Dios <miguel.dedios@artica.es>

* godmode/gis_maps/configure_gis_map.php, include/functions_gis.php,
	operation/gis_maps/render_view.php: fixes for the layers.
	
	MERGED FROM THE BRANCH PANDORA_4




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7752 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-02-28 15:28:21 +00:00
parent ae5a6dc1af
commit 1df7b829e7
4 changed files with 97 additions and 53 deletions

View File

@ -1,3 +1,10 @@
2013-02-28 Miguel de Dios <miguel.dedios@artica.es>
* godmode/gis_maps/configure_gis_map.php, include/functions_gis.php,
operation/gis_maps/render_view.php: fixes for the layers.
MERGED FROM THE BRANCH PANDORA_4
2013-02-28 Sergio Martin <sergio.martin@artica.es>
* include/functions_html.php

View File

@ -45,7 +45,7 @@ function updateArrowLayers() {
var lastIndex = null;
for (var index in layerList) {
//int because in the object array there are method as string
if (isInt(index)) {
numLayer = layerList[index];
@ -58,15 +58,15 @@ function updateArrowLayers() {
else {
$('.up_arrow', layerObj).html('<a class="up_arrow" href="javascript: upLayer(' + numLayer + ');"><?php html_print_image ("images/up.png"); ?></a>');
}
$('.down_arrow', layerObj).html('<a class="down_arrow" href="javascript: downLayer(' + numLayer + ');"><?php html_print_image ("images/down.png"); ?></a>');
count++;
lastIndex = index;
}
}
//Last element
if (lastIndex != null) {
numLayer = layerList[lastIndex];
@ -101,7 +101,7 @@ switch ($action) {
$map_default_altitude = get_parameter('map_default_altitude');
$map_group_id = get_parameter('map_group_id');
$map_levels_zoom = get_parameter('map_levels_zoom');
$map_connection_list_temp = explode(",",get_parameter('map_connection_list'));
@ -185,37 +185,7 @@ switch ($action) {
html_print_input_hidden('action', 'update_saved');
html_print_input_hidden('map_id', $idMap);
$mapData = gis_get_map_data($idMap);
$map_name = $mapData['map']['map_name'];
$map_group_id = $mapData['map']['group_id'];
$map_zoom_level = $mapData['map']['zoom_level'];
$map_background = $mapData['map']['map_background'];
$map_initial_longitude = $mapData['map']['initial_longitude'];
$map_initial_latitude = $mapData['map']['initial_latitude'];
$map_initial_altitude = $mapData['map']['initial_altitude'];
$map_default_longitude = $mapData['map']['default_longitude'];
$map_default_latitude = $mapData['map']['default_latitude'];
$map_default_altitude = $mapData['map']['default_altitude'];
$map_connection_list = $mapData['connections'];
$map_levels_zoom = gis_get_num_zoom_levels_connection_default($map_connection_list);
//$map_levels_zoom = get_parameter('map_levels_zoom');
$layer_list = array();
foreach ($mapData['layers'] as $layer) {
$layerAgentList = array();
foreach($layer['layer_agent_list'] as $layerAgent) {
$layerAgentList[] = $layerAgent['nombre'];
}
$layer_list[] = array(
'layer_name' => $layer['layer_name'],
'layer_group' => $layer['layer_group'],
'layer_visible' => $layer['layer_visible'],
'layer_agent_list' => $layerAgentList
);
}
break;
case 'update_saved':
$idMap = get_parameter('map_id');
@ -239,7 +209,7 @@ switch ($action) {
unset($map_connection_list_temp[$index]);
}
}
$layer_list = explode(",",get_parameter('layer_list'));
$layer_list = explode(",", get_parameter('layer_list'));
foreach ($layer_list as $index => $value) {
$cleanValue = trim($value);
if ($cleanValue == '') {
@ -287,7 +257,6 @@ switch ($action) {
html_print_input_hidden('action', 'update_saved');
$mapCreatedOk = false;
}
$layer_list = $arrayLayers;
ui_print_result_message ($mapCreatedOk, __('Map successfully update'),
__('Map could not be update'));
@ -297,6 +266,46 @@ switch ($action) {
break;
}
//Load the data in edit or reload in update.
switch ($action) {
case 'edit_map':
case 'update_saved':
$mapData = gis_get_map_data($idMap);
$map_name = $mapData['map']['map_name'];
$map_group_id = $mapData['map']['group_id'];
$map_zoom_level = $mapData['map']['zoom_level'];
$map_background = $mapData['map']['map_background'];
$map_initial_longitude = $mapData['map']['initial_longitude'];
$map_initial_latitude = $mapData['map']['initial_latitude'];
$map_initial_altitude = $mapData['map']['initial_altitude'];
$map_default_longitude = $mapData['map']['default_longitude'];
$map_default_latitude = $mapData['map']['default_latitude'];
$map_default_altitude = $mapData['map']['default_altitude'];
$map_connection_list = $mapData['connections'];
$map_levels_zoom = gis_get_num_zoom_levels_connection_default($map_connection_list);
//$map_levels_zoom = get_parameter('map_levels_zoom');
$layer_list = array();
foreach ($mapData['layers'] as $layer) {
$layerAgentList = array();
foreach($layer['layer_agent_list'] as $layerAgent) {
$layerAgentList[] = $layerAgent['nombre'];
}
$layer_list[] = array(
'id' => $layer['id_tmap_layer'],
'layer_name' => $layer['layer_name'],
'layer_group' => $layer['layer_group'],
'layer_visible' => $layer['layer_visible'],
'layer_agent_list' => $layerAgentList
);
}
break;
}
$table->width = '98%';
$table->data = array ();
@ -561,6 +570,7 @@ function refreshMapView() {
}
}
});
}
function active_button_add_agent() {
@ -597,7 +607,7 @@ function deleteLayer(idRow) {
$("#hidden-layer_edit_id_form").val('');
for (var index in layerList) {
//int because in the object array there are method as string
if (isInt(index)) {
if (layerList[index] == idRow) {
@ -632,6 +642,7 @@ function newLayer() {
function serializeForm() {
layer = {};
layer.id = 0;
layer.layer_name = $("#text-layer_name_form").val();
layer.layer_group = $("#layer_group_form :selected").val();
if ($("#checkbox-layer_visible_form:checked").val() == 1)
@ -754,7 +765,7 @@ function addAgentLayer(agent_name) {
function deleteConnectionMap(idConnectionMap) {
for (var index in connectionMaps) {
//int because in the object array there are method as string
if (isInt(index)) {
if (connectionMaps[index] == idConnectionMap) {
@ -884,6 +895,7 @@ function downLayer(idLayer) {
var found = false;
for (var index in layerList) {
//int because in the object array there are method as string
if (isInt(index)) {
if (layerList[index] == idLayer) {

View File

@ -787,18 +787,36 @@ function gis_update_map($idMap, $map_name, $map_initial_longitude, $map_initial_
db_process_sql_delete('tgis_map_layer_has_tagente', array('tgis_map_layer_id_tmap_layer' => $idLayer['id_tmap_layer']));
}
db_process_sql_delete('tgis_map_layer', array('tgis_map_id_tgis_map' => $idMap));
foreach ($arrayLayers as $index => $layer) {
$idLayer = db_process_sql_insert('tgis_map_layer',
array(
'layer_name' => $layer['layer_name'],
'view_layer' => $layer['layer_visible'],
'layer_stack_order' => $index,
'tgis_map_id_tgis_map' => $idMap,
'tgrupo_id_grupo' => $layer['layer_group']
)
);
if ($layer['id'] != 0) {
$idLayer = $layer['id'];
db_process_sql_update('tgis_map_layer',
array(
'layer_name' => $layer['layer_name'],
'view_layer' => $layer['layer_visible'],
'layer_stack_order' => $index,
'tgis_map_id_tgis_map' => $idMap,
'tgrupo_id_grupo' => $layer['layer_group']
),
array('id_tmap_layer' => $idLayer));
}
else {
$idLayer = db_process_sql_insert('tgis_map_layer',
array(
'layer_name' => $layer['layer_name'],
'view_layer' => $layer['layer_visible'],
'layer_stack_order' => $index,
'tgis_map_id_tgis_map' => $idMap,
'tgrupo_id_grupo' => $layer['layer_group']
)
);
}
if (array_key_exists('layer_agent_list', $layer)) {
if (count($layer['layer_agent_list']) > 0) {
@ -812,6 +830,7 @@ function gis_update_map($idMap, $map_name, $map_initial_longitude, $map_initial_
}
}
}
}
}
@ -1083,7 +1102,8 @@ function gis_get_map_data($idMap) {
$layers = db_get_all_rows_sql('SELECT id_tmap_layer, layer_name,
tgrupo_id_grupo AS layer_group, view_layer AS layer_visible
FROM tgis_map_layer
WHERE tgis_map_id_tgis_map = ' . $map['id_tgis_map']);
WHERE tgis_map_id_tgis_map = ' . $map['id_tgis_map'] . '
ORDER BY layer_stack_order ASC;');
if ($layers === false) $layers = array();
foreach ($layers as $index => $layer) {
@ -1175,11 +1195,12 @@ function gis_add_layer_list($layer_list) {
foreach ($layer_list as $layer) {
//Create the layer temp form as it was in the form
$layerTempForm = array();
$layerTempForm['id'] = $layer['id'];
$layerTempForm['layer_name'] = $layer['layer_name'];
$layerTempForm['layer_group'] = $layer['layer_group'];
$layerTempForm['layer_visible'] = $layer['layer_visible'];
if (array_key_exists('layer_agent_list', $layer)) {
foreach($layer['layer_agent_list'] as $agent) {
foreach ($layer['layer_agent_list'] as $agent) {
$layerTempForm['layer_agent_list'][] = $agent;
}
}
@ -1189,7 +1210,9 @@ function gis_add_layer_list($layer_list) {
$returnVar .= '
<tbody id="layer_item_' . $count . '">
<tr>
<td class="col1">' . $layer['layer_name'] . '</td>
<td class="col1">' .
$layer['layer_name'] .
'</td>
<td class="up_arrow"><a id="up_arrow" href="javascript: upLayer(' . $count . ');">' . html_print_image("images/up.png", true, array("alt" => "")) . '</a></td>
<td class="down_arrow"><a id="down_arrow" href="javascript: downLayer(' . $count . ');">' . html_print_image("images/down.png", true, array("alt" => "")) . '</a></td>
<td class="col3">

View File

@ -141,9 +141,11 @@ gis_print_map('map', $map['zoom_level'], $map['initial_latitude'],
if ($layers != false) {
foreach ($layers as $layer) {
gis_make_layer($layer['layer_name'], $layer['view_layer'], null, $layer['id_tmap_layer']);
gis_make_layer($layer['layer_name'],
$layer['view_layer'], null, $layer['id_tmap_layer']);
// calling agents_get_group_agents with none to obtain the names in the same case as they are in the DB.
$agentNamesByGroup = array();
if ($layer['tgrupo_id_grupo'] >= 0) {
$agentNamesByGroup = agents_get_group_agents($layer['tgrupo_id_grupo'],
false, 'none', true, true, false);