Ticket #1373 (closed bug: fixed)
Style and Rule should have separate context properties
| Reported by: | ahocevar | Owned by: | ahocevar |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.6 Release |
| Component: | Style | Version: | 2.5 |
| Keywords: | Cc: | ||
| State: | Complete |
Description
The Rule.context property was intended to allow for evaluating a rule against a different object than the attributes of the feature about to be rendered. But it might be even more useful to define a Style.context to pull property values from.
Example: I have features with an attribute. let's say type. I do not want to do complex rule-based styling, I just want to have a lookup table for the type to choose an externalGraphic:
layer.features[0].attributes = {
type: "scenic"
}
var lookup = {
"recreation": "rec01.png",
"scenic": "icon37.png"
}
var pointSymbolizer = {
externalGraphic: "${type}"
}
var style = new OpenLayers.Style(pointSymbolizer, {context: lookup});
layer.styleMap = new OpenLayers.StyleMap(style);
This would be a first step towards convenience of complex styling.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

