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
qgeotilespec.cpp
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#include "qgeotilespec_p.h"
5#include "qgeotilespec_p_p.h"
6
7#include <QtCore/QDebug>
8
10
12
17
18QGeoTileSpec::QGeoTileSpec(const QString &plugin, int mapId, int zoom, int x, int y, int version)
19 : d(new QGeoTileSpecPrivate(plugin, mapId, zoom, x, y, version))
20{
21}
22
23QGeoTileSpec::QGeoTileSpec(const QGeoTileSpec &other) noexcept = default;
24
26
28{
29 if (this == &other)
30 return *this;
31
32 d = other.d;
33 return *this;
34}
35
37{
38 return d->plugin_;
39}
40
42{
43 d->zoom_ = zoom;
44}
45
47{
48 return d->zoom_;
49}
50
52{
53 d->x_ = x;
54}
55
56int QGeoTileSpec::x() const
57{
58 return d->x_;
59}
60
62{
63 d->y_ = y;
64}
65
66int QGeoTileSpec::y() const
67{
68 return d->y_;
69}
70
72{
73 d->mapId_ = mapId;
74}
75
77{
78 return d->mapId_;
79}
80
81void QGeoTileSpec::setVersion(int version)
82{
83 d->version_ = version;
84}
85
87{
88 return d->version_;
89}
90
91bool QGeoTileSpec::isEqual(const QGeoTileSpec &rhs) const noexcept
92{
93 return (*(d.constData()) == *(rhs.d.constData()));
94}
95
96bool QGeoTileSpec::isLess(const QGeoTileSpec &rhs) const noexcept
97{
98 return (*(d.constData()) < *(rhs.d.constData()));
99}
100
101unsigned int qHash(const QGeoTileSpec &spec)
102{
103 unsigned int result = (qHash(spec.plugin()) * 13) % 31;
104 result += ((spec.mapId() * 17) % 31) << 5;
105 result += ((spec.zoom() * 19) % 31) << 10;
106 result += ((spec.x() * 23) % 31) << 15;
107 result += ((spec.y() * 29) % 31) << 20;
108 result += (spec.version() % 3) << 25;
109 return result;
110}
111
113{
114 dbg << spec.plugin() << spec.mapId() << spec.zoom() << spec.x() << spec.y() << spec.version();
115 return dbg;
116}
117
119{
120 if (plugin_ < rhs.plugin_)
121 return true;
122 if (plugin_ > rhs.plugin_)
123 return false;
124
125 if (mapId_ < rhs.mapId_)
126 return true;
127 if (mapId_ > rhs.mapId_)
128 return false;
129
130 if (zoom_ < rhs.zoom_)
131 return true;
132 if (zoom_ > rhs.zoom_)
133 return false;
134
135 if (x_ < rhs.x_)
136 return true;
137 if (x_ > rhs.x_)
138 return false;
139
140 if (y_ < rhs.y_)
141 return true;
142 if (y_ > rhs.y_)
143 return false;
144
145 return (version_ < rhs.version_);
146}
147
\inmodule QtCore
bool operator<(const QGeoTileSpecPrivate &rhs) const
int x() const
int version() const
int zoom() const
void setZoom(int zoom)
int mapId() const
void setMapId(int mapId)
void setY(int y)
QString plugin() const
int y() const
QGeoTileSpec & operator=(const QGeoTileSpec &other) noexcept
void setVersion(int version)
void setX(int x)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
unsigned int qHash(const QGeoTileSpec &spec)
QDebug operator<<(QDebug dbg, const QGeoTileSpec &spec)
GLint GLint GLint GLint GLint x
[0]
GLint y
GLuint64EXT * result
[6]
#define QT_DEFINE_QSDP_SPECIALIZATION_DTOR(Class)
QSharedPointer< T > other(t)
[5]