Have Layer.WMS support WMS version 1.3 with the axis order sequence, r=elemoine,crschmidt,ahocevar (closes #2284)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9775 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2009-11-03 14:01:51 +00:00
parent 1e87b26029
commit e003972959
4 changed files with 232 additions and 61 deletions

View File

@@ -62,7 +62,15 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
* TRANSPARENT=TRUE. Also isBaseLayer will not changed by the
* constructor. Default false.
*/
noMagic: false,
noMagic: false,
/**
* Property: yx
* {Array} Array of strings with the EPSG codes for which the axis order
* is to be reversed (yx instead of xy, LatLon instead of LonLat). This
* is only relevant for WMS versions >= 1.3.0.
*/
yx: ['EPSG:4326'],
/**
* Constructor: OpenLayers.Layer.WMS
@@ -164,12 +172,21 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
getURL: function (bounds) {
bounds = this.adjustBounds(bounds);
var imageSize = this.getImageSize();
var newParams = {
'BBOX': this.encodeBBOX ? bounds.toBBOX() : bounds.toArray(),
'WIDTH': imageSize.w,
'HEIGHT': imageSize.h
};
var imageSize = this.getImageSize();
var newParams = {};
// WMS 1.3 introduced axis order
if (parseFloat(this.params.VERSION) >= 1.3 &&
OpenLayers.Util.indexOf(this.yx,
this.map.getProjectionObject().getCode()) !== -1) {
newParams.BBOX = this.encodeBBOX ? bounds.toBBOX(null, true) :
bounds.toArray(true);
} else {
newParams.BBOX = this.encodeBBOX ? bounds.toBBOX() :
bounds.toArray();
}
newParams.WIDTH = imageSize.w;
newParams.HEIGHT = imageSize.h;
var requestString = this.getFullRequestString(newParams);
return requestString;
},
@@ -225,7 +242,12 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
*/
getFullRequestString:function(newParams, altUrl) {
var projectionCode = this.map.getProjection();
this.params.SRS = (projectionCode == "none") ? null : projectionCode;
var value = (projectionCode == "none") ? null : projectionCode
if (parseFloat(this.params.VERSION) >= 1.3) {
this.params.CRS = value;
} else {
this.params.SRS = value;
}
return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
this, arguments);