diff options
Diffstat (limited to 'src/location/declarativemaps')
9 files changed, 75 insertions, 86 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeomap.cpp b/src/location/declarativemaps/qdeclarativegeomap.cpp index e68961e5..fe59e246 100644 --- a/src/location/declarativemaps/qdeclarativegeomap.cpp +++ b/src/location/declarativemaps/qdeclarativegeomap.cpp @@ -2672,7 +2672,7 @@ bool QDeclarativeGeoMap::sendTouchEvent(QTouchEvent *event) grabber = touchPointGrabberItem(point); if (grabber && stealEvent && !grabber->keepTouchGrab() && grabber != this) { - QVector<int> ids; + QList<int> ids; foreach (const QTouchEvent::TouchPoint &tp, event->touchPoints()) { if (!(tp.state() & Qt::TouchPointReleased)) { ids.append(tp.id()); diff --git a/src/location/declarativemaps/qdeclarativegeomapitemview.cpp b/src/location/declarativemaps/qdeclarativegeomapitemview.cpp index 43e24620..f9e7a938 100644 --- a/src/location/declarativemaps/qdeclarativegeomapitemview.cpp +++ b/src/location/declarativemaps/qdeclarativegeomapitemview.cpp @@ -185,7 +185,7 @@ void QDeclarativeGeoMapItemView::modelUpdated(const QQmlChangeSet &changeSet, bo removeInstantiatedItems(); } else { // Remove items from the back to the front to retain the mapping to what is received from the changesets - const QVector<QQmlChangeSet::Change> &removes = changeSet.removes(); + const QList<QQmlChangeSet::Change> &removes = changeSet.removes(); std::map<int, int> mapRemoves; for (int i = 0; i < removes.size(); i++) mapRemoves.insert(std::pair<int, int>(removes.at(i).start(), i)); diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp index fa6ee174..24086993 100644 --- a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp +++ b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp @@ -398,8 +398,8 @@ static void wrapPath(const QGeoPolygon &poly } static void cutPathEars(const QList<QList<QDoubleVector2D>> &wrappedPaths, - QVector<QDeclarativeGeoMapItemUtils::vec2> &screenVertices, - QVector<quint32> &screenIndices) + QList<QDeclarativeGeoMapItemUtils::vec2> &screenVertices, + QList<quint32> &screenIndices) { using Coord = double; using N = uint32_t; @@ -427,8 +427,8 @@ static void cutPathEars(const QList<QList<QDoubleVector2D>> &wrappedPaths, } static void cutPathEars(const QList<QDoubleVector2D> &wrappedPath, - QVector<QDeclarativeGeoMapItemUtils::vec2> &screenVertices, - QVector<quint32> &screenIndices) + QList<QDeclarativeGeoMapItemUtils::vec2> &screenVertices, + QList<quint32> &screenIndices) { using Coord = double; using N = uint32_t; diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h b/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h index 8d566e69..12bd4b86 100644 --- a/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h +++ b/src/location/declarativemaps/qdeclarativepolygonmapitem_p_p.h @@ -67,7 +67,7 @@ #include <QtGui/QMatrix4x4> #include <QColor> #include <QList> -#include <QVector> +#include <QList> #include <QtCore/QScopedValueRollback> QT_BEGIN_NAMESPACE @@ -117,9 +117,8 @@ public: void allocateAndFillPolygon(QSGGeometry *geom) const { - - const QVector<QDeclarativeGeoMapItemUtils::vec2> &vx = m_screenVertices; - const QVector<quint32> &ix = m_screenIndices; + const QList<QDeclarativeGeoMapItemUtils::vec2> &vx = m_screenVertices; + const QList<quint32> &ix = m_screenIndices; geom->allocate(vx.size(), ix.size()); if (geom->indexType() == QSGGeometry::UnsignedShortType) { @@ -137,10 +136,10 @@ public: pts[i].set(vx[i].x, vx[i].y); } - QVector<QDeclarativeGeoMapItemUtils::vec2> m_screenVertices; - QVector<quint32> m_screenIndices; + QList<QDeclarativeGeoMapItemUtils::vec2> m_screenVertices; + QList<quint32> m_screenIndices; QDoubleVector2D m_bboxLeftBoundWrapped; - QVector<WrappedPolygon> m_wrappedPolygons; + QList<WrappedPolygon> m_wrappedPolygons; int m_wrapOffset; }; diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp index d59704dc..0448d667 100644 --- a/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp +++ b/src/location/declarativemaps/qdeclarativepolylinemapitem.cpp @@ -571,10 +571,8 @@ static inline int clipPointType(qreal x, qreal y, const QRectF &rect) return type; } -static void clipSegmentToRect(qreal x0, qreal y0, qreal x1, qreal y1, - const QRectF &clipRect, - QVector<qreal> &outPoints, - QVector<QPainterPath::ElementType> &outTypes) +static void clipSegmentToRect(qreal x0, qreal y0, qreal x1, qreal y1, const QRectF &clipRect, + QList<qreal> &outPoints, QList<QPainterPath::ElementType> &outTypes) { int type0 = clipPointType(x0, y0, clipRect); int type1 = clipPointType(x1, y1, clipRect); @@ -637,11 +635,9 @@ static void clipSegmentToRect(qreal x0, qreal y0, qreal x1, qreal y1, } } -static void clipPathToRect(const QVector<qreal> &points, - const QVector<QPainterPath::ElementType> &types, - const QRectF &clipRect, - QVector<qreal> &outPoints, - QVector<QPainterPath::ElementType> &outTypes) +static void clipPathToRect(const QList<qreal> &points, + const QList<QPainterPath::ElementType> &types, const QRectF &clipRect, + QList<qreal> &outPoints, QList<QPainterPath::ElementType> &outTypes) { outPoints.clear(); outPoints.reserve(points.size()); @@ -686,8 +682,8 @@ void QGeoMapPolylineGeometry::updateScreenPoints(const QGeoMap &map, viewport.adjust(-strokeWidth, -strokeWidth, strokeWidth * 2, strokeWidth * 2); viewport.translate(-1 * origin); - QVector<qreal> points; - QVector<QPainterPath::ElementType> types; + QList<qreal> points; + QList<QPainterPath::ElementType> types; if (clipToViewport_) { // Although the geometry has already been clipped against the visible region in wrapped mercator space. @@ -755,7 +751,7 @@ bool QGeoMapPolylineGeometry::contains(const QPointF &point) const { // screenOutline_.contains(screenPoint) doesn't work, as, it appears, that // screenOutline_ for QGeoMapPolylineGeometry is empty (QRectF(0,0 0x0)) - const QVector<QPointF> &verts = vertices(); + const QList<QPointF> &verts = vertices(); QPolygonF tri; for (int i = 0; i < verts.size(); ++i) { tri << verts[i]; @@ -1625,7 +1621,7 @@ bool QGeoMapPolylineGeometryOpenGL::allocateAndFillEntries(QSGGeometry *geom, return false; } - const QVector<QDeclarativeGeoMapItemUtils::vec2> &v = *m_screenVertices; + const QList<QDeclarativeGeoMapItemUtils::vec2> &v = *m_screenVertices; if (v.size() < 2) { geom->allocate(0, 0); return true; @@ -1692,7 +1688,7 @@ void QGeoMapPolylineGeometryOpenGL::allocateAndFillLineStrip(QSGGeometry *geom, // Select LOD. Generate if not present. Assign it to m_screenVertices; Q_UNUSED(lod) - const QVector<QDeclarativeGeoMapItemUtils::vec2> &vx = *m_screenVertices; + const QList<QDeclarativeGeoMapItemUtils::vec2> &vx = *m_screenVertices; geom->allocate(vx.size()); QSGGeometry::Point2D *pts = geom->vertexDataAsPoint2D(); @@ -1918,10 +1914,10 @@ const char *MapPolylineShaderExtruded::vertexShaderMiteredSegments() const "}\n"; } -QVector<QDeclarativeGeoMapItemUtils::vec2> QGeoMapItemLODGeometry::getSimplified( - QVector<QDeclarativeGeoMapItemUtils::vec2> &wrappedPath, // reference as it gets copied in the nested call - double leftBoundWrapped, - unsigned int zoom) +QList<QDeclarativeGeoMapItemUtils::vec2> QGeoMapItemLODGeometry::getSimplified( + QList<QDeclarativeGeoMapItemUtils::vec2> + &wrappedPath, // reference as it gets copied in the nested call + double leftBoundWrapped, unsigned int zoom) { // Try a simplify step QList<QDoubleVector2D> data; @@ -1932,7 +1928,7 @@ QVector<QDeclarativeGeoMapItemUtils::vec2> QGeoMapItemLODGeometry::getSimplified zoom); data.clear(); - QVector<QDeclarativeGeoMapItemUtils::vec2> simple; + QList<QDeclarativeGeoMapItemUtils::vec2> simple; for (auto e: simplified) simple << e; return simple; @@ -1947,16 +1943,11 @@ bool QGeoMapItemLODGeometry::isLODActive(unsigned int lod) const class PolylineSimplifyTask : public QRunnable { public: - PolylineSimplifyTask(const QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2> > &input, // reference as it gets copied in the nested call - const QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2> > &output, - double leftBound, - unsigned int zoom, - QSharedPointer<unsigned int> &working) - : m_zoom(zoom) - , m_leftBound(leftBound) - , m_input(input) - , m_output(output) - , m_working(working) + PolylineSimplifyTask(const QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>> + &input, // reference as it gets copied in the nested call + const QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>> &output, + double leftBound, unsigned int zoom, QSharedPointer<unsigned int> &working) + : m_zoom(zoom), m_leftBound(leftBound), m_input(input), m_output(output), m_working(working) { Q_ASSERT(!input.isNull()); Q_ASSERT(!output.isNull()); @@ -1969,25 +1960,23 @@ public: // Skip sending notifications for now. Updated data will be picked up eventually. // ToDo: figure out how to connect a signal from here to a slot in the item. *m_working = QGeoMapPolylineGeometryOpenGL::zoomToLOD(m_zoom); - const QVector<QDeclarativeGeoMapItemUtils::vec2> res = - QGeoMapPolylineGeometryOpenGL::getSimplified( *m_input, - m_leftBound, - QGeoMapPolylineGeometryOpenGL::zoomForLOD(m_zoom)); + const QList<QDeclarativeGeoMapItemUtils::vec2> res = + QGeoMapPolylineGeometryOpenGL::getSimplified( + *m_input, m_leftBound, QGeoMapPolylineGeometryOpenGL::zoomForLOD(m_zoom)); *m_output = res; *m_working = 0; } unsigned int m_zoom; double m_leftBound; - QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2> > m_input, m_output; + QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>> m_input, m_output; QSharedPointer<unsigned int> m_working; }; -void QGeoMapItemLODGeometry::enqueueSimplificationTask(const QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2> > &input, - const QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2> > &output, - double leftBound, - unsigned int zoom, - QSharedPointer<unsigned int> &working) +void QGeoMapItemLODGeometry::enqueueSimplificationTask( + const QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>> &input, + const QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>> &output, double leftBound, + unsigned int zoom, QSharedPointer<unsigned int> &working) { Q_ASSERT(!input.isNull()); Q_ASSERT(!output.isNull()); @@ -2010,8 +1999,8 @@ void QGeoMapItemLODGeometry::selectLOD(unsigned int zoom, double leftBound, bool // if here, zoomToLOD != 0 and no current working task. // So select the last filled LOD != m_working (lower-bounded by 1, // guaranteed to exist), and enqueue the right one - m_verticesLOD[requestedLod] = QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2>>( - new QVector<QDeclarativeGeoMapItemUtils::vec2>); + m_verticesLOD[requestedLod] = QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>>( + new QList<QDeclarativeGeoMapItemUtils::vec2>); for (unsigned int i = requestedLod - 1; i >= 1; i--) { if (*m_working != i && !m_verticesLOD[i].isNull()) { @@ -2019,8 +2008,8 @@ void QGeoMapItemLODGeometry::selectLOD(unsigned int zoom, double leftBound, bool break; } else if (i == 1) { // get 1 synchronously if not computed already - m_verticesLOD[1] = QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2>>( - new QVector<QDeclarativeGeoMapItemUtils::vec2>); + m_verticesLOD[1] = QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>>( + new QList<QDeclarativeGeoMapItemUtils::vec2>); *m_verticesLOD[1] = getSimplified( *m_verticesLOD[0], leftBound, zoomForLOD(0)); @@ -2044,16 +2033,16 @@ void QGeoMapItemLODGeometry::selectLODOnDataChanged(unsigned int zoom, double le if (lod > 0) { // Generate ZL 1 as fallback for all cases != 0. Do not do if 0 is requested // (= old behavior, LOD disabled) - m_verticesLOD[1] = QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2>>( - new QVector<QDeclarativeGeoMapItemUtils::vec2>); + m_verticesLOD[1] = QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>>( + new QList<QDeclarativeGeoMapItemUtils::vec2>); *m_verticesLOD[1] = getSimplified( *m_verticesLOD[0], leftBound, zoomForLOD(0)); } if (lod > 1) { if (!m_verticesLOD[lod]) - m_verticesLOD[lod] = QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2>>( - new QVector<QDeclarativeGeoMapItemUtils::vec2>); + m_verticesLOD[lod] = QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>>( + new QList<QDeclarativeGeoMapItemUtils::vec2>); enqueueSimplificationTask( m_verticesLOD.at(0), m_verticesLOD[lod], leftBound, diff --git a/src/location/declarativemaps/qdeclarativepolylinemapitem_p_p.h b/src/location/declarativemaps/qdeclarativepolylinemapitem_p_p.h index 2a588222..2cec8830 100644 --- a/src/location/declarativemaps/qdeclarativepolylinemapitem_p_p.h +++ b/src/location/declarativemaps/qdeclarativepolylinemapitem_p_p.h @@ -93,8 +93,8 @@ public: const QDoubleVector2D &leftBoundWrapped); public: - QVector<qreal> srcPoints_; - QVector<QPainterPath::ElementType> srcPointTypes_; + QList<qreal> srcPoints_; + QList<QPainterPath::ElementType> srcPointTypes_; #ifdef QT_LOCATION_DEBUG QList<QDoubleVector2D> m_wrappedPath; @@ -216,9 +216,11 @@ protected: class Q_LOCATION_PRIVATE_EXPORT QGeoMapItemLODGeometry { public: - mutable std::array<QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2>>, 7> m_verticesLOD; // fix it to 7, - // do not allow simplifications beyond ZL 20. This could actually be limited even further - mutable QVector<QDeclarativeGeoMapItemUtils::vec2> *m_screenVertices; + mutable std::array<QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>>, 7> + m_verticesLOD; // fix it to 7, + // do not allow simplifications beyond ZL 20. This could actually be + // limited even further + mutable QList<QDeclarativeGeoMapItemUtils::vec2> *m_screenVertices; mutable QSharedPointer<unsigned int> m_working; QGeoMapItemLODGeometry() @@ -229,8 +231,8 @@ public: void resetLOD() { // New pointer, some old LOD task might still be running and operating on the old pointers. - m_verticesLOD[0] = QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2>>( - new QVector<QDeclarativeGeoMapItemUtils::vec2>); + m_verticesLOD[0] = QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>>( + new QList<QDeclarativeGeoMapItemUtils::vec2>); for (unsigned int i = 1; i < m_verticesLOD.size(); ++i) m_verticesLOD[i] = nullptr; // allocate on first use m_screenVertices = m_verticesLOD.front().data(); // resetting pointer to data to be LOD 0 @@ -244,16 +246,15 @@ public: void selectLOD(unsigned int zoom, double leftBound, bool /*closed*/); - static QVector<QDeclarativeGeoMapItemUtils::vec2> getSimplified ( - QVector<QDeclarativeGeoMapItemUtils::vec2> &wrappedPath, - double leftBoundWrapped, - unsigned int zoom); + static QList<QDeclarativeGeoMapItemUtils::vec2> + getSimplified(QList<QDeclarativeGeoMapItemUtils::vec2> &wrappedPath, double leftBoundWrapped, + unsigned int zoom); - static void enqueueSimplificationTask(const QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2> > &input, // reference as it gets copied in the nested call - const QSharedPointer<QVector<QDeclarativeGeoMapItemUtils::vec2> > &output, - double leftBound, - unsigned int zoom, - QSharedPointer<unsigned int> &working); + static void enqueueSimplificationTask( + const QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>> + &input, // reference as it gets copied in the nested call + const QSharedPointer<QList<QDeclarativeGeoMapItemUtils::vec2>> &output, + double leftBound, unsigned int zoom, QSharedPointer<unsigned int> &working); void selectLODOnDataChanged(unsigned int zoom, double leftBound) const; @@ -365,7 +366,7 @@ public: public: QDoubleVector2D m_bboxLeftBoundWrapped; - QVector<WrappedPolyline> m_wrappedPolygons; + QList<WrappedPolyline> m_wrappedPolygons; int m_wrapOffset; friend class QDeclarativeCircleMapItem; diff --git a/src/location/declarativemaps/qgeomapitemgeometry.cpp b/src/location/declarativemaps/qgeomapitemgeometry.cpp index 28e9fa67..f7feec5c 100644 --- a/src/location/declarativemaps/qgeomapitemgeometry.cpp +++ b/src/location/declarativemaps/qgeomapitemgeometry.cpp @@ -71,8 +71,8 @@ void QGeoMapItemGeometry::translate(const QPointF &offset) */ void QGeoMapItemGeometry::allocateAndFill(QSGGeometry *geom) const { - const QVector<QPointF> &vx = screenVertices_; - const QVector<quint32> &ix = screenIndices_; + const QList<QPointF> &vx = screenVertices_; + const QList<quint32> &ix = screenIndices_; if (isIndexed()) { geom->allocate(vx.size(), ix.size()); diff --git a/src/location/declarativemaps/qgeomapitemgeometry_p.h b/src/location/declarativemaps/qgeomapitemgeometry_p.h index aa5ea4ac..d233978c 100644 --- a/src/location/declarativemaps/qgeomapitemgeometry_p.h +++ b/src/location/declarativemaps/qgeomapitemgeometry_p.h @@ -53,7 +53,7 @@ #include <QPainterPath> #include <QPointF> #include <QRectF> -#include <QVector> +#include <QList> #include <QGeoCoordinate> #include <QVector2D> #include <QList> @@ -106,8 +106,8 @@ public: return QVector2D(screenVertices_[index]); } - inline QVector<QPointF> vertices() const { return screenVertices_; } - inline QVector<quint32> indices() const { return screenIndices_; } + inline QList<QPointF> vertices() const { return screenVertices_; } + inline QList<quint32> indices() const { return screenIndices_; } inline bool isIndexed() const { return (!screenIndices_.isEmpty()); } @@ -153,8 +153,8 @@ protected: QGeoCoordinate srcOrigin_; - QVector<QPointF> screenVertices_; - QVector<quint32> screenIndices_; + QList<QPointF> screenVertices_; + QList<quint32> screenIndices_; }; QT_END_NAMESPACE diff --git a/src/location/declarativemaps/qquickgeomapgesturearea_p.h b/src/location/declarativemaps/qquickgeomapgesturearea_p.h index 0bc774d3..dfbe682d 100644 --- a/src/location/declarativemaps/qquickgeomapgesturearea_p.h +++ b/src/location/declarativemaps/qquickgeomapgesturearea_p.h @@ -331,8 +331,8 @@ private: QVector2D m_flickVector; QElapsedTimer m_lastPosTime; QPointF m_lastPos; - QVector<QTouchEvent::TouchPoint> m_allPoints; - QVector<QTouchEvent::TouchPoint> m_touchPoints; + QList<QTouchEvent::TouchPoint> m_allPoints; + QList<QTouchEvent::TouchPoint> m_touchPoints; QScopedPointer<QTouchEvent::TouchPoint> m_mousePoint; QPointF m_sceneStartPoint1; |