diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index ed43c96a2f..4f7fdfed4a 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -649,7 +649,10 @@ * on. * @property {Array.|undefined} resolutions Resolutions. If specified, * new canvases will be created for these resolutions only. - * @property {ol.source.Vector} source Vector source. + * @property {ol.source.Vector} source The vector source from which the vector + * features drawn in canvas elements are read. + * @property {ol.feature.StyleFunction|undefined} styleFunction Style function + * providing the styles to use when rendering features to the canvas. */ /** diff --git a/src/ol/source/imagevectorsource.js b/src/ol/source/imagevectorsource.js index 34b70ec949..841a81b4db 100644 --- a/src/ol/source/imagevectorsource.js +++ b/src/ol/source/imagevectorsource.js @@ -7,6 +7,7 @@ goog.require('goog.events'); goog.require('goog.events.EventType'); goog.require('goog.vec.Mat4'); goog.require('ol.extent'); +goog.require('ol.feature'); goog.require('ol.render.canvas.ReplayGroup'); goog.require('ol.renderer.vector'); goog.require('ol.source.ImageCanvas'); @@ -17,6 +18,16 @@ goog.require('ol.vec.Mat4'); /** + * An image source whose images are canvas elements into which vector features + * read from a vector source (`ol.source.Vector`) are drawn. An + * `ol.source.ImageVector` object is to be used as the `source` of an image + * layer (`ol.layer.Image`). Image layers are rotated, scaled, and translated, + * as opposed to being re-rendered, during animations and interactions. So, like + * any other image layer, an image layer configured with an + * `ol.source.ImageVector` will exhibit this behaviour. This is in contrast to a + * vector layer, where vector features are re-drawn during animations and + * interactions. + * * @constructor * @extends {ol.source.ImageCanvas} * @param {olx.source.ImageVectorOptions} options Options. @@ -31,9 +42,10 @@ ol.source.ImageVector = function(options) { /** * @private - * @type {ol.feature.StyleFunction} + * @type {!ol.feature.StyleFunction} */ - this.styleFunction_ = options.styleFunction; + this.styleFunction_ = goog.isDef(options.styleFunction) ? + options.styleFunction : ol.feature.defaultStyleFunction; /** * @private