Introducing GeoSceneAbstractTileProjection for tile x/y <-> lonlat
Summary: In the current code in some places hard assumptions are made about the projection used by the tile material. Also are calculations duplicated. The new abstract class GeoSceneAbstractTileProjection and its currently two concrete subclasses GeoSceneEquirectTileProjection & GeoSceneMercatorTileProjection should allow to make most code agnostic of the tile projection details and also remove the code duplication, also makes unit testing of the projection easy. GeoSceneAbstractTileProjection follows the concepts of AbstractProjection and has conversion methods in the interface, with the output vars as non-const references at the end of the argument list (for consistency, I personally prefer yielded stuff as return parameter, or have output vars at least being first in the argument list and as pointers for improved markup in the calling code). As the current two implementations need to know about the variables levelZeroColumns and levelZeroRows, I made these properties of the classes themselves, to avoid having the classes depend on GeoSceneTileDataset. Comes at the cost of data duplication and thus more complicated setup, but also avoids an indirection in the class methods using these values. For simplicity I put these properties onto GeoSceneAbstractTileProjection itself, to avoid another intermediate abstract subclass for the concept of levelZeroColumns and levelZeroRows. The projection methods do not do any out-of-bounds handling, but expect the calling code to pass proper value. Which should be valid with the current callees. Any methods tileProjection() have been renamed to tileProjectionType(), to make clear those just return the type, not a projection object. The patch also makes TileId more dump again and just a property container, especially no longer knowing about GeoSceneTileDataset. FUTURE WORK: * Look into all remaining places which have "if tileProjectionType() == x" to see how they can be made tile projection type agnostic as well Reviewers: rahn, #marble Reviewed By: rahn, #marble Subscribers: rahn Differential Revision: https://phabricator.kde.org/D2780
parent
c85227a4
Please register or sign in to comment