We round these values to four decimale places: This saves us on rounding errors on the client-side, which could theoretically increase our cache size when we hit them, and in the case of the left/top values, this also makes sure that we get the closest pixel value, not the integer of it -- this is important when we get around to requesting the tiles, since otherwise we end up a pixel off, and then we don't get our images back.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@821 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -42,11 +42,11 @@ OpenLayers.Layer.KaMap.prototype =
|
||||
var zoom = this.map.getZoom();
|
||||
var maxRes = this.map.maxResolution;
|
||||
var mapRes = this.map.getResolution();
|
||||
var scale = (((this.tileSize.w * this.map.maxResolution * this.resolution) * (this.scales[this.units])) / this.tileSize.w) / Math.pow(2, zoom);
|
||||
var scale = Math.round( (((this.tileSize.w * this.map.maxResolution * this.resolution) * (this.scales[this.units])) / this.tileSize.w) / Math.pow(2, zoom) * 10000 ) / 10000;
|
||||
|
||||
var cellSize = new OpenLayers.Size(mapRes*this.tileSize.w, mapRes*this.tileSize.h);
|
||||
var pX = Math.floor(((bounds.left) / cellSize.w) * this.tileSize.w);
|
||||
var pY = -Math.floor(((bounds.top) / cellSize.h) * this.tileSize.h);
|
||||
var pX = Math.round(((bounds.left) / cellSize.w) * this.tileSize.w);
|
||||
var pY = -Math.round(((bounds.top) / cellSize.h) * this.tileSize.h);
|
||||
var url = this.getFullRequestString(
|
||||
{ t: pY,
|
||||
l: pX,
|
||||
|
||||
Reference in New Issue
Block a user