Compute new image extent for comparison to existing image extent

This commit is contained in:
rattai
2015-08-04 17:25:47 -04:00
parent 85815a32a0
commit b3f14f09c4
2 changed files with 26 additions and 18 deletions

View File

@@ -198,24 +198,6 @@ ol.source.ImageWMS.prototype.getImage =
pixelRatio = 1;
}
var image = this.image_;
if (!goog.isNull(image) &&
this.renderedRevision_ == this.getRevision() &&
image.getResolution() == resolution &&
image.getPixelRatio() == pixelRatio &&
ol.extent.containsExtent(image.getExtent(), extent)) {
return image;
}
var params = {
'SERVICE': 'WMS',
'VERSION': ol.DEFAULT_WMS_VERSION,
'REQUEST': 'GetMap',
'FORMAT': 'image/png',
'TRANSPARENT': true
};
goog.object.extend(params, this.params_);
extent = extent.slice();
var centerX = (extent[0] + extent[2]) / 2;
var centerY = (extent[1] + extent[3]) / 2;
@@ -240,6 +222,24 @@ ol.source.ImageWMS.prototype.getImage =
extent[1] = centerY - imageResolution * height / 2;
extent[3] = centerY + imageResolution * height / 2;
var image = this.image_;
if (!goog.isNull(image) &&
this.renderedRevision_ == this.getRevision() &&
image.getResolution() == resolution &&
image.getPixelRatio() == pixelRatio &&
ol.extent.containsExtent(image.getExtent(), extent)) {
return image;
}
var params = {
'SERVICE': 'WMS',
'VERSION': ol.DEFAULT_WMS_VERSION,
'REQUEST': 'GetMap',
'FORMAT': 'image/png',
'TRANSPARENT': true
};
goog.object.extend(params, this.params_);
this.imageSize_[0] = width;
this.imageSize_[1] = height;