diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2018-04-19 07:50:12 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2018-04-19 07:50:18 +0200 |
commit | a92696ec3675faf3cfb3dfcf5e649f4bcb0a99ca (patch) | |
tree | 8e35af7f0103fa516f321b796086ce0ecc37495a | |
parent | 3d2281ccf7400a782f69b7b74cb45d0889708bcc (diff) | |
parent | f9b9f578f6e7e1ba572a7f098d53d3a0b0fd4a97 (diff) | |
download | qtlocation-a92696ec3675faf3cfb3dfcf5e649f4bcb0a99ca.tar.gz |
Merge remote-tracking branch 'gerrit/5.11' into 5.11.0
Change-Id: I8be04335a4e29877fb1d0a5029f5c5d60429de69
-rw-r--r-- | src/imports/positioning/positioning.cpp | 2 | ||||
-rw-r--r-- | src/location/declarativemaps/qdeclarativepolygonmapitem.cpp | 13 | ||||
-rw-r--r-- | src/location/declarativemaps/qdeclarativepolygonmapitem_p.h | 2 | ||||
-rw-r--r-- | src/location/declarativemaps/qdeclarativerectanglemapitem_p.h | 2 | ||||
-rw-r--r-- | src/location/declarativemaps/qgeomapitemgeometry_p.h | 4 | ||||
-rw-r--r-- | src/location/maps/qgeomaneuver.h | 2 | ||||
-rw-r--r-- | src/location/maps/qgeoprojection.cpp | 2 | ||||
-rw-r--r-- | src/positioning/qwebmercator.cpp | 24 | ||||
-rw-r--r-- | src/positioning/qwebmercator_p.h | 1 |
9 files changed, 18 insertions, 34 deletions
diff --git a/src/imports/positioning/positioning.cpp b/src/imports/positioning/positioning.cpp index 232d2589..6af79b54 100644 --- a/src/imports/positioning/positioning.cpp +++ b/src/imports/positioning/positioning.cpp @@ -591,6 +591,8 @@ public: QMetaType::registerEqualsComparator<QGeoCircle>(); qRegisterMetaType<QGeoPath>(); QMetaType::registerEqualsComparator<QGeoPath>(); + qRegisterMetaType<QGeoPolygon>(); + QMetaType::registerEqualsComparator<QGeoPolygon>(); qRegisterMetaType<QGeoLocation>(); qRegisterMetaType<QGeoShape>(); QMetaType::registerEqualsComparator<QGeoShape>(); diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp index b019a073..9e96f3c6 100644 --- a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp +++ b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp @@ -246,7 +246,7 @@ void QGeoMapPolygonGeometry::updateSourcePoints(const QGeoMap &map, /*! \internal */ -void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map) +void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map, qreal strokeWidth) { if (!screenDirty_) return; @@ -310,6 +310,8 @@ void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map) } screenBounds_ = ppi.boundingRect(); + if (strokeWidth != 0.0) + this->translate(QPointF(strokeWidth, strokeWidth)); } QDeclarativePolygonMapItem::QDeclarativePolygonMapItem(QQuickItem *parent) @@ -515,7 +517,7 @@ void QDeclarativePolygonMapItem::updatePolish() updatingGeometry_ = true; geometry_.updateSourcePoints(*map(), geopathProjected_); - geometry_.updateScreenPoints(*map()); + geometry_.updateScreenPoints(*map(), border_.width()); QList<QGeoMapItemGeometry *> geoms; geoms << &geometry_; @@ -546,10 +548,11 @@ void QDeclarativePolygonMapItem::updatePolish() } QRectF combined = QGeoMapItemGeometry::translateToCommonOrigin(geoms); - setWidth(combined.width()); - setHeight(combined.height()); + setWidth(combined.width() + 2 * border_.width()); + setHeight(combined.height() + 2 * border_.width()); - setPositionOnMap(geometry_.origin(), -1 * geometry_.sourceBoundingBox().topLeft()); + setPositionOnMap(geometry_.origin(), -1 * geometry_.sourceBoundingBox().topLeft() + + QPointF(border_.width(), border_.width())); } void QDeclarativePolygonMapItem::markSourceDirtyAndUpdate() diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h b/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h index 1e2a91c9..febeb751 100644 --- a/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h +++ b/src/location/declarativemaps/qdeclarativepolygonmapitem_p.h @@ -70,7 +70,7 @@ public: void updateSourcePoints(const QGeoMap &map, const QList<QDoubleVector2D> &path); - void updateScreenPoints(const QGeoMap &map); + void updateScreenPoints(const QGeoMap &map, qreal strokeWidth = 0.0); protected: QPainterPath srcPath_; diff --git a/src/location/declarativemaps/qdeclarativerectanglemapitem_p.h b/src/location/declarativemaps/qdeclarativerectanglemapitem_p.h index 1642d700..c475bf7f 100644 --- a/src/location/declarativemaps/qdeclarativerectanglemapitem_p.h +++ b/src/location/declarativemaps/qdeclarativerectanglemapitem_p.h @@ -67,7 +67,7 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeRectangleMapItem: public QDeclarativ Q_PROPERTY(QGeoCoordinate topLeft READ topLeft WRITE setTopLeft NOTIFY topLeftChanged) Q_PROPERTY(QGeoCoordinate bottomRight READ bottomRight WRITE setBottomRight NOTIFY bottomRightChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) - Q_PROPERTY(QDeclarativeMapLineProperties *border READ border) + Q_PROPERTY(QDeclarativeMapLineProperties *border READ border CONSTANT) public: explicit QDeclarativeRectangleMapItem(QQuickItem *parent = 0); diff --git a/src/location/declarativemaps/qgeomapitemgeometry_p.h b/src/location/declarativemaps/qgeomapitemgeometry_p.h index 5149a7c0..1011cd0c 100644 --- a/src/location/declarativemaps/qgeomapitemgeometry_p.h +++ b/src/location/declarativemaps/qgeomapitemgeometry_p.h @@ -91,6 +91,10 @@ public: inline const QGeoCoordinate &origin() const { return srcOrigin_; } + QPainterPath screenOutline() const { + return screenOutline_; + } + inline bool contains(const QPointF &screenPoint) const { return screenOutline_.contains(screenPoint); } diff --git a/src/location/maps/qgeomaneuver.h b/src/location/maps/qgeomaneuver.h index 76c5421e..52a5b6a6 100644 --- a/src/location/maps/qgeomaneuver.h +++ b/src/location/maps/qgeomaneuver.h @@ -39,7 +39,7 @@ #include <QtCore/qshareddata.h> #include <QtLocation/qlocationglobal.h> -#include <QVariantMap> +#include <QtCore/qvariant.h> QT_BEGIN_NAMESPACE diff --git a/src/location/maps/qgeoprojection.cpp b/src/location/maps/qgeoprojection.cpp index a99656c6..74736cef 100644 --- a/src/location/maps/qgeoprojection.cpp +++ b/src/location/maps/qgeoprojection.cpp @@ -685,7 +685,7 @@ void QGeoProjectionWebMercator::updateVisibleRegion() m_visibleRegionExpanded.clear(); for (const QDoubleVector2D &v: qAsConst(m_visibleRegion)) { const QDoubleVector2D vc = v - centroid; - m_visibleRegionExpanded.push_back(centroid + vc * 1.05); // fixing expansion factor to 1.05 + m_visibleRegionExpanded.push_back(centroid + vc * 1.2); // fixing expansion factor to 1.2 } c2t::clip2tri clipperExpanded; diff --git a/src/positioning/qwebmercator.cpp b/src/positioning/qwebmercator.cpp index b8abac2b..0aad4100 100644 --- a/src/positioning/qwebmercator.cpp +++ b/src/positioning/qwebmercator.cpp @@ -100,30 +100,6 @@ QGeoCoordinate QWebMercator::mercatorToCoord(const QDoubleVector2D &mercator) return QGeoCoordinate(lat, lng, 0.0); } -QGeoCoordinate QWebMercator::mercatorToCoordClamped(const QDoubleVector2D &mercator) -{ - double fx = mercator.x(); - double fy = mercator.y(); - - if (fy < 0.0) - fy = 0.0; - else if (fy > 1.0) - fy = 1.0; - - double lat = qRadiansToDegrees(2.0 * std::atan(std::exp(M_PI * (1.0 - 2.0 * fy))) - (M_PI / 2.0)); - - double lng; - if (fx >= 0) { - lng = realmod(fx, 1.0); - } else { - lng = realmod(1.0 - realmod(-1.0 * fx, 1.0), 1.0); - } - - lng = lng * 360.0 - 180.0; - - return QGeoCoordinate(lat, lng, 0.0); -} - QGeoCoordinate QWebMercator::coordinateInterpolation(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress) { QDoubleVector2D s = QWebMercator::coordToMercator(from); diff --git a/src/positioning/qwebmercator_p.h b/src/positioning/qwebmercator_p.h index 52a5e040..109f0730 100644 --- a/src/positioning/qwebmercator_p.h +++ b/src/positioning/qwebmercator_p.h @@ -64,7 +64,6 @@ class Q_POSITIONING_PRIVATE_EXPORT QWebMercator public: static QDoubleVector2D coordToMercator(const QGeoCoordinate &coord); static QGeoCoordinate mercatorToCoord(const QDoubleVector2D &mercator); - static QGeoCoordinate mercatorToCoordClamped(const QDoubleVector2D &mercator); static QGeoCoordinate coordinateInterpolation(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress); private: |