summaryrefslogtreecommitdiffstats
path: root/src/imports/location/qdeclarativepolygonmapitem.cpp
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2012-08-16 13:32:43 +1000
committerQt by Nokia <qt-info@nokia.com>2012-08-28 10:07:49 +0200
commit059388adce26be48868cd741b4c5d751298fb4d8 (patch)
tree1a8a41c0f280b7ab3c502b49527bd609d1c0884a /src/imports/location/qdeclarativepolygonmapitem.cpp
parent7dd46f8c96a4bdaca2809ff97b773f358392516f (diff)
Convert GeoShape, GeoRectangle and GeoCircle into QML value types.v5.0.0-beta1
This replaces the GeoShape, GeoRectangle and GeoCircle QML elements with value types. A value type is a better fit for shape types. It is very similar to a rect with some utility functions. Declare QGeoShape, QGeoRectangle and QGeoCircle as movable types. Update documentation. Change-Id: Id6c48e1e841c68f2f0c5c6a9c4a6580a57e2dfb6 Reviewed-by: abcd <amos.choy@nokia.com>
Diffstat (limited to 'src/imports/location/qdeclarativepolygonmapitem.cpp')
-rw-r--r--src/imports/location/qdeclarativepolygonmapitem.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp
index d2ff46d0..2dd0bfb2 100644
--- a/src/imports/location/qdeclarativepolygonmapitem.cpp
+++ b/src/imports/location/qdeclarativepolygonmapitem.cpp
@@ -406,22 +406,10 @@ void QDeclarativePolygonMapItem::setPath(const QJSValue &value)
QList<QGeoCoordinate> pathList;
quint32 length = value.property(QStringLiteral("length")).toUInt();
for (quint32 i = 0; i < length; ++i) {
- QJSValue v = value.property(i);
-
- QGeoCoordinate c;
-
- if (v.isObject()) {
- if (v.hasProperty(QStringLiteral("latitude")))
- c.setLatitude(v.property(QStringLiteral("latitude")).toNumber());
- if (v.hasProperty(QStringLiteral("longitude")))
- c.setLongitude(v.property(QStringLiteral("longitude")).toNumber());
- if (v.hasProperty(QStringLiteral("altitude")))
- c.setAltitude(v.property(QStringLiteral("altitude")).toNumber());
- } else if (v.isString()) {
- c = stringToCoordinate(v.toString()).value<QGeoCoordinate>();
- }
+ bool ok;
+ QGeoCoordinate c = parseCoordinate(value.property(i), &ok);
- if (!c.isValid()) {
+ if (!ok || !c.isValid()) {
qmlInfo(this) << "Unsupported path type";
return;
}