* Style and Rule now have separate context properties

* new convenience method addUniqueValueRules in OL.!StyleMap. This can actually be used to achieve what I was trying to show in the example of this ticket's description.
 * some refactoring of OL.Style to remove duplicate code (with tests)
 * a new example showing how to add a "unique value" legend to a point layer using the new addUniqueValueRules method
 * Rule.symbolizer can now also be just a symbolizer, instead of a hash of symbolizers keyed by "Point", "Line", "Polygon". This will make things even simpler (as can be seen in the styles-unique.html example)

r=tschaub (closes #1373)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6396 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2008-02-28 17:57:37 +00:00
parent d3294e73fd
commit 2f0382e6f6
6 changed files with 187 additions and 35 deletions

View File

@@ -38,7 +38,7 @@
}
function test_Comparison_evaluate(t) {
t.plan(3);
t.plan(4);
var rule = new OpenLayers.Rule.Comparison({
property: "area",
@@ -62,6 +62,11 @@
t.eq(result, ruleResults[i], "feature "+i+
" evaluates to "+result.toString()+" correctly.");
}
rule.context = {
area: 4998
}
var result = rule.evaluate();
t.eq(result, true, "evaluation against custom rule context works.");
}
</script>
</head>