Adding wrapDateLine support for XYZ layers. The OSM layer now wraps the date line by default. p=tomh, r=me (Closes #2246)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11864 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
pgiraud
2011-04-04 07:20:48 +00:00
parent 035a30021d
commit e140a5d843
3 changed files with 23 additions and 2 deletions
+7
View File
@@ -148,6 +148,12 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
OpenLayers.Util.indexOf(this.serverResolutions, res) :
this.map.getZoom() + this.zoomOffset;
var limit = Math.pow(2, z);
if (this.wrapDateLine)
{
x = ((x % limit) + limit) % limit;
}
return {'x': x, 'y': y, 'z': z};
},
@@ -199,5 +205,6 @@ OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {
obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
return obj;
},
wrapDateLine: true,
CLASS_NAME: "OpenLayers.Layer.OSM"
});