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();
31
32// QGeoShape API
33 QGeoShapePrivate *clone() const override;
34 bool isValid() const override;
35 bool contains(const QGeoCoordinate &coordinate) const override;
36 void translate(double degreesLatitude, double degreesLongitude) override;
37 bool operator==(const QGeoShapePrivate &other) const override;
38 size_t hash(size_t seed) const override;
39
40// QGeoPathPrivateBase API
41 void markDirty() override;
42
43// QGeoPolygonPrivate API
44 qsizetype holesCount() const;
45 bool polygonContains(const QGeoCoordinate &coordinate) const;
46 const QList<QGeoCoordinate> holePath(qsizetype index) const;
47
48 void addHole(const QList<QGeoCoordinate> &holePath);
49 void removeHole(qsizetype index);
50 void updateClipperPath();
51
52// data members
53 bool m_clipperDirty = true;
54 QList<QList<QGeoCoordinate>> m_holesList;
55 QClipperUtils m_clipperWrapper;
56};
57
58class Q_POSITIONING_EXPORT QGeoPolygonPrivateEager : public QGeoPolygonPrivate
59{
60public:
61 QGeoPolygonPrivateEager();
62 QGeoPolygonPrivateEager(const QList<QGeoCoordinate> &path);
63 ~QGeoPolygonPrivateEager();
64
65// QGeoShape API
66 QGeoShapePrivate *clone() const override;
67 void translate(double degreesLatitude, double degreesLongitude) override;
68
69// QGeoPath API
70 void markDirty() override;
71 void addCoordinate(const QGeoCoordinate &coordinate) override;
72 void computeBoundingBox() override;
73
74// QGeoPolygonPrivate API
75
76// *Eager API
77 void updateBoundingBox();
78
79// data members
80 QList<double> m_deltaXs; // longitude deltas from m_path[0]
81 double m_minX = 0; // minimum value inside deltaXs
82 double m_maxX = 0; // maximum value inside deltaXs
83 double m_minLati = 0; // minimum latitude. paths do not wrap around through the poles
84 double m_maxLati = 0; // minimum latitude. paths do not wrap around through the poles
85};
86
87// This is a mean of creating a QGeoPolygonPrivateEager and injecting it into QGeoPolygons via operator=
88class Q_POSITIONING_EXPORT QGeoPolygonEager : public QGeoPolygon
89{
90 Q_GADGET
91public:
92
93 QGeoPolygonEager();
94 QGeoPolygonEager(const QList<QGeoCoordinate> &path);
95 QGeoPolygonEager(const QGeoPolygon &other);
96 QGeoPolygonEager(const QGeoShape &other);
97 ~QGeoPolygonEager();
98};
99
100QT_END_NAMESPACE
101
102#endif // QGEOPOLYGON_P_H
Combined button and popup list for selecting options.
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
#define M_PI
Definition qmath.h:201