void RoutePresenter::showRoute(QTreeWidgetItem* top, const QGeoRoute& route) { QTreeWidgetItem* routeItem = new QTreeWidgetItem(top); routeItem->setText(0, "route"); QTreeWidgetItem* idItem = 0; if (!route.routeId().isEmpty()) { idItem = new QTreeWidgetItem(routeItem); idItem->setText(0, "id"); idItem->setText(1, route.routeId()); } QTreeWidgetItem* modeItem = new QTreeWidgetItem(routeItem); modeItem->setText(0, "mode"); showModes(modeItem, route.request(), route.travelMode()); QTreeWidgetItem* distanceItem = new QTreeWidgetItem(routeItem); distanceItem->setText(0, "distance"); distanceItem->setText(1, QString().setNum(route.distance())); showBoundingBox(routeItem, route.bounds()); QTreeWidgetItem* wayPointsItem = new QTreeWidgetItem(routeItem); QString overviewLabel = "overview"; if (route.path().count() > 100) overviewLabel += "(100)"; wayPointsItem->setText(0, overviewLabel); showPoints(wayPointsItem, route.path()); QList<QGeoRouteSegment> segments; QGeoRouteSegment segment = route.firstRouteSegment(); while (segment.isValid()) { segments << segment; segment = segment.nextRouteSegment(); } QTreeWidgetItem* segmentsItem = new QTreeWidgetItem(routeItem); QString segmentsLabel = "segments"; if (segments.length() > 100) segmentsLabel += "(100)"; segmentsItem->setText(0, segmentsLabel); segmentsItem->setText(1, QString().setNum(segments.length())); for (int i = 0; i < segments.length() && i < 100; ++i) { showRouteSegment(segmentsItem, segments[i]); } }
QString QGeoRoutingManagerEngineNokia::updateRouteRequestString(const QGeoRoute &route, const QGeoCoordinate &position) { if (!checkEngineSupport(route.request(), route.travelMode())) return ""; QString requestString = "http://"; requestString += m_host; requestString += "/routing/6.2/getroute.xml"; requestString += "?routeid="; requestString += route.routeId(); requestString += "&pos="; requestString += QString::number(position.latitude()); requestString += ","; requestString += QString::number(position.longitude()); requestString += modesRequestString(route.request(), route.travelMode()); requestString += routeRequestString(route.request()); return requestString; }