From 5a9d75a04fa43786a5a018aee8d71f6416c7a125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Wed, 20 Aug 2014 17:20:07 +0200 Subject: [PATCH] Stateless GetFeatureInfo for ol.source.TileWMS --- src/ol/source/tilewmssource.js | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/src/ol/source/tilewmssource.js b/src/ol/source/tilewmssource.js index 9961f604a0..422c7fe6f7 100644 --- a/src/ol/source/tilewmssource.js +++ b/src/ol/source/tilewmssource.js @@ -73,12 +73,6 @@ ol.source.TileWMS = function(opt_options) { */ this.params_ = params; - /** - * @private - * @type {number} - */ - this.pixelRatio_ = NaN; - /** * @private * @type {boolean} @@ -136,11 +130,6 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl = goog.asserts.assert(!('VERSION' in params)); - var pixelRatio = this.pixelRatio_; - if (isNaN(this.pixelRatio_)) { - return undefined; - } - var projectionObj = ol.proj.get(projection); var tileGrid = this.getTileGrid(); @@ -165,9 +154,6 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl = tileExtent = ol.extent.buffer(tileExtent, tileResolution * gutter, tileExtent); } - if (pixelRatio != 1) { - tileSize = (tileSize * pixelRatio + 0.5) | 0; - } var baseParams = { 'SERVICE': 'WMS', @@ -179,16 +165,14 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl = }; goog.object.extend(baseParams, this.params_, params); - var x = Math.floor((coordinate[0] - tileExtent[0]) / - (tileResolution / pixelRatio)); - var y = Math.floor((tileExtent[3] - coordinate[1]) / - (tileResolution / pixelRatio)); + var x = Math.floor((coordinate[0] - tileExtent[0]) / tileResolution); + var y = Math.floor((tileExtent[3] - coordinate[1]) / tileResolution); goog.object.set(baseParams, this.v13_ ? 'I' : 'X', x); goog.object.set(baseParams, this.v13_ ? 'J' : 'Y', y); return this.getRequestUrl_(tileCoord, tileSize, tileExtent, - pixelRatio, projectionObj, baseParams); + 1, projectionObj, baseParams); }; @@ -409,8 +393,6 @@ ol.source.TileWMS.prototype.tileUrlFunction_ = }; goog.object.extend(baseParams, this.params_); - this.pixelRatio_ = pixelRatio; - return this.getRequestUrl_(tileCoord, tileSize, tileExtent, pixelRatio, projection, baseParams); };