Commit e929bbcb authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Move inverse methods tileX2lon, tile2Ylat to TileId as well.

parent 5ffca170
......@@ -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
......
......@@ -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;
......
......@@ -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();
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -11,6 +11,7 @@
#include "TinyPlanetProcessor.h"
#include "BaseClipper.h"
#include "TileId.h"
#include "GeoDataPlacemark.h"
#include "OsmPlacemarkData.h"
......
Supports Markdown
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