Simplify constructor by setting projection.

This commit is contained in:
Tim Schaub
2012-02-26 19:23:22 -07:00
parent faeb691f3a
commit fc03f57591
2 changed files with 14 additions and 29 deletions

View File

@@ -26,9 +26,11 @@
* map.addLayer(world_utfgrid);
*
* var control = new OpenLayers.Control.UTFGrid({
* 'div': 'attrsdiv',
* 'layers': [world_utfgrid],
* 'handlerMode': 'move'
* layers: [world_utfgrid],
* handlerMode: 'move',
* callback: function(dataLookup) {
* // do something with returned data
* }
* })
* (end code)
*
@@ -45,13 +47,11 @@ OpenLayers.Layer.UTFGrid = OpenLayers.Class(OpenLayers.Layer.Grid, {
isBaseLayer: false,
/**
* APIProperty: sphericalMecator
* Whether the tile extents should be set to the defaults for
* spherical mercator. Useful for things like OpenStreetMap.
* Default is true as most (all?) utfgrid implementations assume
* sperical mercator.
* APIProperty: projection
* {<OpenLayers.Projection>}
* Source projection for the UTFGrids. Default is "EPSG:900913".
*/
sphericalMercator: false,
projection: new OpenLayers.Projection("EPSG:900913"),
/**
* APIProperty: zoomOffset
@@ -106,24 +106,7 @@ OpenLayers.Layer.UTFGrid = 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);
}
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, url, {}, options]);
},
/**