Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdeclarativecirclemapitem_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 QDECLARATIVECIRCLEMAPITEM_P_P_H
6#define QDECLARATIVECIRCLEMAPITEM_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 <QtLocation/private/qlocationglobal_p.h>
20#include <QtLocation/private/qdeclarativepolygonmapitem_p_p.h>
21#include <QtLocation/private/qdeclarativecirclemapitem_p.h>
22
24
25class QQuickShape;
26class QQuickShapePath;
27
28class Q_LOCATION_EXPORT QGeoMapCircleGeometry : public QGeoMapPolygonGeometry
29{
30public:
32
33 void updateSourceAndScreenPointsInvert(const QList<QDoubleVector2D> &circlePath, const QGeoMap &map);
34};
35
36class Q_LOCATION_EXPORT QDeclarativeCircleMapItemPrivate
37{
38 Q_DISABLE_COPY_MOVE(QDeclarativeCircleMapItemPrivate)
39public:
40 static const int CircleSamples = 128; // ToDo: make this radius && ZL dependent?
41
43 : m_circle(circle)
44 {
45 }
46
48 virtual void onLinePropertiesChanged() = 0;
49 virtual void markSourceDirtyAndUpdate() = 0;
50 virtual void onMapSet() = 0;
51 virtual void onGeoGeometryChanged() = 0;
52 virtual void onItemGeometryChanged() = 0;
53 virtual void updatePolish() = 0;
54 virtual void afterViewportChanged() = 0;
56 virtual bool contains(const QPointF &point) const = 0;
57
59 {
60 if (!m_circle.map() || m_circle.map()->geoProjection().projectionType() != QGeoProjection::ProjectionWebMercator)
61 return;
62
63 m_circlePath.clear();
64 const QGeoProjectionWebMercator &p = static_cast<const QGeoProjectionWebMercator&>(m_circle.map()->geoProjection());
65 if (m_circle.referenceSurface() == QLocation::ReferenceSurface::Map)
66 calculatePeripheralPointsSimple(m_circlePath, m_circle.center(), m_circle.radius(), p, CircleSamples);
67 else
68 calculatePeripheralPointsGreatCircle(m_circlePath, m_circle.center(), m_circle.radius(), p, CircleSamples);
69 }
70
71 static int crossEarthPole(const QGeoCoordinate &center, qreal distance);
72
73 static void includeOnePoleInPath(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
75
76 static void calculatePeripheralPointsSimple(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
77 qreal distance, const QGeoProjectionWebMercator &p, int steps);
78
79 static void calculatePeripheralPointsGreatCircle(QList<QDoubleVector2D> &path, const QGeoCoordinate &center,
80 qreal distance, const QGeoProjectionWebMercator &p, int steps);
81
83 QList<QDoubleVector2D> m_circlePath;
84};
85
87{
88public:
91
93 {
94 // mark dirty just in case we're a width change
95 markSourceDirtyAndUpdate();
96 }
98 {
99 m_geometry.markSourceDirty();
100 m_circle.polishAndUpdate();
101 }
102 void onMapSet() override
103 {
104 updateCirclePath();
105 markSourceDirtyAndUpdate();
106 }
107 void onGeoGeometryChanged() override
108 {
109 updateCirclePath();
110 markSourceDirtyAndUpdate();
111 }
112 void onItemGeometryChanged() override
113 {
114 onGeoGeometryChanged();
115 }
116 void afterViewportChanged() override
117 {
118 markSourceDirtyAndUpdate();
119 }
120 void updatePolish() override;
121 QSGNode * updateMapItemPaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data) override;
122 bool contains(const QPointF &point) const override;
123
125 QQuickShape *m_shape = nullptr;
126 QQuickShapePath *m_shapePath = nullptr;
127 QDeclarativeGeoMapPainterPath *m_painterPath = nullptr;
128};
129
131
132#endif // QDECLARATIVECIRCLEMAPITEM_P_P_H
virtual void afterViewportChanged()=0
virtual QSGNode * updateMapItemPaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *data)=0
QDeclarativeCircleMapItemPrivate(QDeclarativeCircleMapItem &circle)
virtual void onItemGeometryChanged()=0
virtual void onGeoGeometryChanged()=0
virtual bool contains(const QPointF &point) const =0
virtual void onLinePropertiesChanged()=0
virtual void markSourceDirtyAndUpdate()=0
\inmodule QtPositioning
void updateSourceAndScreenPointsInvert(const QList< QDoubleVector2D > &circlePath, const QGeoMap &map)
\inmodule QtCore\reentrant
Definition qpoint.h:217
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
QMap< QString, QString > map
[6]
Combined button and popup list for selecting options.
static bool contains(const QJsonArray &haystack, unsigned needle)
Definition qopengl.cpp:116
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei GLsizei GLfloat distance
GLsizei const GLchar *const * path
GLfloat GLfloat p
[1]
double qreal
Definition qtypes.h:187