With a confirmation that Tim is happy considering this a review, I'm going to

go ahead and commit this (relatively lighttweight) patch to the code so that
the projection library base API is there, even though for the most part, it's
not usable yet. This changes map.projection from being a string to being a 
class, with a projCode on it. (Closes #1035)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@5401 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-12-13 23:29:18 +00:00
parent c3c2895e8c
commit abe2a52c31
8 changed files with 46 additions and 12 deletions
+15 -4
View File
@@ -126,9 +126,11 @@ OpenLayers.Layer = OpenLayers.Class({
/**
* APIProperty: projection
* {String} Set in the layer options to override the default projection
* string this layer - also set maxExtent, maxResolution, and units if
* appropriate.
* {<OpenLayers.Projection>} or {<String>} Set in the layer options to
* override the default projection string this layer - also set maxExtent,
* maxResolution, and units if appropriate. Can be either a string or
* an <OpenLayers.Projection> object when created -- will be converted
* to an object when setMap is called if a string is passed.
*/
projection: null,
@@ -267,6 +269,7 @@ OpenLayers.Layer = OpenLayers.Class({
if (this.map != null) {
this.map.removeLayer(this, setNewBaseLayer);
}
this.projection = null;
this.map = null;
this.name = null;
this.div = null;
@@ -410,7 +413,15 @@ OpenLayers.Layer = OpenLayers.Class({
// been set
this.maxExtent = this.maxExtent || this.map.maxExtent;
this.projection = this.projection || this.map.projection;
this.units = this.units || this.map.units;
if (this.projection && typeof this.projection == "string") {
this.projection = new OpenLayers.Projection(this.projection);
}
// Check the projection to see if we can get units -- if not, refer
// to properties.
this.units = this.projection.getUnits() ||
this.units || this.map.units;
this.initResolutions();