SLOT(mapImageReceived(QUrl, QPixmap)));
}
+/**
+ * @todo Create URL builder method
+ * QUrl buildURL(zoomLevel, QPoint tileNumbers)
+ */
void MapEngine::setViewLocation(QPointF latLonCoordinate)
{
m_mapView->setZoomLevel(m_zoomLevel);
}
}
+/**
+* @todo Create URL parser methor and refactor code (use pointers for returning)
+*/
void MapEngine::mapImageReceived(const QUrl &url, const QPixmap &pixmap)
{
m_mapScene->addMapTile(mapTile);
}
+/**
+ * @todo QPoint convertLatLonToTile(int zoomLevel, QPointF latLonCoordinate), convert to static
+ */
QPoint MapEngine::latLonToTile(qreal latitude, qreal longitude, int zoom)
{
qDebug() << __PRETTY_FUNCTION__;
return QPoint(qFloor(x*z), qFloor(y*z));
}
+/**
+ * @todo Remove both
+ */
qreal MapEngine::tileXToLongitude(int x, int zoom)
{
qDebug() << __PRETTY_FUNCTION__;
* @param tileNumber x & y numbers of the tile
* @return QPoint MapScene coordinate
*/
+ /**
+ * @todo use bit shift instead of pow
+ */
static QPoint convertTileNumberToSceneCoordinate(int zoomLevel, QPoint tileNumber)
{
int x = tileNumber.x() * TILE_SIZE_X * pow(2, MAX_ZOOM_LEVEL - zoomLevel);
startNextDownload();
}
+/**
+ * @todo Return false if image can't be read and do not emit signal
+ */
bool MapFetcher::loadImageFromCache(const QUrl &url)
{
qDebug() << __PRETTY_FUNCTION__;
public:
/**
+ * @todo remove fn:s from comment blocks
+ */
+ /**
* @brief Constructor for MapFetcher.
*
* @fn MapFetcher
* @return bool true if image was loaded from cache, false otherwise
*/
bool loadImageFromCache(const QUrl &url);
-
+/**
+ * @todo add comments for data members
+ */
QNetworkAccessManager *m_manager;
QList<QNetworkReply*> currentDownloads;
QQueue<QUrl> downloadQueue;
{
m_zoomLevel = zoomLevel;
setPosition();
-
+/**
+ * @todo use bit shifting
+ */
double zoomFactor = pow(2, (MapEngine::MAX_ZOOM_LEVEL - m_zoomLevel));
setScale(zoomFactor);
}
void MapTile::setPosition()
{
+ /**
+ * @todo use bit shifting
+ */
if ((m_zoomLevel >= MapEngine::MIN_ZOOM_LEVEL) && (m_zoomLevel <= MapEngine::MAX_ZOOM_LEVEL) &&
(m_tileNumber.x() >= 0) && (m_tileNumber.x() <= pow(2, m_zoomLevel) -1) &&
(m_tileNumber.y() >= 0) && (m_tileNumber.y() <= pow(2, m_zoomLevel) -1)) {
*/
MapView(QWidget *parent = 0);
- /// \brief
- /// \param zoomLevel
/**
* @brief Set zoom level of the view
*