* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
public slots:
-
- /**
- * @brief Slot to receive location of crosshair
- *
- * @param ownLocation (Latitude and Longitude)
- */
- void receiveOwnLocation(QPointF ownLocation);
-
/**
* @brief Slot to intercept error signal from ImageFetcher and SituareService
*
void loginOk();
/**
+ * @brief Slot to receive location of crosshair
+ *
+ * @param ownLocation (Latitude and Longitude)
+ */
+ void receiveOwnLocation(QPointF ownLocation);
+
+ /**
* @brief Calls reverseGeo from SituareService to translate coordinates to street address
*
*/
******************************************************************************/
signals:
/**
- * @brief Signals when new user data is ready
- *
- * @param user Instance of User
- */
- void userLocationReady(User *user);
-
- /**
* @brief Signals when new friends data is ready
*
* @param friendList List of User instances (friends)
*/
void requestOwnLocation();
+ /**
+ * @brief Signals when new user data is ready
+ *
+ * @param user Instance of User
+ */
+ void userLocationReady(User *user);
+
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
return QPointF(longitude, latitude);
}
-QPointF MapEngine::ownLocation()
+void MapEngine::ownLocation()
{
qDebug() << __PRETTY_FUNCTION__;
QPointF ownLatitudeLongitudeLocation =
convertSceneCoordinateToLatLon(m_zoomLevel, m_viewArea.center());
emit ownLocation(ownLatitudeLongitudeLocation);
-
- return ownLatitudeLongitudeLocation;
}
-QRect MapEngine::receiveViewSceneRect(QRect viewSceneRect)
+void MapEngine::receiveViewSceneRect(QRect viewSceneRect)
{
qDebug() << __PRETTY_FUNCTION__;
m_viewArea = viewSceneRect;
- return m_viewArea;
}
*/
static QString tilePath(int zoomLevel, int x, int y);
+ /**
+ * @brief converts scene coordinates to latitude and longitude
+ *
+ * @param current zoom level
+ * @param sceneCoordinate that will be converted
+ */
QPointF convertSceneCoordinateToLatLon(int zoomLevel, QPoint sceneCoordinate);
public slots:
void viewResized(const QSize &size);
/**
- * @brief Slot to catch user own location data
+ * @brief Returns own location crosshair's latitude and longitude coordinates
*
- * @param user User info
*/
- void receiveOwnLocation(User *user);
+ void ownLocation();
/**
- * @brief Returns own location crosshair's latitude and longitude coordinates
+ * @brief Slot to catch user own location data
*
- * @return own location
+ * @param user User info
*/
- QPointF ownLocation();
+ void receiveOwnLocation(User *user);
/**
* @brief Slot to receive visible area of map scene
*
- * @
- * @return visible area of map scene
+ * @param visible area of map scene
*/
- QRect receiveViewSceneRect(QRect viewSceneRect);
+ void receiveViewSceneRect(QRect viewSceneRect);
private:
/**
*/
void mapScrolled();
-void requestToGetViewPortContents();
+ /**
+ * @brief Signal request mapView to update view port contents
+ */
+ void requestToGetViewPortContents();
+
+ /**
+ * @brief Signal sends location of crosshair
+ *
+ * @param ownLocation location of crosshair (Latitude, Longitude)
+ */
void ownLocation(const QPointF ownLocation);
/**
QSize m_viewSize; ///< Current view size
bool m_zoomedIn; ///< Flag for checking if zoomed in when zoom is finished
int m_zoomLevel; ///< Current zoom level
-
QRect m_viewArea; ///< Visible area of map scene
-
};
#endif // MAPENGINE_H
*/
void updateViewPortContent();
+ /**
+ * @brief Slot for catching request to get view port contents.
+ * implementation of this slot sends signal that includes visble area of view port.
+ */
QRect viewportContent();
private:
*/
void viewContentChanged(QPoint viewTopLeft);
+ /**
+ * @brief Signal that sends visible area of map scene
+ *
+ * @param viewArea visible area of map scene
+ */
void updateViewContent(QRect viewArea);
/**
connect(m_gpsToggleAct, SIGNAL(toggled(bool)),
this, SLOT(gpsToggled(bool)));
connect(m_gpsToggleAct, SIGNAL(toggled(bool)),
- m_mapViewScreen, SLOT(setOwnLocationCrosshairVisibility(bool)));
+ m_mapViewScreen, SLOT(setOwnLocationCrosshairVisibility(bool)));
m_autoCenteringAct = new QAction(tr("Auto centering"), this);
m_autoCenteringAct->setCheckable(true);
m_autoCenteringAct->setChecked(true);
void friendsLocationsReady(QList<User *> &friendsList);
/**
+ * @brief Signal from MapEngine to SituareEngine is travelling here
+ */
+ void ownLocation(QPointF ownLatitudeLongitudeLocation);
+
+ /**
* @brief Signal for gps position.
*
* @param position longitude and latitude values
void refreshUserData();
/**
+ * @brief Signal from SituareEngine to MapEngine is travelling here
+ */
+ void requestOwnLocation();
+
+ /**
* @brief Signal for requesting reverseGeo from SituareEngine
*
*/
*/
void zoomOutKeyPressed();
- /**
- * @brief Signal from SituareEngine to MapEngine is travelling here
- */
- void requestOwnLocation();
-
- /**
- * @brief Signal from MapEngine to SituareEngine is travelling here
- */
- void ownLocation(QPointF ownLatitudeLongitudeLocation);
-
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
PanelSideBar *friendsListPanelSidebar = new PanelSideBar(this, RIGHT);
m_zoomButtonPanel = new ZoomButtonPanel(this, ZOOM_BUTTON_PANEL_POSITION_X,
- ZOOM_BUTTON_PANEL_POSITION_Y);
+ ZOOM_BUTTON_PANEL_POSITION_Y);
- ownLocationCrosshair = new QLabel(this);
- QPixmap crosshairImage(":/res/images/sight.png");
- ownLocationCrosshair->setPixmap(crosshairImage);
- ownLocationCrosshair->setFixedSize(crosshairImage.size());
- ownLocationCrosshair->hide();
+ m_ownLocationCrosshair = 0;
connect(mapView, SIGNAL(viewScrolled(QPoint)),
m_mapEngine, SLOT(setLocation(QPoint)));
mapView, SLOT(setZoomLevel(int)));
connect(mapView, SIGNAL(viewResized(QSize)),
m_mapEngine, SLOT(viewResized(QSize)));
-// connect(mapView, SIGNAL(viewContentChanged(QRect)),
-// m_mapEngine, SLOT(alignImmovableItems(QRect)));
connect(mapView, SIGNAL(updateViewContent(QRect)),
m_mapEngine, SLOT(receiveViewSceneRect(QRect)));
connect(mapView, SIGNAL(viewZoomFinished()),
qDebug() << __PRETTY_FUNCTION__;
if (m_drawOwnLocationCrosshair) {
- ownLocationCrosshair->move(width/2 - ownLocationCrosshair->pixmap()->width()/2,
- height/2 - ownLocationCrosshair->pixmap()->height()/2);
+ m_ownLocationCrosshair->move(width/2 - m_ownLocationCrosshair->pixmap()->width()/2,
+ height/2 - m_ownLocationCrosshair->pixmap()->height()/2);
}
}
void MapViewScreen::setOwnLocationCrosshairVisibility(bool visibility)
{
if (visibility == false) {
- ownLocationCrosshair->show();
+
+ if (m_ownLocationCrosshair == 0) {
+ m_ownLocationCrosshair = new QLabel(this);
+ QPixmap crosshairImage(":/res/images/sight.png");
+ m_ownLocationCrosshair->setPixmap(crosshairImage);
+ m_ownLocationCrosshair->setFixedSize(crosshairImage.size());
+ }
+
+ m_ownLocationCrosshair->show();
m_drawOwnLocationCrosshair = true;
drawOwnLocationCrosshair(m_viewPortWidth, m_viewPortHeight);
}
else {
- ownLocationCrosshair->hide();
+ m_ownLocationCrosshair->hide();
m_drawOwnLocationCrosshair = false;
}
}
/*******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
-public slots:
+public slots:
+ /**
+ * @brief Slot for setting own location crosshair visibility
+ *
+ * @param visibility false <-> show, true <-> hide
+ */
void setOwnLocationCrosshairVisibility(bool visibility);
private slots:
* @param width Width of the viewport
* @param height Height of the viewport
*/
- void setViewPortSize(const int width, const int height); // rename: storeviewportsize
+ void setViewPortSize(const int width, const int height);
/**
* @brief Slot for GPS position.
void mapLocationChanged();
/**
- * @brief Signal from SituareEngine to MapEngine is travelling here
+ * @brief Signal from MapEngine to SituareEngine is travelling here
*/
- void requestOwnLocation();
+ void ownLocation(QPointF ownLatitudeLongitudeLocation);
/**
- * @brief Signal from MapEngine to SituareEngine is travelling here
+ * @brief Signal from SituareEngine to MapEngine is travelling here
*/
- void ownLocation(QPointF ownLatitudeLongitudeLocation);
+ void requestOwnLocation();
/**
* @brief Signal when user location is fetched
ZoomButtonPanel *m_zoomButtonPanel; ///< Instance of zoom button panel
QLabel *m_osmLicense; ///< Label for Open Street Map license
bool m_autoCenteringEnabled; ///< Enable
- QLabel *ownLocationCrosshair; ///< Label that show ownLocationCrosshair
+ QLabel *m_ownLocationCrosshair; ///< Label that show ownLocationCrosshair
bool m_drawOwnLocationCrosshair; ///< Flag for making ownLocationCrosshair visible or not
int m_viewPortWidth; ///< Width of view port
int m_viewPortHeight; ///< Height of view port