Merge pull request #3 from fredj/proj-defaults

Proj defaults
This commit is contained in:
ahocevar
2012-02-15 04:23:47 -08:00

View File

@@ -70,24 +70,14 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, options) {
if (options && options.sphericalMercator || this.sphericalMercator) {
options = OpenLayers.Util.extend({
maxExtent: new OpenLayers.Bounds(
-128 * 156543.03390625,
-128 * 156543.03390625,
128 * 156543.03390625,
128 * 156543.03390625
),
maxResolution: 156543.03390625,
numZoomLevels: 19,
units: "m",
projection: "EPSG:900913"
}, options);
options = options || {};
if (options.sphericalMercator || this.sphericalMercator) {
options.projection = new OpenLayers.Projection('EPSG:900913');
options.numZoomLevels = 19;
}
url = url || this.url;
name = name || this.name;
var newArguments = [name, url, {}, options];
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, [
name || this.name, url || this.url, {}, options
]);
},
/**
@@ -157,10 +147,9 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
OpenLayers.Util.indexOf(resolutions, res) :
this.getServerZoom() + this.zoomOffset;
var limit = Math.pow(2, z);
if (this.wrapDateLine)
{
x = ((x % limit) + limit) % limit;
if (this.wrapDateLine) {
var limit = Math.pow(2, z);
x = ((x % limit) + limit) % limit;
}
return {'x': x, 'y': y, 'z': z};