Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 7f729155 authored by Bernhard Beschow's avatar Bernhard Beschow

remove unneeded method overload

parent bc6ad545
......@@ -72,16 +72,6 @@ void GeoSceneAbstractTileProjection::setLevelZeroRows(int levelZeroRows)
d_ptr->levelZeroRows = levelZeroRows;
}
GeoDataLatLonBox GeoSceneAbstractTileProjection::geoCoordinates(int zoomLevel, int x, int y) const
{
qreal west, north, east, south;
geoCoordinates(zoomLevel, x, y, west, north);
geoCoordinates(zoomLevel, x + 1, y + 1, east, south);
return GeoDataLatLonBox(north, south, east, west);
}
GeoDataLatLonBox GeoSceneAbstractTileProjection::geoCoordinates(const TileId &tileId) const
{
return geoCoordinates(tileId.zoomLevel(), tileId.x(), tileId.y());
......
......@@ -93,20 +93,6 @@ public:
*/
virtual QRect tileIndexes(const GeoDataLatLonBox &latLonBox, int zoomLevel) const = 0;
/**
* @brief Get the north-west geo coordinates corresponding to a tile.
* If @p x, @p y or @p zoomLevel have values out-of-bounds, the behaviour is undefined.
*
* @param zoomLevel the zoomlevel of the tile
* @param x the x index of the tile
* @param y the y index of the tile
* @param westernTileEdgeLon the longitude angle in radians of the western tile edge tis returned through this parameter
* @param northernTileEdgeLat the latitude angle in radians of the northern tile edge is returned through this parameter
*/
virtual void geoCoordinates(int zoomLevel,
int x, int y,
qreal& westernTileEdgeLon, qreal& northernTileEdgeLat) const = 0;
/**
* @brief Get the boundary geo coordinates corresponding to a tile.
* If @p x, @p y or @p zoomLevel have values out-of-bounds, the behaviour is undefined.
......@@ -117,7 +103,7 @@ public:
*
* @return geographic bounding box covered by the given tile
*/
GeoDataLatLonBox geoCoordinates(int zoomLevel, int x, int y) const;
virtual GeoDataLatLonBox geoCoordinates(int zoomLevel, int x, int y) const = 0;
/**
* @brief Get the boundary geo coordinates corresponding to a tile.
......
......@@ -129,17 +129,18 @@ QRect GeoSceneEquirectTileProjection::tileIndexes(const GeoDataLatLonBox &latLon
return QRect(QPoint(westX, northY), QPoint(eastX, southY));
}
void GeoSceneEquirectTileProjection::geoCoordinates(int zoomLevel,
int x, int y,
qreal& westernTileEdgeLon, qreal& northernTileEdgeLat) const
GeoDataLatLonBox GeoSceneEquirectTileProjection::geoCoordinates(int zoomLevel, int x, int y) const
{
qreal radius = (1 << zoomLevel) * levelZeroColumns() / 2.0;
const qreal radiusX = (1 << zoomLevel) * levelZeroColumns() / 2.0;
const qreal radiusY = (1 << zoomLevel) * levelZeroRows() / 2.0;
westernTileEdgeLon = (x - radius ) / radius * M_PI;
const qreal west = (x - radiusX) / radiusX * M_PI;
const qreal north = (radiusY - y) / radiusY * M_PI / 2.0;
radius = (1 << zoomLevel) * levelZeroRows() / 2.0;
const qreal east = ((x + 1) - radiusX) / radiusX * M_PI;
const qreal south = (radiusY - (y + 1)) / radiusY * M_PI / 2.0;
northernTileEdgeLat = (radius - y) / radius * M_PI / 2.0;
return GeoDataLatLonBox(north, south, east, west);
}
}
......@@ -62,9 +62,7 @@ public:
/**
* @copydoc
*/
void geoCoordinates(int zoomLevel,
int x, int y,
qreal& westernTileEdgeLon, qreal& northernTileEdgeLat) const override;
GeoDataLatLonBox geoCoordinates(int zoomLevel, int x, int y) const override;
using GeoSceneAbstractTileProjection::geoCoordinates;
......
......@@ -151,15 +151,19 @@ QRect GeoSceneMercatorTileProjection::tileIndexes(const GeoDataLatLonBox &latLon
return QRect(QPoint(westX, northY), QPoint(eastX, southY));
}
void GeoSceneMercatorTileProjection::geoCoordinates(int zoomLevel,
int x, int y,
qreal& westernTileEdgeLon, qreal& northernTileEdgeLat) const
GeoDataLatLonBox GeoSceneMercatorTileProjection::geoCoordinates(int zoomLevel, int x, int y) const
{
const unsigned int xTileCount = (1 << zoomLevel) * levelZeroColumns();
westernTileEdgeLon = lonFromTileX(x, xTileCount);
const unsigned int yTileCount = (1 << zoomLevel) * levelZeroRows();
northernTileEdgeLat = latFromTileY(y, yTileCount);
const qreal west = lonFromTileX(x, xTileCount);
const qreal north = latFromTileY(y, yTileCount);
const qreal east = lonFromTileX(x + 1, xTileCount);
const qreal south = latFromTileY(y + 1, yTileCount);
return GeoDataLatLonBox(north, south, east, west);
}
}
......@@ -66,9 +66,7 @@ public:
/**
* @copydoc
*/
void geoCoordinates(int zoomLevel,
int x, int y,
qreal& westernTileEdgeLon, qreal& northernTileEdgeLat) const override;
GeoDataLatLonBox geoCoordinates(int zoomLevel, int x, int y) const override;
using GeoSceneAbstractTileProjection::geoCoordinates;
......
......@@ -411,16 +411,7 @@ void TileProjectionTest::testGeoCoordinatesEquirect()
QFETCH(qreal, expectedEasternTileEdgeLon);
QFETCH(qreal, expectedSouthernTileEdgeLat);
GeoSceneEquirectTileProjection projection;
qreal westernTileEdgeLon;
qreal northernTileEdgeLat;
// method variant with zoomLevel, tileX, tileY
projection.geoCoordinates(zoomLevel, tileX, tileY, westernTileEdgeLon, northernTileEdgeLat);
QCOMPARE(westernTileEdgeLon, expectedWesternTileEdgeLon);
QCOMPARE(northernTileEdgeLat, expectedNorthernTileEdgeLat);
const GeoSceneEquirectTileProjection projection;
// method variants with GeoDataLatLonBox
const GeoDataLatLonBox latLonBox = projection.geoCoordinates(zoomLevel, tileX, tileY);
......@@ -487,16 +478,7 @@ void TileProjectionTest::testGeoCoordinatesMercator()
QFETCH(qreal, expectedEasternTileEdgeLon);
QFETCH(qreal, expectedSouthernTileEdgeLat);
GeoSceneMercatorTileProjection projection;
qreal westernTileEdgeLon;
qreal northernTileEdgeLat;
// method variant with zoomLevel, tileX, tileY
projection.geoCoordinates(zoomLevel, tileX, tileY, westernTileEdgeLon, northernTileEdgeLat);
QCOMPARE(westernTileEdgeLon, expectedWesternTileEdgeLon);
QFUZZYCOMPARE(northernTileEdgeLat, expectedNorthernTileEdgeLat, 0.00001);
const GeoSceneMercatorTileProjection projection;
// method variants with GeoDataLatLonBox
const GeoDataLatLonBox latLonBox = projection.geoCoordinates(zoomLevel, tileX, tileY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment