Revert "Merge pull request #4344 from bartvde/issue-2844"
This reverts commite5c44b37c9, reversing changes made to7f4c6e3634.
This commit is contained in:
@@ -14,7 +14,7 @@ goog.require('ol.extent');
|
||||
* @constructor
|
||||
* @extends {ol.ImageBase}
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {Array.<number>|undefined} resolution Resolution.
|
||||
* @param {number|undefined} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {Array.<ol.Attribution>} attributions Attributions.
|
||||
* @param {string} src Image source URI.
|
||||
@@ -114,10 +114,7 @@ ol.Image.prototype.handleImageError_ = function() {
|
||||
*/
|
||||
ol.Image.prototype.handleImageLoad_ = function() {
|
||||
if (this.resolution === undefined) {
|
||||
this.resolution = [
|
||||
ol.extent.getWidth(this.extent) / this.image_.width,
|
||||
ol.extent.getHeight(this.extent) / this.image_.height
|
||||
];
|
||||
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
|
||||
}
|
||||
this.state = ol.ImageState.LOADED;
|
||||
this.unlistenImage_();
|
||||
|
||||
@@ -24,9 +24,7 @@ ol.ImageState = {
|
||||
* @constructor
|
||||
* @extends {goog.events.EventTarget}
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {Array.<number>|undefined} resolution Resolution, first value
|
||||
* is the resolution in the x direction, second value is the resolution
|
||||
* in the y direction.
|
||||
* @param {number|undefined} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {ol.ImageState} state State.
|
||||
* @param {Array.<ol.Attribution>} attributions Attributions.
|
||||
@@ -55,7 +53,7 @@ ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {Array.<number>|undefined}
|
||||
* @type {number|undefined}
|
||||
*/
|
||||
this.resolution = resolution;
|
||||
|
||||
@@ -109,7 +107,7 @@ ol.ImageBase.prototype.getPixelRatio = function() {
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<number>} Resolution.
|
||||
* @return {number} Resolution.
|
||||
*/
|
||||
ol.ImageBase.prototype.getResolution = function() {
|
||||
goog.asserts.assert(this.resolution !== undefined, 'resolution not yet set');
|
||||
|
||||
@@ -30,8 +30,7 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
|
||||
var state = opt_loader !== undefined ?
|
||||
ol.ImageState.IDLE : ol.ImageState.LOADED;
|
||||
|
||||
goog.base(this, extent, [resolution, resolution], pixelRatio, state,
|
||||
attributions);
|
||||
goog.base(this, extent, resolution, pixelRatio, state, attributions);
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -193,19 +193,15 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame =
|
||||
var imageExtent = image.getExtent();
|
||||
var imageResolution = image.getResolution();
|
||||
var imagePixelRatio = image.getPixelRatio();
|
||||
var xImageResolution = imageResolution[0];
|
||||
var yImageResolution = imageResolution[1];
|
||||
var xScale = pixelRatio * xImageResolution /
|
||||
(viewResolution * imagePixelRatio);
|
||||
var yScale = pixelRatio * yImageResolution /
|
||||
var scale = pixelRatio * imageResolution /
|
||||
(viewResolution * imagePixelRatio);
|
||||
ol.vec.Mat4.makeTransform2D(this.imageTransform_,
|
||||
pixelRatio * frameState.size[0] / 2,
|
||||
pixelRatio * frameState.size[1] / 2,
|
||||
xScale, yScale,
|
||||
scale, scale,
|
||||
viewRotation,
|
||||
imagePixelRatio * (imageExtent[0] - viewCenter[0]) / xImageResolution,
|
||||
imagePixelRatio * (viewCenter[1] - imageExtent[3]) / yImageResolution);
|
||||
imagePixelRatio * (imageExtent[0] - viewCenter[0]) / imageResolution,
|
||||
imagePixelRatio * (viewCenter[1] - imageExtent[3]) / imageResolution);
|
||||
this.imageTransformInv_ = null;
|
||||
this.updateAttributions(frameState.attributions, image.getAttributions());
|
||||
this.updateLogos(frameState, imageSource);
|
||||
|
||||
@@ -116,9 +116,8 @@ ol.reproj.Image = function(sourceProj, targetProj,
|
||||
attributions = this.sourceImage_.getAttributions();
|
||||
}
|
||||
|
||||
goog.base(this, targetExtent, [targetResolution, targetResolution],
|
||||
this.sourcePixelRatio_, state, attributions);
|
||||
|
||||
goog.base(this, targetExtent, targetResolution, this.sourcePixelRatio_,
|
||||
state, attributions);
|
||||
};
|
||||
goog.inherits(ol.reproj.Image, ol.ImageBase);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ ol.reproj.enlargeClipPoint_ = function(centroidX, centroidY, x, y) {
|
||||
* @param {number} width Width of the canvas.
|
||||
* @param {number} height Height of the canvas.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {Array.<number>} sourceResolution Source resolution.
|
||||
* @param {number} sourceResolution Source resolution.
|
||||
* @param {ol.Extent} sourceExtent Extent of the data source.
|
||||
* @param {number} targetResolution Target resolution.
|
||||
* @param {ol.Extent} targetExtent Target extent.
|
||||
@@ -124,14 +124,12 @@ ol.reproj.render = function(width, height, pixelRatio,
|
||||
|
||||
var canvasWidthInUnits = ol.extent.getWidth(sourceDataExtent);
|
||||
var canvasHeightInUnits = ol.extent.getHeight(sourceDataExtent);
|
||||
var sourceResolutionX = sourceResolution[0];
|
||||
var sourceResolutionY = sourceResolution[1];
|
||||
var stitchContext = ol.dom.createCanvasContext2D(
|
||||
Math.round(pixelRatio * canvasWidthInUnits / sourceResolutionX),
|
||||
Math.round(pixelRatio * canvasHeightInUnits / sourceResolutionY));
|
||||
Math.round(pixelRatio * canvasWidthInUnits / sourceResolution),
|
||||
Math.round(pixelRatio * canvasHeightInUnits / sourceResolution));
|
||||
|
||||
stitchContext.scale(pixelRatio / sourceResolutionX,
|
||||
pixelRatio / sourceResolutionY);
|
||||
stitchContext.scale(pixelRatio / sourceResolution,
|
||||
pixelRatio / sourceResolution);
|
||||
stitchContext.translate(-sourceDataExtent[0], sourceDataExtent[3]);
|
||||
|
||||
sources.forEach(function(src, i, arr) {
|
||||
@@ -224,8 +222,8 @@ ol.reproj.render = function(width, height, pixelRatio,
|
||||
context.translate(sourceDataExtent[0] - sourceNumericalShiftX,
|
||||
sourceDataExtent[3] - sourceNumericalShiftY);
|
||||
|
||||
context.scale(sourceResolutionX / pixelRatio,
|
||||
-sourceResolutionY / pixelRatio);
|
||||
context.scale(sourceResolution / pixelRatio,
|
||||
-sourceResolution / pixelRatio);
|
||||
|
||||
context.drawImage(stitchContext.canvas, 0, 0);
|
||||
context.restore();
|
||||
|
||||
@@ -258,7 +258,7 @@ ol.reproj.Tile.prototype.reproject_ = function() {
|
||||
|
||||
var targetExtent = this.targetTileGrid_.getTileCoordExtent(tileCoord);
|
||||
this.canvas_ = ol.reproj.render(width, height, this.pixelRatio_,
|
||||
[sourceResolution, sourceResolution], this.sourceTileGrid_.getExtent(),
|
||||
sourceResolution, this.sourceTileGrid_.getExtent(),
|
||||
targetResolution, targetExtent, this.triangulation_, sources,
|
||||
this.renderEdges_);
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ ol.source.ImageMapGuide.prototype.getImageInternal =
|
||||
|
||||
var imageUrl = this.imageUrlFunction_(extent, size, projection);
|
||||
if (imageUrl !== undefined) {
|
||||
image = new ol.Image(extent, [resolution, resolution], pixelRatio,
|
||||
image = new ol.Image(extent, resolution, pixelRatio,
|
||||
this.getAttributions(), imageUrl, this.crossOrigin_,
|
||||
this.imageLoadFunction_);
|
||||
goog.events.listen(image, goog.events.EventType.CHANGE,
|
||||
|
||||
@@ -26,12 +26,10 @@ ol.source.ImageStatic = function(options) {
|
||||
|
||||
var imageExtent = options.imageExtent;
|
||||
|
||||
var xResolution, yResolution, resolutions, imgResolution;
|
||||
var resolution, resolutions;
|
||||
if (options.imageSize !== undefined) {
|
||||
xResolution = ol.extent.getWidth(imageExtent) / options.imageSize[0];
|
||||
yResolution = ol.extent.getHeight(imageExtent) / options.imageSize[1];
|
||||
imgResolution = [xResolution, yResolution];
|
||||
resolutions = [yResolution];
|
||||
resolution = ol.extent.getHeight(imageExtent) / options.imageSize[1];
|
||||
resolutions = [resolution];
|
||||
}
|
||||
|
||||
var crossOrigin = options.crossOrigin !== undefined ?
|
||||
@@ -52,8 +50,8 @@ ol.source.ImageStatic = function(options) {
|
||||
* @private
|
||||
* @type {ol.Image}
|
||||
*/
|
||||
this.image_ = new ol.Image(imageExtent, imgResolution, 1,
|
||||
attributions, options.url, crossOrigin, imageLoadFunction);
|
||||
this.image_ = new ol.Image(imageExtent, resolution, 1, attributions,
|
||||
options.url, crossOrigin, imageLoadFunction);
|
||||
goog.events.listen(this.image_, goog.events.EventType.CHANGE,
|
||||
this.handleImageChange, false, this);
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ ol.source.ImageWMS.prototype.getImageInternal =
|
||||
var image = this.image_;
|
||||
if (image &&
|
||||
this.renderedRevision_ == this.getRevision() &&
|
||||
image.getResolution()[0] == resolution &&
|
||||
image.getResolution() == resolution &&
|
||||
image.getPixelRatio() == pixelRatio &&
|
||||
ol.extent.containsExtent(image.getExtent(), extent)) {
|
||||
return image;
|
||||
@@ -247,7 +247,7 @@ ol.source.ImageWMS.prototype.getImageInternal =
|
||||
var url = this.getRequestUrl_(extent, this.imageSize_, pixelRatio,
|
||||
projection, params);
|
||||
|
||||
this.image_ = new ol.Image(extent, [resolution, resolution], pixelRatio,
|
||||
this.image_ = new ol.Image(extent, resolution, pixelRatio,
|
||||
this.getAttributions(), url, this.crossOrigin_, this.imageLoadFunction_);
|
||||
|
||||
this.renderedRevision_ = this.getRevision();
|
||||
|
||||
Reference in New Issue
Block a user