From 1acfa3578314c1d1c86525e2d712ffe8fc76728a Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sun, 10 Nov 2013 11:57:08 +0100 Subject: [PATCH] Add ol.layer.Vector renderFeatureFunction --- src/ol/layer/vectorlayer.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/ol/layer/vectorlayer.js b/src/ol/layer/vectorlayer.js index 50147d0be6..5b1162e641 100644 --- a/src/ol/layer/vectorlayer.js +++ b/src/ol/layer/vectorlayer.js @@ -8,6 +8,7 @@ goog.require('ol.source.Vector'); * @enum {string} */ ol.layer.VectorProperty = { + RENDER_FEATURE_FUNCTION: 'renderFeatureFunction', STYLE_FUNCTION: 'styleFunction' }; @@ -34,6 +35,19 @@ ol.layer.Vector = function(opt_options) { goog.inherits(ol.layer.Vector, ol.layer.Layer); +/** + * @return {function(ol.Feature): boolean|undefined} Render feature function. + */ +ol.layer.Vector.prototype.getRenderFeatureFunction = function() { + return /** @type {function(ol.Feature): boolean|undefined} */ ( + this.get(ol.layer.VectorProperty.RENDER_FEATURE_FUNCTION)); +}; +goog.exportProperty( + ol.layer.Vector.prototype, + 'getRenderFeatureFunction', + ol.layer.Vector.prototype.getRenderFeatureFunction); + + /** * @return {ol.style.StyleFunction|undefined} Style function. */ @@ -55,6 +69,21 @@ ol.layer.Vector.prototype.getVectorSource = function() { }; +/** + * @param {function(ol.Feature): boolean|undefined} renderFeatureFunction + * Render feature function. + */ +ol.layer.Vector.prototype.setRenderFeatureFunction = + function(renderFeatureFunction) { + this.set( + ol.layer.VectorProperty.RENDER_FEATURE_FUNCTION, renderFeatureFunction); +}; +goog.exportProperty( + ol.layer.Vector.prototype, + 'setRenderFeatureFunction', + ol.layer.Vector.prototype.setRenderFeatureFunction); + + /** * @param {ol.style.StyleFunction|undefined} styleFunction Style function. */