Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qgeomapitemgeometry_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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 QGEOMAPITEMGEOMETRY_H
5#define QGEOMAPITEMGEOMETRY_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/qdeclarativegeomapitemutils_p.h>
21#include <QtPositioning/private/qdoublevector2d_p.h>
22#include <QtPositioning/private/qwebmercator_p.h>
23
24#include <QPainterPath>
25#include <QPointF>
26#include <QRectF>
27#include <QList>
28#include <QGeoCoordinate>
29#include <QGeoRectangle>
30#include <QVector2D>
31#include <QList>
32
34
35class QSGGeometry;
36class QGeoMap;
37
38class Q_LOCATION_EXPORT QGeoMapItemGeometry
39{
40public:
41 static QList<QGeoCoordinate> path(const QGeoRectangle &rect)
42 {
43 QList<QGeoCoordinate> res;
44 res << rect.topLeft();
45 res << QGeoCoordinate(rect.topLeft().latitude(), rect.bottomRight().longitude());
46 res << rect.bottomRight();
47 res << QGeoCoordinate(rect.bottomRight().latitude(), rect.topLeft().longitude());
48 return res;
49 }
50
51 static QList<QGeoCoordinate> perimeter(const QGeoRectangle &rect)
52 {
53 QList<QGeoCoordinate> res = path(rect);
54 res.append(res.first());
55 return res;
56 }
57
58 static QList<QDoubleVector2D> pathMercator(const QList<QGeoCoordinate> &p)
59 {
60 QList<QDoubleVector2D> res;
61 for (const auto &c: p)
63 return res;
64 }
65
67 virtual ~QGeoMapItemGeometry();
68
69 inline bool isSourceDirty() const { return sourceDirty_; }
70 inline bool isScreenDirty() const { return screenDirty_; }
71 inline void markSourceDirty() { sourceDirty_ = true; screenDirty_ = true; }
72 inline void markScreenDirty() { screenDirty_ = true; clipToViewport_ = true; }
73 inline void markFullScreenDirty() { screenDirty_ = true; clipToViewport_ = false;}
74 inline void markClean() { screenDirty_ = (sourceDirty_ = false); clipToViewport_ = true;}
75 inline void clearScreen() { screenDirty_ = false; }
76
77 inline QGeoCoordinate geoLeftBound() { return geoLeftBound_; }
78
79 inline QRectF sourceBoundingBox() const { return sourceBounds_; }
80 inline QRectF screenBoundingBox() const { return screenBounds_; }
81 inline void clearBounds() { sourceBounds_ = screenBounds_ = QRectF(); firstPointOffset_ = QPointF(); }
82
83 inline QPointF firstPointOffset() const { return firstPointOffset_; }
84
85 inline const QGeoCoordinate &origin() const { return srcOrigin_; }
86
88 return screenOutline_;
89 }
90
91 virtual bool contains(const QPointF &screenPoint) const {
92 return screenOutline_.contains(screenPoint);
93 }
94
95 inline QVector2D vertex(quint32 index) const {
96 return QVector2D(screenVertices_[index]);
97 }
98
99 inline QList<QPointF> vertices() const { return screenVertices_; }
100 inline QList<quint32> indices() const { return screenIndices_; }
101
102 inline bool isIndexed() const { return (!screenIndices_.isEmpty()); }
103
104 /* Size is # of triangles */
105 inline quint32 size() const
106 {
107 if (isIndexed())
108 return screenIndices_.size() / 3;
109 else
110 return screenVertices_.size() / 3;
111 }
112
113 inline void clear() { firstPointOffset_ = QPointF(0,0);
114 screenVertices_.clear(); screenIndices_.clear(); }
115
116 mutable bool m_dataChanged = false;
117
118private:
119 Q_DISABLE_COPY(QGeoMapItemGeometry);
120
121protected:
122 bool sourceDirty_ = true;
123 bool screenDirty_ = true;
124 bool clipToViewport_ = true;
125 bool preserveGeometry_ = false;
127
129
131
134
136
137 QList<QPointF> screenVertices_;
138 QList<quint32> screenIndices_;
139};
140
142
143#endif // QGEOMAPITEMGEOMETRY_H
\inmodule QtPositioning
QVector2D vertex(quint32 index) const
QList< QPointF > vertices() const
QList< quint32 > indices() const
QPainterPath screenOutline() const
static QList< QDoubleVector2D > pathMercator(const QList< QGeoCoordinate > &p)
QList< QPointF > screenVertices_
static QList< QGeoCoordinate > perimeter(const QGeoRectangle &rect)
QPointF firstPointOffset() const
static QList< QGeoCoordinate > path(const QGeoRectangle &rect)
QRectF screenBoundingBox() const
QList< quint32 > screenIndices_
QRectF sourceBoundingBox() const
const QGeoCoordinate & origin() const
QGeoCoordinate geoLeftBound()
virtual bool contains(const QPointF &screenPoint) const
\inmodule QtPositioning
\inmodule QtGui
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qrect.h:484
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
static QDoubleVector2D coordToMercator(const QGeoCoordinate &coord)
rect
[4]
Combined button and popup list for selecting options.
GLuint index
[2]
GLuint res
const GLubyte * c
GLsizei const GLchar *const * path
GLfloat GLfloat p
[1]
unsigned int quint32
Definition qtypes.h:50