Add pixelRatio to ol.source.Image#getImage

This commit is contained in:
Frederic Junod
2013-12-12 15:16:59 +01:00
parent 79ade07fb7
commit ca0b77d0e3
7 changed files with 10 additions and 9 deletions

View File

@@ -78,8 +78,8 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame =
var hints = frameState.viewHints; var hints = frameState.viewHints;
if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING]) { if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING]) {
image = imageSource.getImage( image = imageSource.getImage(frameState.extent, viewResolution,
frameState.extent, viewResolution, view2DState.projection); frameState.devicePixelRatio, view2DState.projection);
if (!goog.isNull(image)) { if (!goog.isNull(image)) {
var imageState = image.getState(); var imageState = image.getState();
if (imageState == ol.ImageState.IDLE) { if (imageState == ol.ImageState.IDLE) {

View File

@@ -66,8 +66,8 @@ ol.renderer.dom.ImageLayer.prototype.prepareFrame =
var hints = frameState.viewHints; var hints = frameState.viewHints;
if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING]) { if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING]) {
var image_ = imageSource.getImage( var image_ = imageSource.getImage(frameState.extent, viewResolution,
frameState.extent, viewResolution, view2DState.projection); frameState.devicePixelRatio, view2DState.projection);
if (!goog.isNull(image_)) { if (!goog.isNull(image_)) {
var imageState = image_.getState(); var imageState = image_.getState();
if (imageState == ol.ImageState.IDLE) { if (imageState == ol.ImageState.IDLE) {

View File

@@ -95,8 +95,8 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame =
var hints = frameState.viewHints; var hints = frameState.viewHints;
if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING]) { if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING]) {
var image_ = imageSource.getImage( var image_ = imageSource.getImage(frameState.extent, viewResolution,
frameState.extent, viewResolution, view2DState.projection); frameState.devicePixelRatio, view2DState.projection);
if (!goog.isNull(image_)) { if (!goog.isNull(image_)) {
var imageState = image_.getState(); var imageState = image_.getState();
if (imageState == ol.ImageState.IDLE) { if (imageState == ol.ImageState.IDLE) {

View File

@@ -113,6 +113,7 @@ ol.source.Image.prototype.findNearestResolution =
/** /**
* @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.proj.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @return {ol.Image} Single image. * @return {ol.Image} Single image.
*/ */

View File

@@ -48,7 +48,7 @@ goog.inherits(ol.source.ImageStatic, ol.source.Image);
* @inheritDoc * @inheritDoc
*/ */
ol.source.ImageStatic.prototype.getImage = ol.source.ImageStatic.prototype.getImage =
function(extent, resolution, projection) { function(extent, resolution, pixelRatio, projection) {
if (ol.extent.intersects(extent, this.image_.getExtent())) { if (ol.extent.intersects(extent, this.image_.getExtent())) {
return this.image_; return this.image_;
} }

View File

@@ -69,7 +69,7 @@ ol.source.ImageWMS.prototype.getParams = function() {
* @inheritDoc * @inheritDoc
*/ */
ol.source.ImageWMS.prototype.getImage = ol.source.ImageWMS.prototype.getImage =
function(extent, resolution, projection) { function(extent, resolution, pixelRatio, projection) {
resolution = this.findNearestResolution(resolution); resolution = this.findNearestResolution(resolution);
var image = this.image_; var image = this.image_;

View File

@@ -72,7 +72,7 @@ goog.inherits(ol.source.MapGuide, ol.source.Image);
* @inheritDoc * @inheritDoc
*/ */
ol.source.MapGuide.prototype.getImage = ol.source.MapGuide.prototype.getImage =
function(extent, resolution, projection) { function(extent, resolution, pixelRatio, projection) {
resolution = this.findNearestResolution(resolution); resolution = this.findNearestResolution(resolution);
var image = this.image_; var image = this.image_;