Output cleanup for case when no alternative is found
This commit is contained in:
parent
cfec837278
commit
4a299fd4ff
@ -122,13 +122,13 @@ public:
|
|||||||
|
|
||||||
//give an array of alternative routes
|
//give an array of alternative routes
|
||||||
reply.content += "\"alternative_geometries\": [";
|
reply.content += "\"alternative_geometries\": [";
|
||||||
if(config.geometry) {
|
if(config.geometry && INT_MAX != rawRoute.lengthOfAlternativePath) {
|
||||||
//Generate the linestrings for each alternative
|
//Generate the linestrings for each alternative
|
||||||
alternateDescriptionFactory.AppendEncodedPolylineString(reply.content, config.encodeGeometry);
|
alternateDescriptionFactory.AppendEncodedPolylineString(reply.content, config.encodeGeometry);
|
||||||
}
|
}
|
||||||
reply.content += "],";
|
reply.content += "],";
|
||||||
reply.content += "\"alternative_instructions\":[";
|
reply.content += "\"alternative_instructions\":[";
|
||||||
if(config.instructions) {
|
if(config.instructions && INT_MAX != rawRoute.lengthOfAlternativePath) {
|
||||||
reply.content += "[";
|
reply.content += "[";
|
||||||
//Generate instructions for each alternative
|
//Generate instructions for each alternative
|
||||||
BuildTextualDescription(alternateDescriptionFactory, reply, rawRoute.lengthOfAlternativePath, sEngine);
|
BuildTextualDescription(alternateDescriptionFactory, reply, rawRoute.lengthOfAlternativePath, sEngine);
|
||||||
@ -136,16 +136,24 @@ public:
|
|||||||
}
|
}
|
||||||
reply.content += "],";
|
reply.content += "],";
|
||||||
reply.content += "\"alternative_summaries\":[";
|
reply.content += "\"alternative_summaries\":[";
|
||||||
//Generate route summary (length, duration) for each alternative
|
if(INT_MAX != rawRoute.lengthOfAlternativePath) {
|
||||||
alternateDescriptionFactory.BuildRouteSummary(alternateDescriptionFactory.entireLength, rawRoute.lengthOfAlternativePath - ( numberOfEnteredRestrictedAreas*TurnInstructions.AccessRestrictionPenalty));
|
//Generate route summary (length, duration) for each alternative
|
||||||
reply.content += "{";
|
alternateDescriptionFactory.BuildRouteSummary(alternateDescriptionFactory.entireLength, rawRoute.lengthOfAlternativePath - ( numberOfEnteredRestrictedAreas*TurnInstructions.AccessRestrictionPenalty));
|
||||||
reply.content += "\"total_distance\":";
|
reply.content += "{";
|
||||||
reply.content += alternateDescriptionFactory.summary.lengthString;
|
reply.content += "\"total_distance\":";
|
||||||
reply.content += ","
|
reply.content += alternateDescriptionFactory.summary.lengthString;
|
||||||
"\"total_time\":";
|
reply.content += ","
|
||||||
reply.content += alternateDescriptionFactory.summary.durationString;
|
"\"total_time\":";
|
||||||
reply.content += "}";
|
reply.content += alternateDescriptionFactory.summary.durationString;
|
||||||
|
reply.content += ","
|
||||||
|
"\"start_point\":\"";
|
||||||
|
reply.content += sEngine.GetEscapedNameForNameID(descriptionFactory.summary.startName);
|
||||||
|
reply.content += "\","
|
||||||
|
"\"end_point\":\"";
|
||||||
|
reply.content += sEngine.GetEscapedNameForNameID(descriptionFactory.summary.destName);
|
||||||
|
reply.content += "\"";
|
||||||
|
reply.content += "}";
|
||||||
|
}
|
||||||
reply.content += "],";
|
reply.content += "],";
|
||||||
|
|
||||||
//list all viapoints so that the client may display it
|
//list all viapoints so that the client may display it
|
||||||
|
Loading…
Reference in New Issue
Block a user