diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 58324cf4ef..1eaaede3e8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2013-05-20 Miguel de Dios + + * operation/gis_maps/ajax.php, + include/javascript/openlayers.pandora.js, include/functions_gis.php: + lost changes to set the size of agent icons. + 2013-05-20 Miguel de Dios * pandoradb.data.postgreSQL.sql, pandoradb.data.oracle.sql, diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php index d2b60321ec..a671c97ef6 100644 --- a/pandora_console/include/functions_gis.php +++ b/pandora_console/include/functions_gis.php @@ -251,7 +251,7 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null) { var refreshAjaxIntervalSeconds = 60000; var idIntervalAjax = null; var oldRefreshAjaxIntervalSeconds = 60000; - + - + function refreshAjaxLayer(layer) { var featureIdArray = Array(); for (featureIndex = 0; featureIndex < layer.features.length; featureIndex++) { feature = layer.features[featureIndex]; - + if (feature.data.type != 'point_path_info') { if (feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { featureIdArray.push(feature.data.id); } } } - + if (featureIdArray.length > 0) { jQuery.ajax ({ data: "page=operation/gis_maps/ajax&opt=get_new_positions&id_features=" + featureIdArray.toString() @@ -285,7 +285,7 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null) { success: function (data) { if (data.correct) { content = $.evalJSON(data.content); - + if (content != null) { for (var idAgent in content) { if (isInt(idAgent)) { @@ -296,11 +296,18 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null) { delete feature; feature = null status = parseInt(agentDataGIS['status']); - - js_addAgentPointExtent(layer.name, agentDataGIS['name'], - agentDataGIS['stored_longitude'], agentDataGIS['stored_latitude'], - agentDataGIS['icon_path'], 20, 20, idAgent, 'point_agent_info', status, agentDataGIS['id_parent']); - + + js_addAgentPointExtent(layer.name, + agentDataGIS['name'], + agentDataGIS['stored_longitude'], + agentDataGIS['stored_latitude'], + agentDataGIS['icon_path'], + agentDataGIS['icon_width'], + agentDataGIS['icon_height'], + idAgent, + 'point_agent_info', status, + agentDataGIS['id_parent']); + //TODO: Optimize, search a new position to call for all agent in the layer and or optimice code into function. js_refreshParentLines(); } @@ -311,7 +318,7 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null) { }); } } - + function clock_ajax_refresh() { //console.log(new Date().getHours() + ":" + new Date().getMinutes() + ":" + new Date().getSeconds()); for (layerIndex = 0; layerIndex < map.getNumLayers(); layerIndex++) { @@ -337,7 +344,7 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null) { } last_time_of_data = Math.round(new Date().getTime() / 1000); //Unixtimestamp - + //Test if the user change the refresh time. if (oldRefreshAjaxIntervalSeconds != refreshAjaxIntervalSeconds) { clearInterval(idIntervalAjax); @@ -345,7 +352,7 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null) { oldRefreshAjaxIntervalSeconds = refreshAjaxIntervalSeconds; } } - + $(document).ready ( function () { idIntervalAjax = setInterval("clock_ajax_refresh()", refreshAjaxIntervalSeconds); @@ -357,7 +364,7 @@ function gis_activate_ajax_refresh($layers = null, $lastTimeOfData = null) { function gis_add_agent_point($layerName, $pointName, $lat, $lon, $icon = null, $width = 20, $height = 20, $point_id = '', $status = -1, $type_string = '', $idParent = 0) { - + global $config; if (!$config['gis_label']) $pointName = ''; @@ -610,7 +617,7 @@ function gis_save_map_connection($mapConnection_name, $mapConnection_group, $mapConnection_defaultAltitude, $mapConnection_centerLatitude, $mapConnection_centerLongitude, $mapConnection_centerAltitude, $mapConnectionData, $idConnectionMap = null) { - + if ($idConnectionMap !== null) { $returnQuery = db_process_sql_update('tgis_map_connection', array( diff --git a/pandora_console/include/javascript/openlayers.pandora.js b/pandora_console/include/javascript/openlayers.pandora.js index 558ca810b8..6c9f1df4ff 100755 --- a/pandora_console/include/javascript/openlayers.pandora.js +++ b/pandora_console/include/javascript/openlayers.pandora.js @@ -563,7 +563,7 @@ function js_addPoint(layerName, pointName, lon, lat, id, type_string, statusAgen function js_addAgentPointExtent(layerName, pointName, lon, lat, icon, width, height, id, type_string, statusAgent, idParent) { var point = new OpenLayers.Geometry.Point(lon, lat) .transform(map.displayProjection, map.getProjectionObject()); - + var layer = map.getLayersByName(layerName); layer = layer[0]; diff --git a/pandora_console/operation/gis_maps/ajax.php b/pandora_console/operation/gis_maps/ajax.php index 6e5f1ae429..0299f4cbaf 100644 --- a/pandora_console/operation/gis_maps/ajax.php +++ b/pandora_console/operation/gis_maps/ajax.php @@ -119,8 +119,15 @@ switch ($opt) { if (!$config['gis_label']) $row['nombre'] = ''; + $icon = gis_get_agent_icon_map($row['tagente_id_agente'], true, $status); + $icon_size = getimagesize($icon); + $icon_width = $icon_size[0]; + $icon_height = $icon_size[1]; + $agents[$row['tagente_id_agente']] = array( - 'icon_path' => gis_get_agent_icon_map($row['tagente_id_agente'], true, $status), + 'icon_path' => $icon, + 'icon_width' => $icon_width, + 'icon_height' => $icon_height, 'name' => $row['nombre'], 'status' => $status, 'stored_longitude' => $row['stored_longitude'],