openlayers/ol3 — pull request #1598 by elemoine (2014-01-27 13:08:34+00:00)
Title: Changing the style function doesn't redraw the layer

When calling `setStyleFunction` to change the style function one expects the vector layer to be redrawn (using the styles returned by the new style function). But that does not happen.

It doesn't happen because, in that case, the vector layer renderer just replays the current batch, with old style values, as opposed to creating a new batch.

The vector layer renderer could use the revision number of the vector layer rather than that of the vector source. In this way changes to the vector source should still be detected (and result in the creation of a new batch).

But I think we have problems here:

* Calling `setStyleFunction` dispatches a `propertychange` event, rather than a `change` event. And we currently don't increment the revision number when dispatching `propertychange` events. (Should we?)

* `renderGeometryFunctions` is also a property of vector layers. But when `setRenderGeometryFunctions` is called we don't want to throw away the current batch and create a new one. The `renderGeometryFunctions` are indeed a way to skip geometries without invalidating the current batch.

So calling `setStyleFunction` should result in a new batch being created (and rendered), while calling `setRenderGeometryFunctions` should result in the current batch being replayed.