Add pixelRatio to ol.source.Image#createImage

This commit is contained in:
Frederic Junod
2013-12-16 12:08:11 +01:00
parent ca0b77d0e3
commit 78ec21fb85
4 changed files with 7 additions and 4 deletions

View File

@@ -78,12 +78,13 @@ goog.inherits(ol.source.Image, ol.source.Source);
* @protected * @protected
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
* @param {ol.Size} size Size. * @param {ol.Size} size Size.
* @param {ol.proj.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {ol.Image} Single image. * @return {ol.Image} Single image.
*/ */
ol.source.Image.prototype.createImage = ol.source.Image.prototype.createImage =
function(extent, resolution, size, projection) { function(extent, resolution, pixelRatio, size, projection) {
var image = null; var image = null;
var imageUrl = this.imageUrlFunction(extent, size, projection); var imageUrl = this.imageUrlFunction(extent, size, projection);
if (goog.isDef(imageUrl)) { if (goog.isDef(imageUrl)) {

View File

@@ -38,7 +38,7 @@ ol.source.ImageStatic = function(options) {
* @type {ol.Image} * @type {ol.Image}
*/ */
this.image_ = this.createImage( this.image_ = this.createImage(
imageExtent, imageResolution, imageSize, projection); imageExtent, imageResolution, 1, imageSize, projection);
}; };
goog.inherits(ol.source.ImageStatic, ol.source.Image); goog.inherits(ol.source.ImageStatic, ol.source.Image);

View File

@@ -85,7 +85,8 @@ ol.source.ImageWMS.prototype.getImage =
var height = (extent[3] - extent[1]) / resolution; var height = (extent[3] - extent[1]) / resolution;
var size = [width, height]; var size = [width, height];
this.image_ = this.createImage(extent, resolution, size, projection); this.image_ = this.createImage(
extent, resolution, pixelRatio, size, projection);
return this.image_; return this.image_;
}; };

View File

@@ -90,7 +90,8 @@ ol.source.MapGuide.prototype.getImage =
var height = (extent[3] - extent[1]) / resolution; var height = (extent[3] - extent[1]) / resolution;
var size = [width, height]; var size = [width, height];
this.image_ = this.createImage(extent, resolution, size, projection); this.image_ = this.createImage(
extent, resolution, pixelRatio, size, projection);
return this.image_; return this.image_;
}; };