Closed petrsloup closed 9 years ago
There is a need to support non-tiled source #9 as well.
Updated the description to support (non-tiled) image sources as well.
Instead of the ol.reproj.createTile
and ol.reproj.createImage
methods, new classes were implemented: ol.reproj.Tile
and ol.reproj.Image
with the constructor parameters being the same as the arguments described above.
Since the reprojection process is asynchronous (waiting for the input data), it is much cleaner to maintain the reprojection data, state and callbacks inside the instance rather than creating several closure from the createX
methods and modifying the instance. (For example, after reprojecting the data, there was no natural way to change the state
of the Tile/Image -- the instance should be responsible for its own state.)
This initial work is now practically finished - all code is in rasterreproj branch.
Demo is visible at: http://klokantech.github.io/ol3raster/examples/reprojection.html
Two warping functions sharing most of the code: a) For tile sources:
ol.reproj.createTile(sourceProj, sourceTileGrid, targetProj, targetTileGrid, x, y, z, pixelRatio, getTileFunction) -> ol.Tile
b) For image sources:ol.reproj.createImage(sourceProj, targetProj, targetExtent, targetResolution, pixelRatio, getImageFunction) -> ol.ImageBase
targetProjection
tosourceProjection
targetProj.getMetersPerUnit() * targetProj.getPointResolution(targetResolution, extentCenter) / sourceProj.getMetersPerUnit()
z
+getTileRangeForExtentAndResolution
to determine which tiles are requiredgetImageFunction
ol.Tile
b)ol.ImageBase
) with state set to LOADINGchange
events on all inputs if needed (not cached))