Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdeclarativepolylinemapitem_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 Paolo Angelelli <paolo.angelelli@gmail.com>
2// Copyright (C) 2022 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QDECLARATIVEPOLYLINEMAPITEM_P_P_H
6#define QDECLARATIVEPOLYLINEMAPITEM_P_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/QScopedValueRollback>
20#include <QSGGeometryNode>
21#include <QSGFlatColorMaterial>
22
23#include <QtLocation/private/qlocationglobal_p.h>
24#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
25#include <QtLocation/private/qgeomapitemgeometry_p.h>
26
27#include <QtPositioning/private/qdoublevector2d_p.h>
28
29QT_BEGIN_NAMESPACE
30
31class QQuickShape;
32class QQuickShapePath;
33
35{
36 void updateSourcePoints(const QGeoMap &map,
37 const QList<QDoubleVector2D> &basePath);
38
39 QPainterPath srcPath() const { return srcPath_; }
40
43};
44
46{
47 Q_DISABLE_COPY_MOVE(QDeclarativePolylineMapItemPrivate)
48public:
49 QDeclarativePolylineMapItemPrivate(QDeclarativePolylineMapItem &poly)
50 : m_poly(poly)
51 {
52 }
53
54 virtual ~QDeclarativePolylineMapItemPrivate();
55 virtual void markSourceDirtyAndUpdate() = 0;
56 virtual void onMapSet() = 0;
57 virtual void onLinePropertiesChanged() = 0;
58 virtual void onGeoGeometryChanged() = 0;
59 virtual void onGeoGeometryUpdated() = 0;
60 virtual void onItemGeometryChanged() = 0;
61 virtual void updatePolish() = 0;
62 virtual void afterViewportChanged() = 0;
63 virtual QSGNode * updateMapItemPaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data) = 0;
64 virtual bool contains(const QPointF &point) const = 0;
65
67};
68
69class Q_LOCATION_EXPORT QDeclarativePolylineMapItemPrivateCPU: public QDeclarativePolylineMapItemPrivate
70{
71public:
72 QDeclarativePolylineMapItemPrivateCPU(QDeclarativePolylineMapItem &poly);
73 ~QDeclarativePolylineMapItemPrivateCPU() override;
74
75 void onLinePropertiesChanged() override
76 {
77 // mark dirty just in case we're a width change
78 markSourceDirtyAndUpdate();
79 }
80 void markSourceDirtyAndUpdate() override
81 {
82 m_geometry.markSourceDirty();
83 m_poly.polishAndUpdate();
84 }
85 void regenerateCache();
86 void updateCache();
87 void afterViewportChanged() override
88 {
89 // preserveGeometry is cleared in updateMapItemPaintNode
90 markSourceDirtyAndUpdate();
91 }
92 void onMapSet() override
93 {
94 regenerateCache();
95 markSourceDirtyAndUpdate();
96 }
97 void onGeoGeometryChanged() override
98 {
99 regenerateCache();
100 markSourceDirtyAndUpdate();
101 }
102 void onGeoGeometryUpdated() override
103 {
104 updateCache();
105 markSourceDirtyAndUpdate();
106 }
107 void onItemGeometryChanged() override
108 {
109 onGeoGeometryChanged();
110 }
111 void updatePolish() override;
112 QSGNode *updateMapItemPaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData * /*data*/) override;
113 bool contains(const QPointF &point) const override;
114
115 QList<QDoubleVector2D> m_geopathProjected;
116 QGeoMapPolylineGeometry m_geometry;
117 QQuickShape *m_shape = nullptr;
118 QQuickShapePath *m_shapePath = nullptr;
119 QDeclarativeGeoMapPainterPath *m_painterPath = nullptr;
120};
121
122QT_END_NAMESPACE
123
124#endif // QDECLARATIVEPOLYLINEMAPITEM_P_P_H
virtual void afterViewportChanged()=0
virtual QSGNode * updateMapItemPaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data)=0
virtual void onItemGeometryChanged()=0
virtual void onGeoGeometryChanged()=0
virtual bool contains(const QPointF &point) const =0
virtual void onLinePropertiesChanged()=0
virtual void markSourceDirtyAndUpdate()=0
virtual void onGeoGeometryUpdated()=0
static QT_BEGIN_NAMESPACE bool get_line_intersection(const double p0_x, const double p0_y, const double p1_x, const double p1_y, const double p2_x, const double p2_y, const double p3_x, const double p3_y, double *i_x, double *i_y, double *i_t)
static QList< QList< QDoubleVector2D > > clipLine(const QList< QDoubleVector2D > &l, const QList< QDoubleVector2D > &poly)
void updateSourcePoints(const QGeoMap &map, const QList< QDoubleVector2D > &basePath)