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
231
232QGeoCoordinate QGeoShape::center()
const
234 Q_D(
const QGeoShape);
239 return QGeoCoordinate();
243
244
245
246
247
250
251
252
253
254
257
258
259QGeoShape &QGeoShape::operator=(
const QGeoShape &other)
269
270
271
272
273QString QGeoShape::toString()
const
275 return QStringLiteral(
"QGeoShape(%1)").arg(type());
278#ifndef QT_NO_DEBUG_STREAM
279QDebug QGeoShape::debugStreaming(QDebug dbg,
const QGeoShape &shape)
281 QDebugStateSaver saver(dbg);
282 dbg.nospace() <<
"QGeoShape(";
283 switch (shape.type()) {
284 case QGeoShape::UnknownType:
287 case QGeoShape::RectangleType:
290 case QGeoShape::PathType:
293 case QGeoShape::PolygonType:
296 case QGeoShape::CircleType:
306#ifndef QT_NO_DATASTREAM
307QDataStream &QGeoShape::dataStreamOut(QDataStream &stream,
const QGeoShape &shape)
309 stream << quint32(shape.type());
310 switch (shape.type()) {
311 case QGeoShape::UnknownType:
313 case QGeoShape::RectangleType: {
314 QGeoRectangle r = shape;
315 stream << r.topLeft() << r.bottomRight();
318 case QGeoShape::CircleType: {
319 QGeoCircle c = shape;
320 stream << c.center() << c.radius();
323 case QGeoShape::PathType: {
326 stream << p.path().size();
327 for (
const auto &c: p.path())
331 case QGeoShape::PolygonType: {
332 QGeoPolygon p = shape;
333 stream << p.perimeter().size();
334 for (
const auto &c: p.perimeter())
343QDataStream &QGeoShape::dataStreamIn(QDataStream &stream, QGeoShape &shape)
349 case QGeoShape::UnknownType:
352 case QGeoShape::RectangleType: {
356 shape = QGeoRectangle(tl, br);
359 case QGeoShape::CircleType: {
363 shape = QGeoCircle(c, r);
366 case QGeoShape::PathType: {
367 QList<QGeoCoordinate> l;
373 for (qsizetype i = 0; i < sz; i++) {
377 shape = QGeoPath(l, width);
380 case QGeoShape::PolygonType: {
381 QList<QGeoCoordinate> l;
385 for (qsizetype i = 0; i < sz; i++) {
389 shape = QGeoPolygon(l);
399
400
401
402
403
407 return shape.d_ptr->hash(seed);
409 return qHashMulti(seed, shape.type());
414#include "moc_qgeoshape.cpp"
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept