[OpenLayers-Commits] r3644 - in sandbox/euzuro/untiled3: examples lib/OpenLayers/Layer
commits at openlayers.org
commits at openlayers.org
Fri Jul 6 21:17:04 EDT 2007
Author: euzuro
Date: 2007-07-06 21:17:03 -0400 (Fri, 06 Jul 2007)
New Revision: 3644
Modified:
sandbox/euzuro/untiled3/examples/layerLoadMonitoring.html
sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js
Log:
add progress indicator event - tileloaded. add bling to the example to keep up
Modified: sandbox/euzuro/untiled3/examples/layerLoadMonitoring.html
===================================================================
--- sandbox/euzuro/untiled3/examples/layerLoadMonitoring.html 2007-07-07 00:55:18 UTC (rev 3643)
+++ sandbox/euzuro/untiled3/examples/layerLoadMonitoring.html 2007-07-07 01:17:03 UTC (rev 3644)
@@ -42,11 +42,15 @@
{ singleTile: false, buffer:0}
);
- layer.events.register("loadstart", this, function() {
+ layer.events.register("loadstart", layer, function() {
logEvent("Load Start");
});
+
+ layer.events.register("tileloaded", layer, function() {
+ logEvent("Tile loaded. " + this.numLoadingTiles + " left.");
+ });
- layer.events.register("loadend", this, function() {
+ layer.events.register("loadend", layer, function() {
logEvent("Load End");
});
@@ -81,6 +85,10 @@
layer.redraw();
}
+ function clearLog() {
+ eventsLog.innerHTML = "<b>Events Log:</b>";
+ }
+
// -->
</script>
</head>
@@ -113,6 +121,10 @@
<input type="radio" name="tiling" value="single" onclick="configureTiling(this.value);"/>
Single Tile
</td>
+ <td style="width:25px"> </td>
+ <td>
+ <input type="button" value="Clear" onclick="clearLog()"/>
+ </td>
</td>
</table>
</div>
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js 2007-07-07 00:55:18 UTC (rev 3643)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js 2007-07-07 01:17:03 UTC (rev 3644)
@@ -62,6 +62,14 @@
initialize: function(name, url, params, options) {
OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
arguments);
+
+ //grid layers will trigger 'tileloaded' when each new tile is
+ // loaded, as a means of progress update to listeners.
+ // listeners can access 'numLoadingTiles' if they wish to keep track
+ // of the loading progress
+ //
+ this.events.addEventType("tileloaded");
+
this.grid = new Array();
},
@@ -283,13 +291,13 @@
if (this.numLoadingTiles == 0) {
this.events.triggerEvent("loadstart");
}
-
this.numLoadingTiles++;
};
tile.events.register("loadstart", this, tile.onLoadStart);
tile.onLoadEnd = function() {
this.numLoadingTiles--;
+ this.events.triggerEvent("tileloaded");
//if that was the last tile, then trigger a 'loadend' on the layer
if (this.numLoadingTiles == 0) {
this.events.triggerEvent("loadend");
More information about the Commits
mailing list