KaMap uses a different initTiles because it doesn't use the same starting

point for '0,0'. This meant that with the new initTiles change, we were
not adding enough buffer tiles around the kamap layers, so they would
display funkily. This fixes that issue.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@1156 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-08-09 13:38:59 +00:00
parent 2991ae3191
commit 7a3f9b8444

View File

@@ -77,13 +77,6 @@ OpenLayers.Layer.KaMap.prototype =
_initTiles:function() {
//first of all, clear out the main div
this.div.innerHTML = "";
//now clear out the old grid and start a new one
this.clearGrid();
this.grid = new Array();
var viewSize = this.map.getSize();
var bounds = this.map.getExtent();
var extent = this.map.getMaxExtent();
@@ -111,31 +104,53 @@ OpenLayers.Layer.KaMap.prototype =
var startX = tileoffsetx;
var startLon = tileoffsetlon;
var rowidx = 0;
do {
var row = new Array();
var row;
row = this.grid[rowidx++];
if (!row) {
row = new Array();
this.grid.push(row);
}
tileoffsetlon = startLon;
tileoffsetx = startX;
var colidx = 0;
do {
var tileBounds = new OpenLayers.Bounds(tileoffsetlon,
tileoffsetlat,
tileoffsetlon + tilelon,
tileoffsetlat + tilelat);
var tile = this.addTile(tileBounds,
new OpenLayers.Pixel(tileoffsetx - parseInt(this.map.layerContainerDiv.style.left),
tileoffsety - parseInt(this.map.layerContainerDiv.style.top))
);
var x = tileoffsetx;
x -= parseInt(this.map.layerContainerDiv.style.left);
var y = tileoffsety;
y -= parseInt(this.map.layerContainerDiv.style.top);
var px = new OpenLayers.Pixel(x, y);
var tile;
tile = row[colidx++];
if (!tile) {
tile = this.addTile(tileBounds, px);
tile.draw();
row.push(tile);
} else {
tile.moveTo(tileBounds, px);
}
tileoffsetlon += tilelon;
tileoffsetx += this.tileSize.w;
} while (tileoffsetlon < bounds.right)
} while (tileoffsetlon <= bounds.right + tilelon * this.buffer)
tileoffsetlat -= tilelat;
tileoffsety += this.tileSize.h;
} while(tileoffsetlat > bounds.bottom - tilelat)
} while(tileoffsetlat >= bounds.bottom - tilelat * this.buffer)
},