* @param tileNumber x & y numbers of the tile
* @return QPoint MapScene coordinate
*/
-
static QPoint convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber)
{
int pow = 1 << (MAX_MAP_ZOOM_LEVEL - zoomLevel);
* @param sceneCoordinate MapScene coordinate
* @return QPoint tile x & y numbers
*/
- static QPoint convertSceneCoordinateToTileNumber(int zoomLevel, QPointF sceneCoordinate)
+ static QPoint convertSceneCoordinateToTileNumber(int zoomLevel, QPoint sceneCoordinate)
{
int pow = 1 << (MAX_MAP_ZOOM_LEVEL - zoomLevel);
int x = static_cast<int>(sceneCoordinate.x() / (TILE_SIZE_X*pow));
* @param latLonCoordinate latitude and longitude values
* @return scene coordinate
*/
- static QPointF convertLatLonToSceneCoordinate(QPointF latLonCoordinate)
+ static QPoint convertLatLonToSceneCoordinate(QPointF latLonCoordinate)
{
/// @todo CREATE TEST CASE & CHECK CALCULATION
qDebug() << __PRETTY_FUNCTION__;
qreal y = static_cast<qreal>((1.0 - log(tan(latitude * M_PI / 180.0) + 1.0
/ cos(latitude * M_PI / 180.0)) / M_PI) / 2.0);
- return QPointF(x*z*TILE_SIZE_X, y*z*TILE_SIZE_Y);
+ return QPointF(x*z*TILE_SIZE_X, y*z*TILE_SIZE_Y).toPoint();
}
public slots:
* Emits locationChanged signal.
* @param sceneCoordinate Scene coordinates for new position
*/
- void setLocation(QPointF sceneCoordinate);
+ void setLocation(QPoint sceneCoordinate);
void viewResized(const QSize &size);
* @param sceneCoordinate scene's current center coordinate
* @return QRect grid of tile coordinates
*/
- QRect calculateGrid(QPointF sceneCoordinate);
+ QRect calculateGrid(QPoint sceneCoordinate);
/**
* @brief Calculate new tiles to fetch.
*
* @param sceneCoordinate scene's center coordinate
*/
- void calculateNewTiles(QPointF sceneCoordinate);
+ void calculateNewTiles(QPoint sceneCoordinate);
/**
* @brief Remove tiles which are out of view bounds.
* @param sceneCoordinate scene's center coordinate
* @return bool true if center tile changed, false otherwise
*/
- bool centerTileChanged(QPointF sceneCoordinate);
+ bool centerTileChanged(QPoint sceneCoordinate);
private slots:
/**
*
* @param sceneCoordinate New scene coordinates
*/
- void locationChanged(QPointF sceneCoordinate);
+ void locationChanged(QPoint sceneCoordinate);
/**
* @brief Signal for zoom level change
*/
void fetchImage(const QUrl &url);
- /**
- * @brief Signal for centering to scene coordinate.
- *
- * @param sceneCoordinate center scene coordinate
- */
- void centerToSceneCoordinates(QPointF sceneCoordinate);
-
private:
MapScene *m_mapScene; ///< Scene for map tiles
int m_zoomLevel; ///< Current zoom level
QHash<QString, MapTile *> mapTilesInScene; ///< List of map tiles in map scene
QSize m_viewSize; ///< Current view size
- QPointF m_sceneCoordinate; ///< Current center coordinate
+ QPoint m_sceneCoordinate; ///< Current center coordinate
QPoint m_centerTile; ///< Current center tile
QRect viewGrid; ///< Current grid of tiles in view
};