From 360e37146cf29b6eacb1ed3a3df10c1005d27f36 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Tue, 19 Feb 2013 21:37:40 -0700 Subject: [PATCH] Rule is filter and symbolizer, style is collection of rules --- src/ol/style/rule.js | 34 ++++++++++++++++++++++++++++++++++ src/ol/style/style.js | 25 +++++++++++++++++++++++++ src/ol/style/symbolizer.js | 17 +++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 src/ol/style/rule.js create mode 100644 src/ol/style/style.js diff --git a/src/ol/style/rule.js b/src/ol/style/rule.js new file mode 100644 index 0000000000..90e7ae8b00 --- /dev/null +++ b/src/ol/style/rule.js @@ -0,0 +1,34 @@ +goog.provide('ol.style.Rule'); + +goog.require('ol.filter.Filter'); +goog.require('ol.style.Symbolizer'); + + +/** + * @typedef {{filter: (ol.filter.Filter), + * symbolizers: (Array.)}} + */ +ol.style.RuleOptions; + + + +/** + * @constructor + * @param {ol.style.RuleOptions} options Rule options. + */ +ol.style.Rule = function(options) { + + /** + * @type {ol.filter.Filter} + * @private + */ + this.filter_ = goog.isDef(options.filter) ? options.filter : null; + + /** + * @type {Array.} + * @private + */ + this.symbolizers_ = goog.isDef(options.symbolizers) ? + options.symbolizers : []; + +}; diff --git a/src/ol/style/style.js b/src/ol/style/style.js new file mode 100644 index 0000000000..536c8dac6c --- /dev/null +++ b/src/ol/style/style.js @@ -0,0 +1,25 @@ +goog.provide('ol.style.Style'); + +goog.require('ol.style.Rule'); + + +/** + * @typedef {{rules: (Array.)}} + */ +ol.style.StyleOptions; + + + +/** + * @constructor + * @param {ol.style.StyleOptions} options Style options. + */ +ol.style.Style = function(options) { + + /** + * @type {Array.} + * @private + */ + this.rules_ = goog.isDef(options.rules) ? options.rules : []; + +}; diff --git a/src/ol/style/symbolizer.js b/src/ol/style/symbolizer.js index 1959afa171..432b0bbcac 100644 --- a/src/ol/style/symbolizer.js +++ b/src/ol/style/symbolizer.js @@ -1,4 +1,7 @@ goog.provide('ol.style.LiteralSymbolizer'); +goog.provide('ol.style.Symbolizer'); + +goog.require('ol.Feature'); @@ -6,3 +9,17 @@ goog.provide('ol.style.LiteralSymbolizer'); * @interface */ ol.style.LiteralSymbolizer = function() {}; + + + +/** + * @interface + */ +ol.style.Symbolizer = function() {}; + + +/** + * @param {ol.Feature} feature Feature for evaluating expressions. + * @return {ol.style.LiteralSymbolizer} Literal symbolizer. + */ +ol.style.Symbolizer.prototype.createLiteral = function(feature) {};