Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
// Qt-Security score:significant reason:default
4
5
#
ifndef
QGEOMAPITEMGEOMETRY_H
6
#
define
QGEOMAPITEMGEOMETRY_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
<
QtLocation
/
private
/
qlocationglobal_p
.
h
>
20
#
include
<
QtLocation
/
private
/
qdeclarativegeomapitembase_p
.
h
>
21
#
include
<
QtLocation
/
private
/
qdeclarativegeomapitemutils_p
.
h
>
22
#
include
<
QtPositioning
/
private
/
qdoublevector2d_p
.
h
>
23
#
include
<
QtPositioning
/
private
/
qwebmercator_p
.
h
>
24
25
#
include
<
QPainterPath
>
26
#
include
<
QPointF
>
27
#
include
<
QRectF
>
28
#
include
<
QList
>
29
#
include
<
QGeoCoordinate
>
30
#
include
<
QGeoRectangle
>
31
#
include
<
QVector2D
>
32
#
include
<
QList
>
33
34
QT_BEGIN_NAMESPACE
35
36
class
QSGGeometry;
37
class
QGeoMap;
38
39
class
Q_LOCATION_EXPORT
QGeoMapItemGeometry
40
{
41
public
:
42
static
QList<QGeoCoordinate> path(
const
QGeoRectangle &rect)
43
{
44
QList<QGeoCoordinate> res;
45
res << rect.topLeft();
46
res << QGeoCoordinate(rect.topLeft().latitude(), rect.bottomRight().longitude());
47
res << rect.bottomRight();
48
res << QGeoCoordinate(rect.bottomRight().latitude(), rect.topLeft().longitude());
49
return
res;
50
}
51
52
static
QList<QGeoCoordinate> perimeter(
const
QGeoRectangle &rect)
53
{
54
QList<QGeoCoordinate> res = path(rect);
55
res.append(res.first());
56
return
res;
57
}
58
59
static
QList<QDoubleVector2D> pathMercator(
const
QList<QGeoCoordinate> &p)
60
{
61
QList<QDoubleVector2D> res;
62
for
(
const
auto
&c: p)
63
res << QWebMercator::coordToMercator(c);
64
return
res;
65
}
66
67
QGeoMapItemGeometry();
68
virtual
~QGeoMapItemGeometry();
69
70
inline
bool
isSourceDirty()
const
{
return
sourceDirty_; }
71
inline
bool
isScreenDirty()
const
{
return
screenDirty_; }
72
inline
void
markSourceDirty() { sourceDirty_ =
true
; screenDirty_ =
true
; }
73
inline
void
markScreenDirty() { screenDirty_ =
true
; clipToViewport_ =
true
; }
74
inline
void
markFullScreenDirty() { screenDirty_ =
true
; clipToViewport_ =
false
;}
75
inline
void
markClean() { screenDirty_ = (sourceDirty_ =
false
); clipToViewport_ =
true
;}
76
inline
void
clearScreen() { screenDirty_ =
false
; }
77
78
inline
QGeoCoordinate geoLeftBound() {
return
geoLeftBound_; }
79
80
inline
QRectF sourceBoundingBox()
const
{
return
sourceBounds_; }
81
inline
QRectF screenBoundingBox()
const
{
return
screenBounds_; }
82
inline
void
clearBounds() { sourceBounds_ = screenBounds_ = QRectF(); firstPointOffset_ = QPointF(); }
83
84
inline
QPointF firstPointOffset()
const
{
return
firstPointOffset_; }
85
86
inline
const
QGeoCoordinate &origin()
const
{
return
srcOrigin_; }
87
88
QPainterPath screenOutline()
const
{
89
return
screenOutline_;
90
}
91
92
virtual
bool
contains(
const
QPointF &screenPoint)
const
{
93
return
screenOutline_.contains(screenPoint);
94
}
95
96
inline
QVector2D vertex(quint32 index)
const
{
97
return
QVector2D(screenVertices_[index]);
98
}
99
100
inline
QList<QPointF> vertices()
const
{
return
screenVertices_; }
101
inline
QList<quint32> indices()
const
{
return
screenIndices_; }
102
103
inline
bool
isIndexed()
const
{
return
(!screenIndices_.isEmpty()); }
104
105
/* Size is # of triangles */
106
inline
quint32 size()
const
107
{
108
if
(isIndexed())
109
return
screenIndices_.size() / 3;
110
else
111
return
screenVertices_.size() / 3;
112
}
113
114
inline
void
clear() { firstPointOffset_ = QPointF(0,0);
115
screenVertices_.clear(); screenIndices_.clear(); }
116
117
mutable
bool
m_dataChanged =
false
;
118
119
private
:
120
Q_DISABLE_COPY(QGeoMapItemGeometry);
121
122
protected
:
123
bool
sourceDirty_ =
true
;
124
bool
screenDirty_ =
true
;
125
bool
clipToViewport_ =
true
;
126
bool
preserveGeometry_ =
false
;
127
QGeoCoordinate geoLeftBound_;
128
129
QPointF firstPointOffset_;
130
131
QPainterPath screenOutline_;
132
133
QRectF sourceBounds_;
134
QRectF screenBounds_;
135
136
QGeoCoordinate srcOrigin_;
137
138
QList<QPointF> screenVertices_;
139
QList<quint32> screenIndices_;
140
};
141
142
QT_END_NAMESPACE
143
144
#
endif
// QGEOMAPITEMGEOMETRY_H
QGeoMapItemGeometry
Definition
qgeomapitemgeometry_p.h:40
qtlocation
src
location
quickmapitems
qgeomapitemgeometry_p.h
Generated on
for Qt by
1.18.0