summaryrefslogtreecommitdiffstats
path: root/src/imports/location/qdeclarativegeomapgesturearea.cpp
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@jollamobile.com>2015-01-16 10:20:34 +1000
committerAaron McCarthy <mccarthy.aaron@gmail.com>2015-01-20 02:46:21 +0100
commitc549b13656fe7bde5536961f168f0f1a68ea3490 (patch)
treee779d64e3cab36d7edcd4ae82387f4881d92b5ff /src/imports/location/qdeclarativegeomapgesturearea.cpp
parent9ef638cd502ccf0caa536b4627497767bece0670 (diff)
Better names for incorrectly named Map functions.
The functions to transform between coordinates and position on screen were incorrect. Documentation and function names did not match implementation. New functions with better names have been added and documentation updated to match implementation. Old invalid functions have been deprecated. Related private symbols have been renamed to match their purpose. [ChangeLog][QtLocation][Important Behavior Changes] Functions in Map item which are used transform between coordinates and screen position have been deprecated due to confusing naming. Change-Id: Ic501cd81220414800bc2247eae9f510954ee469f Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/imports/location/qdeclarativegeomapgesturearea.cpp')
-rw-r--r--src/imports/location/qdeclarativegeomapgesturearea.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/imports/location/qdeclarativegeomapgesturearea.cpp b/src/imports/location/qdeclarativegeomapgesturearea.cpp
index 1d161036..0fbf5557 100644
--- a/src/imports/location/qdeclarativegeomapgesturearea.cpp
+++ b/src/imports/location/qdeclarativegeomapgesturearea.cpp
@@ -748,7 +748,7 @@ void QDeclarativeGeoMapGestureArea::touchPointStateMachine()
if (touchPoints_.count() == 0) {
touchPointState_ = touchPoints0;
} else if (touchPoints_.count() == 2) {
- touchCenterCoord_ = map_->screenPositionToCoordinate(QDoubleVector2D(sceneCenter_), false);
+ touchCenterCoord_ = map_->itemPositionToCoordinate(QDoubleVector2D(sceneCenter_), false);
startTwoTouchPoints();
touchPointState_ = touchPoints2;
}
@@ -757,7 +757,7 @@ void QDeclarativeGeoMapGestureArea::touchPointStateMachine()
if (touchPoints_.count() == 0) {
touchPointState_ = touchPoints0;
} else if (touchPoints_.count() == 1) {
- touchCenterCoord_ = map_->screenPositionToCoordinate(QDoubleVector2D(sceneCenter_), false);
+ touchCenterCoord_ = map_->itemPositionToCoordinate(QDoubleVector2D(sceneCenter_), false);
startOneTouchPoint();
touchPointState_ = touchPoints1;
}
@@ -785,7 +785,7 @@ void QDeclarativeGeoMapGestureArea::startOneTouchPoint()
sceneStartPoint1_ = declarativeMap_->mapFromScene(touchPoints_.at(0).scenePos());
lastPos_ = sceneStartPoint1_;
lastPosTime_.start();
- QGeoCoordinate startCoord = map_->screenPositionToCoordinate(QDoubleVector2D(sceneStartPoint1_), false);
+ QGeoCoordinate startCoord = map_->itemPositionToCoordinate(QDoubleVector2D(sceneStartPoint1_), false);
// ensures a smooth transition for panning
startCoord_.setLongitude(startCoord_.longitude() + startCoord.longitude() -
touchCenterCoord_.longitude());
@@ -813,7 +813,7 @@ void QDeclarativeGeoMapGestureArea::startTwoTouchPoints()
QPointF startPos = (sceneStartPoint1_ + sceneStartPoint2_) * 0.5;
lastPos_ = startPos;
lastPosTime_.start();
- QGeoCoordinate startCoord = map_->screenPositionToCoordinate(QDoubleVector2D(startPos), false);
+ QGeoCoordinate startCoord = map_->itemPositionToCoordinate(QDoubleVector2D(startPos), false);
startCoord_.setLongitude(startCoord_.longitude() + startCoord.longitude() -
touchCenterCoord_.longitude());
startCoord_.setLatitude(startCoord_.latitude() + startCoord.latitude() -
@@ -999,7 +999,7 @@ void QDeclarativeGeoMapGestureArea::panStateMachine()
case panInactive:
if (canStartPan()) {
// Update startCoord_ to ensure smooth start for panning when going over startDragDistance
- QGeoCoordinate newStartCoord = map_->screenPositionToCoordinate(QDoubleVector2D(lastPos_), false);
+ QGeoCoordinate newStartCoord = map_->itemPositionToCoordinate(QDoubleVector2D(lastPos_), false);
startCoord_.setLongitude(newStartCoord.longitude());
startCoord_.setLatitude(newStartCoord.latitude());
panState_ = panActive;
@@ -1064,13 +1064,13 @@ bool QDeclarativeGeoMapGestureArea::canStartPan()
*/
void QDeclarativeGeoMapGestureArea::updatePan()
{
- QPointF startPoint = map_->coordinateToScreenPosition(startCoord_, false).toPointF();
+ QPointF startPoint = map_->coordinateToItemPosition(startCoord_, false).toPointF();
int dx = static_cast<int>(sceneCenter_.x() - startPoint.x());
int dy = static_cast<int>(sceneCenter_.y() - startPoint.y());
QPointF mapCenterPoint;
mapCenterPoint.setY(map_->height() / 2.0 - dy);
mapCenterPoint.setX(map_->width() / 2.0 - dx);
- QGeoCoordinate animationStartCoordinate = map_->screenPositionToCoordinate(QDoubleVector2D(mapCenterPoint), false);
+ QGeoCoordinate animationStartCoordinate = map_->itemPositionToCoordinate(QDoubleVector2D(mapCenterPoint), false);
map_->mapController()->setCenter(animationStartCoordinate);
}