Get rid of extra style arrays in examples

This commit is contained in:
Tim Schaub
2015-11-11 18:18:41 -07:00
parent e8c99e4e63
commit 99a902a311
19 changed files with 212 additions and 242 deletions

View File

@@ -19,8 +19,8 @@ var styleFunction = (function() {
fill: null,
stroke: new ol.style.Stroke({color: 'orange', width: 2})
});
styles['Point'] = [new ol.style.Style({image: image})];
styles['Polygon'] = [new ol.style.Style({
styles['Point'] = new ol.style.Style({image: image});
styles['Polygon'] = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'blue',
width: 3
@@ -28,14 +28,14 @@ var styleFunction = (function() {
fill: new ol.style.Fill({
color: 'rgba(0, 0, 255, 0.1)'
})
})];
styles['MultiLinestring'] = [new ol.style.Style({
});
styles['MultiLinestring'] = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'green',
width: 3
})
})];
styles['MultiPolygon'] = [new ol.style.Style({
});
styles['MultiPolygon'] = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'yellow',
width: 1
@@ -43,8 +43,8 @@ var styleFunction = (function() {
fill: new ol.style.Fill({
color: 'rgba(255, 255, 0, 0.1)'
})
})];
styles['default'] = [new ol.style.Style({
});
styles['default'] = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'red',
width: 3
@@ -53,7 +53,7 @@ var styleFunction = (function() {
color: 'rgba(255, 0, 0, 0.1)'
}),
image: image
})];
});
return function(feature, resolution) {
return styles[feature.getGeometry().getType()] || styles['default'];
};