diff --git a/examples/georss-flickr.html b/examples/georss-flickr.html
new file mode 100644
index 0000000000..e2991466bd
--- /dev/null
+++ b/examples/georss-flickr.html
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
GeoRSS from Flickr in OpenLayers
+
The displayed GeoRSS feed has a <media:thumbnail/> property for each item. An extended createFeatureFromItem() function is used to add this attribute to the attributes hash of each feature read in by OpenLayers.Format.GeoRSS. The example is configured with a style to render each item with its thumbnail image. Also, to show how rules work, we defined a rule that if the title of an rss item contains "powder", it will be rendered larger than the others.
+
+
+
diff --git a/examples/xml/georss-flickr.xml b/examples/xml/georss-flickr.xml
new file mode 100644
index 0000000000..23ec199bfe
--- /dev/null
+++ b/examples/xml/georss-flickr.xml
@@ -0,0 +1,730 @@
+
+
+
+ Photos from everyone tagged snowboard and powder, with geodata
+ http://www.flickr.com/photos/
+
+ Sat, 24 Nov 2007 16:25:03 -0800
+ Sat, 24 Nov 2007 16:25:03 -0800
+
+ http://www.flickr.com/
+
+ http://www.flickr.com/images/buddyicon.jpg
+ Photos from everyone tagged snowboard and powder, with geodata
+ http://www.flickr.com/photos/
+
+
+
+ hofü07_5259
+ http://www.flickr.com/photos/-mo-/2061136492/
+ I - mo - I posted a photo:
+
+
+
+ ]]>
+ Sat, 24 Nov 2007 16:25:03 -0800
+ 2007-11-17T12:01:18-08:00
+ nobody@flickr.com (I - mo - I)
+ tag:flickr.com,2004:/photo/2061136492
+ 47.25162 11.754426
+
+
+ 47.25162
+ 11.754426
+
+
+ hofü07_5259
+ I - mo - I posted a photo:
+
+
+
+ ]]>
+
+ I - mo - I
+ sun snow fall fun austria yeah powder snowboard tyrol 2007 hochfügen powderahyeahturn
+
+
+
+ First tracks
+
+ http://www.flickr.com/photos/ruthanddave/2046899659/
+ Ruth and Dave posted a photo:
+
+
+
+
Not mine, alas.
+ ]]>
+ Mon, 19 Nov 2007 08:20:11 -0800
+ 2007-11-18T11:19:50-08:00
+ nobody@flickr.com (Ruth and Dave)
+ tag:flickr.com,2004:/photo/2046899659
+
+ 50.107423 -122.899847
+
+ 50.107423
+ -122.899847
+
+
+ First tracks
+ Ruth and Dave posted a photo:
+
+
+
+
Not mine, alas.
+ ]]>
+
+ Ruth and Dave
+ november lines whistler snowboarding tracks peak powder snowboard turns freshies
+
+
+
+
+ Powder turns
+ http://www.flickr.com/photos/ruthanddave/2047707124/
+ Ruth and Dave posted a photo:
+
+
+
+ ]]>
+ Mon, 19 Nov 2007 08:26:04 -0800
+ 2007-11-18T11:19:57-08:00
+ nobody@flickr.com (Ruth and Dave)
+ tag:flickr.com,2004:/photo/2047707124
+ 50.107423 -122.899847
+
+
+ 50.107423
+ -122.899847
+
+
+ Powder turns
+ Ruth and Dave posted a photo:
+
+
+
+ ]]>
+
+ Ruth and Dave
+ november face lines whistler snowboarding tracks first peak powder fresh snowboard turns
+
+
+
+ Splitboard
+
+ http://www.flickr.com/photos/hamsgod/1330385819/
+ @nt!x posted a photo:
+
+
+
+ ]]>
+
+ Oliver Astrologo
+ sky people italy panorama mountain snow alps landscape powder snowboard rider snowboarder passo ghiacciaio stelvio
+
+
+
+ Sawatch Range From Vail Pano
+
+ http://www.flickr.com/photos/dman861/498747983/
+ dman861 posted a photo:
+
+
+
+
View near the Eagle's Nest at the top of Eagle Bahn Gondola. Mount of the Holy Cross mountain is visible in this picture but you can't make out the cross shape. I have no idea who the lady is. Handheld panorama, stitch of 5
+ photos.
+ ]]>
+ Mon, 14 May 2007 17:05:11 -0800
+ 2007-05-14T15:00:27-08:00
+ nobody@flickr.com (dman861)
+ tag:flickr.com,2004:/photo/498747983
+
+ 39.617598 -106.386773
+
+ 39.617598
+ -106.386773
+
+
+ Sawatch Range From Vail Pano
+ dman861 posted a photo:
+
+
+
+
View near the Eagle's Nest at the top of Eagle Bahn Gondola. Mount of the Holy Cross mountain is visible in this picture but you can't make out the cross shape. I have no idea who the lady is. Handheld panorama, stitch of 5
+ photos.
+ ]]>
+
+ dman861
+
+ trees sky panorama mountain snow ski mountains sport pinetree person photo colorado peak wideangle panoramic powder resort panasonic trail vail snowboard gondola beavercreek range avon mountainrange mountoftheholycross sawatch dmctz3 tz3
+
+
+
+
+
+ Flash Powder
+ http://www.flickr.com/photos/eckan/488776800/
+ Erik Eckerström posted a photo:
+
+
+ ]]>
+
+ blupic.com
+ blue winter sky mountain snow canada ski nature vancouver whistler nikon skiing d70 peak columbia powder 1870mmf3545g snowboard british blackcomb mogul
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/OpenLayers.js b/lib/OpenLayers.js
index 877455a4b1..1719e68f5d 100644
--- a/lib/OpenLayers.js
+++ b/lib/OpenLayers.js
@@ -164,6 +164,11 @@
"OpenLayers/Renderer/VML.js",
"OpenLayers/Layer/Vector.js",
"OpenLayers/Layer/GML.js",
+ "OpenLayers/Style.js",
+ "OpenLayers/Rule.js",
+ "OpenLayers/Rule/FeatureId.js",
+ "OpenLayers/Rule/Logical.js",
+ "OpenLayers/Rule/Comparison.js",
"OpenLayers/Format.js",
"OpenLayers/Format/XML.js",
"OpenLayers/Format/GML.js",
diff --git a/lib/OpenLayers/Layer/Vector.js b/lib/OpenLayers/Layer/Vector.js
index 332206113f..2af80dad28 100644
--- a/lib/OpenLayers/Layer/Vector.js
+++ b/lib/OpenLayers/Layer/Vector.js
@@ -350,6 +350,12 @@ OpenLayers.Layer.Vector = OpenLayers.Class(OpenLayers.Layer, {
style = this.style;
}
}
+
+ if (style && style.CLASS_NAME &&
+ style.CLASS_NAME == "OpenLayers.Style") {
+ style = style.createStyle(feature);
+ }
+
this.renderer.drawFeature(feature, style);
},
diff --git a/lib/OpenLayers/Rule.js b/lib/OpenLayers/Rule.js
new file mode 100644
index 0000000000..f7b0c66bfa
--- /dev/null
+++ b/lib/OpenLayers/Rule.js
@@ -0,0 +1,90 @@
+/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
+ * for the full text of the license. */
+
+
+/**
+ * @requires OpenLayers/Util.js
+ * @requires OpenLayers/Style.js
+ *
+ * Class: OpenLayers.Rule
+ *
+ * This class represents a OGC Rule, as being used for rule-based SLD styling
+ */
+OpenLayers.Rule = OpenLayers.Class({
+
+ /**
+ * APIProperty: name
+ * {String} name of this rule
+ */
+ name: 'default',
+
+ /**
+ * Property: symbolizer
+ * {Object} Hash of styles for this rule. Contains hashes of feature
+ * styles. Keys are one or more of ["Point", "Line", "Polygon"]
+ */
+ symbolizer: null,
+
+ /**
+ * APIProperty: minScale
+ * {Number} or {String} minimum scale at which to draw the feature.
+ * In the case of a String, this can be a combination of text and
+ * propertyNames in the form "literal ${propertyName}"
+ */
+ minScale: null,
+
+ /**
+ * APIProperty: maxScale
+ * {Number} or {String} maximum scale at which to draw the feature.
+ * In the case of a String, this can be a combination of text and
+ * propertyNames in the form "literal ${propertyName}"
+ */
+ maxScale: null,
+
+ /**
+ * Constructor: OpenLayers.Rule
+ * Creates a Rule.
+ *
+ * Parameters:
+ * options - {Object} An optional object with properties to set on the
+ * rule
+ *
+ * Returns:
+ * {}
+ */
+ initialize: function(options) {
+ this.symbolizer = {};
+
+ OpenLayers.Util.extend(this, options);
+ },
+
+ /**
+ * APIMethod: destroy
+ * nullify references to prevent circular references and memory leaks
+ */
+ destroy: function() {
+ for (var i in this.symbolizer) {
+ this.symbolizer[i] = null;
+ }
+ this.symbolizer = null;
+ },
+
+ /**
+ * APIMethod: evaluate
+ * evaluates this rule for a specific feature
+ *
+ * Parameters:
+ * feature - {} feature to apply the rule to.
+ *
+ * Returns:
+ * {boolean} true if the rule applies, false if it does not.
+ * This rule is the default rule and always returns true.
+ */
+ evaluate: function(feature) {
+ // Default rule always applies. Subclasses will want to override this.
+ return true;
+ },
+
+ CLASS_NAME: "OpenLayers.Rule"
+});
\ No newline at end of file
diff --git a/lib/OpenLayers/Rule/Comparison.js b/lib/OpenLayers/Rule/Comparison.js
new file mode 100644
index 0000000000..4eaea6e312
--- /dev/null
+++ b/lib/OpenLayers/Rule/Comparison.js
@@ -0,0 +1,204 @@
+/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the Clear BSD
+ * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires: OpenLayers/Rule.js
+ *
+ * Class: OpenLayers.Rule.Comparison
+ *
+ * This class represents the comparison rules, as being used for rule-based
+ * SLD styling
+ *
+ * Inherits from
+ * -
+ */
+OpenLayers.Rule.Comparison = OpenLayers.Class(OpenLayers.Rule, {
+
+ /**
+ * APIProperty: type
+ * {String} type: type of the comparison. This is one of
+ * - OpenLayers.Rule.Comparison.EQUAL_TO = "==";
+ * - OpenLayers.Rule.Comparison.NOT_EQUAL_TO = "!=";
+ * - OpenLayers.Rule.Comparison.LESS_THAN = "<";
+ * - OpenLayers.Rule.Comparison.GREATER_THAN = ">";
+ * - OpenLayers.Rule.Comparison.LESS_THAN_OR_EQUAL_TO = "<=";
+ * - OpenLayers.Rule.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
+ * - OpenLayers.Rule.Comparison.BETWEEN = "..";
+ * - OpenLayers.Rule.Comparison.LIKE = "~";
+ */
+ type: null,
+
+ /**
+ * APIProperty: property
+ * {String}
+ * name of the feature attribute to compare
+ */
+ property: null,
+
+ /**
+ * APIProperty: value
+ * {Number} or {String}
+ * comparison value for binary comparisons. In the case of a String, this
+ * can be a combination of text and propertyNames in the form
+ * "literal ${propertyName}"
+ */
+ value: null,
+
+ /**
+ * APIProperty: lowerBoundary
+ * {Number} or {String}
+ * lower boundary for between comparisons. In the case of a String, this
+ * can be a combination of text and propertyNames in the form
+ * "literal ${propertyName}"
+ */
+ lowerBoundary: null,
+
+ /**
+ * APIProperty: upperBoundary
+ * {Number} or {String}
+ * upper boundary for between comparisons. In the case of a String, this
+ * can be a combination of text and propertyNames in the form
+ * "literal ${propertyName}"
+ */
+ upperBoundary: null,
+
+ /**
+ * Constructor: OpenLayers.Rule.Logical
+ * Creates a logical rule (And, Or, Not).
+ *
+ * Parameters:
+ * params - {Object} Hash of parameters for this rule:
+ * -
+ * - value:
+ * options - {Object} An optional object with properties to set on the
+ * rule
+ *
+ * Returns:
+ * {}
+ */
+ initialize: function(options) {
+ OpenLayers.Rule.prototype.initialize.apply(
+ this, [options]);
+ },
+
+ /**
+ * APIMethod: evaluate
+ * evaluates this rule for a specific feature
+ *
+ * Parameters:
+ * feature - {} feature to apply the rule to.
+ *
+ * Returns:
+ * {boolean} true if the rule applies, false if it does not
+ */
+ evaluate: function(feature) {
+ var attributes = feature.attributes || feature.data;
+ switch(this.type) {
+ case OpenLayers.Rule.Comparison.EQUAL_TO:
+ case OpenLayers.Rule.Comparison.LESS_THAN:
+ case OpenLayers.Rule.Comparison.GREATER_THAN:
+ case OpenLayers.Rule.Comparison.LESS_THAN_OR_EQUAL_TO:
+ case OpenLayers.Rule.Comparison.GREATER_THAN_OR_EQUAL_TO:
+ return this.binaryCompare(feature, this.property, this.value);
+
+ case OpenLayers.Rule.Comparison.BETWEEN:
+ var result =
+ attributes[this.property] > this.lowerBoundary;
+ result = result &&
+ attributes[this.property] < this.upperBoundary;
+ return result;
+ case OpenLayers.Rule.Comparison.LIKE:
+ var regexp = new RegExp(this.value,
+ "gi");
+ return regexp.test(attributes[this.property]);
+ }
+ },
+
+ /**
+ * APIMethod: value2regex
+ * Converts the value of this rule into a regular expression string,
+ * according to the wildcard characters specified. This method has to
+ * be called after instantiation of this class, if the value is not a
+ * regular expression already.
+ *
+ * Parameters:
+ * wildCard - {} wildcard character in the above value, default
+ * is "*"
+ * singleChar - {) single-character wildcard in the above value
+ * default is "."
+ * escape - {) escape character in the above value, default is
+ * "!"
+ *
+ * Returns:
+ * {String} regular expression string
+ */
+ value2regex: function(wildCard, singleChar, escapeChar) {
+ if (wildCard == ".") {
+ var msg = "'.' is an unsupported wildCard character for "+
+ "OpenLayers.Rule.Comparison";
+ OpenLayers.Console.error(msg);
+ return null;
+ }
+
+ // set UMN MapServer defaults for unspecified parameters
+ wildCard = wildCard ? wildCard : "*";
+ singleChar = singleChar ? singleChar : ".";
+ escapeChar = escapeChar ? escapeChar : "!";
+
+ this.value = this.value.replace(
+ new RegExp("\\"+escapeChar, "g"), "\\");
+ this.value = this.value.replace(
+ new RegExp("\\"+singleChar, "g"), ".");
+ this.value = this.value.replace(
+ new RegExp("\\"+wildCard, "g"), ".*");
+ this.value = this.value.replace(
+ new RegExp("\\\\.\\*", "g"), "\\"+wildCard);
+ this.value = this.value.replace(
+ new RegExp("\\\\\\.", "g"), "\\"+singleChar);
+
+ return this.value;
+ },
+
+ /**
+ * Function: binaryCompare
+ * Compares a feature property to a rule value
+ *
+ * Parameters:
+ * feature - {}
+ * property - {String} or {Number}
+ * value - {String} or {Number}, same as property
+ *
+ * Returns:
+ * {boolean}
+ */
+ binaryCompare: function(feature, property, value) {
+ var attributes = feature.attributes || feature.data;
+ switch (this.type) {
+ case OpenLayers.Rule.Comparison.EQUAL_TO:
+ return attributes[property] == value;
+ case OpenLayers.Rule.Comparison.NOT_EQUAL_TO:
+ return attributes[property] != value;
+ case OpenLayers.Rule.Comparison.LESS_THAN:
+ return attributes[property] < value;
+ case OpenLayers.Rule.Comparison.GREATER_THAN:
+ return attributes[property] > value;
+ case OpenLayers.Rule.Comparison.LESS_THAN_OR_EQUAL_TO:
+ return attributes[property] <= value;
+ case OpenLayers.Rule.Comparison.GREATER_THAN_OR_EQUAL_TO:
+ return attributes[property] >= value;
+ }
+ },
+
+ CLASS_NAME: "OpenLayers.Rule.Comparison"
+});
+
+
+OpenLayers.Rule.Comparison.EQUAL_TO = "==";
+OpenLayers.Rule.Comparison.NOT_EQUAL_TO = "!=";
+OpenLayers.Rule.Comparison.LESS_THAN = "<";
+OpenLayers.Rule.Comparison.GREATER_THAN = ">";
+OpenLayers.Rule.Comparison.LESS_THAN_OR_EQUAL_TO = "<=";
+OpenLayers.Rule.Comparison.GREATER_THAN_OR_EQUAL_TO = ">=";
+OpenLayers.Rule.Comparison.BETWEEN = "..";
+OpenLayers.Rule.Comparison.LIKE = "~";
diff --git a/lib/OpenLayers/Rule/FeatureId.js b/lib/OpenLayers/Rule/FeatureId.js
new file mode 100644
index 0000000000..8f4007aa29
--- /dev/null
+++ b/lib/OpenLayers/Rule/FeatureId.js
@@ -0,0 +1,69 @@
+/* Copyright (c) 2006-2007 MetaCarta, Inc., published under the Clear BSD
+ * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+
+/**
+ * @requires: OpenLayers/Rule.js
+ *
+ * Class: OpenLayers.Rule
+ *
+ * This class represents a ogc:FeatureId Rule, as being used for rule-based SLD
+ * styling
+ *
+ * Inherits from
+ * -
+ */
+OpenLayers.Rule.FeatureId = OpenLayers.Class(OpenLayers.Rule, {
+
+ /**
+ * APIProperty: fid
+ * {Array()} Feature Ids to evaluate this rule against. To be passed
+ * To be passed inside the params object.
+ */
+ fids: null,
+
+ /**
+ * Constructor: OpenLayers.Rule.FeatureId
+ * Creates an ogc:FeatureId rule.
+ *
+ * Parameters:
+ * options - {Object} An optional object with properties to set on the
+ * rule
+ *
+ * Returns:
+ * {}
+ *
+ * Inherits from:
+ * -
+ */
+ initialize: function(options) {
+ this.fids = [];
+ OpenLayers.Rule.prototype.initialize.apply(
+ this, [options]);
+ },
+
+ /**
+ * APIMethod: evaluate
+ * evaluates this rule for a specific feature
+ *
+ * Parameters:
+ * feature - {} feature to apply the rule to.
+ * For vector features, the check is run against the fid,
+ * for plain features against the id.
+ *
+ * Returns:
+ * {boolean} true if the rule applies, false if it does not
+ */
+ evaluate: function(feature) {
+ for (var i=0; i
+ */
+OpenLayers.Rule.Logical = OpenLayers.Class(OpenLayers.Rule, {
+
+ /**
+ * APIProperty: children
+ * {Array()} child rules for this rule
+ */
+ children: null,
+
+ /**
+ * APIProperty: type
+ * {String} type of logical operator. Available types are:
+ * - OpenLayers.Rule.Locical.AND = "&&";
+ * - OpenLayers.Rule.Logical.OR = "||";
+ * - OpenLayers.Rule.Logical.NOT = "!";
+ */
+ type: null,
+
+ /**
+ * Constructor: OpenLayers.Rule.Logical
+ * Creates a logical rule (And, Or, Not).
+ *
+ * Parameters:
+ * options - {Object} An optional object with properties to set on the
+ * rule
+ *
+ * Returns:
+ * {}
+ */
+ initialize: function(options) {
+ this.children = [];
+ OpenLayers.Rule.prototype.initialize.apply(
+ this, [options]);
+ },
+
+ /**
+ * APIMethod: destroy
+ * nullify references to prevent circular references and memory leaks
+ */
+ destroy: function() {
+ for (var i=0; i} feature to apply the rule to.
+ *
+ * Returns:
+ * {boolean} true if the rule applies, false if it does not
+ */
+ evaluate: function(feature) {
+ switch(this.type) {
+ case OpenLayers.Rule.Logical.AND:
+ for (var i=0; i} name of the layer that this style belongs to, usually
+ * according to the NamedLayer attribute of an SLD document.
+ */
+ layerName: null,
+
+ /**
+ * APIProperty: isDefault
+ * {Boolean}
+ */
+ isDefault: false,
+
+ /**
+ * Property: rules
+ * Array({})
+ */
+ rules: null,
+
+ /**
+ * Property: defaultStyle
+ * {Object} hash of style properties to use as default for merging
+ * rule-based style symbolizers onto. If no rules are defined, createStyle
+ * will return this style.
+ */
+ defaultStyle: null,
+
+ /**
+ * Property: propertyStyles
+ * {Hash of Boolean} cache of style properties that need to be parsed for
+ * propertyNames. Property names are keys, values won't be used.
+ */
+ propertyStyles: null,
+
+
+ /**
+ * Constructor: OpenLayers.Style
+ * Creates a UserStyle.
+ *
+ * Parameters:
+ * style - {Object} Optional hash of style properties that will be
+ * used as default style for this style object. This style
+ * applies if no rules are specified. Symbolizers defined in
+ * rules will extend this default style.
+ * options - {Object} An optional object with properties to set on the
+ * userStyle
+ *
+ * Return:
+ * {}
+ */
+ initialize: function(style, options) {
+ this.rules = [];
+
+ // use the default style from OpenLayers.Feature.Vector if no style
+ // was given in the constructor
+ this.setDefaultStyle(style ||
+ OpenLayers.Feature.Vector.style["default"]);
+
+ OpenLayers.Util.extend(this, options);
+ },
+
+ /**
+ * APIMethod: destroy
+ * nullify references to prevent circular references and memory leaks
+ */
+ destroy: function() {
+ for (var i=0; i} feature to evaluate rules for
+ * baseStyle - {Object} hash of styles feature styles to extend
+ *
+ * Returns:
+ * {} hash of feature styles
+ */
+ createStyle: function(feature, baseStyle) {
+ if (!baseStyle) {
+ baseStyle = this.defaultStyle;
+ }
+ var style = OpenLayers.Util.extend({}, baseStyle);
+
+ var draw = true;
+
+ for (var i=0; i OpenLayers.Style.createLiteral(
+ this.rules[i].minScale, feature);
+ }
+ if (draw && this.rules[i].maxScale) {
+ draw = scale < OpenLayers.Style.createLiteral(
+ this.rules[i].maxScale, feature);
+ }
+
+ // determine which symbolizer (Point, Line, Polygon) to use
+ var symbolizerPrefix = feature.geometry ?
+ this.getSymbolizerPrefix(feature.geometry) :
+ OpenLayers.Style.SYMBOLIZER_PREFIXES[0];
+
+ // now merge the style with the current style
+ var symbolizer = this.rules[i].symbolizer[symbolizerPrefix];
+ OpenLayers.Util.extend(style, symbolizer);
+ }
+ }
+
+ style.display = draw ? "" : "none";
+
+ // calculate literals for all styles in the propertyStyles cache
+ for (var i in this.propertyStyles) {
+ style[i] = OpenLayers.Style.createLiteral(style[i], feature);
+ }
+
+ return style;
+ },
+
+ /**
+ * Method: findPropertyStyles
+ * Looks into all rules for this style and the defaultStyle to collect
+ * all the style hash property names containing ${...} strings that have
+ * to be replaced using the createLiteral method before returning them.
+ *
+ * Returns:
+ * {Object} hash of property names that need createLiteral parsing. The
+ * name of the property is the key, and the value is true;
+ */
+ findPropertyStyles: function() {
+ var propertyStyles = {};
+
+ // check the default style
+ var style = this.defaultStyle;
+ for (var i in style) {
+ if (typeof style[i] == "string" && style[i].match(/\$\{\w+\}/)) {
+ propertyStyles[i] = true;
+ }
+ }
+
+ // walk through all rules to check for properties in their symbolizer
+ var rules = this.rules;
+ var prefixes = OpenLayers.Style.SYMBOLIZER_PREFIXES;
+ for (var i in rules) {
+ for (var s=0; s)}
+ */
+ addRules: function(rules) {
+ this.rules = this.rules.concat(rules);
+ this.propertyStyles = this.findPropertyStyles();
+ },
+
+ /**
+ * APIMethod: setDefaultStyle
+ * Sets the default style for this style object.
+ *
+ * Parameters:
+ * style - {Object} Hash of style properties
+ */
+ setDefaultStyle: function(style) {
+ this.defaultStyle = style;
+ this.propertyStyles = this.findPropertyStyles();
+ },
+
+ /**
+ * Method: getSymbolizerPrefix
+ * Returns the correct symbolizer prefix according to the
+ * geometry type of the passed geometry
+ *
+ * Parameters:
+ * geometry {}
+ *
+ * Returns:
+ * {String} key of the according symbolizer
+ */
+ getSymbolizerPrefix: function(geometry) {
+ var prefixes = OpenLayers.Style.SYMBOLIZER_PREFIXES;
+ for (var i=0; i} feature to take attribute values from
+ *
+ * Returns:
+ * {String} the parsed value. In the example of the value parameter above, the
+ * result would be "foo valueOfBar", assuming that the passed feature has an
+ * attribute named "bar" with the value "valueOfBar".
+ */
+OpenLayers.Style.createLiteral = function(value, feature) {
+ if (typeof value == "string" && value.indexOf("${") != -1) {
+ var attributes = feature.attributes || feature.data;
+ value = OpenLayers.String.format(value, attributes)
+ value = isNaN(value) ? value : parseFloat(value);
+ }
+ return value;
+}
+
+/**
+ * Constant: OpenLayers.Style.SYMBOLIZER_PREFIXES
+ * {Array} prefixes of the sld symbolizers. These are the
+ * same as the main geometry types
+ */
+OpenLayers.Style.SYMBOLIZER_PREFIXES = ['Point', 'Line', 'Polygon'];
diff --git a/tests/Rule/test_Comparison.html b/tests/Rule/test_Comparison.html
new file mode 100644
index 0000000000..2793fc39e2
--- /dev/null
+++ b/tests/Rule/test_Comparison.html
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
diff --git a/tests/Rule/test_FeatureId.html b/tests/Rule/test_FeatureId.html
new file mode 100644
index 0000000000..b5f554c8a7
--- /dev/null
+++ b/tests/Rule/test_FeatureId.html
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
diff --git a/tests/Rule/test_Logical.html b/tests/Rule/test_Logical.html
new file mode 100644
index 0000000000..b6398fb874
--- /dev/null
+++ b/tests/Rule/test_Logical.html
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
diff --git a/tests/list-tests.html b/tests/list-tests.html
index 34d2fcb08f..5abbc687b7 100644
--- a/tests/list-tests.html
+++ b/tests/list-tests.html
@@ -35,6 +35,11 @@