summaryrefslogtreecommitdiff
path: root/src/location/maps/qgeoprojection_p.h
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-07-07 15:31:00 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-07-17 12:40:42 +0000
commit2ab93acd9751b3ffe2c36a4a0e37dc792686a08f (patch)
tree59070747c2225f76754cf292e15ed29b30141d85 /src/location/maps/qgeoprojection_p.h
parentb02916a5568d57eda767ca930dcdb366179250bc (diff)
downloadqtlocation-2ab93acd9751b3ffe2c36a4a0e37dc792686a08f.tar.gz
Fix dragging items out of map bounds
In 5.9.0 map items are clipped against the visible region. This implies that their geometry is also clipped against the visible region. This is problematic in ::geometryChanged, since the old geometry is always clipped in this way. This patch clips items against a "projectable" region instead, that is the part of the map that is in front of the camera. Since this can produce very large vertices, mapbox earcut 3rd party library is pulled in, to replace qTriangulate that only supports coordinates up to 1<<21. Task-number: QTBUG-61727 Change-Id: I7449e755a4848a2b2107c5de4e27821e3e887bfb Reviewed-by: Paolo Angelelli <paolo.angelelli@qt.io>
Diffstat (limited to 'src/location/maps/qgeoprojection_p.h')
-rw-r--r--src/location/maps/qgeoprojection_p.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/location/maps/qgeoprojection_p.h b/src/location/maps/qgeoprojection_p.h
index 7d306eea..76e11af0 100644
--- a/src/location/maps/qgeoprojection_p.h
+++ b/src/location/maps/qgeoprojection_p.h
@@ -73,6 +73,7 @@ public:
virtual bool isProjectable(const QDoubleVector2D &wrappedProjection) const = 0;
virtual QList<QDoubleVector2D> visibleRegion() const = 0;
+ virtual QList<QDoubleVector2D> projectableRegion() const = 0;
// Conversion methods for QGeoCoordinate <-> screen.
// This currently assumes that the "MapProjection" space is [0, 1][0, 1] for every type of possibly supported map projection
@@ -126,7 +127,7 @@ public:
bool isProjectable(const QDoubleVector2D &wrappedProjection) const Q_DECL_OVERRIDE;
QList<QDoubleVector2D> visibleRegion() const Q_DECL_OVERRIDE;
-
+ QList<QDoubleVector2D> projectableRegion() const Q_DECL_OVERRIDE;
inline QDoubleVector2D viewportToWrappedMapProjection(const QDoubleVector2D &itemPosition) const;
inline QDoubleVector2D viewportToWrappedMapProjection(const QDoubleVector2D &itemPosition, double &s) const;
private:
@@ -202,6 +203,7 @@ private:
Line2D m_nearPlaneMapIntersection;
QList<QDoubleVector2D> m_visibleRegion;
+ QList<QDoubleVector2D> m_projectableRegion;
bool m_visibleRegionDirty;
Q_DISABLE_COPY(QGeoProjectionWebMercator)