From 1cfd185355cad9db4f6b336e7cb52c114aa26147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Wed, 20 Nov 2013 14:40:52 +0100 Subject: [PATCH] Add ol.style.Style constructor --- src/ol/style/style.js | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/ol/style/style.js diff --git a/src/ol/style/style.js b/src/ol/style/style.js new file mode 100644 index 0000000000..282efb1b3b --- /dev/null +++ b/src/ol/style/style.js @@ -0,0 +1,58 @@ +// FIXME export ol.style.Style + +goog.provide('ol.style.Style'); +goog.provide('ol.style.StyleFunction'); + +goog.require('ol.style.Fill'); +goog.require('ol.style.Image'); + + +/** + * @typedef {{fill: (ol.style.Fill|undefined), + * image: (ol.style.Image|undefined), + * stroke: (ol.style.Stroke|undefined), + * text: (ol.style.Text|undefined), + * zIndex: (number|undefined)}} + */ +ol.style.StyleOptions; + + + +/** + * @constructor + * @param {ol.style.StyleOptions} options Options. + */ +ol.style.Style = function(options) { + + /** + * @type {ol.style.Fill} + */ + this.fill = goog.isDef(options.fill) ? options.fill : null; + + /** + * @type {ol.style.Image} + */ + this.image = goog.isDef(options.image) ? options.image : null; + + /** + * @type {ol.style.Stroke} + */ + this.stroke = goog.isDef(options.stroke) ? options.stroke : null; + + /** + * @type {ol.style.Text} + */ + this.text = goog.isDef(options.text) ? options.text : null; + + /** + * @type {number|undefined} + */ + this.zIndex = options.zIndex; + +}; + + +/** + * @typedef {function(ol.Feature): ol.style.Style} + */ +ol.style.StyleFunction;