summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/nokia/qgeoroutexmlparser.h
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2018-08-26 19:20:49 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2018-09-05 10:45:58 +0000
commit5a33ef5ef4b82714dc6b41eb8badc23be4a42fdf (patch)
treee1263c79a2277d8f739c9adcfa38be86c9495344 /src/plugins/geoservices/nokia/qgeoroutexmlparser.h
parent3bd2541f84be5200a54c7565074ea22992397c79 (diff)
downloadqtlocation-5a33ef5ef4b82714dc6b41eb8badc23be4a42fdf.tar.gz
Fix HERE qgeoroutexmlparser and add legs support
All route segments after the second waypoint contain broken paths. This patch fixes it refactoring the parsing logic, also adding support for route legs. Change-Id: I30ec9e889a5e16bf81c4a0caf1b59fc895b7ea5e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/geoservices/nokia/qgeoroutexmlparser.h')
-rw-r--r--src/plugins/geoservices/nokia/qgeoroutexmlparser.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/plugins/geoservices/nokia/qgeoroutexmlparser.h b/src/plugins/geoservices/nokia/qgeoroutexmlparser.h
index e2feb728..f31f8716 100644
--- a/src/plugins/geoservices/nokia/qgeoroutexmlparser.h
+++ b/src/plugins/geoservices/nokia/qgeoroutexmlparser.h
@@ -45,6 +45,7 @@
#include <QtLocation/QGeoRouteRequest>
#include <QtLocation/QGeoRouteSegment>
#include <QtLocation/QGeoManeuver>
+#include <QtLocation/qgeoroute.h>
QT_BEGIN_NAMESPACE
@@ -58,7 +59,11 @@ class QGeoManeuverContainer
public:
QGeoManeuver maneuver;
QString id;
- QString toId;
+ QString toLink; // Id of the link this maneuver brings into
+ int legIndex = 0;
+ int index = 0;
+ bool first = false;
+ bool last = false;
};
class QGeoRouteSegmentContainer
@@ -67,6 +72,11 @@ public:
QGeoRouteSegment segment;
QString id;
QString maneuverId;
+
+ bool operator ==(const QGeoRouteSegmentContainer &other) const
+ {
+ return ( segment == other.segment && id == other.id && maneuverId == other.maneuverId );
+ }
};
class QGeoDynamicSpeedInfoContainer
@@ -104,9 +114,9 @@ private:
bool parseMode(QGeoRoute *route);
bool parseSummary(QGeoRoute *route);
bool parseGeoPoints(const QString &strPoints, QList<QGeoCoordinate> *geoPoints, const QString &elementName);
- bool parseLeg();
- bool parseManeuver();
- bool parseLink();
+ bool parseLeg(int legIndex);
+ bool parseManeuver(QList<QGeoManeuverContainer> &maneuvers);
+ bool parseLink(QList<QGeoRouteSegmentContainer> &links);
bool postProcessRoute(QGeoRoute *route);
bool parseBoundingBox(QGeoRectangle &bounds);
@@ -117,8 +127,9 @@ private:
QXmlStreamReader *m_reader;
QList<QGeoRoute> m_results;
- QList<QGeoManeuverContainer> m_maneuvers;
- QList<QGeoRouteSegmentContainer> m_segments;
+ QList<QGeoRouteLeg> m_legs;
+ QList<QList<QGeoManeuverContainer>> m_maneuvers;
+ QList<QList<QGeoRouteSegmentContainer>> m_segments;
};
QT_END_NAMESPACE