// path layer
// ----------
+ function style_point_function(feature, resolution) {
+ var src = img_path + '/marker_p_' + feature.get('type') + '.png';
+ return new ol.style.Style({
+ image: new ol.style.Icon({
+ src: src,
+ imgSize: [20, 34],
+ anchor: [0.5, 1.0]
+ })
+ });
+ }
+
+ function style_path_function(feature, resolution) {
+ var line_color = {
+ 'rodelbahn': '#014e9a',
+ 'gehweg': '#e98401',
+ 'alternative': '#7f7fff',
+ 'lift': '#000000',
+ 'anfahrt': '#e1e100'
+ };
+ var color = feature.get('strokeColor') || line_color[feature.get('type')] || '#e7525b';
+ var width = (feature.get('type') in ['lift', 'anfahrt']) ? 3 : 6;
+ return new ol.style.Style({
+ stroke: new ol.style.Stroke({
+ color: color,
+ width: width
+ })
+ });
+ }
+
+ function style_function(feature, resolution) {
+ if (feature.getGeometry() instanceof ol.geom.Point) return style_point_function(feature, resolution);
+ return style_path_function(feature, resolution);
+ };
+
var layer_path = new OpenLayers.Layer.Vector("Path", {
styleMap: new OpenLayers.StyleMap(new OpenLayers.Style({
strokeColor: '${getStrokeColor}',
var layer_sledrun_source = new ol.source.Vector({features: features_all});
var layer_sledrun = new ol.layer.Vector({
- source: layer_sledrun_source
- // style: styleFunction
+ source: layer_sledrun_source,
+ style: style_function
});
var map = new ol.Map({