m_facebookAuthenticator, SLOT(updateCredentials(QUrl)));
// signals from map view
- connect(m_ui, SIGNAL(mapViewScrolled(SceneCoordinate, bool)),
- m_mapEngine, SLOT(setCenterPosition(SceneCoordinate, bool)));
+ connect(m_ui, SIGNAL(mapViewScrolled(SceneCoordinate)),
+ m_mapEngine, SLOT(setCenterPosition(SceneCoordinate)));
connect(m_ui, SIGNAL(mapViewResized(QSize)),
m_mapEngine, SLOT(viewResized(QSize)));
connect(m_mapEngine, SIGNAL(error(int, int)),
this, SLOT(error(int, int)));
- connect(m_mapEngine, SIGNAL(locationChanged(SceneCoordinate, bool)),
- m_ui, SIGNAL(centerToSceneCoordinates(SceneCoordinate, bool)));
+ connect(m_mapEngine, SIGNAL(locationChanged(SceneCoordinate)),
+ m_ui, SIGNAL(centerToSceneCoordinates(SceneCoordinate)));
connect(m_mapEngine, SIGNAL(zoomLevelChanged(int)),
m_ui, SIGNAL(zoomLevelChanged(int)));
m_scroller = &MapScroller::getInstance();
- connect(m_scroller, SIGNAL(coordinateUpdated(SceneCoordinate, bool)),
- this, SLOT(setCenterPosition(SceneCoordinate, bool)));
+ connect(m_scroller, SIGNAL(coordinateUpdated(SceneCoordinate)),
+ this, SLOT(setCenterPosition(SceneCoordinate)));
connect(m_scroller, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State)),
this, SLOT(scrollerStateChanged(QAbstractAnimation::State)));
updateDirectionIndicator();
}
-void MapEngine::setCenterPosition(SceneCoordinate coordinate, bool isUserDragAction)
+void MapEngine::setCenterPosition(SceneCoordinate coordinate)
{
qDebug() << __PRETTY_FUNCTION__;
disableAutoCenteringIfRequired(coordinate);
m_sceneCoordinate = coordinate;
- emit locationChanged(m_sceneCoordinate, isUserDragAction);
+ emit locationChanged(m_sceneCoordinate);
if (isCenterTileChanged(coordinate)) {
getTiles(coordinate);
m_viewSize = size;
setTilesGridSize(m_viewSize);
- emit locationChanged(m_sceneCoordinate, false);
+ emit locationChanged(m_sceneCoordinate);
getTiles(m_sceneCoordinate);
m_mapScene->removeOutOfViewTiles(m_viewTilesGrid, m_zoomLevel);
m_mapScene->setSceneVerticalOverlap(m_viewSize.height(), m_zoomLevel);
*
* Does emit locationChanged signal.
* @param coordinate Scene coordinates for new position
- * @param isUserDragAction True if caused by user dragging action
*/
- void setCenterPosition(SceneCoordinate coordinate, bool isUserDragAction = false);
+ void setCenterPosition(SceneCoordinate coordinate);
/**
* @brief Builds and sets route, also centers it
* @brief Request view centering to new locaiton
*
* @param coordinate New scene coordinates
- * @param isUserDragAction True if caused by user dragging action
*/
- void locationChanged(SceneCoordinate coordinate, bool isUserDragAction);
+ void locationChanged(SceneCoordinate coordinate);
/**
* @brief Signal is emitted when location item is clicked.
const SceneCoordinate &end,
qreal progress);
-MapScroller::MapScroller()
- : m_isKineticScroll(false)
-{
- qDebug() << __PRETTY_FUNCTION__;
-}
-
MapScroller& MapScroller::getInstance()
{
qDebug() << __PRETTY_FUNCTION__;
return instance;
}
-void MapScroller::setKineticScrollFlag(bool isKineticScroll)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_isKineticScroll = isKineticScroll;
-}
-
void MapScroller::updateCurrentValue(const QVariant &value)
{
qDebug() << __PRETTY_FUNCTION__;
if ((state() == QAbstractAnimation::Running) && (value.canConvert<SceneCoordinate>()))
- emit coordinateUpdated(value.value<SceneCoordinate>(), m_isKineticScroll);
- else
- m_isKineticScroll = false;
-
- // NOTE: m_isKineticScroll is cleared when new animation values are set, because this method is
- // called then and state() is QAbstractAnimation::Stopped
+ emit coordinateUpdated(value.value<SceneCoordinate>());
}
/////////////////////////////////////////////////////////////////////////////
/**
* @brief Constructor in not accessible because class is using singleton design pattern.
*/
- MapScroller();
+ MapScroller() {}
/**
* @brief Destructor in not accessible because class is using singleton design pattern.
*/
static MapScroller &getInstance();
- /**
- * @brief Set flag for kinetic scroll
- *
- * @param isKineticScroll Set to true if starting a kinetic scroll
- */
- void setKineticScrollFlag(bool isKineticScroll);
-
/*******************************************************************************
* SIGNALS
******************************************************************************/
* @brief Signal if emitted when coordinate value is updated
*
* @param coordinate New coordinate value
- * @param isKineticScroll True if currently running a kinetic scroll animation
*/
- void coordinateUpdated(SceneCoordinate coordinate, bool isKineticScroll);
-
-/*******************************************************************************
- * DATA MEMBERS
- ******************************************************************************/
-private:
- bool m_isKineticScroll; ///< Is the current animation a kinetic scroll animation?
+ void coordinateUpdated(SceneCoordinate coordinate);
};
#endif // MAPSCROLLER_H
return mapToScene(m_viewCenterPoint) - m_centerHorizontalShiftPoint;
}
-void MapView::centerToSceneCoordinates(const SceneCoordinate &coordinate, bool isUserDragAction)
+void MapView::centerToSceneCoordinates(const SceneCoordinate &coordinate)
{
qDebug() << __PRETTY_FUNCTION__ << "coordinate" << coordinate;
QPointF target = coordinate.toPointF();
m_lastSetScenePosition = coordinate;
-// if (!isUserDragAction)
- target += m_centerHorizontalShiftPoint;
+ target += m_centerHorizontalShiftPoint;
centerOn(target);
}
QPointF viewCenterPoint = m_internalScenePosition - m_centerHorizontalShiftPoint;
- emit viewScrolled(SceneCoordinate(viewCenterPoint.x(), viewCenterPoint.y()), true);
+ emit viewScrolled(SceneCoordinate(viewCenterPoint.x(), viewCenterPoint.y()));
m_lastMouseEventScenePosition = mapToScene(event->pos()).toPoint();
m_lastMouseEventViewPosition = event->pos();
m_scroller->setStartValue(SceneCoordinate(centerPoint.x(), centerPoint.y()));
QPointF endValue = centerPoint + effectSceneDistance;
m_scroller->setEndValue(SceneCoordinate(endValue.x(), endValue.y()));
- m_scroller->setKineticScrollFlag(true);
m_scroller->start();
}
}
* Does also shift the center point horizontally, if required.
*
* @param coordinate Scene coordinates of the new center point
- * @param isUserDragAction True if caused by user dragging action. Does not shift the center
- * point if true.
*/
- void centerToSceneCoordinates(const SceneCoordinate &coordinate, bool isUserDragAction = false);
+ void centerToSceneCoordinates(const SceneCoordinate &coordinate);
/**
* @brief Set zoom level of the view
*
* Signal is emitted when view is scrolled.
* @param coordinate Scene coordinates of the new center point of the view
- * @param isUserDragAction True if caused by user dragging action
*/
- void viewScrolled(const SceneCoordinate &coordinate, bool isUserDragAction);
+ void viewScrolled(const SceneCoordinate &coordinate);
/**
* @brief Signal for informing that zooming animation is finished
buildIndicatorButtonPanel();
buildMapScale();
- connect(m_mapView, SIGNAL(viewScrolled(SceneCoordinate, bool)),
- this, SIGNAL(mapViewScrolled(SceneCoordinate, bool)));
+ connect(m_mapView, SIGNAL(viewScrolled(SceneCoordinate)),
+ this, SIGNAL(mapViewScrolled(SceneCoordinate)));
- connect(this, SIGNAL(centerToSceneCoordinates(SceneCoordinate, bool)),
- m_mapView, SLOT(centerToSceneCoordinates(SceneCoordinate, bool)));
+ connect(this, SIGNAL(centerToSceneCoordinates(SceneCoordinate)),
+ m_mapView, SLOT(centerToSceneCoordinates(SceneCoordinate)));
connect(m_mapView, SIGNAL(viewResized(QSize)),
this, SIGNAL(mapViewResized(QSize)));
* @brief View should be centered to new location
*
* @param coordinate Scene coordinates of the new center point
- * @param isUserDragAction True if caused by user dragging action
*/
- void centerToSceneCoordinates(const SceneCoordinate &coordinate, bool isUserDragAction);
+ void centerToSceneCoordinates(const SceneCoordinate &coordinate);
/**
* @brief Signal when direction and distance from current map center point to current GPS
* @brief Forwarding signal from MapView to MapEngine
*
* @param coordinate New center point coordinate
- * @param isUserDragAction True if caused by user dragging action
*/
- void mapViewScrolled(const SceneCoordinate &coordinate, bool isUserDragAction);
+ void mapViewScrolled(const SceneCoordinate &coordinate);
/**
* @brief Forwarding signal from MapEngine to MapView