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
qgeopolygon_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 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 QGEOPOLYGON_P_H
6#define QGEOPOLYGON_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 <QtPositioning/private/qgeopath_p.h>
20#include <QtPositioning/qgeopolygon.h>
21#include <QtPositioning/private/qclipperutils_p.h>
22
23QT_BEGIN_NAMESPACE
24
25class Q_POSITIONING_EXPORT QGeoPolygonPrivate : public QGeoPathPrivateBase
26{
27public:
28 QGeoPolygonPrivate();
29 QGeoPolygonPrivate(const QList<QGeoCoordinate> &path);
30 QGeoPolygonPrivate(const QGeoPolygonPrivate &other);
31 ~QGeoPolygonPrivate();
32
33// QGeoShape API
34 QGeoShapePrivate *clone() const override;
35 bool isValid() const override;
36 bool contains(const QGeoCoordinate &coordinate) const override;
37 void translate(double degreesLatitude, double degreesLongitude) override;
38 bool operator==(const QGeoShapePrivate &other) const override;
39 size_t hash(size_t seed) const override;
40
41// QGeoPathPrivateBase API
42 void markDirty() override;
43
44// QGeoPolygonPrivate API
45 qsizetype holesCount() const;
46 bool polygonContains(const QGeoCoordinate &coordinate) const;
47 const QList<QGeoCoordinate> holePath(qsizetype index) const;
48
49 void addHole(const QList<QGeoCoordinate> &holePath);
50 void removeHole(qsizetype index);
51 void ensureClipperPathUpdated() const;
52
53// data members
54 QList<QList<QGeoCoordinate>> m_holesList;
55 mutable QClipperUtils m_clipperWrapper; // cached
56 mutable double m_leftBoundWrapped = 0.0; // cached
57 mutable std::atomic<bool> m_clipperDirty = true;
58};
59
60class Q_POSITIONING_EXPORT QGeoPolygonPrivateEager final : public QGeoPolygonPrivate
61{
62public:
63 QGeoPolygonPrivateEager();
64 QGeoPolygonPrivateEager(const QList<QGeoCoordinate> &path);
65 QGeoPolygonPrivateEager(const QGeoPolygonPrivateEager &other);
66 ~QGeoPolygonPrivateEager();
67
68// QGeoShape API
69 QGeoShapePrivate *clone() const override;
70 void translate(double degreesLatitude, double degreesLongitude) override;
71
72// QGeoPath API
73 void markDirty() override;
74 void addCoordinate(const QGeoCoordinate &coordinate) override;
75
76// QGeoPolygonPrivate API
77
78// *Eager API
79 void updateBoundingBox();
80
81// data members
82 QList<double> m_deltaXs; // longitude deltas from m_path[0]
83 double m_minX = 0; // minimum value inside deltaXs
84 double m_maxX = 0; // maximum value inside deltaXs
85 double m_minLati = 0; // minimum latitude. paths do not wrap around through the poles
86 double m_maxLati = 0; // minimum latitude. paths do not wrap around through the poles
87};
88
89// This is a mean of creating a QGeoPolygonPrivateEager and injecting it into QGeoPolygons via operator=
90class Q_POSITIONING_EXPORT QGeoPolygonEager : public QGeoPolygon
91{
92 Q_GADGET
93public:
94
95 QGeoPolygonEager();
96 QGeoPolygonEager(const QList<QGeoCoordinate> &path);
97 QGeoPolygonEager(const QGeoPolygon &other);
98 QGeoPolygonEager(const QGeoShape &other);
99 ~QGeoPolygonEager();
100};
101
102QT_END_NAMESPACE
103
104#endif // QGEOPOLYGON_P_H
\inmodule QtPositioning
Definition qgeopolygon.h:17
static void calculatePeripheralPoints(QList< QGeoCoordinate > &path, const QGeoCircle &circle, int steps)
static void translatePoly(QList< QGeoCoordinate > &m_path, QList< QList< QGeoCoordinate > > &m_holesList, QGeoRectangle &m_bbox, double degreesLatitude, double degreesLongitude, double m_maxLati, double m_minLati)
constexpr auto kTooManyElements
constexpr auto kTooManyHoles
QT_BEGIN_NAMESPACE constexpr int kMaxInt
#define M_PI
Definition qmath.h:201