m_ownLocation->show();
}
+void MapEngine::gpsPositionUpdate(QPointF position, qreal accuracy)
+{
+ m_gpsLocationItem->updatePosition(convertLatLonToSceneCoordinate(position), accuracy);
+
+ if (m_autoCenteringEnabled)
+ setViewLocation(position);
+}
+
- void MapEngine::setAutoCentering(bool enabled)
+ bool MapEngine::disableAutoCentering(QPoint sceneCoordinate)
{
- qDebug() << __PRETTY_FUNCTION__;
+ if (isAutoCenteringEnabled()) {
+ int zoomFactor = (1 << (MAX_MAP_ZOOM_LEVEL - m_zoomLevel));
+
+ QPoint oldPixelValue = QPoint(m_lastManualPosition.x() / zoomFactor,
+ m_lastManualPosition.y() / zoomFactor);
+
+ QPoint newPixelValue = QPoint(sceneCoordinate.x() / zoomFactor,
+ sceneCoordinate.y() / zoomFactor);
+
+ if ((abs(oldPixelValue.x() - newPixelValue.x()) > AUTO_CENTERING_DISABLE_DISTANCE) ||
+ (abs(oldPixelValue.y() - newPixelValue.y()) > AUTO_CENTERING_DISABLE_DISTANCE))
+ return true;
+ }
+
+ return false;
+ }
+
+ bool MapEngine::isAutoCenteringEnabled()
+ {
+ return m_autoCenteringEnabled;
+ }
- m_autoCentering = enabled;
+ void MapEngine::setAutoCentering(bool enabled)
+ {
+ m_autoCenteringEnabled = enabled;
}
* DATA MEMBERS
******************************************************************************/
private:
- bool m_autoCentering; ///< Should the view center automatically to received GPS coordinates
+ bool m_autoCenteringEnabled; ///< Auto centering enabled
QPoint m_centerTile; ///< Current center tile
FriendItemsHandler *m_friendItemsHandler; ///< Handler for friend and group items
+ GPSLocationItem *m_gpsLocationItem;
+ QPoint m_lastManualPosition; ///< Last manually set position in scene coordinate
MapFetcher *m_mapFetcher; ///< Fetcher for map tiles
MapScene *m_mapScene; ///< Scene for map tiles
MapZoomPanel *m_mapZoomPanel; ///< Toolbar for zoom buttons
map/friendgroupitem.h \
map/frienditemshandler.h \
gps/gpspositioninterface.h \
- map/gpslocationitem.h
++ map/gpslocationitem.h \
+ situarecommon.h
QT += network \
webkit
DEFINES += QT_NO_DEBUG_OUTPUT