reorder code to make it a bit more readable

This commit is contained in:
Dennis Luxen 2013-12-27 12:38:08 +01:00
parent 07509ba5c9
commit c5f6065280

View File

@ -119,31 +119,32 @@ public:
"{\"status\":" "{\"status\":"
); );
if(raw_route.lengthOfShortestPath != INT_MAX) { if(INT_MAX == raw_route.lengthOfShortestPath) {
description_factory.SetStartSegment(phantom_nodes.startPhantom);
reply.content.push_back("0,"
"\"status_message\": \"Found route between points\",");
BOOST_ASSERT( raw_route.unpacked_path_segments.size() == raw_route.segmentEndCoordinates.size() );
for( unsigned i = 0; i < raw_route.unpacked_path_segments.size(); ++i ) {
const int added_segments = DescribeLeg(
raw_route.unpacked_path_segments[i],
raw_route.segmentEndCoordinates[i]
);
BOOST_ASSERT( 0 < added_segments );
shortest_leg_end_indices.push_back(
added_segments + shortest_leg_end_indices.back()
);
}
description_factory.SetEndSegment(phantom_nodes.targetPhantom);
description_factory.Run(facade, config.zoom_level);
} else {
//We do not need to do much, if there is no route ;-) //We do not need to do much, if there is no route ;-)
reply.content.push_back("207," reply.content.push_back(
"\"status_message\": \"Cannot find route between points\"}"); "207,\"status_message\": \"Cannot find route between points\"}"
);
return; return;
} }
description_factory.SetStartSegment(phantom_nodes.startPhantom);
reply.content.push_back("0,"
"\"status_message\": \"Found route between points\",");
BOOST_ASSERT( raw_route.unpacked_path_segments.size() == raw_route.segmentEndCoordinates.size() );
for( unsigned i = 0; i < raw_route.unpacked_path_segments.size(); ++i ) {
const int added_segments = DescribeLeg(
raw_route.unpacked_path_segments[i],
raw_route.segmentEndCoordinates[i]
);
BOOST_ASSERT( 0 < added_segments );
shortest_leg_end_indices.push_back(
added_segments + shortest_leg_end_indices.back()
);
}
description_factory.SetEndSegment(phantom_nodes.targetPhantom);
description_factory.Run(facade, config.zoom_level);
reply.content.push_back("\"route_geometry\": "); reply.content.push_back("\"route_geometry\": ");
if(config.geometry) { if(config.geometry) {
description_factory.AppendEncodedPolylineString( description_factory.AppendEncodedPolylineString(