Absolute calculation of tile bounds
This avoids cumulated tile bounds errors for layer types that do not use a tile row/column index in requests (e.g. WMS).
This commit is contained in:
@@ -867,7 +867,8 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
*
|
||||
* Returns:
|
||||
* {Object} containing properties tilelon, tilelat, tileoffsetlat,
|
||||
* tileoffsetlat, tileoffsetx, tileoffsety
|
||||
* tileoffsetlat, tileoffsetx, tileoffsety and optional startrow, startcol
|
||||
* for grid layouts where absolute tile bounds calculation is possible.
|
||||
*/
|
||||
calculateGridLayout: function(bounds, origin, resolution) {
|
||||
var tilelon = resolution * this.tileSize.w;
|
||||
@@ -894,7 +895,8 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
return {
|
||||
tilelon: tilelon, tilelat: tilelat,
|
||||
tileoffsetlon: tileoffsetlon, tileoffsetlat: tileoffsetlat,
|
||||
tileoffsetx: tileoffsetx, tileoffsety: tileoffsety
|
||||
tileoffsetx: tileoffsetx, tileoffsety: tileoffsety,
|
||||
startcol: tilecol, startrow: tilerow
|
||||
};
|
||||
|
||||
},
|
||||
@@ -1012,12 +1014,16 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
||||
Math.pow(tileCenter.lat - center.lat, 2)
|
||||
});
|
||||
|
||||
tileoffsetlon += tilelon;
|
||||
tileoffsetlon = 'startcol' in tileLayout ?
|
||||
origin.lon + (tileLayout.startcol + colidx) * tilelon :
|
||||
tileoffsetlon + tilelon;
|
||||
tileoffsetx += Math.round(tileSize.w);
|
||||
} while ((tileoffsetlon <= bounds.right + tilelon * this.buffer)
|
||||
|| colidx < minCols);
|
||||
|
||||
tileoffsetlat -= tilelat;
|
||||
tileoffsetlat = 'startrow' in tileLayout ?
|
||||
origin.lat + (tileLayout.startrow - rowidx) * tilelat :
|
||||
tileoffsetlat - tilelat;
|
||||
tileoffsety += Math.round(tileSize.h);
|
||||
} while((tileoffsetlat >= bounds.bottom - tilelat * this.buffer)
|
||||
|| rowidx < minRows);
|
||||
|
||||
Reference in New Issue
Block a user