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
55
58
59
60
61
62
63
64
65
66
67
70
71
72
73
74
75
76
77
80
81
82
83
84
85
86
87
88
89
90
91
92
95
96
97
98
99
100
101
102
103
104
105inline QGeoShapePrivate *QGeoShape::d_func()
107 return static_cast<QGeoShapePrivate *>(d_ptr.data());
110inline const QGeoShapePrivate *QGeoShape::d_func()
const
112 return static_cast<
const QGeoShapePrivate *>(d_ptr.constData());
116
117
118QGeoShape::QGeoShape()
123
124
125QGeoShape::QGeoShape(
const QGeoShape &other)
131
132
133QGeoShape::QGeoShape(QGeoShapePrivate *d)
138bool QGeoShape::equals(
const QGeoShape &lhs,
const QGeoShape &rhs)
140 if (lhs.d_func() == rhs.d_func())
143 if (!lhs.d_func() || !rhs.d_func())
146 return *lhs.d_func() == *rhs.d_func();
150
151
152QGeoShape::~QGeoShape()
157
158
159QGeoShape::ShapeType QGeoShape::type()
const
161 Q_D(
const QGeoShape);
170
171
172
173bool QGeoShape::isValid()
const
175 Q_D(
const QGeoShape);
184
185
186
187
188bool QGeoShape::isEmpty()
const
190 Q_D(
const QGeoShape);
199
200
201bool QGeoShape::contains(
const QGeoCoordinate &coordinate)
const
203 Q_D(
const QGeoShape);
206 return d->contains(coordinate);
212
213
214
215
216
217QGeoRectangle QGeoShape::boundingGeoRectangle()
const
219 Q_D(
const QGeoShape);
222 return d->boundingGeoRectangle();
224 return QGeoRectangle();
228
229
230
233
234
235
236
237QGeoCoordinate QGeoShape::center()
const
239 Q_D(
const QGeoShape);
244 return QGeoCoordinate();
248
249
250
251
252
255
256
257
258
259
262
263
264QGeoShape &QGeoShape::operator=(
const QGeoShape &other)
274
275
276
277
278QString QGeoShape::toString()
const
280 return QStringLiteral(
"QGeoShape(%1)").arg(type());
283#ifndef QT_NO_DEBUG_STREAM
284QDebug QGeoShape::debugStreaming(QDebug dbg,
const QGeoShape &shape)
286 QDebugStateSaver saver(dbg);
287 dbg.nospace() <<
"QGeoShape(";
288 switch (shape.type()) {
289 case QGeoShape::UnknownType:
292 case QGeoShape::RectangleType:
295 case QGeoShape::PathType:
298 case QGeoShape::PolygonType:
301 case QGeoShape::CircleType:
311#ifndef QT_NO_DATASTREAM
312QDataStream &QGeoShape::dataStreamOut(QDataStream &stream,
const QGeoShape &shape)
314 stream << quint32(shape.type());
315 switch (shape.type()) {
316 case QGeoShape::UnknownType:
318 case QGeoShape::RectangleType: {
319 QGeoRectangle r = shape;
320 stream << r.topLeft() << r.bottomRight();
323 case QGeoShape::CircleType: {
324 QGeoCircle c = shape;
325 stream << c.center() << c.radius();
328 case QGeoShape::PathType: {
331 stream << p.path().size();
332 for (
const auto &c: p.path())
336 case QGeoShape::PolygonType: {
337 QGeoPolygon p = shape;
338 stream << p.perimeter().size();
339 for (
const auto &c: p.perimeter())
341 if (stream.version() >= QDataStream::Qt_6_10) {
343 const qsizetype holesCount = p.holesCount();
344 stream << holesCount;
345 for (qsizetype i = 0; i < holesCount; ++i)
346 stream << p.holePath(i);
355QDataStream &QGeoShape::dataStreamIn(QDataStream &stream, QGeoShape &shape)
361 case QGeoShape::UnknownType:
364 case QGeoShape::RectangleType: {
368 shape = QGeoRectangle(tl, br);
371 case QGeoShape::CircleType: {
375 shape = QGeoCircle(c, r);
378 case QGeoShape::PathType: {
379 QList<QGeoCoordinate> l;
385 for (qsizetype i = 0; i < sz; i++) {
389 shape = QGeoPath(l, width);
392 case QGeoShape::PolygonType: {
393 QList<QGeoCoordinate> l;
397 for (qsizetype i = 0; i < sz; i++) {
402 if (stream.version() >= QDataStream::Qt_6_10) {
404 qsizetype holesCount = 0;
405 stream >> holesCount;
406 for (qsizetype i = 0; i < holesCount; ++i) {
407 QList<QGeoCoordinate> holePath;
422
423
424
425
426
430 return shape.d_ptr->hash(seed);
432 return qHashMulti(seed, shape.type());
437#include "moc_qgeoshape.cpp"
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept