openlayers/ol3 — pull request #912 by tschaub (2013-08-15 19:11:21+00:00)
Title: Seperate fill and stroke symbolizers and provide "else" symbolizers

***Part I:*** Fill and Stroke Symbolizers

Terminology: Symbolizers are user facing. Renderers get literals (or symbolizer literals). Symbolizers have expressions that are evaluated, literals only have literal values.

To make it more straightforward for users, we separate the `ol.style.Fill` and `ol.style.Stroke` symbolizers (these generate `ol.style.LineLiteral` or `ol.style.PolygonLiteral` depending on the target geometry type). The fill and stroke symbolizers are also used in the `ol.style.Shape` symbolizer (which generates a `ol.style.ShapeLiteral` when used to render point geometries). Separating fill and stroke also lets users specify a rule that may apply to lines or polygons (and the appropriate literals can be created and cached after feature parsing).

***Part II:*** Providing "Else" Symbolizers

The "else" symbolizers apply in two context (really the same): when no rules are provided or when none of the provided rules apply. So, for people who don't care about rule based styling, the style constructor is simplified to this:

```js
var style = new ol.style.Style({symbolizers: [
new ol.style.Fill({color: '#ff0000'})
]});
```

For people who do leverage rule based styling, the "else" symbolizers (those provided at the root of the style options) are used to generate literals for features when none of the other rules apply. (Note that this is the same as the `ElseFilter` in [SLD](http://mapserver.org/ogc/sld.html)).

```js
var style = new ol.style.Style({
rules: [
new ol.style.Rule({
filter: 'type == "highway"'
symbolizers: [
new ol.style.Stroke({
color: '#ff0000',
width: 3.5
})
]
})
],
symbolizers: [
new ol.style.Stroke({
color: '#666666'
width: 1.5
})
]
});
```js

With these changes, we can nicely handle SLD and CSS dialects. I don't think we should add the concepts of default symbolizer literal values as in OpenLayers 2 - though the same effect can be achieved with a CSS styling language.