openlayers/ol3 — pull request #797 by bbinet (2013-06-19 08:22:33+00:00)
Title: Layer group support

This PR adds support for layer groups (aka composite layers, aggregate layers).

A layergroup is basically a collection of layer or layergroup which implements a common interface with the layer and will modify the layerStates of its child layers in the framestate when a property (brightness, contrast, hue, opacity, saturation, visible) of this layergroup has changed.

There is still some work to do on the webgl renderer side for the layer group to correctly update values for hue, brightness, contrast, saturation properties.
Currently, some webgllayerrenderer callbacks are directly registered to the "change" event for hue, brightness, contrast, saturation layer properties, and these callbacks will update the corresponding matrix if needed and will request the map to render.
This is not compatible with the layergroup because a layergroup has no renderer but directly modify the layerState of its child layers in the framestate, so for example when the hue property of a layergroup change, the layergroup will request the map to render but the hue matrix will not be updated because the hue property of the child layers will not actually change (the hue value will only change in the framestate layerStates).

So I propose to change the way the webgl renderer works to update its internal matrices for hue, brightness, contrast, and saturation: instead of updating these matrices when properties change, we could only rely on the framestate and update a matrix in the renderFrame method only if we detect that a layer property has changed in the framestate.

I would like to have your opinion on this as it changes a bit the way the webgl renderer works.
If you agree with this change I will do it and update the pull request.