From d5b7527f1f25510bff824b72a53ef5313cddc3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sun, 12 Jan 2014 11:26:21 +0100 Subject: [PATCH 1/2] Add docs for ol.source.ImageVector --- src/objectliterals.jsdoc | 3 ++- src/ol/source/imagevectorsource.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index ed43c96a2f..f04d9632c7 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -649,7 +649,8 @@ * 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. */ /** diff --git a/src/ol/source/imagevectorsource.js b/src/ol/source/imagevectorsource.js index 34b70ec949..f4d44f3b20 100644 --- a/src/ol/source/imagevectorsource.js +++ b/src/ol/source/imagevectorsource.js @@ -17,6 +17,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. From babd133cf66e5ddafed1732f8ec20f7752436640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sun, 12 Jan 2014 11:28:00 +0100 Subject: [PATCH 2/2] Export ol.source.ImageVector's styleFunction option --- src/objectliterals.jsdoc | 2 ++ src/ol/source/imagevectorsource.js | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index f04d9632c7..4f7fdfed4a 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -651,6 +651,8 @@ * new canvases will be created for these resolutions only. * @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 f4d44f3b20..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'); @@ -41,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