summaryrefslogtreecommitdiff
path: root/src/positioning/qgeoshape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/positioning/qgeoshape.cpp')
-rw-r--r--src/positioning/qgeoshape.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/positioning/qgeoshape.cpp b/src/positioning/qgeoshape.cpp
index ad7b0c58..7acbc9fa 100644
--- a/src/positioning/qgeoshape.cpp
+++ b/src/positioning/qgeoshape.cpp
@@ -42,6 +42,7 @@
#include "qgeorectangle.h"
#include "qgeocircle.h"
#include "qgeopath.h"
+#include "qgeopolygon.h"
#ifndef QT_NO_DEBUG_STREAM
@@ -345,6 +346,9 @@ QDebug operator<<(QDebug dbg, const QGeoShape &shape)
case QGeoShape::PathType:
dbg << "Path";
break;
+ case QGeoShape::PolygonType:
+ dbg << "Polygon";
+ break;
case QGeoShape::CircleType:
dbg << "Circle";
}
@@ -379,6 +383,13 @@ QDataStream &operator<<(QDataStream &stream, const QGeoShape &shape)
stream << c;
break;
}
+ case QGeoShape::PolygonType: {
+ QGeoPolygon p = shape;
+ stream << p.path().size();
+ for (const auto &c: p.path())
+ stream << c;
+ break;
+ }
}
return stream;
@@ -419,6 +430,18 @@ QDataStream &operator>>(QDataStream &stream, QGeoShape &shape)
shape = QGeoPath(l);
break;
}
+ case QGeoShape::PolygonType: {
+ QList<QGeoCoordinate> l;
+ QGeoCoordinate c;
+ int sz;
+ stream >> sz;
+ for (int i = 0; i < sz; i++) {
+ stream >> c;
+ l.append(c);
+ }
+ shape = QGeoPolygon(l);
+ break;
+ }
}
return stream;