Allow different source and view projection in image layer renderers
To enable image layer reprojection.
This commit is contained in:
@@ -170,11 +170,13 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame =
|
||||
if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING] &&
|
||||
!ol.extent.isEmpty(renderedExtent)) {
|
||||
var projection = viewState.projection;
|
||||
var sourceProjection = imageSource.getProjection();
|
||||
if (sourceProjection) {
|
||||
goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection),
|
||||
'projection and sourceProjection are equivalent');
|
||||
projection = sourceProjection;
|
||||
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
||||
var sourceProjection = imageSource.getProjection();
|
||||
if (sourceProjection) {
|
||||
goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection),
|
||||
'projection and sourceProjection are equivalent');
|
||||
projection = sourceProjection;
|
||||
}
|
||||
}
|
||||
image = imageSource.getImage(
|
||||
renderedExtent, viewResolution, pixelRatio, projection);
|
||||
|
||||
@@ -101,11 +101,13 @@ ol.renderer.dom.ImageLayer.prototype.prepareFrame =
|
||||
if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING] &&
|
||||
!ol.extent.isEmpty(renderedExtent)) {
|
||||
var projection = viewState.projection;
|
||||
var sourceProjection = imageSource.getProjection();
|
||||
if (sourceProjection) {
|
||||
goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection),
|
||||
'projection and sourceProjection are equivalent');
|
||||
projection = sourceProjection;
|
||||
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
||||
var sourceProjection = imageSource.getProjection();
|
||||
if (sourceProjection) {
|
||||
goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection),
|
||||
'projection and sourceProjection are equivalent');
|
||||
projection = sourceProjection;
|
||||
}
|
||||
}
|
||||
var image_ = imageSource.getImage(renderedExtent, viewResolution,
|
||||
frameState.pixelRatio, projection);
|
||||
|
||||
@@ -159,8 +159,9 @@ ol.renderer.Layer.prototype.loadImage = function(image) {
|
||||
if (imageState == ol.ImageState.IDLE) {
|
||||
image.load();
|
||||
imageState = image.getState();
|
||||
goog.asserts.assert(imageState == ol.ImageState.LOADING,
|
||||
'imageState is "loading"');
|
||||
goog.asserts.assert(imageState == ol.ImageState.LOADING ||
|
||||
imageState == ol.ImageState.LOADED,
|
||||
'imageState is "loading" or "loaded"');
|
||||
}
|
||||
return imageState == ol.ImageState.LOADED;
|
||||
};
|
||||
|
||||
@@ -125,11 +125,13 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame =
|
||||
if (!hints[ol.ViewHint.ANIMATING] && !hints[ol.ViewHint.INTERACTING] &&
|
||||
!ol.extent.isEmpty(renderedExtent)) {
|
||||
var projection = viewState.projection;
|
||||
var sourceProjection = imageSource.getProjection();
|
||||
if (sourceProjection) {
|
||||
goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection),
|
||||
'projection and sourceProjection are equivalent');
|
||||
projection = sourceProjection;
|
||||
if (!ol.ENABLE_RASTER_REPROJECTION) {
|
||||
var sourceProjection = imageSource.getProjection();
|
||||
if (sourceProjection) {
|
||||
goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection),
|
||||
'projection and sourceProjection are equivalent');
|
||||
projection = sourceProjection;
|
||||
}
|
||||
}
|
||||
var image_ = imageSource.getImage(renderedExtent, viewResolution,
|
||||
pixelRatio, projection);
|
||||
|
||||
Reference in New Issue
Block a user