Improved dateline handling for Grid layers. r=bartvde (closes #3521)

This commit is contained in:
ahocevar
2011-09-28 07:43:58 -06:00
4 changed files with 116 additions and 7 deletions
+12
View File
@@ -403,6 +403,18 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
* tileoffsetlat, tileoffsetx, tileoffsety
*/
calculateGridLayout: function(bounds, origin, resolution) {
bounds = bounds.clone();
if (this.map.baseLayer.wrapDateLine) {
var maxExtent = this.map.getMaxExtent(),
width = maxExtent.getWidth();
// move the bounds one world width to the right until the origin is
// within the world extent
while (bounds.left < maxExtent.left) {
bounds.left += width;
bounds.right += width;
}
}
var tilelon = resolution * this.tileSize.w;
var tilelat = resolution * this.tileSize.h;