From 4eb379a912ce2f949892e53a5c8afcc96d2b1f6e Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Tue, 15 May 2012 16:42:31 +0200 Subject: [PATCH] Print all end/via/start points --- Descriptors/JSONDescriptor.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Descriptors/JSONDescriptor.h b/Descriptors/JSONDescriptor.h index a0e2f5f9c..766d9620c 100644 --- a/Descriptors/JSONDescriptor.h +++ b/Descriptors/JSONDescriptor.h @@ -185,18 +185,23 @@ public: reply.content += "\"via_points\":["; std::string tmp; if(true == config.geometry) { - for(unsigned segmentIdx = 1; segmentIdx < rawRoute.segmentEndCoordinates.size(); ++segmentIdx) { - if(segmentIdx > 1) - reply.content += ","; + for(unsigned i = 0; i < rawRoute.segmentEndCoordinates.size(); ++i) { reply.content += "["; - if(rawRoute.segmentEndCoordinates[segmentIdx].startPhantom.location.isSet()) - convertInternalReversedCoordinateToString(rawRoute.segmentEndCoordinates[segmentIdx].startPhantom.location, tmp); + if(rawRoute.segmentEndCoordinates[i].startPhantom.location.isSet()) + convertInternalReversedCoordinateToString(rawRoute.segmentEndCoordinates[i].startPhantom.location, tmp); else - convertInternalReversedCoordinateToString(rawRoute.rawViaNodeCoordinates[segmentIdx], tmp); + convertInternalReversedCoordinateToString(rawRoute.rawViaNodeCoordinates[i], tmp); reply.content += tmp; - reply.content += "]"; + reply.content += "],"; } + reply.content += "["; + if(rawRoute.segmentEndCoordinates.back().startPhantom.location.isSet()) + convertInternalReversedCoordinateToString(rawRoute.segmentEndCoordinates.back().targetPhantom.location, tmp); + else + convertInternalReversedCoordinateToString(rawRoute.rawViaNodeCoordinates.back(), tmp); + reply.content += tmp; + reply.content += "]"; } reply.content += "],"; reply.content += "\"hint_data\": {"; @@ -205,14 +210,13 @@ public: reply.content += tmp; reply.content += ", \"locations\": ["; + std::string hint; for(unsigned i = 0; i < rawRoute.segmentEndCoordinates.size(); ++i) { - std::string hint; reply.content += "\""; EncodeObjectToBase64(rawRoute.segmentEndCoordinates[i].startPhantom, hint); reply.content += hint; reply.content += "\", "; } - std::string hint; EncodeObjectToBase64(rawRoute.segmentEndCoordinates.back().targetPhantom, hint); reply.content += "\""; reply.content += hint;