Merge pull request #4408 from ahocevar/fix-imagewms-ratio-3.11.x
Use ratio when calculating ImageWMS width and height
This commit is contained in:
@@ -203,16 +203,8 @@ ol.source.ImageWMS.prototype.getImageInternal =
|
||||
var centerY = (extent[1] + extent[3]) / 2;
|
||||
|
||||
var imageResolution = resolution / pixelRatio;
|
||||
|
||||
// Compute an integer width and height.
|
||||
var width = Math.ceil(ol.extent.getWidth(extent) / imageResolution);
|
||||
var height = Math.ceil(ol.extent.getHeight(extent) / imageResolution);
|
||||
|
||||
// Modify the extent to match the integer width and height.
|
||||
extent[0] = centerX - imageResolution * width / 2;
|
||||
extent[2] = centerX + imageResolution * width / 2;
|
||||
extent[1] = centerY - imageResolution * height / 2;
|
||||
extent[3] = centerY + imageResolution * height / 2;
|
||||
var imageWidth = ol.extent.getWidth(extent) / imageResolution;
|
||||
var imageHeight = ol.extent.getHeight(extent) / imageResolution;
|
||||
|
||||
var image = this.image_;
|
||||
if (image &&
|
||||
@@ -241,8 +233,8 @@ ol.source.ImageWMS.prototype.getImageInternal =
|
||||
};
|
||||
goog.object.extend(params, this.params_);
|
||||
|
||||
this.imageSize_[0] = width;
|
||||
this.imageSize_[1] = height;
|
||||
this.imageSize_[0] = Math.ceil(imageWidth * this.ratio_);
|
||||
this.imageSize_[1] = Math.ceil(imageHeight * this.ratio_);
|
||||
|
||||
var url = this.getRequestUrl_(extent, this.imageSize_, pixelRatio,
|
||||
projection, params);
|
||||
|
||||
Reference in New Issue
Block a user