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
qdeclarativecirclemapitem_p.h
Go to the documentation of this file.
1// Copyright (C) 2015 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QDECLARATIVECIRCLEMAPITEM_H
6#define QDECLARATIVECIRCLEMAPITEM_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/qdeclarativegeomapitembase_p.h>
21#include <QtLocation/private/qdeclarativepolylinemapitem_p_p.h>
22#include <QSGGeometryNode>
23#include <QSGFlatColorMaterial>
24#include <QtPositioning/QGeoCircle>
25
26QT_BEGIN_NAMESPACE
27
28class QDeclarativeCircleMapItemPrivate;
29class Q_LOCATION_EXPORT QDeclarativeCircleMapItem : public QDeclarativeGeoMapItemBase
30{
31 Q_OBJECT
32 QML_NAMED_ELEMENT(MapCircle)
33 QML_ADDED_IN_VERSION(5, 0)
34
35 Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged)
36 Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
37 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
38 Q_PROPERTY(QDeclarativeMapLineProperties *border READ border CONSTANT)
39
40public:
41 explicit QDeclarativeCircleMapItem(QQuickItem *parent = nullptr);
42 ~QDeclarativeCircleMapItem() override;
43
44 void setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map) override;
45 QSGNode *updateMapItemPaintNode(QSGNode *, UpdatePaintNodeData *) override;
46
47 QGeoCoordinate center();
48 void setCenter(const QGeoCoordinate &center);
49
50 qreal radius() const;
51 void setRadius(qreal radius);
52
53 QColor color() const;
54 void setColor(const QColor &color);
55
56 QDeclarativeMapLineProperties *border();
57
58 bool contains(const QPointF &point) const override;
59 const QGeoShape &geoShape() const override;
60 void setGeoShape(const QGeoShape &shape) override;
61
62Q_SIGNALS:
63 void centerChanged(const QGeoCoordinate &center);
64 void radiusChanged(qreal radius);
65 void colorChanged(const QColor &color);
66
67protected:
68 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
69 void updatePolish() override;
70
71protected Q_SLOTS:
72 void markSourceDirtyAndUpdate();
73 void onLinePropertiesChanged();
74 void afterViewportChanged(const QGeoMapViewportChangeEvent &event) override;
75
76private:
77 void updateCirclePath();
78
79private:
80 QGeoCircle m_circle;
81 QDeclarativeMapLineProperties m_border;
82 QColor m_color;
83 bool m_updatingGeometry;
84
85 std::unique_ptr<QDeclarativeCircleMapItemPrivate> m_d;
86
87 friend class QDeclarativeCircleMapItemPrivate;
88 friend class QDeclarativeCircleMapItemPrivateCPU;
89};
90
91//////////////////////////////////////////////////////////////////////
92
93QT_END_NAMESPACE
94
95QML_DECLARE_TYPE(QDeclarativeCircleMapItem)
96
97#endif /* QDECLARATIVECIRCLEMAPITEM_H */
#define M_PI
Definition qmath.h:201