[OpenLayers-Users] refresh some tiles dynamically
wangyang
cnwy at 263.net
Sat Jun 18 13:08:48 EDT 2011
Hi,
I want to refresh some tiles by features, below is my code and want to
improve the code to refresh image:
refreshByFeatures:function() {
var features = this.featuresCache; //stores the features info
var bounds;
if (features) {
for (var i = 0; i < features.length; ++i) {
if (!bounds) {
bounds = features[i].geometry.getBounds();
} else {
bounds.extend(features[i].geometry.getBounds());
}
}
}
if (bounds) {
var layer = map.getLayersByName(lay_name)[0];
var tiles = layer.grid;
for (var i = 0,rows = tiles.length; i < rows; i++) {
for (var j = 0,cols = tiles[i].length; j < cols; j++) {
var tile = tiles[i][j];
var tilesBounds = tile.bounds;
//
if (tilesBounds.intersectsBounds(bounds)) {
//to refresh the tile, I have to append something to
the url to tell browser to retrieve the image. Is there an elegant way?
tile.imgDiv.src += '&1=1';
}
}
}
}
}
Thanks.
wangyang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110619/e6f828db/attachment.html
More information about the Users
mailing list