also consider the resolutions array if no zoomOffset is provided. r=bartvde (closes #3485)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12357 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-09-12 04:26:32 +00:00
parent 98be6e313b
commit 22bd5fa546
5 changed files with 37 additions and 10 deletions

View File

@@ -297,7 +297,10 @@ OpenLayers.Layer = OpenLayers.Class({
/**
* APIProperty: wrapDateLine
* {Boolean} #487 for more info.
* {Boolean} Wraps the world at the international dateline, so the map can
* be panned infinitely in longitudinal direction. Only use this on the
* base layer, and only if the layer's maxExtent equals the world bounds.
* #487 for more info.
*/
wrapDateLine: false,

View File

@@ -247,7 +247,11 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
// *partially* contained by our tiles (IE user has
// programmatically panned to the other side of the earth)
// then we want to reTile (thus, partial true).
//
//
var maxExtent = this.map.getMaxExtent(),
bl = new OpenLayers.LonLat(bounds.left, bounds.bottom).wrapDateLine(maxExtent),
tr = new OpenLayers.LonLat(bounds.right, bounds.top).wrapDateLine(maxExtent);
bounds = new OpenLayers.Bounds(bl.lon, bl.lat, tr.lon, tr.lat);
if (forceReTile || !tilesBounds.containsBounds(bounds, true)) {
this.initGriddedTiles(bounds);
} else {

View File

@@ -144,8 +144,9 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
(res * this.tileSize.w));
var y = Math.round((this.maxExtent.top - bounds.top) /
(res * this.tileSize.h));
var z = this.serverResolutions != null ?
OpenLayers.Util.indexOf(this.serverResolutions, res) :
var resolutions = this.serverResolutions || this.resolutions;
var z = this.zoomOffset == 0 ?
OpenLayers.Util.indexOf(resolutions, res) :
this.map.getZoom() + this.zoomOffset;
var limit = Math.pow(2, z);

View File

@@ -133,6 +133,14 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
this.translate(0, 0);
return true;
} else {
var maxExtent = this.map.getMaxExtent(),
width = maxExtent.getWidth() / resolution;
if (extent.left < maxExtent.left) {
extent.left += width;
}
if (extent.right > maxExtent.right) {
extent.left -= width;
}
var inRange = this.translate(left - this.left, top - this.top);
if (!inRange) {
// recenter the coordinate system