checksum is transmitted to the client.

This commit is contained in:
DennisOSRM 2012-02-17 08:34:52 +01:00
parent e034733ac6
commit 1744e69214
3 changed files with 11 additions and 5 deletions

View File

@ -151,8 +151,8 @@ public:
reply.content += "],"; reply.content += "],";
//list all viapoints so that the client may display it //list all viapoints so that the client may display it
reply.content += "\"via_points\":["; reply.content += "\"via_points\":[";
std::string tmp;
if(true == config.geometry) { if(true == config.geometry) {
std::string tmp;
for(unsigned segmentIdx = 1; segmentIdx < rawRoute.segmentEndCoordinates.size(); ++segmentIdx) { for(unsigned segmentIdx = 1; segmentIdx < rawRoute.segmentEndCoordinates.size(); ++segmentIdx) {
if(segmentIdx > 1) if(segmentIdx > 1)
reply.content += ","; reply.content += ",";
@ -166,8 +166,13 @@ public:
reply.content += "]"; reply.content += "]";
} }
} }
reply.content += "]," reply.content += "],";
"\"transactionId\": \"OSRM Routing Engine JSON Descriptor (v0.3)\""; reply.content += "\"route_data\": {";
reply.content += "\"checksum\":";
intToString(rawRoute.checkSum, tmp);
reply.content += tmp;
reply.content += "},";
reply.content += "\"transactionId\": \"OSRM Routing Engine JSON Descriptor (v0.3)\"";
reply.content += "}"; reply.content += "}";
} }

View File

@ -25,6 +25,7 @@ struct RawRouteData {
std::vector< _PathData > computedRouted; std::vector< _PathData > computedRouted;
std::vector< PhantomNodes > segmentEndCoordinates; std::vector< PhantomNodes > segmentEndCoordinates;
std::vector< _Coordinate > rawViaNodeCoordinates; std::vector< _Coordinate > rawViaNodeCoordinates;
unsigned checkSum;
}; };
#endif /* RAWROUTEDATA_H_ */ #endif /* RAWROUTEDATA_H_ */

View File

@ -94,7 +94,7 @@ public:
_Coordinate startCoord(lat1, lon1); _Coordinate startCoord(lat1, lon1);
_Coordinate targetCoord(lat2, lon2); _Coordinate targetCoord(lat2, lon2);
RawRouteData rawRoute; RawRouteData rawRoute;
rawRoute.checkSum = nodeHelpDesk->GetCheckSum();
if(false == checkCoord(startCoord) || false == checkCoord(targetCoord)) { if(false == checkCoord(startCoord) || false == checkCoord(targetCoord)) {
reply = http::Reply::stockReply(http::Reply::badRequest); reply = http::Reply::stockReply(http::Reply::badRequest);
return; return;
@ -152,7 +152,7 @@ public:
std::string JSONParameter = routeParameters.options.Find("jsonp"); std::string JSONParameter = routeParameters.options.Find("jsonp");
if("" != JSONParameter) { if("" != JSONParameter) {
reply.content += JSONParameter; reply.content += JSONParameter;
reply.content += "(\n"; reply.content += "(";
} }
_DescriptorConfig descriptorConfig; _DescriptorConfig descriptorConfig;