summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-09-11 05:06:13 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-09-11 05:53:40 (GMT)
commite929bbcb89d64aec0dd3487d88e3f771d0ca340b (patch)
treee862c1be067c0ca1051fc94b0c53a7a4b97fa7f5
parent5ffca170843876ae99a181f7d27e5cd498a62560 (diff)
Move inverse methods tileX2lon, tile2Ylat to TileId as well.
-rw-r--r--src/lib/marble/TileId.cpp14
-rw-r--r--src/lib/marble/TileId.h2
-rw-r--r--tools/vectorosm-tilecreator/BaseClipper.cpp13
-rw-r--r--tools/vectorosm-tilecreator/BaseClipper.h3
-rw-r--r--tools/vectorosm-tilecreator/ShpCoastlineProcessor.cpp9
-rw-r--r--tools/vectorosm-tilecreator/TinyPlanetProcessor.cpp1
6 files changed, 22 insertions, 20 deletions
diff --git a/src/lib/marble/TileId.cpp b/src/lib/marble/TileId.cpp
index d8e7e26..d408d7f 100644
--- a/src/lib/marble/TileId.cpp
+++ b/src/lib/marble/TileId.cpp
@@ -103,6 +103,20 @@ unsigned int TileId::lat2tileY( qreal latitude, unsigned int maxTileY )
return (unsigned int)floor(0.5 * (1.0 - gdInv(lat) / M_PI) * maxTileY);
}
+
+qreal TileId::tileX2lon( unsigned int x, unsigned int maxTileX )
+{
+ return ( (2*M_PI * x) / maxTileX - M_PI );
+}
+
+qreal TileId::tileY2lat( unsigned int y, unsigned int maxTileY )
+{
+ return gd(M_PI * (1.0 - (2.0 * y) / maxTileY));
+}
+
+
+
+
}
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/lib/marble/TileId.h b/src/lib/marble/TileId.h
index baab7d3..ce94078 100644
--- a/src/lib/marble/TileId.h
+++ b/src/lib/marble/TileId.h
@@ -45,6 +45,8 @@ class MARBLE_EXPORT TileId
static unsigned int lon2tileX( qreal lon, unsigned int maxTileX );
static unsigned int lat2tileY( qreal lat, unsigned int maxTileY );
+ static qreal tileX2lon( unsigned int x, unsigned int maxTileX );
+ static qreal tileY2lat( unsigned int y, unsigned int maxTileY );
private:
uint m_mapThemeIdHash;
diff --git a/tools/vectorosm-tilecreator/BaseClipper.cpp b/tools/vectorosm-tilecreator/BaseClipper.cpp
index 286aa74..358a3d6 100644
--- a/tools/vectorosm-tilecreator/BaseClipper.cpp
+++ b/tools/vectorosm-tilecreator/BaseClipper.cpp
@@ -110,19 +110,6 @@ BaseClipper::BaseClipper() :
}
-qreal BaseClipper::tileX2lon( unsigned int x, unsigned int maxTileX )
-{
- return ( (2*M_PI * x) / maxTileX - M_PI );
-}
-
-qreal BaseClipper::tileY2lat( unsigned int y, unsigned int maxTileY )
-{
- return gd(M_PI * (1.0 - (2.0 * y) / maxTileY));
-}
-
-
-
-
void BaseClipper::initClipRect (const GeoDataLatLonBox &clippingBox, int pointsToAddAtEdges)
{
m_left = clippingBox.west();
diff --git a/tools/vectorosm-tilecreator/BaseClipper.h b/tools/vectorosm-tilecreator/BaseClipper.h
index 1b95649..60fb789 100644
--- a/tools/vectorosm-tilecreator/BaseClipper.h
+++ b/tools/vectorosm-tilecreator/BaseClipper.h
@@ -26,9 +26,6 @@ class BaseClipper
public:
BaseClipper();
- static qreal tileX2lon( unsigned int x, unsigned int maxTileX );
- static qreal tileY2lat( unsigned int y, unsigned int maxTileY );
-
template<class T>
static QPolygonF toQPolygon(const T &lineString, bool reverseOrder = false)
{
diff --git a/tools/vectorosm-tilecreator/ShpCoastlineProcessor.cpp b/tools/vectorosm-tilecreator/ShpCoastlineProcessor.cpp
index 6e9735e..8781264 100644
--- a/tools/vectorosm-tilecreator/ShpCoastlineProcessor.cpp
+++ b/tools/vectorosm-tilecreator/ShpCoastlineProcessor.cpp
@@ -11,6 +11,7 @@
#include "ShpCoastlineProcessor.h"
#include "BaseClipper.h"
+#include "TileId.h"
#include "GeoDataPlacemark.h"
#include "OsmPlacemarkData.h"
@@ -47,10 +48,10 @@ GeoDataDocument *ShpCoastlineProcessor::cutToTiles(unsigned int zoomLevel, unsig
tile->setName(tileName);
GeoDataLatLonBox tileBoundary;
- qreal north = BaseClipper::tileY2lat(tileY, N);
- qreal south = BaseClipper::tileY2lat(tileY+1, N);
- qreal west = BaseClipper::tileX2lon(tileX, N);
- qreal east = BaseClipper::tileX2lon(tileX+1, N);
+ qreal north = TileId::tileY2lat(tileY, N);
+ qreal south = TileId::tileY2lat(tileY+1, N);
+ qreal west = TileId::tileX2lon(tileX, N);
+ qreal east = TileId::tileX2lon(tileX+1, N);
// qDebug() << tileName;
// qDebug() << "west: " << west*RAD2DEG << "\t east: " << east*RAD2DEG;
diff --git a/tools/vectorosm-tilecreator/TinyPlanetProcessor.cpp b/tools/vectorosm-tilecreator/TinyPlanetProcessor.cpp
index 7a706d2..495cea1 100644
--- a/tools/vectorosm-tilecreator/TinyPlanetProcessor.cpp
+++ b/tools/vectorosm-tilecreator/TinyPlanetProcessor.cpp
@@ -11,6 +11,7 @@
#include "TinyPlanetProcessor.h"
#include "BaseClipper.h"
+#include "TileId.h"
#include "GeoDataPlacemark.h"
#include "OsmPlacemarkData.h"