In OpenLayers 2.12, the backbuffer for each layer was placed right below
the layer itself. With animated zooming, that was changed so backbuffers
are all placed below the base layer. As it turned out, this is only good
for certain kinds of layers (e.g. street labels), so the default now is
to place the backbuffer right below its layer again. But the
transitionEffect option can now have a new value, 'map-resize', which will
cause the backbuffer to be placed below the base layer.
Since we don't rely on the DOM order for layers, we also cannot rely on it
for backbuffers. This change simply adds a sensible z-index to the
backbuffer container.
When an application zooms the map programmatically right after
initialization, there will be an empty backbuffer. This should be avoided,
because it adds an unnecessary DOM element.
The tile.onLoadEnd handler registers a transitionend listener on the image
of the last loaded tile. But if loading was aborted, there will be no
image. The new logic registers the transitionend event on the last child
of the layer div, which is not necessarily the tile we're handling loadend
for. When the backbuffer is empty (i.e. no tile was loaded at the time the
backbuffer was created), it will be removed immediately.
We need to handle the backbuffer before we fire the loadend event.
Otherwise listeners that call e.g. mergeNewParams() will cause the
backbuffer removal code to fail, because tile.imgDiv (and hence
this._transitionElement) will be null.
This change introduces a new 'replace' mode for tile transitions: when the
resolution does not change, which happens when mergeNewParams is called,
the tile will be marked with the .olTileReplace class. If this class sets
the tile's imgDiv display to 'none', the backbuffer for the tile will
immediately be removed when the tile is loaded.
The loadend event of an image is fired before the image is rendered. For
standard 256x256 tiles, this does not matter. But for singleTile layers on
large screens, rendering time needs to be considered. So we add a delay
that depends on the tile size. TODO: make the denominator configurable.
We now reuse tile images by maintaining a cache of image elements with a
simplified LRU expiry policy (by order, not by timestamp). The tile queue
is bypassed for images that are available in the cache, so they can be
rendered immediately. And the tile queue itself loads more than just one
image at a time now (2 per layer url).
In addition to relying on removeBackBufferDelay, we can remove the
backbuffer earlier without flicker in an ontransitionend listener on the
last loaded tile.
Calculating pixel positions from origin and grid index causes alignment
issues in the grid. By going back to incremental positioning, we get a
result without blank spaces between tiles again.
Now we also do not use deltas for shiftRow and shiftColumn. Some
refactoring was done so we do not need different calculateGridLayout
methods for layers with top-left and bottom-left tile origin.
TODO: With this commit, ArcGisCache and KaMap layers are broken.