value: 'sledrun'
});
+ // Returns 0 to 5 for features that represent sledruns as their condition
+ var get_sledrun_condition = function(feature) {
+ if (feature.attributes.condition === undefined) return 0;
+ return feature.attributes.condition;
+ }
+
+
var layer_point = new OpenLayers.Layer.Vector("Point", {
styleMap: new OpenLayers.StyleMap({
'default': new OpenLayers.Style({
context: {
// the following context functions should only be available in the rule that uses them,
// but the rule dependent contexts are ignored by OpenLayers (I think that's a bug)
- getCondition: function(feature) {
- if (feature.attributes.condition === undefined) return 0;
- return feature.attributes.condition;
- },
+ getCondition: get_sledrun_condition,
getSymbol: function(feature) {
var name = feature.attributes.type;
return name;
new OpenLayers.Rule({
filter: filter_point_sledrun,
symbolizer: {
- externalGraphic: '/vorlagen/bahnzustand${getCondition}_0.png',
+ externalGraphic: '/vorlagen/bahnzustand${getCondition}nn.png',
graphicWidth: 17,
graphicHeight: 17,
graphicXOffset: -8,
fontWeight: "bold"
}, {
context: {
+ getCondition: get_sledrun_condition,
getTitle: function(feature) {
var title = '';
if (feature.attributes.type != 'point') {
filter: filter_point_sledrun,
symbolizer: {
label: "${name}",
- labelYOffset: 14
+ labelYOffset: 14,
+ externalGraphic: '/vorlagen/bahnzustand${getCondition}nh.png'
}
}),
new OpenLayers.Rule({
}),
select: new OpenLayers.Style({
fillOpacity: 1.
+ }, {
+ context: {
+ getCondition: get_sledrun_condition,
+ },
+ rules: [
+ new OpenLayers.Rule({
+ filter: filter_point_sledrun,
+ symbolizer: {
+ externalGraphic: '/vorlagen/bahnzustand${getCondition}nh.png'
+ }
+ })
+ ]
})
}),
rendererOptions: {yOrdering: true}