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