Accept renderers as sources for the raster source

This commit is contained in:
ahocevar
2018-05-25 11:59:44 +02:00
parent c7207c5a07
commit f53a1e7507
2 changed files with 26 additions and 9 deletions

View File

@@ -13,6 +13,7 @@ import {equals, getCenter, getHeight, getWidth} from '../extent.js';
import ImageLayer from '../layer/Image.js';
import TileLayer from '../layer/Tile.js';
import {assign} from '../obj.js';
import CanvasLayerRenderer from '../renderer/canvas/Layer.js';
import CanvasImageLayerRenderer from '../renderer/canvas/ImageLayer.js';
import CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js';
import ImageSource from '../source/Image.js';
@@ -111,7 +112,7 @@ inherits(RasterSourceEvent, Event);
/**
* @typedef {Object} Options
* @property {Array.<module:ol/source/Source>} sources Input sources.
* @property {Array.<module:ol/source/Source|module:ol/renderer/canvas/Layer>} sources Input sources.
* @property {module:ol/source/Raster~Operation} [operation] Raster operation.
* The operation will be called with data from input sources
* and the output will be assigned to the raster source.
@@ -487,6 +488,10 @@ function createRenderer(source) {
renderer = createTileRenderer(source);
} else if (source instanceof ImageSource) {
renderer = createImageRenderer(source);
} else if (source instanceof TileLayer) {
renderer = new CanvasTileLayerRenderer(source);
} else if (source instanceof CanvasLayerRenderer) {
renderer = source;
}
return renderer;
}