summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/imports/location/qdeclarativecirclemapitem.cpp54
-rw-r--r--src/imports/location/qdeclarativecirclemapitem_p.h3
-rw-r--r--src/imports/location/qdeclarativepolygonmapitem.cpp18
-rw-r--r--src/imports/location/qdeclarativepolygonmapitem_p.h4
-rw-r--r--src/imports/location/qdeclarativepolylinemapitem.cpp144
-rw-r--r--src/imports/location/qdeclarativepolylinemapitem_p.h12
-rw-r--r--src/imports/location/qdeclarativerectanglemapitem.cpp6
-rw-r--r--tests/auto/declarative_ui/tst_map_item_details.qml12
8 files changed, 186 insertions, 67 deletions
diff --git a/src/imports/location/qdeclarativecirclemapitem.cpp b/src/imports/location/qdeclarativecirclemapitem.cpp
index eb3de7a2..b44183bb 100644
--- a/src/imports/location/qdeclarativecirclemapitem.cpp
+++ b/src/imports/location/qdeclarativecirclemapitem.cpp
@@ -90,8 +90,8 @@ QT_BEGIN_NAMESPACE
\section2 Performance
MapCircle performance is almost equivalent to that of a MapPolygon with
- 125 vertices. There is a small amount of additional overhead with
- respect to calculating the vertices first.
+ the same number of vertices. There is a small amount of additional
+ overhead with respect to calculating the vertices first.
Like the other map objects, MapCircle is normally drawn without a smooth
appearance. Setting the opacity property will force the object to be
@@ -125,6 +125,8 @@ QT_BEGIN_NAMESPACE
#define M_PI 3.14159265358979323846
#endif
+static const int CircleSamples = 128;
+
struct Vertex
{
QVector2D position;
@@ -261,15 +263,22 @@ static bool crossEarthPole(const QGeoCoordinate &center, qreal distance)
return false;
}
-static void calculatePeripheralPoints(QList<QGeoCoordinate> &path, const QGeoCoordinate &center, qreal distance, int steps)
+static void calculatePeripheralPoints(QList<QGeoCoordinate> &path,
+ const QGeoCoordinate &center,
+ qreal distance,
+ int steps,
+ QGeoCoordinate &leftBound )
{
// Calculate points based on great-circle distance
// Calculation is the same as GeoCoordinate's atDistanceAndAzimuth function
// but tweaked here for computing multiple points
- // pre-calculate
+ // pre-calculations
+ steps = qMax(steps, 3);
+ qreal centerLon = center.longitude();
+ qreal minLon = centerLon;
qreal latRad = qgeocoordinate_degToRad(center.latitude());
- qreal lonRad = qgeocoordinate_degToRad(center.longitude());
+ qreal lonRad = qgeocoordinate_degToRad(centerLon);
qreal cosLatRad = std::cos(latRad);
qreal sinLatRad = std::sin(latRad);
qreal ratio = (distance / (qgeocoordinate_EARTH_MEAN_RADIUS * 1000.0));
@@ -277,7 +286,7 @@ static void calculatePeripheralPoints(QList<QGeoCoordinate> &path, const QGeoCoo
qreal sinRatio = std::sin(ratio);
qreal sinLatRad_x_cosRatio = sinLatRad * cosRatio;
qreal cosLatRad_x_sinRatio = cosLatRad * sinRatio;
-
+ int idx = 0;
for (int i = 0; i < steps; ++i) {
qreal azimuthRad = 2 * M_PI * i / steps;
qreal resultLatRad = std::asin(sinLatRad_x_cosRatio
@@ -292,7 +301,17 @@ static void calculatePeripheralPoints(QList<QGeoCoordinate> &path, const QGeoCoo
lon2 -= 360.0;
}
path << QGeoCoordinate(lat2, lon2, center.altitude());
+ // Consider only points in the left half of the circle for the left bound.
+ if (azimuthRad > M_PI) {
+ if (lon2 > centerLon) // if point and center are on different hemispheres
+ lon2 -= 360;
+ if (lon2 < minLon) {
+ minLon = lon2;
+ idx = i;
+ }
+ }
}
+ leftBound = path.at(idx);
}
QDeclarativeCircleMapItem::QDeclarativeCircleMapItem(QQuickItem *parent)
@@ -460,13 +479,12 @@ void QDeclarativeCircleMapItem::updatePolish()
if (geometry_.isSourceDirty()) {
circlePath_.clear();
- calculatePeripheralPoints(circlePath_, center_, radius_, 125);
+ calculatePeripheralPoints(circlePath_, center_, radius_, CircleSamples, geoLeftBound_);
}
- QGeoCoordinate leftBoundCoord;
int pathCount = circlePath_.size();
- bool preserve = preserveCircleGeometry(circlePath_, center_, radius_, leftBoundCoord);
- geometry_.setPreserveGeometry(preserve, leftBoundCoord);
+ bool preserve = preserveCircleGeometry(circlePath_, center_, radius_);
+ geometry_.setPreserveGeometry(preserve, geoLeftBound_);
geometry_.updateSourcePoints(*map(), circlePath_);
if (crossEarthPole(center_, radius_) && circlePath_.size() == pathCount)
geometry_.updateScreenPointsInvert(*map()); // invert fill area for really huge circles
@@ -475,8 +493,8 @@ void QDeclarativeCircleMapItem::updatePolish()
if (border_.color() != Qt::transparent && border_.width() > 0) {
QList<QGeoCoordinate> closedPath = circlePath_;
closedPath << closedPath.first();
- borderGeometry_.setPreserveGeometry(preserve, leftBoundCoord);
- borderGeometry_.updateSourcePoints(*map(), closedPath);
+ borderGeometry_.setPreserveGeometry(preserve, geoLeftBound_);
+ borderGeometry_.updateSourcePoints(*map(), closedPath, geoLeftBound_);
borderGeometry_.updateScreenPoints(*map(), border_.width());
QList<QGeoMapItemGeometry *> geoms;
@@ -562,23 +580,13 @@ void QDeclarativeCircleMapItem::geometryChanged(const QRectF &newGeometry, const
}
bool QDeclarativeCircleMapItem::preserveCircleGeometry (QList<QGeoCoordinate> &path,
- const QGeoCoordinate &center, qreal distance,
- QGeoCoordinate &leftBoundCoord)
+ const QGeoCoordinate &center, qreal distance)
{
// if circle crosses north/south pole, then don't preserve circular shape,
if ( crossEarthPole(center, distance)) {
updateCirclePathForRendering(path, center, distance);
return false;
}
- // else find and set its left bound
- for (int i = 1; i < path.count(); ++i) {
- int iNext = (i + 1) % path.count();
- if (path.at(iNext).longitude() > path.at(i).longitude()
- && path.at(i-1).longitude() > path.at(i).longitude()) {
- if (qAbs(path.at(iNext).longitude() - path.at(i-1).longitude()) < 180)
- leftBoundCoord = path.at(i);
- }
- }
return true;
}
diff --git a/src/imports/location/qdeclarativecirclemapitem_p.h b/src/imports/location/qdeclarativecirclemapitem_p.h
index 9b142309..c91d1606 100644
--- a/src/imports/location/qdeclarativecirclemapitem_p.h
+++ b/src/imports/location/qdeclarativecirclemapitem_p.h
@@ -107,7 +107,7 @@ protected Q_SLOTS:
private:
bool preserveCircleGeometry(QList<QGeoCoordinate> &path, const QGeoCoordinate &center,
- qreal distance, QGeoCoordinate &leftBoundCoord);
+ qreal distance);
void updateCirclePathForRendering(QList<QGeoCoordinate> &path, const QGeoCoordinate &center,
qreal distance);
@@ -116,6 +116,7 @@ private:
QDeclarativeMapLineProperties border_;
QColor color_;
qreal radius_;
+ QGeoCoordinate geoLeftBound_;
QList<QGeoCoordinate> circlePath_;
bool dirtyMaterial_;
QGeoMapCircleGeometry geometry_;
diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp
index 554ec06a..361c554d 100644
--- a/src/imports/location/qdeclarativepolygonmapitem.cpp
+++ b/src/imports/location/qdeclarativepolygonmapitem.cpp
@@ -430,7 +430,7 @@ void QDeclarativePolygonMapItem::setPath(const QJSValue &value)
return;
path_ = pathList;
-
+ geoLeftBound_ = QDeclarativePolylineMapItem::getLeftBound(path_, deltaXs_, minX_);
geometry_.markSourceDirty();
borderGeometry_.markSourceDirty();
polishAndUpdate();
@@ -448,7 +448,7 @@ void QDeclarativePolygonMapItem::setPath(const QJSValue &value)
void QDeclarativePolygonMapItem::addCoordinate(const QGeoCoordinate &coordinate)
{
path_.append(coordinate);
-
+ geoLeftBound_ = QDeclarativePolylineMapItem::getLeftBound(path_, deltaXs_, minX_, geoLeftBound_);
geometry_.markSourceDirty();
borderGeometry_.markSourceDirty();
polishAndUpdate();
@@ -472,7 +472,7 @@ void QDeclarativePolygonMapItem::removeCoordinate(const QGeoCoordinate &coordina
return;
path_.removeAt(index);
-
+ geoLeftBound_ = QDeclarativePolylineMapItem::getLeftBound(path_, deltaXs_, minX_);
geometry_.markSourceDirty();
borderGeometry_.markSourceDirty();
polishAndUpdate();
@@ -543,7 +543,7 @@ void QDeclarativePolygonMapItem::updatePolish()
QList<QGeoCoordinate> closedPath = path_;
closedPath << closedPath.first();
borderGeometry_.clear();
- borderGeometry_.updateSourcePoints(*map(), closedPath);
+ borderGeometry_.updateSourcePoints(*map(), closedPath, geoLeftBound_);
if (border_.color() != Qt::transparent && border_.width() > 0)
borderGeometry_.updateScreenPoints(*map(), border_.width());
@@ -640,12 +640,10 @@ void QDeclarativePolygonMapItem::geometryChanged(const QRectF &newGeometry, cons
path_.replace(i, coord);
}
-
- QGeoCoordinate leftBoundCoord = geometry_.geoLeftBound();
- leftBoundCoord.setLongitude(QLocationUtils::wrapLong(leftBoundCoord.longitude()
- + newCoordinate.longitude() - firstLongitude));
- geometry_.setPreserveGeometry(true, leftBoundCoord);
- borderGeometry_.setPreserveGeometry(true, leftBoundCoord);
+ geoLeftBound_.setLongitude(QLocationUtils::wrapLong(geoLeftBound_.longitude()
+ + newCoordinate.longitude() - firstLongitude));
+ geometry_.setPreserveGeometry(true, geoLeftBound_);
+ borderGeometry_.setPreserveGeometry(true, geoLeftBound_);
geometry_.markSourceDirty();
borderGeometry_.markSourceDirty();
polishAndUpdate();
diff --git a/src/imports/location/qdeclarativepolygonmapitem_p.h b/src/imports/location/qdeclarativepolygonmapitem_p.h
index 8b803b1d..19ac5081 100644
--- a/src/imports/location/qdeclarativepolygonmapitem_p.h
+++ b/src/imports/location/qdeclarativepolygonmapitem_p.h
@@ -122,11 +122,15 @@ private:
QDeclarativeMapLineProperties border_;
QList<QGeoCoordinate> path_;
+ QGeoCoordinate geoLeftBound_;
QColor color_;
bool dirtyMaterial_;
QGeoMapPolygonGeometry geometry_;
QGeoMapPolylineGeometry borderGeometry_;
bool updatingGeometry_;
+ // for the left bound calculation
+ QVector<double> deltaXs_; // longitude deltas from path_[0]
+ double minX_; // minimum value inside deltaXs_
};
//////////////////////////////////////////////////////////////////////
diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp
index f2373abf..2899d839 100644
--- a/src/imports/location/qdeclarativepolylinemapitem.cpp
+++ b/src/imports/location/qdeclarativepolylinemapitem.cpp
@@ -180,7 +180,8 @@ QGeoMapPolylineGeometry::QGeoMapPolylineGeometry()
\internal
*/
void QGeoMapPolylineGeometry::updateSourcePoints(const QGeoMap &map,
- const QList<QGeoCoordinate> &path)
+ const QList<QGeoCoordinate> &path,
+ const QGeoCoordinate geoLeftBound)
{
bool foundValid = false;
double minX = -1.0;
@@ -191,6 +192,8 @@ void QGeoMapPolylineGeometry::updateSourcePoints(const QGeoMap &map,
if (!sourceDirty_)
return;
+ geoLeftBound_ = geoLeftBound;
+
// clear the old data and reserve enough memory
srcPoints_.clear();
srcPoints_.reserve(path.size() * 2);
@@ -217,16 +220,23 @@ void QGeoMapPolylineGeometry::updateSourcePoints(const QGeoMap &map,
if (!qIsFinite(point.x()) || !qIsFinite(point.y()))
return;
+ bool isPointLessThanUnwrapBelowX = (point.x() < unwrapBelowX);
+ bool isCoordNotLeftBound = !qFuzzyCompare(geoLeftBound_.longitude(), coord.longitude());
+ bool isPointNotUnwrapBelowX = !qFuzzyCompare(point.x(), unwrapBelowX);
+ bool isPointNotMapWidthHalf = !qFuzzyCompare(mapWidthHalf, point.x());
+
// unwrap x to preserve geometry if moved to border of map
- if (preserveGeometry_ && point.x() < unwrapBelowX
- && !qFuzzyCompare(geoLeftBound_.longitude(), coord.longitude())
- && !qFuzzyCompare(point.x(), unwrapBelowX)
- && !qFuzzyCompare(mapWidthHalf, point.x()))
- point.setX(unwrapBelowX + geoDistanceToScreenWidth(map, geoLeftBound_, coord));
+ if (preserveGeometry_ && isPointLessThanUnwrapBelowX
+ && isCoordNotLeftBound
+ && isPointNotUnwrapBelowX
+ && isPointNotMapWidthHalf) {
+ double distance = geoDistanceToScreenWidth(map, geoLeftBound_, coord);
+ point.setX(unwrapBelowX + distance);
+ }
if (!foundValid) {
foundValid = true;
- srcOrigin_ = coord;
+ srcOrigin_ = coord; // TODO: Make this consistent with the left bound
origin = point;
point = QDoubleVector2D(0,0);
@@ -258,8 +268,6 @@ void QGeoMapPolylineGeometry::updateSourcePoints(const QGeoMap &map,
}
sourceBounds_ = QRectF(QPointF(minX, minY), QPointF(maxX, maxY));
- geoLeftBound_ = map.itemPositionToCoordinate(
- QDoubleVector2D(minX + origin.x(), minY + origin.y()), false);
}
////////////////////////////////////////////////////////////////////////////
@@ -545,7 +553,7 @@ void QDeclarativePolylineMapItem::setPathFromGeoList(const QList<QGeoCoordinate>
return;
path_ = path;
-
+ geoLeftBound_ = getLeftBound(path_, deltaXs_, minX_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -575,7 +583,7 @@ int QDeclarativePolylineMapItem::pathLength() const
void QDeclarativePolylineMapItem::addCoordinate(const QGeoCoordinate &coordinate)
{
path_.append(coordinate);
-
+ geoLeftBound_ = getLeftBound(path_, deltaXs_, minX_, geoLeftBound_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -596,7 +604,7 @@ void QDeclarativePolylineMapItem::insertCoordinate(int index, const QGeoCoordina
return;
path_.insert(index, coordinate);
-
+ geoLeftBound_ = getLeftBound(path_, deltaXs_, minX_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -618,7 +626,7 @@ void QDeclarativePolylineMapItem::replaceCoordinate(int index, const QGeoCoordin
return;
path_[index] = coordinate;
-
+ geoLeftBound_ = getLeftBound(path_, deltaXs_, minX_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -666,14 +674,7 @@ bool QDeclarativePolylineMapItem::containsCoordinate(const QGeoCoordinate &coord
void QDeclarativePolylineMapItem::removeCoordinate(const QGeoCoordinate &coordinate)
{
int index = path_.lastIndexOf(coordinate);
- if (index == -1)
- return;
-
- path_.removeAt(index);
-
- geometry_.markSourceDirty();
- polishAndUpdate();
- emit pathChanged();
+ removeCoordinate(index);
}
/*!
@@ -693,7 +694,7 @@ void QDeclarativePolylineMapItem::removeCoordinate(int index)
return;
path_.removeAt(index);
-
+ geoLeftBound_ = getLeftBound(path_, deltaXs_, minX_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -718,6 +719,96 @@ QDeclarativeMapLineProperties *QDeclarativePolylineMapItem::line()
return &line_;
}
+QGeoCoordinate QDeclarativePolylineMapItem::computeLeftBound(const QList<QGeoCoordinate> &path,
+ QVector<double> &deltaXs,
+ double &minX)
+{
+ if (path.isEmpty()) {
+ minX = qInf();
+ return QGeoCoordinate();
+ }
+ deltaXs.resize(path.size());
+
+ deltaXs[0] = minX = 0.0;
+ int minId = 0;
+
+ for (int i = 1; i < path.size(); i++) {
+ const QGeoCoordinate &geoFrom = path.at(i-1);
+ const QGeoCoordinate &geoTo = path.at(i);
+ double longiFrom = geoFrom.longitude();
+ double longiTo = geoTo.longitude();
+ double deltaLongi = longiTo - longiFrom;
+ if (qAbs(deltaLongi) > 180.0) {
+ if (longiTo > 0.0)
+ longiTo -= 360.0;
+ else
+ longiTo += 360.0;
+ deltaLongi = longiTo - longiFrom;
+ }
+ deltaXs[i] = deltaXs[i-1] + deltaLongi;
+ if (deltaXs[i] < minX) {
+ minX = deltaXs[i];
+ minId = i;
+ }
+ }
+ return path.at(minId);
+}
+
+QGeoCoordinate QDeclarativePolylineMapItem::updateLeftBound(const QList<QGeoCoordinate> &path,
+ QVector<double> &deltaXs,
+ double &minX,
+ QGeoCoordinate currentLeftBound)
+{
+ if (path.isEmpty()) {
+ minX = qInf();
+ return QGeoCoordinate();
+ } else if (path.size() == 1) {
+ deltaXs.clear();
+ minX = 0.0;
+ return path.last();
+ } else if ( path.size() != deltaXs.size() + 2 ) { // this case should not happen
+ minX = qInf();
+ return QGeoCoordinate();
+ }
+
+ const QGeoCoordinate &geoFrom = path.at(path.size()-2);
+ const QGeoCoordinate &geoTo = path.last();
+ double longiFrom = geoFrom.longitude();
+ double longiTo = geoTo.longitude();
+ double deltaLongi = longiTo - longiFrom;
+ if (qAbs(deltaLongi) > 180.0) {
+ if (longiTo > 0.0)
+ longiTo -= 360.0;
+ else
+ longiTo += 360.0;
+ deltaLongi = longiTo - longiFrom;
+ }
+
+ deltaXs.push_back((deltaXs.isEmpty()) ? 0.0 : deltaXs.last() + deltaLongi);
+ if (deltaXs.last() < minX) {
+ minX = deltaXs.last();
+ return path.last();
+ } else {
+ return currentLeftBound;
+ }
+}
+
+QGeoCoordinate QDeclarativePolylineMapItem::getLeftBound(const QList<QGeoCoordinate> &path,
+ QVector<double> &deltaXs,
+ double &minX)
+{
+ return QDeclarativePolylineMapItem::computeLeftBound(path, deltaXs, minX);
+}
+
+// Optimizing the common addCoordinate() path
+QGeoCoordinate QDeclarativePolylineMapItem::getLeftBound(const QList<QGeoCoordinate> &path,
+ QVector<double> &deltaXs,
+ double &minX,
+ QGeoCoordinate currentLeftBound)
+{
+ return QDeclarativePolylineMapItem::updateLeftBound(path, deltaXs, minX, currentLeftBound);
+}
+
/*!
\internal
*/
@@ -756,10 +847,9 @@ void QDeclarativePolylineMapItem::geometryChanged(const QRectF &newGeometry, con
path_.replace(i, coord);
}
- QGeoCoordinate leftBoundCoord = geometry_.geoLeftBound();
- leftBoundCoord.setLongitude(QLocationUtils::wrapLong(leftBoundCoord.longitude()
- + newCoordinate.longitude() - firstLongitude));
- geometry_.setPreserveGeometry(true, leftBoundCoord);
+ geoLeftBound_.setLongitude(QLocationUtils::wrapLong(geoLeftBound_.longitude()
+ + newCoordinate.longitude() - firstLongitude));
+ geometry_.setPreserveGeometry(true, geoLeftBound_);
geometry_.markSourceDirty();
polishAndUpdate();
emit pathChanged();
@@ -811,7 +901,7 @@ void QDeclarativePolylineMapItem::updatePolish()
QScopedValueRollback<bool> rollback(updatingGeometry_);
updatingGeometry_ = true;
- geometry_.updateSourcePoints(*map(), path_);
+ geometry_.updateSourcePoints(*map(), path_, geoLeftBound_);
geometry_.updateScreenPoints(*map(), line_.width());
setWidth(geometry_.sourceBoundingBox().width());
diff --git a/src/imports/location/qdeclarativepolylinemapitem_p.h b/src/imports/location/qdeclarativepolylinemapitem_p.h
index 298dc3bc..8c827b6f 100644
--- a/src/imports/location/qdeclarativepolylinemapitem_p.h
+++ b/src/imports/location/qdeclarativepolylinemapitem_p.h
@@ -89,7 +89,8 @@ public:
QGeoMapPolylineGeometry();
void updateSourcePoints(const QGeoMap &map,
- const QList<QGeoCoordinate> &path);
+ const QList<QGeoCoordinate> &path,
+ const QGeoCoordinate geoLeftBound);
void updateScreenPoints(const QGeoMap &map,
qreal strokeWidth);
@@ -132,6 +133,11 @@ public:
QDeclarativeMapLineProperties *line();
+ static QGeoCoordinate computeLeftBound(const QList<QGeoCoordinate> &path, QVector<double> &deltaXs, double &minX);
+ static QGeoCoordinate updateLeftBound(const QList<QGeoCoordinate> &path, QVector<double> &deltaXs, double &minX, QGeoCoordinate currentLeftBound);
+ static QGeoCoordinate getLeftBound(const QList<QGeoCoordinate> &path, QVector<double> &deltaXs, double &minX);
+ static QGeoCoordinate getLeftBound(const QList<QGeoCoordinate> &path, QVector<double> &deltaXs, double &minX, QGeoCoordinate currentLeftBound);
+
Q_SIGNALS:
void pathChanged();
@@ -149,10 +155,14 @@ private:
QDeclarativeMapLineProperties line_;
QList<QGeoCoordinate> path_;
+ QGeoCoordinate geoLeftBound_;
QColor color_;
bool dirtyMaterial_;
QGeoMapPolylineGeometry geometry_;
bool updatingGeometry_;
+ // for the left bound calculation
+ QVector<double> deltaXs_; // longitude deltas from path_[0]
+ double minX_; // minimum value inside deltaXs_
};
//////////////////////////////////////////////////////////////////////
diff --git a/src/imports/location/qdeclarativerectanglemapitem.cpp b/src/imports/location/qdeclarativerectanglemapitem.cpp
index c28bcf3e..f50d0340 100644
--- a/src/imports/location/qdeclarativerectanglemapitem.cpp
+++ b/src/imports/location/qdeclarativerectanglemapitem.cpp
@@ -344,7 +344,7 @@ void QDeclarativeRectangleMapItem::updatePolish()
pathClosed << pathClosed.first();
if (border_.color() != Qt::transparent && border_.width() > 0) {
- borderGeometry_.updateSourcePoints(*map(), pathClosed);
+ borderGeometry_.updateSourcePoints(*map(), pathClosed, topLeft_);
borderGeometry_.updateScreenPoints(*map(), border_.width());
QList<QGeoMapItemGeometry *> geoms;
@@ -392,8 +392,8 @@ void QDeclarativeRectangleMapItem::afterViewportChanged(const QGeoMapViewportCha
geometry_.markSourceDirty();
borderGeometry_.markSourceDirty();
}
- geometry_.setPreserveGeometry(true, geometry_.geoLeftBound());
- borderGeometry_.setPreserveGeometry(true, borderGeometry_.geoLeftBound());
+ geometry_.setPreserveGeometry(true, topLeft_);
+ borderGeometry_.setPreserveGeometry(true, topLeft_);
geometry_.markScreenDirty();
borderGeometry_.markScreenDirty();
polishAndUpdate();
diff --git a/tests/auto/declarative_ui/tst_map_item_details.qml b/tests/auto/declarative_ui/tst_map_item_details.qml
index 68e069d4..ebaf1ea7 100644
--- a/tests/auto/declarative_ui/tst_map_item_details.qml
+++ b/tests/auto/declarative_ui/tst_map_item_details.qml
@@ -421,6 +421,8 @@ Item {
function test_dateline() {
map.center = datelineCoordinate
map.zoomLevel = 2.2
+ var inspectionTime = 0 // change this to inspect the behavior.
+
// rectangle
// item spanning across dateline
map.addMapItem(extMapRectDateline)
@@ -440,6 +442,7 @@ Item {
verify(point.x == map.width / 2.0)
// drag item back onto dateline
verify(LocationTestHelper.waitForPolished(map))
+ visualInspectionPoint(inspectionTime)
mousePress(map, point.x + 5, point.y + 5)
var i
for (i=0; i < 20; i += 2) {
@@ -448,6 +451,7 @@ Item {
}
mouseRelease(map, point.x + 5 - i, point.y + 5)
verify(LocationTestHelper.waitForPolished(map))
+ visualInspectionPoint(inspectionTime)
point = map.fromCoordinate(extMapRectDateline.topLeft)
verify(point.x < map.width / 2.0)
point = map.fromCoordinate(extMapRectDateline.bottomRight)
@@ -465,7 +469,7 @@ Item {
point = map.fromCoordinate(extMapCircleDateline.center)
verify(LocationTestHelper.waitForPolished(map))
verify(point.x > map.width / 2.0)
- visualInspectionPoint()
+ visualInspectionPoint(inspectionTime)
mousePress(map, point.x, point.y)
for (i=0; i < 50; i += 4) {
wait(1)
@@ -473,6 +477,7 @@ Item {
}
mouseRelease(map, point.x - i, point.y)
verify(LocationTestHelper.waitForPolished(map))
+ visualInspectionPoint(inspectionTime)
point = map.fromCoordinate(extMapCircleDateline.center)
visualInspectionPoint()
verify(point.x < map.width / 2.0)
@@ -489,7 +494,7 @@ Item {
point = map.fromCoordinate(extMapQuickItemDateline.coordinate)
verify(point.x > map.width / 2.0)
verify(LocationTestHelper.waitForPolished(map))
- visualInspectionPoint()
+ visualInspectionPoint(inspectionTime)
mousePress(map, point.x + 5, point.y + 5)
for (i=0; i < 64; i += 5) {
wait(1)
@@ -497,6 +502,7 @@ Item {
}
mouseRelease(map, point.x + 5 - i, point.y + 5)
verify(LocationTestHelper.waitForPolished(map))
+ visualInspectionPoint(inspectionTime)
point = map.fromCoordinate(extMapQuickItemDateline.coordinate)
visualInspectionPoint()
verify(point.x < map.width / 2.0)
@@ -534,6 +540,7 @@ Item {
point = map.fromCoordinate(extMapPolygonDateline.path[3])
verify(point.x == map.width / 2.0)
verify(LocationTestHelper.waitForPolished(map))
+ visualInspectionPoint(inspectionTime)
mousePress(map, point.x + 5, point.y - 5)
for (i=0; i < 16; i += 2) {
wait(1)
@@ -541,6 +548,7 @@ Item {
}
mouseRelease(map, point.x + 5 - i, point.y - 5)
verify(LocationTestHelper.waitForPolished(map))
+ visualInspectionPoint(inspectionTime)
point = map.fromCoordinate(extMapPolygonDateline.path[0])
verify(point.x < map.width / 2.0)
point = map.fromCoordinate(extMapPolygonDateline.path[1])