2010-01-27 Pablo de la Concepción <pablo.concepcion@artica.es>
* include/functions_gis.php: Modiffied addPoint and addPointExtent to receive more parmeters so it's possible to use any kind of point. Modified comments on saveMap2 * operation/gis_maps/render_view.php: Used map_id instead if id when the parameter passed in the url is a map id. Fixed to work with the new function getMapConf. Improved "pure" view. Still some things are hardcoded and needs improvement * operation/gis_maps/ajax.php: Modified to suppor calls to get info of different kind of points. Removed hardcoded data. * operation/gis_maps/index.php: Used map_id instead if id when the parameter passed in the url is a map id. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2315 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b36726a02a
commit
010cd0f132
|
@ -1,3 +1,20 @@
|
|||
2010-01-27 Pablo de la Concepción <pablo.concepcion@artica.es>
|
||||
|
||||
* include/functions_gis.php: Modiffied addPoint and addPointExtent to
|
||||
receive more parmeters so it's possible to use any kind of point.
|
||||
Modified comments on saveMap2
|
||||
|
||||
* operation/gis_maps/render_view.php: Used map_id instead if id when
|
||||
the parameter passed in the url is a map id.
|
||||
Fixed to work with the new function getMapConf.
|
||||
Improved "pure" view. Still some things are hardcoded and needs improvement
|
||||
|
||||
* operation/gis_maps/ajax.php: Modified to suppor calls to get info of
|
||||
different kind of points. Removed hardcoded data.
|
||||
|
||||
* operation/gis_maps/index.php: Used map_id instead if id when
|
||||
the parameter passed in the url is a map id.
|
||||
|
||||
2010-01-27 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_gis.php: fix a typing "print_r" in function "getMapConf"
|
||||
|
|
|
@ -95,23 +95,23 @@ function printMap($idDiv, $iniZoom, $numLevelZooms, $latCenter, $lonCenter, $bas
|
|||
layer[0].setVisibility(action);
|
||||
}
|
||||
|
||||
function addPoint(layerName, pointName, lon, lat) {
|
||||
function addPoint(layerName, pointName, lon, lat, id, type_string) {
|
||||
var point = new OpenLayers.Geometry.Point(lon, lat)
|
||||
.transform(map.displayProjection, map.getProjectionObject());
|
||||
|
||||
var layer = map.getLayersByName(layerName);
|
||||
layer = layer[0];
|
||||
|
||||
layer.addFeatures(new OpenLayers.Feature.Vector(point,{nombre: pointName, estado: "ok"}));
|
||||
layer.addFeatures(new OpenLayers.Feature.Vector(point,{nombre: pointName, estado: "ok", id: id, type: type_string, long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject()) }));
|
||||
}
|
||||
|
||||
function addPointExtent(layerName, pointName, lon, lat, icon, width, height) {
|
||||
function addPointExtent(layerName, pointName, lon, lat, icon, width, height, id, type_string) {
|
||||
var point = new OpenLayers.Geometry.Point(lon, lat)
|
||||
.transform(map.displayProjection, map.getProjectionObject());
|
||||
|
||||
var layer = map.getLayersByName(layerName);
|
||||
layer = layer[0];
|
||||
layer.addFeatures(new OpenLayers.Feature.Vector(point,{estado: "ok"}, {fontWeight: "bolder", fontColor: "#00014F", labelYOffset: -height, graphicHeight: width, graphicWidth: height, externalGraphic: icon, label: pointName}));
|
||||
layer.addFeatures(new OpenLayers.Feature.Vector(point,{estado: "ok", id: id, type: type_string, long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject()) }, {fontWeight: "bolder", fontColor: "#00014F", labelYOffset: -height, graphicHeight: width, graphicWidth: height, externalGraphic: icon, label: pointName}));
|
||||
}
|
||||
|
||||
function addPointPath(layerName, lon, lat, color, manual, id) {
|
||||
|
@ -126,14 +126,14 @@ function printMap($idDiv, $iniZoom, $numLevelZooms, $latCenter, $lonCenter, $bas
|
|||
var pointRadiusManual = pointRadiusNormal - (strokeWidth / 2);
|
||||
|
||||
if (manual) {
|
||||
point = new OpenLayers.Feature.Vector(point,{estado: "ok", id: id,
|
||||
lanlot: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject())},
|
||||
point = new OpenLayers.Feature.Vector(point,{estado: "ok", id: id, type: "point_path_info",
|
||||
long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject())},
|
||||
{fillColor: "#ffffff", pointRadius: pointRadiusManual, stroke: 1, strokeColor: color, strokeWidth: strokeWidth, cursor: "pointer"}
|
||||
);
|
||||
}
|
||||
else {
|
||||
point = new OpenLayers.Feature.Vector(point,{estado: "ok", id: id,
|
||||
lanlot: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject())},
|
||||
point = new OpenLayers.Feature.Vector(point,{estado: "ok", id: id, type: "point_path_info",
|
||||
long_lat: new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject())},
|
||||
{fillColor: color, pointRadius: pointRadiusNormal, cursor: "pointer"}
|
||||
);
|
||||
}
|
||||
|
@ -195,15 +195,14 @@ function makeLayer($name, $visible = true, $dot = null) { static $i = 0;
|
|||
layer.events.on({
|
||||
"featureselected": function(e) {
|
||||
if (e.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
|
||||
|
||||
var feature = e.feature;
|
||||
var featureData = feature.data;
|
||||
var lanlot = featureData.lanlot;
|
||||
var long_lat = featureData.long_lat;
|
||||
|
||||
var popup;
|
||||
|
||||
popup = new OpenLayers.Popup.FramedCloud('cloud00',
|
||||
lanlot,
|
||||
long_lat,
|
||||
null,
|
||||
'<div class="cloudContent' + featureData.id + '" style="text-align: center;"><img src="images/spinner.gif" /></div>',
|
||||
null,
|
||||
|
@ -213,7 +212,8 @@ function makeLayer($name, $visible = true, $dot = null) { static $i = 0;
|
|||
map.addPopup(popup);
|
||||
|
||||
jQuery.ajax ({
|
||||
data: "page=operation/gis_maps/ajax&opt=point_info&id=" + featureData.id,
|
||||
data: "page=operation/gis_maps/ajax&opt="+featureData.type+"&id=" + featureData.id,
|
||||
//data: "page=operation/gis_maps/ajax&opt=point_path_info&id=" + featureData.id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
url: "ajax.php",
|
||||
|
@ -251,7 +251,7 @@ function activateSelectControl($layers=null) {
|
|||
<?php
|
||||
}
|
||||
|
||||
function addPoint($layerName, $pointName, $lat, $lon, $icon = null, $width = 20, $height = 20) {
|
||||
function addPoint($layerName, $pointName, $lat, $lon, $icon = null, $width = 20, $height = 20, $point_id = '', $type_string = '') {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready (
|
||||
|
@ -261,13 +261,13 @@ function addPoint($layerName, $pointName, $lat, $lon, $icon = null, $width = 20,
|
|||
?>
|
||||
addPointExtent('<?php echo $layerName; ?>',
|
||||
'<?php echo $pointName; ?>', <?php echo $lon; ?>,
|
||||
<?php echo $lat; ?>, '<?php echo $icon; ?>', <?php echo $width; ?>, <?php echo $height?>);
|
||||
<?php echo $lat; ?>, '<?php echo $icon; ?>', <?php echo $width; ?>, <?php echo $height?>, <?php echo $point_id; ?>, '<?php echo $type_string; ?>');
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
?>
|
||||
addPoint('<?php echo $layerName; ?>',
|
||||
'<?php echo $pointName; ?>', <?php echo $lon; ?>, <?php echo $lat; ?>);
|
||||
'<?php echo $pointName; ?>', <?php echo $lon; ?>, <?php echo $lat; ?>, <?php echo $point_id; ?>, '<?php echo $type_string; ?>');
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
@ -300,9 +300,8 @@ function getMaps() {
|
|||
* @return An array of arrays of configuration parameters
|
||||
*/
|
||||
function getMapConf($idMap) {
|
||||
$mapConfs= get_db_all_rows_sql('SELECT tconn.* FROM tgis_map_connection AS tconn, tgis_map_has_tgis_map_connection AS trel
|
||||
$mapConfs= get_db_all_rows_sql('SELECT tconn.*, trel.default_map_connection FROM tgis_map_connection AS tconn, tgis_map_has_tgis_map_connection AS trel
|
||||
WHERE trel.tgis_map_connection_id_tmap_connection = tconn.id_tmap_connection AND trel.tgis_map_id_tgis_map = ' . $idMap);
|
||||
|
||||
return $mapConfs;
|
||||
}
|
||||
|
||||
|
@ -539,19 +538,18 @@ function saveMap($conf, $baselayers, $layers) {
|
|||
* tgis_map_layer and witch each id_layer save the agent in this layer in
|
||||
* table tgis_map_layer_has_tagente.
|
||||
*
|
||||
* @param unknown_type $map_name
|
||||
* @param unknown_type $map_initial_longitude
|
||||
* @param unknown_type $map_initial_latitude
|
||||
* @param unknown_type $map_initial_altitude
|
||||
* @param unknown_type $map_zoom_level
|
||||
* @param unknown_type $map_background
|
||||
* @param unknown_type $map_default_longitude
|
||||
* @param unknown_type $map_default_latitude
|
||||
* @param unknown_type $map_default_altitude
|
||||
* @param unknown_type $map_group_id
|
||||
* @param unknown_type $map_connection_list
|
||||
* @param unknown_type $arrayLayers
|
||||
* @return unknown_type
|
||||
* @param $map_name
|
||||
* @param $map_initial_longitude
|
||||
* @param $map_initial_latitude
|
||||
* @param $map_initial_altitude
|
||||
* @param $map_zoom_level
|
||||
* @param $map_background
|
||||
* @param $map_default_longitude
|
||||
* @param $map_default_latitude
|
||||
* @param $map_default_altitude
|
||||
* @param $map_group_id
|
||||
* @param $map_connection_list
|
||||
* @param $arrayLayers
|
||||
*/
|
||||
function saveMap2($map_name, $map_initial_longitude, $map_initial_latitude,
|
||||
$map_initial_altitude, $map_zoom_level, $map_background,
|
||||
|
|
|
@ -19,25 +19,63 @@ require_once ("include/config.php");
|
|||
check_login ();
|
||||
|
||||
require_once ('include/functions_gis.php');
|
||||
require_once ('include/functions_ui.php');
|
||||
|
||||
$opt = get_parameter('opt');
|
||||
|
||||
switch ($opt) {
|
||||
case 'point_info':
|
||||
case 'point_path_info':
|
||||
$id = get_parameter('id');
|
||||
$row = get_db_row_sql('SELECT * FROM tgis_data WHERE id_tgis_data = ' . $id);
|
||||
|
||||
$row = array('id_tgis_data' => 0, 'longitude' => -3.709,
|
||||
'latitude' => 40.422, 'altitude' => 0, 'end_timestamp' => '2010-01-14 17:19:45', 'start_timestamp' => '2010-01-12 17:19:45', 'manual_placemen' => 1, 'tagente_id_agente' => 1);
|
||||
$returnJSON = array();
|
||||
$returnJSON['correct'] = 1;
|
||||
$returnJSON['content'] = __('Agent') . ': <a style="font-weight: bolder;" href="?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $row['tagente_id_agente'] . '">'.get_agent_name($row['tagente_id_agente']).'</a><br />';
|
||||
$returnJSON['content'] .= __('Position (Long, Lat, Alt)') . ': (' . $row['longitude'] . ', ' . $row['latitude'] . ', ' . $row['altitude'] . ') <br />';
|
||||
$returnJSON['content'] .= __('Start contact') . ': ' . $row['start_timestamp'] . '<br />';
|
||||
$returnJSON['content'] .= __('Last contact') . ': ' . $row['end_timestamp'] . '<br />';
|
||||
$returnJSON['content'] .= __('Num reports') . ': '.$row['number_of_packages'].'<br />';
|
||||
if ($row['manual_placemen']) $returnJSON['content'] .= '<br />' . __('Manual placement') . '<br />';
|
||||
|
||||
echo json_encode($returnJSON);
|
||||
|
||||
break;
|
||||
case 'point_agent_info':
|
||||
$id = get_parameter('id');
|
||||
$row = get_db_row_sql('SELECT * FROM tagente WHERE id_agente = ' . $id);
|
||||
|
||||
$returnJSON = array();
|
||||
$returnJSON['correct'] = 1;
|
||||
$returnJSON['content'] = __('Agent') . ': <a style="font-weight: bolder;" href="?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $row['tagente_id_agente'] . '">pepito</a><br />';
|
||||
$returnJSON['content'] .= __('Position') . ': (' . $row['longitude'] . ', ' . $row['latitude'] . ', ' . $row['altitude'] . ') <br />';
|
||||
$returnJSON['content'] .= __('Start contact') . ': ' . $row['start_timestamp'] . '<br />';
|
||||
$returnJSON['content'] .= __('Last contact') . ': ' . $row['end_timestamp'] . '<br />';
|
||||
$returnJSON['content'] .= __('Num reports') . ': 666<br />'; //$row['num_packages']; //TODO
|
||||
if ($row['manual_placemen']) $returnJSON['content'] .= '<br />' . __('Manual placement') . '<br />';
|
||||
$returnJSON['content'] = __('Agent') . ': <a style="font-weight: bolder;" href="?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $row['id_agente'] . '">'.$row['nombre'].'</a><br />';
|
||||
$returnJSON['content'] .= __('Position (Long, Lat, Alt)') . ': (' . $row['last_longitude'] . ', ' . $row['last_latitude'] . ', ' . $row['last_altitude'] . ') <br />';
|
||||
$agent_ip_address = get_agent_address ($id_agente);
|
||||
if ($agent_ip_address || $agent_ip_address != '') {
|
||||
$returnJSON['content'] .= __('IP Address').': '.get_agent_address ($id_agente).'<br />';
|
||||
}
|
||||
$returnJSON['content'] .= __('OS').': '.print_os_icon($row['id_os'], true, true);
|
||||
|
||||
$osversion_offset = strlen($row["os_version"]);
|
||||
if ($osversion_offset > 15) {
|
||||
$osversion_offset = $osversion_offset - 15;
|
||||
}
|
||||
else {
|
||||
$osversion_offset = 0;
|
||||
}
|
||||
$returnJSON['content'] .= ' ( <i><span title="'.$row["os_version"].'">'.substr($row["os_version"],$osversion_offset,15).'</span></i>)<br />';
|
||||
$agent_description = $row['comentarios'];
|
||||
if ($agent_description || $agent_description != '') {
|
||||
$returnJSON['content'] .= __('Description').': '.$agent_description.'<br />';
|
||||
}
|
||||
$returnJSON['content'] .= __('Group').': '.print_group_icon ($row["id_grupo"], true).' (<strong>'.get_group_name ($row["id_grupo"]).'</strong>)<br />';
|
||||
$returnJSON['content'] .= __('Agent Version').': '.$row["agent_version"].'<br />';
|
||||
$returnJSON['content'] .= __('Last contact')." / ".__('Remote').': '. $row["ultimo_contacto"]. " / ";
|
||||
if ($row["ultimo_contacto_remoto"] == "0000-00-00 00:00:00") {
|
||||
$returnJSON['content'] .=__('Never');
|
||||
} else {
|
||||
$returnJSON['content'] .= $row["ultimo_contacto_remoto"];
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo json_encode($returnJSON);
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ if ($maps !== false) {
|
|||
}
|
||||
$data = array ();
|
||||
|
||||
$data[0] = '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&id='.
|
||||
$data[0] = '<a href="index.php?sec=gismaps&sec2=operation/gis_maps/render_view&map_id='.
|
||||
$map['id_tgis_map'] . '">' . $map['map_name'].'</a> ';
|
||||
$data[1] = print_group_icon ($map["group_id"], true);
|
||||
|
||||
|
|
|
@ -20,13 +20,26 @@ check_login ();
|
|||
|
||||
require_once ('include/functions_gis.php');
|
||||
|
||||
$idMap = (int) get_parameter ('id');
|
||||
$idMap = (int) get_parameter ('map_id');
|
||||
$show_history = get_parameter ('show_history', 'n');
|
||||
|
||||
$map = get_db_row ('tgis_map', 'id_tgis_map', $idMap);
|
||||
$confMap = getMapConf($idMap);
|
||||
$baseLayers = $confMap['baselayer'];
|
||||
$controls = $confMap['controls'][0];
|
||||
$numZoomLevels = $confMap['numLevelsZoom'][0];
|
||||
|
||||
$num_baselayer=0;
|
||||
foreach ($confMap as $mapC) {
|
||||
|
||||
$baselayers[$num_baselayer]['typeBaseLayer'] = $mapC['connection_type'];
|
||||
$baselayers[$num_baselayer]['name'] = $mapC['conection_name'];
|
||||
$decodeJSON = json_decode($mapC['conection_data'], true);
|
||||
$baselayers[$num_baselayer]['url'] = $decodeJSON['url'];
|
||||
$num_baselayer++;
|
||||
if ($mapC['default_map_connection'] == 1) {
|
||||
$numZoomLevels = $mapC['num_zoom_levels'];
|
||||
}
|
||||
}
|
||||
|
||||
$controls = array('PanZoom', 'ScaleLine', 'Navigation', 'MousePosition', 'OverviewMap');
|
||||
|
||||
$layers = getLayers($idMap);
|
||||
|
||||
|
@ -35,11 +48,11 @@ echo "<h2>".__('Visual console')." » ".__('Map');
|
|||
echo " " . $map['map_name'] . " ";
|
||||
|
||||
if ($config["pure"] == 0) {
|
||||
echo '<a href="index.php?sec=visualc&sec2=operation/gis_maps/render_view&id='.$idMap.'&refr='.$config["refr"].'&pure=1">';
|
||||
echo '<a href="index.php?sec=visualc&sec2=operation/gis_maps/render_view&map_id='.$idMap.'&refr='.$config["refr"].'&pure=1">';
|
||||
print_image ("images/fullscreen.png", false, array ("title" => __('Full screen mode')));
|
||||
echo "</a>";
|
||||
} else {
|
||||
echo '<a href="index.php?sec=visualc&sec2=operation/gis_maps/render_view&id='.$idMap.'&refr='.$config["refr"].'">';
|
||||
echo '<a href="index.php?sec=visualc&sec2=operation/gis_maps/render_view&map_id='.$idMap.'&refr='.$config["refr"].'">';
|
||||
print_image ("images/normalscreen.png", false, array ("title" => __('Back to normal mode')));
|
||||
echo "</a>";
|
||||
}
|
||||
|
@ -47,11 +60,11 @@ if ($config["pure"] == 0) {
|
|||
echo " ";
|
||||
|
||||
if (give_acl ($config["id_user"], $map['group_id'], "AW"))
|
||||
echo '<a href="index.php?sec=gmap&sec2=godmode/reporting/map_builder&id_map='.$idMap.'">'.print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
|
||||
echo '<a href="index.php?sec=gmap&sec2=godmode/reporting/map_builder&map_id='.$idMap.'">'.print_image ("images/setup.png", true, array ("title" => __('Setup'))).'</a>';
|
||||
echo "</h2>";
|
||||
|
||||
printMap('map', $map['zoom_level'], $numZoomLevels, $map['initial_latitude'],
|
||||
$map['initial_longitude'], array($baseLayers[0]['typeBaseLayer'] => $baseLayers[0]['url']), $controls);
|
||||
$map['initial_longitude'], $baselayers, $controls);
|
||||
|
||||
if ($layers != false) {
|
||||
foreach ($layers as $layer) {
|
||||
|
@ -84,9 +97,10 @@ if ($layers != false) {
|
|||
$status = false;
|
||||
}
|
||||
$icon = get_agent_icon_map($idAgent, $status);
|
||||
|
||||
if ($show_history=='y'){
|
||||
addPath($layer['layer_name'], $idAgent);
|
||||
addPoint($layer['layer_name'], $agentName, $coords['last_latitude'], $coords['last_longitude'], $icon);
|
||||
}
|
||||
addPoint($layer['layer_name'], $agentName, $coords['last_latitude'], $coords['last_longitude'], $icon, 20, 20, $idAgent, 'point_agent_info');
|
||||
}
|
||||
}
|
||||
activateSelectControl();
|
||||
|
@ -94,4 +108,10 @@ if ($layers != false) {
|
|||
|
||||
?>
|
||||
<br /><br />
|
||||
<div id='map' style='width: 99%; height: 400px; border: 1px solid black;' ></div>
|
||||
<?php
|
||||
if ($config["pure"] == 0) {
|
||||
echo "<div id='map' style='width: 99%; height: 400px; border: 1px solid black;' ></div>";
|
||||
}
|
||||
else {
|
||||
echo "<div id='map' style='position:absolute;top:40px; z-index:100; width: 98%; height:94%; border: 1px solid black;' ></div>";
|
||||
}
|
Loading…
Reference in New Issue