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// Qt-Security score:significant reason:default
5
6#ifndef QDECLARATIVEPOLYLINEMAPITEM_P_P_H
7#define QDECLARATIVEPOLYLINEMAPITEM_P_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <QtCore/QScopedValueRollback>
21#include <QSGGeometryNode>
22#include <QSGFlatColorMaterial>
23
24#include <QtLocation/private/qlocationglobal_p.h>
25#include <QtLocation/private/qdeclarativepolylinemapitem_p.h>
26#include <QtLocation/private/qgeomapitemgeometry_p.h>
27
28#include <QtPositioning/private/qdoublevector2d_p.h>
29
30QT_BEGIN_NAMESPACE
31
32class QQuickShape;
33class QQuickShapePath;
34
36{
37 void updateSourcePoints(const QGeoMap &map,
38 const QList<QDoubleVector2D> &basePath);
39
40 QPainterPath srcPath() const { return srcPath_; }
41
44};
45
47{
48 Q_DISABLE_COPY_MOVE(QDeclarativePolylineMapItemPrivate)
49public:
50 QDeclarativePolylineMapItemPrivate(QDeclarativePolylineMapItem &poly)
51 : m_poly(poly)
52 {
53 }
54
55 virtual ~QDeclarativePolylineMapItemPrivate();
56 virtual void markSourceDirtyAndUpdate() = 0;
57 virtual void onMapSet() = 0;
58 virtual void onLinePropertiesChanged() = 0;
59 virtual void onGeoGeometryChanged() = 0;
60 virtual void onGeoGeometryUpdated() = 0;
61 virtual void onItemGeometryChanged() = 0;
62 virtual void updatePolish() = 0;
63 virtual void afterViewportChanged() = 0;
64 virtual QSGNode * updateMapItemPaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data) = 0;
65 virtual bool contains(const QPointF &point) const = 0;
66
68};
69
70class Q_LOCATION_EXPORT QDeclarativePolylineMapItemPrivateCPU: public QDeclarativePolylineMapItemPrivate
71{
72public:
73 QDeclarativePolylineMapItemPrivateCPU(QDeclarativePolylineMapItem &poly);
74 ~QDeclarativePolylineMapItemPrivateCPU() override;
75
76 void onLinePropertiesChanged() override
77 {
78 // mark dirty just in case we're a width change
79 markSourceDirtyAndUpdate();
80 }
81 void markSourceDirtyAndUpdate() override
82 {
83 m_geometry.markSourceDirty();
84 m_poly.polishAndUpdate();
85 }
86 void regenerateCache();
87 void updateCache();
88 void afterViewportChanged() override
89 {
90 // preserveGeometry is cleared in updateMapItemPaintNode
91 markSourceDirtyAndUpdate();
92 }
93 void onMapSet() override
94 {
95 regenerateCache();
96 markSourceDirtyAndUpdate();
97 }
98 void onGeoGeometryChanged() override
99 {
100 regenerateCache();
101 markSourceDirtyAndUpdate();
102 }
103 void onGeoGeometryUpdated() override
104 {
105 updateCache();
106 markSourceDirtyAndUpdate();
107 }
108 void onItemGeometryChanged() override
109 {
110 onGeoGeometryChanged();
111 }
112 void updatePolish() override;
113 QSGNode *updateMapItemPaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData * /*data*/) override;
114 bool contains(const QPointF &point) const override;
115
116 QList<QDoubleVector2D> m_geopathProjected;
117 QGeoMapPolylineGeometry m_geometry;
118 QQuickShape *m_shape = nullptr;
119 QQuickShapePath *m_shapePath = nullptr;
120 QDeclarativeGeoMapPainterPath *m_painterPath = nullptr;
121};
122
123QT_END_NAMESPACE
124
125#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)