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

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to