Factor out WMS version 1.3 check
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
// FIXME factor out v13 calculation
|
|
||||||
|
|
||||||
goog.provide('ol.source.ImageWMS');
|
goog.provide('ol.source.ImageWMS');
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
@@ -44,6 +42,13 @@ ol.source.ImageWMS = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.params_ = options.params;
|
this.params_ = options.params;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
this.v13_ = true;
|
||||||
|
this.updateV13_();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.source.wms.ServerType|undefined}
|
* @type {ol.source.wms.ServerType|undefined}
|
||||||
@@ -115,10 +120,7 @@ ol.source.ImageWMS.prototype.getImage =
|
|||||||
};
|
};
|
||||||
goog.object.extend(params, this.params_);
|
goog.object.extend(params, this.params_);
|
||||||
|
|
||||||
var v13 = goog.string.compareVersions(
|
params[this.v13_ ? 'CRS' : 'SRS'] = projection.getCode();
|
||||||
goog.object.get(params, 'VERSION'), '1.3') >= 0;
|
|
||||||
|
|
||||||
params[v13 ? 'CRS' : 'SRS'] = projection.getCode();
|
|
||||||
|
|
||||||
if (!('STYLES' in this.params_)) {
|
if (!('STYLES' in this.params_)) {
|
||||||
goog.object.set(params, 'STYLES', new String(''));
|
goog.object.set(params, 'STYLES', new String(''));
|
||||||
@@ -170,7 +172,7 @@ ol.source.ImageWMS.prototype.getImage =
|
|||||||
|
|
||||||
var axisOrientation = projection.getAxisOrientation();
|
var axisOrientation = projection.getAxisOrientation();
|
||||||
var bbox;
|
var bbox;
|
||||||
if (v13 && axisOrientation.substr(0, 2) == 'ne') {
|
if (this.v13_ && axisOrientation.substr(0, 2) == 'ne') {
|
||||||
bbox = [extent[1], extent[0], extent[3], extent[2]];
|
bbox = [extent[1], extent[0], extent[3], extent[2]];
|
||||||
} else {
|
} else {
|
||||||
bbox = extent;
|
bbox = extent;
|
||||||
@@ -204,6 +206,17 @@ ol.source.ImageWMS.prototype.setUrl = function(url) {
|
|||||||
*/
|
*/
|
||||||
ol.source.ImageWMS.prototype.updateParams = function(params) {
|
ol.source.ImageWMS.prototype.updateParams = function(params) {
|
||||||
goog.object.extend(this.params_, params);
|
goog.object.extend(this.params_, params);
|
||||||
|
this.updateV13_();
|
||||||
this.image_ = null;
|
this.image_ = null;
|
||||||
this.dispatchChangeEvent();
|
this.dispatchChangeEvent();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ol.source.ImageWMS.prototype.updateV13_ = function() {
|
||||||
|
var version =
|
||||||
|
goog.object.get(this.params_, 'VERSION', ol.source.wms.DEFAULT_VERSION);
|
||||||
|
this.v13_ = goog.string.compareVersions(version, '1.3') >= 0;
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user