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
4#ifndef QDECLARATIVECIRCLEMAPITEM_H
5#define QDECLARATIVECIRCLEMAPITEM_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtLocation/private/qlocationglobal_p.h>
19#include <QtLocation/private/qdeclarativegeomapitembase_p.h>
20#include <QtLocation/private/qdeclarativepolylinemapitem_p_p.h>
21#include <QSGGeometryNode>
22#include <QSGFlatColorMaterial>
23#include <QtPositioning/QGeoCircle>
24
25QT_BEGIN_NAMESPACE
26
27class QDeclarativeCircleMapItemPrivate;
28class Q_LOCATION_EXPORT QDeclarativeCircleMapItem : public QDeclarativeGeoMapItemBase
29{
30 Q_OBJECT
31 QML_NAMED_ELEMENT(MapCircle)
32 QML_ADDED_IN_VERSION(5, 0)
33
34 Q_PROPERTY(QGeoCoordinate center READ center WRITE setCenter NOTIFY centerChanged)
35 Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
36 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
37 Q_PROPERTY(QDeclarativeMapLineProperties *border READ border CONSTANT)
38
39public:
40 explicit QDeclarativeCircleMapItem(QQuickItem *parent = nullptr);
41 ~QDeclarativeCircleMapItem() override;
42
43 void setMap(QDeclarativeGeoMap *quickMap, QGeoMap *map) override;
44 QSGNode *updateMapItemPaintNode(QSGNode *, UpdatePaintNodeData *) override;
45
46 QGeoCoordinate center();
47 void setCenter(const QGeoCoordinate &center);
48
49 qreal radius() const;
50 void setRadius(qreal radius);
51
52 QColor color() const;
53 void setColor(const QColor &color);
54
55 QDeclarativeMapLineProperties *border();
56
57 bool contains(const QPointF &point) const override;
58 const QGeoShape &geoShape() const override;
59 void setGeoShape(const QGeoShape &shape) override;
60
61Q_SIGNALS:
62 void centerChanged(const QGeoCoordinate &center);
63 void radiusChanged(qreal radius);
64 void colorChanged(const QColor &color);
65
66protected:
67 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
68 void updatePolish() override;
69
70protected Q_SLOTS:
71 void markSourceDirtyAndUpdate();
72 void onLinePropertiesChanged();
73 void afterViewportChanged(const QGeoMapViewportChangeEvent &event) override;
74
75private:
76 void updateCirclePath();
77
78private:
79 QGeoCircle m_circle;
80 QDeclarativeMapLineProperties m_border;
81 QColor m_color;
82 bool m_updatingGeometry;
83
84 std::unique_ptr<QDeclarativeCircleMapItemPrivate> m_d;
85
86 friend class QDeclarativeCircleMapItemPrivate;
87 friend class QDeclarativeCircleMapItemPrivateCPU;
88};
89
90//////////////////////////////////////////////////////////////////////
91
92QT_END_NAMESPACE
93
94QML_DECLARE_TYPE(QDeclarativeCircleMapItem)
95
96#endif /* QDECLARATIVECIRCLEMAPITEM_H */
#define M_PI
Definition qmath.h:200