2010-03-02 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_gis.php: add function "addParentLines", in ths function make a hierachy layer and call "js_refreshParentLines" for paint hierachy lines. In function "activateAjaxRefresh" use the function "js_refreshParentLines" for repaint the lines. *include/javascript/openlayers.pandora.js: add the global var "storeLayerNameHierachy" for save the text localiced name of Hierachy lines layer. Add the function "js_refreshParentLines" for paint the lines from parent to sons. In function "changeShowStatus" add the "js_refreshParentLines" * operation/gis_maps/render_view.php: use the function "addParentLines" for start the parent lines. * operation/agentes/gis_view.php: clean sourcecode. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2442 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
4c577a9cb0
commit
ee6e942096
|
@ -1,4 +1,22 @@
|
|||
2010-03-01 Miguel de Dios <miguel.dedios@artica.es>
|
||||
2010-03-02 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_gis.php: add function "addParentLines", in ths function
|
||||
make a hierachy layer and call "js_refreshParentLines" for paint hierachy
|
||||
lines. In function "activateAjaxRefresh" use the function
|
||||
"js_refreshParentLines" for repaint the lines.
|
||||
|
||||
*include/javascript/openlayers.pandora.js: add the global var
|
||||
"storeLayerNameHierachy" for save the text localiced name of Hierachy lines
|
||||
layer. Add the function "js_refreshParentLines" for paint the lines from
|
||||
parent to sons. In function "changeShowStatus" add the
|
||||
"js_refreshParentLines"
|
||||
|
||||
* operation/gis_maps/render_view.php: use the function "addParentLines" for
|
||||
start the parent lines.
|
||||
|
||||
* operation/agentes/gis_view.php: clean sourcecode.
|
||||
|
||||
2010-03-02 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* operation/gis_maps/ajax.php: fix the query to extract the GIS data for
|
||||
agent, in any moment in the past I dirty the query, but now it's clean, and
|
||||
|
|
|
@ -12,6 +12,29 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
/**
|
||||
* Print javascript to add parent lines between the agents.
|
||||
*
|
||||
* @param inteer $idMap The id of map.
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
function addParentLines() {
|
||||
makeLayer(__('Agent hierarchy'));
|
||||
|
||||
echo "<script type='text/javascript'>";
|
||||
echo "$(document).ready (function () {
|
||||
var layer = map.getLayersByName('" . __('Hierarchy agent') . "');
|
||||
layer = layer[0];
|
||||
|
||||
map.setLayerIndex(layer, 0);
|
||||
|
||||
js_refreshParentLines('" . __('Hierarchy agent') . "');
|
||||
});";
|
||||
echo "</script>";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the data of last position of agent from tgis_data_status.
|
||||
*
|
||||
|
@ -326,6 +349,9 @@ function activateAjaxRefresh($layers = null, $lastTimeOfData = null) {
|
|||
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']);
|
||||
|
||||
//TODO: Optimize, search a new position to call for all agent in the layer and or optimice code into function.
|
||||
js_refreshParentLines();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -358,6 +384,7 @@ function activateAjaxRefresh($layers = null, $lastTimeOfData = null) {
|
|||
}
|
||||
?>
|
||||
}
|
||||
|
||||
last_time_of_data = Math.round(new Date().getTime() / 1000); //Unixtimestamp
|
||||
|
||||
//Test if the user change the refresh time.
|
||||
|
|
|
@ -14,6 +14,60 @@
|
|||
|
||||
var map; // Map global var object is use in multiple places.
|
||||
var statusShow = 'all';
|
||||
//The name of layer hierachy because in PHP change the text name into language of user.
|
||||
var storeLayerNameHierachy = '';
|
||||
|
||||
function js_refreshParentLines(layerName) {
|
||||
if (typeof(layerName) == 'undefined') {
|
||||
layerName = storeLayerNameHierachy;
|
||||
}
|
||||
else {
|
||||
storeLayerNameHierachy = layerName;
|
||||
}
|
||||
|
||||
listFeaturesWithParents = Array();
|
||||
|
||||
jQuery.each(map.getLayersByClass("OpenLayers.Layer.Vector"), function (i, layer) {
|
||||
visible = layer.visibility;
|
||||
|
||||
jQuery.each(layer.features, function (i, feature) {
|
||||
if (feature.data.type == "point_agent_info") {
|
||||
id_parent = feature.data.id_parent;
|
||||
long_lat = feature.data.long_lat;
|
||||
id = feature.data.id;
|
||||
status = feature.data.status;
|
||||
|
||||
listFeaturesWithParents[id] = {'id': id, 'id_parent': id_parent, 'long_lat': long_lat, 'status': status, 'visible': visible};
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var layer = map.getLayersByName(layerName);
|
||||
layer = layer[0];
|
||||
|
||||
layer.destroyFeatures();
|
||||
|
||||
jQuery.each(listFeaturesWithParents, function (i, feature) {
|
||||
if (typeof(feature) == 'undefined') return;
|
||||
if (feature.id_parent == 0) return;
|
||||
if ((!feature.visible)
|
||||
|| (!listFeaturesWithParents[feature.id_parent].visible)) return;
|
||||
if ((isHideFeatureByStatus(feature.status))
|
||||
|| (isHideFeatureByStatus(listFeaturesWithParents[feature.id_parent].status))) return;
|
||||
|
||||
points = new Array();
|
||||
|
||||
points[0] = new OpenLayers.Geometry.Point(feature.long_lat.lon, feature.long_lat.lat);
|
||||
points[1] = new OpenLayers.Geometry.Point(listFeaturesWithParents[feature.id_parent].long_lat.lon, listFeaturesWithParents[feature.id_parent].long_lat.lat);
|
||||
|
||||
var line = new OpenLayers.Feature.Vector(
|
||||
new OpenLayers.Geometry.LineString(points),
|
||||
null,
|
||||
{ strokeWidth: 2, fillOpacity: 0.2, fillColor: 'red', strokeDashstyle: "dash", strokeColor: 'red'});
|
||||
|
||||
layer.addFeatures(line);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicialize the map in the browser and the object map.
|
||||
|
@ -157,6 +211,7 @@ function changeShowStatus(newShowStatus) {
|
|||
$("#button_status_" + statusShow).attr('style', 'border: 1px black solid;');
|
||||
|
||||
hideAgentsStatus();
|
||||
js_refreshParentLines();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,7 +67,6 @@ $intervals[172800] = human_time_description_raw (172800);
|
|||
$intervals[604800] = human_time_description_raw (604800);
|
||||
|
||||
echo "<br />";
|
||||
//debugPrint($_SERVER);
|
||||
echo "<form action='index.php?" . $_SERVER['QUERY_STRING'] . "' method='POST'>";
|
||||
echo __("Period to show data as path") . ": ";
|
||||
print_extended_select_for_time ($intervals, 'period', $period, '', '', '0', 10);
|
||||
|
|
|
@ -138,6 +138,7 @@ if ($layers != false) {
|
|||
$coords['stored_longitude'], $icon, 20, 20, $idAgent, $status, 'point_agent_info', $parent);
|
||||
}
|
||||
}
|
||||
addParentLines();
|
||||
|
||||
$timestampLastOperation = get_db_value_sql("SELECT UNIX_TIMESTAMP()");
|
||||
|
||||
|
|
Loading…
Reference in New Issue