New OpenLayers.Projection.defaults property.

This allows us to simplify the map and layer configuration, because now the projection also defines defaults for maxExtent, maxResolution and units.
This change also adds transforms for SRS aliases for EPSG:4326 and centralizes axis order information in OpenLayers.Projection.defaults.
This commit is contained in:
ahocevar
2012-02-15 11:09:55 +01:00
parent da3dc76a6d
commit 11966d231f
11 changed files with 127 additions and 78 deletions

View File

@@ -56,9 +56,11 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
* Property: yx
* {Object} Keys in this object are EPSG codes for which the axis order
* is to be reversed (yx instead of xy, LatLon instead of LonLat), with
* true as value. This is only relevant for WMS versions >= 1.3.0.
* true as value. This is only relevant for WMS versions >= 1.3.0, and
* only if yx is not set in <OpenLayers.Projection.defaults> for the
* used projection.
*/
yx: {'EPSG:4326': true},
yx: {},
/**
* Constructor: OpenLayers.Layer.WMS
@@ -173,8 +175,9 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
* {Boolean} true if the axis order is reversed, false otherwise.
*/
reverseAxisOrder: function() {
return (parseFloat(this.params.VERSION) >= 1.3 &&
!!this.yx[this.map.getProjectionObject().getCode()]);
var projCode = this.map.getProjectionObject().getCode();
return parseFloat(this.params.VERSION) >= 1.3 &&
!!(this.yx[projCode] || OpenLayers.Projection.defaults[projCode].yx);
},
/**