Stateless GetFeatureInfo for ol.source.TileWMS
This commit is contained in:
@@ -73,12 +73,6 @@ ol.source.TileWMS = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.params_ = params;
|
this.params_ = params;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
this.pixelRatio_ = NaN;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
@@ -136,11 +130,6 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl =
|
|||||||
|
|
||||||
goog.asserts.assert(!('VERSION' in params));
|
goog.asserts.assert(!('VERSION' in params));
|
||||||
|
|
||||||
var pixelRatio = this.pixelRatio_;
|
|
||||||
if (isNaN(this.pixelRatio_)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
var projectionObj = ol.proj.get(projection);
|
var projectionObj = ol.proj.get(projection);
|
||||||
|
|
||||||
var tileGrid = this.getTileGrid();
|
var tileGrid = this.getTileGrid();
|
||||||
@@ -165,9 +154,6 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl =
|
|||||||
tileExtent = ol.extent.buffer(tileExtent,
|
tileExtent = ol.extent.buffer(tileExtent,
|
||||||
tileResolution * gutter, tileExtent);
|
tileResolution * gutter, tileExtent);
|
||||||
}
|
}
|
||||||
if (pixelRatio != 1) {
|
|
||||||
tileSize = (tileSize * pixelRatio + 0.5) | 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
var baseParams = {
|
var baseParams = {
|
||||||
'SERVICE': 'WMS',
|
'SERVICE': 'WMS',
|
||||||
@@ -179,16 +165,14 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl =
|
|||||||
};
|
};
|
||||||
goog.object.extend(baseParams, this.params_, params);
|
goog.object.extend(baseParams, this.params_, params);
|
||||||
|
|
||||||
var x = Math.floor((coordinate[0] - tileExtent[0]) /
|
var x = Math.floor((coordinate[0] - tileExtent[0]) / tileResolution);
|
||||||
(tileResolution / pixelRatio));
|
var y = Math.floor((tileExtent[3] - coordinate[1]) / tileResolution);
|
||||||
var y = Math.floor((tileExtent[3] - coordinate[1]) /
|
|
||||||
(tileResolution / pixelRatio));
|
|
||||||
|
|
||||||
goog.object.set(baseParams, this.v13_ ? 'I' : 'X', x);
|
goog.object.set(baseParams, this.v13_ ? 'I' : 'X', x);
|
||||||
goog.object.set(baseParams, this.v13_ ? 'J' : 'Y', y);
|
goog.object.set(baseParams, this.v13_ ? 'J' : 'Y', y);
|
||||||
|
|
||||||
return this.getRequestUrl_(tileCoord, tileSize, tileExtent,
|
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_);
|
goog.object.extend(baseParams, this.params_);
|
||||||
|
|
||||||
this.pixelRatio_ = pixelRatio;
|
|
||||||
|
|
||||||
return this.getRequestUrl_(tileCoord, tileSize, tileExtent,
|
return this.getRequestUrl_(tileCoord, tileSize, tileExtent,
|
||||||
pixelRatio, projection, baseParams);
|
pixelRatio, projection, baseParams);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user