12#ifndef QT_NO_DEBUG_STREAM
13#include <QtCore/QDebug>
16#ifndef QT_NO_DATASTREAM
17#include <QtCore/QDataStream>
22QT_IMPL_METATYPE_EXTERN(QGeoShape)
24QGeoShapePrivate::QGeoShapePrivate(QGeoShape::ShapeType type)
29QGeoShapePrivate::~QGeoShapePrivate()
33bool QGeoShapePrivate::operator==(
const QGeoShapePrivate &other)
const
35 return type == other.type;
39
40
41
43
44
45
46
47
48
49
50
51
52
53
54
57
58
59
60
61
62
63
64
65
66
69
70
71
72
73
74
75
76
79
80
81
82
83
84
85
86
87
88
89
90
91
94
95
96
97
98
99
100
101
102
103
104inline QGeoShapePrivate *QGeoShape::d_func()
106 return static_cast<QGeoShapePrivate *>(d_ptr.data());
109inline const QGeoShapePrivate *QGeoShape::d_func()
const
111 return static_cast<
const QGeoShapePrivate *>(d_ptr.constData());
115
116
117QGeoShape::QGeoShape()
122
123
124QGeoShape::QGeoShape(
const QGeoShape &other)
130
131
132QGeoShape::QGeoShape(QGeoShapePrivate *d)
137bool QGeoShape::equals(
const QGeoShape &lhs,
const QGeoShape &rhs)
139 if (lhs.d_func() == rhs.d_func())
142 if (!lhs.d_func() || !rhs.d_func())
145 return *lhs.d_func() == *rhs.d_func();
149
150
151QGeoShape::~QGeoShape()
156
157
158QGeoShape::ShapeType QGeoShape::type()
const
160 Q_D(
const QGeoShape);
169
170
171
172bool QGeoShape::isValid()
const
174 Q_D(
const QGeoShape);
183
184
185
186
187bool QGeoShape::isEmpty()
const
189 Q_D(
const QGeoShape);
198
199
200bool QGeoShape::contains(
const QGeoCoordinate &coordinate)
const
202 Q_D(
const QGeoShape);
205 return d->contains(coordinate);
211
212
213
214
215
216QGeoRectangle QGeoShape::boundingGeoRectangle()
const
218 Q_D(
const QGeoShape);
221 return d->boundingGeoRectangle();
223 return QGeoRectangle();
227
228
229
232
233
234
235
236QGeoCoordinate QGeoShape::center()
const
238 Q_D(
const QGeoShape);
243 return QGeoCoordinate();
247
248
249
250
251
254
255
256
257
258
261
262
263QGeoShape &QGeoShape::operator=(
const QGeoShape &other)
273
274
275
276
277QString QGeoShape::toString()
const
279 return QStringLiteral(
"QGeoShape(%1)").arg(type());
282#ifndef QT_NO_DEBUG_STREAM
283QDebug QGeoShape::debugStreaming(QDebug dbg,
const QGeoShape &shape)
285 QDebugStateSaver saver(dbg);
286 dbg.nospace() <<
"QGeoShape(";
287 switch (shape.type()) {
288 case QGeoShape::UnknownType:
291 case QGeoShape::RectangleType:
294 case QGeoShape::PathType:
297 case QGeoShape::PolygonType:
300 case QGeoShape::CircleType:
310#ifndef QT_NO_DATASTREAM
311QDataStream &QGeoShape::dataStreamOut(QDataStream &stream,
const QGeoShape &shape)
313 stream << quint32(shape.type());
314 switch (shape.type()) {
315 case QGeoShape::UnknownType:
317 case QGeoShape::RectangleType: {
318 QGeoRectangle r = shape;
319 stream << r.topLeft() << r.bottomRight();
322 case QGeoShape::CircleType: {
323 QGeoCircle c = shape;
324 stream << c.center() << c.radius();
327 case QGeoShape::PathType: {
330 stream << p.path().size();
331 for (
const auto &c: p.path())
335 case QGeoShape::PolygonType: {
336 QGeoPolygon p = shape;
337 stream << p.perimeter().size();
338 for (
const auto &c: p.perimeter())
340 if (stream.version() >= QDataStream::Qt_6_10) {
342 const qsizetype holesCount = p.holesCount();
343 stream << holesCount;
344 for (qsizetype i = 0; i < holesCount; ++i)
345 stream << p.holePath(i);
354QDataStream &QGeoShape::dataStreamIn(QDataStream &stream, QGeoShape &shape)
360 case QGeoShape::UnknownType:
363 case QGeoShape::RectangleType: {
367 shape = QGeoRectangle(tl, br);
370 case QGeoShape::CircleType: {
374 shape = QGeoCircle(c, r);
377 case QGeoShape::PathType: {
378 QList<QGeoCoordinate> l;
384 for (qsizetype i = 0; i < sz; i++) {
388 shape = QGeoPath(l, width);
391 case QGeoShape::PolygonType: {
392 QList<QGeoCoordinate> l;
396 for (qsizetype i = 0; i < sz; i++) {
401 if (stream.version() >= QDataStream::Qt_6_10) {
403 qsizetype holesCount = 0;
404 stream >> holesCount;
405 for (qsizetype i = 0; i < holesCount; ++i) {
406 QList<QGeoCoordinate> holePath;
421
422
423
424
425
429 return shape.d_ptr->hash(seed);
431 return qHashMulti(seed, shape.type());
436#include "moc_qgeoshape.cpp"
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept