Support tile, image and vector layers

This commit is contained in:
ahocevar
2018-05-28 10:28:27 +02:00
parent 137c875df7
commit 81c0c80a2b

View File

@@ -113,7 +113,7 @@ inherits(RasterSourceEvent, Event);
/** /**
* @typedef {Object} Options * @typedef {Object} Options
* @property {Array.<module:ol/source/Source|module:ol/layer/Vector>} sources Input sources. * @property {Array.<module:ol/source/Source|module:ol/layer/Layer>} sources Input sources or layers.
* @property {module:ol/source/Raster~Operation} [operation] Raster operation. * @property {module:ol/source/Raster~Operation} [operation] Raster operation.
* The operation will be called with data from input sources * The operation will be called with data from input sources
* and the output will be assigned to the raster source. * and the output will be assigned to the raster source.
@@ -489,7 +489,10 @@ function createRenderer(source) {
renderer = createTileRenderer(source); renderer = createTileRenderer(source);
} else if (source instanceof ImageSource) { } else if (source instanceof ImageSource) {
renderer = createImageRenderer(source); renderer = createImageRenderer(source);
} else if (source instanceof Layer && source.getType() == LayerType.VECTOR) { } else if (source instanceof TileLayer) {
renderer = new CanvasTileLayerRenderer(source);
} else if (source instanceof Layer &&
(source.getType() == LayerType.IMAGE || source.getType() == LayerType.VECTOR)) {
renderer = new CanvasImageLayerRenderer(source); renderer = new CanvasImageLayerRenderer(source);
} }
return renderer; return renderer;