2010-02-24 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_gis.php: change the setup params "maxExtent", "maxResolution", "numZoomLevels" from map to baselayer. Add new function "getAgentsLayer" to get agent info of agents in layer, but only agents not in group in layer. * operation/gis_maps/render_view.php: use new function "getAgentsLayer". * operation/gis_maps/ajax.php: fix the extract agent gis info, and clean source code. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2418 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
384270a4dd
commit
137e263142
|
@ -1,3 +1,15 @@
|
|||
2010-02-24 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_gis.php: change the setup params "maxExtent",
|
||||
"maxResolution", "numZoomLevels" from map to baselayer. Add new function
|
||||
"getAgentsLayer" to get agent info of agents in layer, but only agents not
|
||||
in group in layer.
|
||||
|
||||
* operation/gis_maps/render_view.php: use new function "getAgentsLayer".
|
||||
|
||||
* operation/gis_maps/ajax.php: fix the extract agent gis info, and clean
|
||||
source code.
|
||||
|
||||
2010-02-25 Pablo de la Concepción <pablo.concepcion@artica.es>
|
||||
|
||||
* godmode/setup/gis_step_2.php: Modified to get the KEY to load the Google
|
||||
|
|
|
@ -73,12 +73,7 @@ function printMap($idDiv, $iniZoom, $numLevelZooms, $latCenter, $lonCenter, $bas
|
|||
echo ", new OpenLayers.Control.LayerSwitcher()";
|
||||
echo "],";
|
||||
?>
|
||||
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
|
||||
maxResolution: 156543.0399,
|
||||
numZoomLevels: <?php echo $numLevelZooms; ?>,
|
||||
units: 'm', //metros
|
||||
//Disabled projection because with Image map not run fine...I don't know
|
||||
// projection: new OpenLayers.Projection("EPSG:900913"),
|
||||
displayProjection: new OpenLayers.Projection("EPSG:4326")
|
||||
});
|
||||
|
||||
|
@ -91,7 +86,11 @@ function printMap($idDiv, $iniZoom, $numLevelZooms, $latCenter, $lonCenter, $bas
|
|||
case 'OSM':
|
||||
?>
|
||||
var baseLayer = new OpenLayers.Layer.OSM("<?php echo $baselayer['name']; ?>",
|
||||
"<?php echo $baselayer['url']; ?>", {numZoomLevels: <?php echo $numLevelZooms; ?>});
|
||||
"<?php echo $baselayer['url']; ?>", {numZoomLevels: <?php echo $numLevelZooms; ?>,
|
||||
maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
|
||||
maxResolution: 156543.0399,
|
||||
projection: new OpenLayers.Projection("EPSG:900913")
|
||||
});
|
||||
map.addLayer(baseLayer);
|
||||
<?php
|
||||
break;
|
||||
|
@ -291,7 +290,8 @@ function activateAjaxRefresh($layers = null, $lastTimeOfData = null) {
|
|||
}
|
||||
}
|
||||
|
||||
function clock_ajax_refresh() {
|
||||
function clock_ajax_refresh() {
|
||||
//console.log(new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds());
|
||||
for (layerIndex = 0; layerIndex < map.getNumLayers(); layerIndex++) {
|
||||
layer = map.layers[layerIndex];
|
||||
<?php
|
||||
|
@ -352,6 +352,34 @@ function addPoint($layerName, $pointName, $lat, $lon, $icon = null, $width = 20,
|
|||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the agents in layer but not by group in layer.
|
||||
*
|
||||
* @param integer $idLayer Layer ID.
|
||||
* @param array $fields Fields of row tagente to return.
|
||||
*
|
||||
* @return array The array rows of tagente of agents in the layer.
|
||||
*/
|
||||
function getAgentsLayer($idLayer, $fields = null) {
|
||||
|
||||
if ($fields === null) {
|
||||
$select = '*';
|
||||
}
|
||||
else {
|
||||
$select = implode(',',$fields);
|
||||
}
|
||||
|
||||
$agents = get_db_all_rows_sql('SELECT ' . $select . ' FROM tagente WHERE id_agente IN (
|
||||
SELECT tagente_id_agente FROM tgis_map_layer_has_tagente WHERE tgis_map_layer_id_tmap_layer = ' . $idLayer . ');');
|
||||
|
||||
foreach ($agents as $index => $agent) {
|
||||
$agents[$index] = $agent['nombre'];
|
||||
}
|
||||
|
||||
|
||||
return $agents;
|
||||
}
|
||||
|
||||
function addPointPath($layerName, $lat, $lon, $color, $manual = 1, $id) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -55,44 +55,27 @@ switch ($opt) {
|
|||
(SELECT tgrupo_id_grupo FROM tgis_map_layer WHERE id_tmap_layer = ' . $layerId . ')
|
||||
OR id_agente IN
|
||||
(SELECT tagente_id_agente FROM tgis_map_layer_has_tagente WHERE tgis_map_layer_id_tmap_layer = ' . $layerId . ');');
|
||||
|
||||
|
||||
$agentsGISStatus = get_db_all_rows_sql('SELECT tagente_id_agente, stored_longitude, stored_latitude
|
||||
FROM tgis_data_status
|
||||
WHERE tagente_id_agente IN
|
||||
(SELECT id_agente FROM tagente WHERE id_grupo IN
|
||||
(SELECT tgrupo_id_grupo FROM tgis_map_layer WHERE id_tmap_layer = ' . $layerId . '))
|
||||
OR tagente_id_agente IN
|
||||
(SELECT tagente_id_agente FROM tgis_map_layer_has_tagente WHERE tgis_map_layer_id_tmap_layer = ' . $layerId . ');');
|
||||
|
||||
}
|
||||
else {
|
||||
//All groups, all agents
|
||||
$idAgentsWithGISTemp = get_db_all_rows_sql('SELECT tagente_id_agente AS id_agente
|
||||
FROM tgis_data_status
|
||||
WHERE tagente_id_agente');
|
||||
|
||||
|
||||
$agentsGISStatus = get_db_all_rows_sql('SELECT tagente_id_agente, stored_longitude, stored_latitude
|
||||
FROM tgis_data_status
|
||||
WHERE tagente_id_agente');
|
||||
}
|
||||
|
||||
foreach ($idAgentsWithGISTemp as $idAgent) {
|
||||
$idAgentsWithGIS[] = $idAgent['id_agente'];
|
||||
}
|
||||
|
||||
$agentsGISStatus = get_db_all_rows_sql('SELECT tagente_id_agente, stored_longitude, stored_latitude
|
||||
FROM tgis_data_status
|
||||
WHERE tagente_id_agente IN (' . implode(',', $idAgentsWithGIS) . ')
|
||||
UNION
|
||||
SELECT id_agente AS tagente_id_agente,
|
||||
' . $defaultCoords['default_longitude'] . ' AS stored_longitude, ' . $defaultCoords['default_latitude'] . ' AS stored_latitude
|
||||
FROM tagente
|
||||
WHERE id_agente NOT IN (' . implode(',', $idAgentsWithGIS) . ')');
|
||||
$agentsGISStatus = get_db_all_rows_sql('SELECT t1.id_agente AS tagente_id_agente,
|
||||
IFNULL(t2.stored_longitude, ' . $defaultCoords['default_longitude'] . ') AS stored_longitude,
|
||||
IFNULL(t2.stored_latitude, ' . $defaultCoords['default_latitude'] . ') AS stored_latitude
|
||||
FROM tagente AS t1
|
||||
LEFT JOIN tgis_data_status AS t2 ON t1.id_agente = t2.tagente_id_agente
|
||||
WHERE id_agente IN (' . implode(',', $idAgentsWithGIS) . ')');
|
||||
}
|
||||
else {
|
||||
//agentView equal 1
|
||||
//Extract the agent GIS status for one agent.
|
||||
$agentsGISStatus = get_db_all_rows_sql('SELECT tagente_id_agente, stored_longitude, stored_latitude
|
||||
FROM tgis_data_status
|
||||
WHERE tagente_id_agente = ' . $id_features);
|
||||
|
|
|
@ -112,7 +112,11 @@ if ($layers != false) {
|
|||
makeLayer($layer['layer_name'], $layer['view_layer'], null, $layer['id_tmap_layer']);
|
||||
|
||||
// calling get_group_agents with none to obtain the names in the same case as they are in the DB.
|
||||
$agentNames = get_group_agents($layer['tgrupo_id_grupo'],false,'none');
|
||||
$agentNamesByGroup = get_group_agents($layer['tgrupo_id_grupo'],false,'none', true);
|
||||
$agentNamesByLayer = getAgentsLayer($layer['id_tmap_layer'], array('nombre'));
|
||||
|
||||
$agentNames = array_unique($agentNamesByGroup + $agentNamesByLayer);
|
||||
|
||||
foreach ($agentNames as $agentName) {
|
||||
$idAgent = get_agent_id($agentName);
|
||||
$coords = getDataLastPositionAgent($idAgent);
|
||||
|
|
Loading…
Reference in New Issue