Create and remove layer renderers in renderFrame

Previously, the map renderer would listen for layers being added and
removed from the layers collection, and would create and remove layer
renderers in response to these events.

With this change, layer renderers are only created or removed when
renderFrame is called, which leads to somewhat simpler code.

We still need to listen to changes to the layers collection, but now
these only trigger a new render.

This new approach also has an advantage when layers change order.
Swapping the order of two layers involves removing one and re-inserting
it elsewhere.  With the old approach, this would cause the deletion and
re-creation of the layer renderer.  With this new approach, the layer
renderer is preserved.
Remove layer renderers in post render function
Track changes to layers in the map
Handle obscure edge case where deferred post render function receives a null frame state
Merge pull request #542 from twpayne/simplify-renderer-events

Create and remove layer renderers in renderFrame
Always create layer renderer, even when layer is invisible or not ready

This is necessary because it is the layer renderer that is responsible
for triggering a render when a layer loads or becomes visible.
Render instead of requestRenderFrame when single image loads
Merge pull request #562 from twpayne/renderer-fixes

Renderer fixes
Add index to frame state
Use index instead of time as frame marker
Merge pull request #563 from twpayne/single-image-load-render

Render instead of requestRenderFrame when single image loads
Merge pull request #564 from twpayne/frame-index

Frame index
Add ol.DeviceOrientation
Add 'tracking' property to ol.DeviceOrientation
Add 'heading' property to ol.DeviceOrientation