Merge pull request #3 from fredj/proj-defaults

Proj defaults
This commit is contained in:
ahocevar
2012-02-15 04:23:47 -08:00
+10 -21
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 * options - {Object} Hashtable of extra options to tag onto the layer
*/ */
initialize: function(name, url, options) { initialize: function(name, url, options) {
if (options && options.sphericalMercator || this.sphericalMercator) { options = options || {};
options = OpenLayers.Util.extend({ if (options.sphericalMercator || this.sphericalMercator) {
maxExtent: new OpenLayers.Bounds( options.projection = new OpenLayers.Projection('EPSG:900913');
-128 * 156543.03390625, options.numZoomLevels = 19;
-128 * 156543.03390625,
128 * 156543.03390625,
128 * 156543.03390625
),
maxResolution: 156543.03390625,
numZoomLevels: 19,
units: "m",
projection: "EPSG:900913"
}, options);
} }
url = url || this.url; OpenLayers.Layer.Grid.prototype.initialize.apply(this, [
name = name || this.name; name || this.name, url || this.url, {}, options
var newArguments = [name, url, {}, options]; ]);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
}, },
/** /**
@@ -157,10 +147,9 @@ OpenLayers.Layer.XYZ = OpenLayers.Class(OpenLayers.Layer.Grid, {
OpenLayers.Util.indexOf(resolutions, res) : OpenLayers.Util.indexOf(resolutions, res) :
this.getServerZoom() + this.zoomOffset; this.getServerZoom() + this.zoomOffset;
var limit = Math.pow(2, z); if (this.wrapDateLine) {
if (this.wrapDateLine) var limit = Math.pow(2, z);
{ x = ((x % limit) + limit) % limit;
x = ((x % limit) + limit) % limit;
} }
return {'x': x, 'y': y, 'z': z}; return {'x': x, 'y': y, 'z': z};