initial refactoring of variable names

This commit is contained in:
Dennis Luxen 2013-09-19 19:07:18 +02:00
parent 9452c7e0c7
commit 242b68c488

View File

@ -45,29 +45,29 @@ template<class DataFacadeT>
class JSONDescriptor : public BaseDescriptor<DataFacadeT> { class JSONDescriptor : public BaseDescriptor<DataFacadeT> {
private: private:
_DescriptorConfig config; _DescriptorConfig config;
DescriptionFactory descriptionFactory; DescriptionFactory description_factory;
DescriptionFactory alternateDescriptionFactory; DescriptionFactory alternateDescriptionFactory;
FixedPointCoordinate current; FixedPointCoordinate current;
unsigned numberOfEnteredRestrictedAreas; unsigned entered_restricted_area_count;
struct RoundAbout{ struct RoundAbout{
RoundAbout() : RoundAbout() :
startIndex(INT_MAX), start_index(INT_MAX),
nameID(INT_MAX), name_id(INT_MAX),
leaveAtExit(INT_MAX) leave_at_exit(INT_MAX)
{} {}
int startIndex; int start_index;
int nameID; int name_id;
int leaveAtExit; int leave_at_exit;
} roundAbout; } roundAbout;
struct Segment { struct Segment {
Segment() : nameID(-1), length(-1), position(-1) {} Segment() : name_id(-1), length(-1), position(-1) {}
Segment(int n, int l, int p) : nameID(n), length(l), position(p) {} Segment(int n, int l, int p) : name_id(n), length(l), position(p) {}
int nameID; int name_id;
int length; int length;
int position; int position;
}; };
std::vector<Segment> shortestSegments, alternativeSegments; std::vector<Segment> shortest_path_segments, alternative_path_segments;
struct RouteNames { struct RouteNames {
std::string shortestPathName1; std::string shortestPathName1;
@ -77,120 +77,137 @@ private:
}; };
public: public:
JSONDescriptor() : numberOfEnteredRestrictedAreas(0) {} JSONDescriptor() : entered_restricted_area_count(0) {}
void SetConfig(const _DescriptorConfig & c) { config = c; } void SetConfig(const _DescriptorConfig & c) { config = c; }
//TODO: reorder
void Run( void Run(
http::Reply & reply, http::Reply & reply,
const RawRouteData &rawRoute, const RawRouteData & raw_route_information,
PhantomNodes &phantomNodes, PhantomNodes & phantom_nodes,
const DataFacadeT * facade const DataFacadeT * facade
) { ) {
WriteHeaderToOutput(reply.content); WriteHeaderToOutput(reply.content);
if(rawRoute.lengthOfShortestPath != INT_MAX) { if(raw_route_information.lengthOfShortestPath != INT_MAX) {
descriptionFactory.SetStartSegment(phantomNodes.startPhantom); description_factory.SetStartSegment(phantom_nodes.startPhantom);
reply.content += "0," reply.content += "0,"
"\"status_message\": \"Found route between points\","; "\"status_message\": \"Found route between points\",";
//Get all the coordinates for the computed route //Get all the coordinates for the computed route
BOOST_FOREACH(const _PathData & pathData, rawRoute.computedShortestPath) { BOOST_FOREACH(const _PathData & path_data, raw_route_information.computedShortestPath) {
current = facade->GetCoordinateOfNode(pathData.node); current = facade->GetCoordinateOfNode(path_data.node);
descriptionFactory.AppendSegment(current, pathData ); description_factory.AppendSegment(current, path_data );
} }
descriptionFactory.SetEndSegment(phantomNodes.targetPhantom); description_factory.SetEndSegment(phantom_nodes.targetPhantom);
} else { } 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 += "207," reply.content += "207,"
"\"status_message\": \"Cannot find route between points\","; "\"status_message\": \"Cannot find route between points\",";
} }
descriptionFactory.Run(facade, config.z); description_factory.Run(facade, config.z);
reply.content += "\"route_geometry\": "; reply.content += "\"route_geometry\": ";
if(config.geometry) { if(config.geometry) {
descriptionFactory.AppendEncodedPolylineString(reply.content, config.encodeGeometry); description_factory.AppendEncodedPolylineString(reply.content, config.encodeGeometry);
} else { } else {
reply.content += "[]"; reply.content += "[]";
} }
reply.content += "," reply.content += ","
"\"route_instructions\": ["; "\"route_instructions\": [";
numberOfEnteredRestrictedAreas = 0; entered_restricted_area_count = 0;
if(config.instructions) { if(config.instructions) {
BuildTextualDescription(descriptionFactory, reply, rawRoute.lengthOfShortestPath, facade, shortestSegments); BuildTextualDescription(
description_factory,
reply,
raw_route_information.lengthOfShortestPath,
facade,
shortest_path_segments
);
} else { } else {
BOOST_FOREACH(const SegmentInformation & segment, descriptionFactory.pathDescription) { BOOST_FOREACH(
TurnInstruction currentInstruction = segment.turnInstruction & TurnInstructions.InverseAccessRestrictionFlag; const SegmentInformation & segment,
numberOfEnteredRestrictedAreas += (currentInstruction != segment.turnInstruction); description_factory.pathDescription
) {
TurnInstruction current_instruction = segment.turnInstruction & TurnInstructions.InverseAccessRestrictionFlag;
entered_restricted_area_count += (current_instruction != segment.turnInstruction);
} }
} }
reply.content += "],"; reply.content += "],";
descriptionFactory.BuildRouteSummary(descriptionFactory.entireLength, rawRoute.lengthOfShortestPath - ( numberOfEnteredRestrictedAreas*TurnInstructions.AccessRestrictionPenalty)); description_factory.BuildRouteSummary(
description_factory.entireLength,
raw_route_information.lengthOfShortestPath - ( entered_restricted_area_count*TurnInstructions.AccessRestrictionPenalty)
);
reply.content += "\"route_summary\":"; reply.content += "\"route_summary\":";
reply.content += "{"; reply.content += "{";
reply.content += "\"total_distance\":"; reply.content += "\"total_distance\":";
reply.content += descriptionFactory.summary.lengthString; reply.content += description_factory.summary.lengthString;
reply.content += "," reply.content += ","
"\"total_time\":"; "\"total_time\":";
reply.content += descriptionFactory.summary.durationString; reply.content += description_factory.summary.durationString;
reply.content += "," reply.content += ","
"\"start_point\":\""; "\"start_point\":\"";
reply.content += facade->GetEscapedNameForNameID(descriptionFactory.summary.startName); reply.content += facade->GetEscapedNameForNameID(
description_factory.summary.startName
);
reply.content += "\"," reply.content += "\","
"\"end_point\":\""; "\"end_point\":\"";
reply.content += facade->GetEscapedNameForNameID(descriptionFactory.summary.destName); reply.content += facade->GetEscapedNameForNameID(
description_factory.summary.destName
);
reply.content += "\""; reply.content += "\"";
reply.content += "}"; reply.content += "}";
reply.content +=","; reply.content +=",";
//only one alternative route is computed at this time, so this is hardcoded //only one alternative route is computed at this time, so this is hardcoded
if(rawRoute.lengthOfAlternativePath != INT_MAX) { if(raw_route_information.lengthOfAlternativePath != INT_MAX) {
alternateDescriptionFactory.SetStartSegment(phantomNodes.startPhantom); alternateDescriptionFactory.SetStartSegment(phantom_nodes.startPhantom);
//Get all the coordinates for the computed route //Get all the coordinates for the computed route
BOOST_FOREACH(const _PathData & pathData, rawRoute.computedAlternativePath) { BOOST_FOREACH(const _PathData & path_data, raw_route_information.computedAlternativePath) {
current = facade->GetCoordinateOfNode(pathData.node); current = facade->GetCoordinateOfNode(path_data.node);
alternateDescriptionFactory.AppendSegment(current, pathData ); alternateDescriptionFactory.AppendSegment(current, path_data );
} }
alternateDescriptionFactory.SetEndSegment(phantomNodes.targetPhantom); alternateDescriptionFactory.SetEndSegment(phantom_nodes.targetPhantom);
} }
alternateDescriptionFactory.Run(facade, config.z); alternateDescriptionFactory.Run(facade, config.z);
//give an array of alternative routes //give an array of alternative routes
reply.content += "\"alternative_geometries\": ["; reply.content += "\"alternative_geometries\": [";
if(config.geometry && INT_MAX != rawRoute.lengthOfAlternativePath) { if(config.geometry && INT_MAX != raw_route_information.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\":[";
numberOfEnteredRestrictedAreas = 0; entered_restricted_area_count = 0;
if(INT_MAX != rawRoute.lengthOfAlternativePath) { if(INT_MAX != raw_route_information.lengthOfAlternativePath) {
reply.content += "["; reply.content += "[";
//Generate instructions for each alternative //Generate instructions for each alternative
if(config.instructions) { if(config.instructions) {
BuildTextualDescription( BuildTextualDescription(
alternateDescriptionFactory, alternateDescriptionFactory,
reply, reply,
rawRoute.lengthOfAlternativePath, raw_route_information.lengthOfAlternativePath,
facade, facade,
alternativeSegments alternative_path_segments
); );
} else { } else {
BOOST_FOREACH(const SegmentInformation & segment, alternateDescriptionFactory.pathDescription) { BOOST_FOREACH(const SegmentInformation & segment, alternateDescriptionFactory.pathDescription) {
TurnInstruction currentInstruction = segment.turnInstruction & TurnInstructions.InverseAccessRestrictionFlag; TurnInstruction current_instruction = segment.turnInstruction & TurnInstructions.InverseAccessRestrictionFlag;
numberOfEnteredRestrictedAreas += (currentInstruction != segment.turnInstruction); entered_restricted_area_count += (current_instruction != segment.turnInstruction);
} }
} }
reply.content += "]"; reply.content += "]";
} }
reply.content += "],"; reply.content += "],";
reply.content += "\"alternative_summaries\":["; reply.content += "\"alternative_summaries\":[";
if(INT_MAX != rawRoute.lengthOfAlternativePath) { if(INT_MAX != raw_route_information.lengthOfAlternativePath) {
//Generate route summary (length, duration) for each alternative //Generate route summary (length, duration) for each alternative
alternateDescriptionFactory.BuildRouteSummary(alternateDescriptionFactory.entireLength, rawRoute.lengthOfAlternativePath - ( numberOfEnteredRestrictedAreas*TurnInstructions.AccessRestrictionPenalty)); alternateDescriptionFactory.BuildRouteSummary(alternateDescriptionFactory.entireLength, raw_route_information.lengthOfAlternativePath - ( entered_restricted_area_count*TurnInstructions.AccessRestrictionPenalty));
reply.content += "{"; reply.content += "{";
reply.content += "\"total_distance\":"; reply.content += "\"total_distance\":";
reply.content += alternateDescriptionFactory.summary.lengthString; reply.content += alternateDescriptionFactory.summary.lengthString;
@ -199,10 +216,10 @@ public:
reply.content += alternateDescriptionFactory.summary.durationString; reply.content += alternateDescriptionFactory.summary.durationString;
reply.content += "," reply.content += ","
"\"start_point\":\""; "\"start_point\":\"";
reply.content += facade->GetEscapedNameForNameID(descriptionFactory.summary.startName); reply.content += facade->GetEscapedNameForNameID(description_factory.summary.startName);
reply.content += "\"," reply.content += "\","
"\"end_point\":\""; "\"end_point\":\"";
reply.content += facade->GetEscapedNameForNameID(descriptionFactory.summary.destName); reply.content += facade->GetEscapedNameForNameID(description_factory.summary.destName);
reply.content += "\""; reply.content += "\"";
reply.content += "}"; reply.content += "}";
} }
@ -210,7 +227,7 @@ public:
//Get Names for both routes //Get Names for both routes
RouteNames routeNames; RouteNames routeNames;
GetRouteNames(shortestSegments, alternativeSegments, facade, routeNames); GetRouteNames(shortest_path_segments, alternative_path_segments, facade, routeNames);
reply.content += "\"route_name\":[\""; reply.content += "\"route_name\":[\"";
reply.content += routeNames.shortestPathName1; reply.content += routeNames.shortestPathName1;
@ -227,40 +244,40 @@ public:
//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; std::string tmp;
if(config.geometry && INT_MAX != rawRoute.lengthOfShortestPath) { if(config.geometry && INT_MAX != raw_route_information.lengthOfShortestPath) {
for(unsigned i = 0; i < rawRoute.segmentEndCoordinates.size(); ++i) { for(unsigned i = 0; i < raw_route_information.segmentEndCoordinates.size(); ++i) {
reply.content += "["; reply.content += "[";
if(rawRoute.segmentEndCoordinates[i].startPhantom.location.isSet()) if(raw_route_information.segmentEndCoordinates[i].startPhantom.location.isSet())
convertInternalReversedCoordinateToString(rawRoute.segmentEndCoordinates[i].startPhantom.location, tmp); convertInternalReversedCoordinateToString(raw_route_information.segmentEndCoordinates[i].startPhantom.location, tmp);
else else
convertInternalReversedCoordinateToString(rawRoute.rawViaNodeCoordinates[i], tmp); convertInternalReversedCoordinateToString(raw_route_information.rawViaNodeCoordinates[i], tmp);
reply.content += tmp; reply.content += tmp;
reply.content += "],"; reply.content += "],";
} }
reply.content += "["; reply.content += "[";
if(rawRoute.segmentEndCoordinates.back().startPhantom.location.isSet()) if(raw_route_information.segmentEndCoordinates.back().startPhantom.location.isSet())
convertInternalReversedCoordinateToString(rawRoute.segmentEndCoordinates.back().targetPhantom.location, tmp); convertInternalReversedCoordinateToString(raw_route_information.segmentEndCoordinates.back().targetPhantom.location, tmp);
else else
convertInternalReversedCoordinateToString(rawRoute.rawViaNodeCoordinates.back(), tmp); convertInternalReversedCoordinateToString(raw_route_information.rawViaNodeCoordinates.back(), tmp);
reply.content += tmp; reply.content += tmp;
reply.content += "]"; reply.content += "]";
} }
reply.content += "],"; reply.content += "],";
reply.content += "\"hint_data\": {"; reply.content += "\"hint_data\": {";
reply.content += "\"checksum\":"; reply.content += "\"checksum\":";
intToString(rawRoute.checkSum, tmp); intToString(raw_route_information.checkSum, tmp);
reply.content += tmp; reply.content += tmp;
reply.content += ", \"locations\": ["; reply.content += ", \"locations\": [";
std::string hint; std::string hint;
for(unsigned i = 0; i < rawRoute.segmentEndCoordinates.size(); ++i) { for(unsigned i = 0; i < raw_route_information.segmentEndCoordinates.size(); ++i) {
reply.content += "\""; reply.content += "\"";
EncodeObjectToBase64(rawRoute.segmentEndCoordinates[i].startPhantom, hint); EncodeObjectToBase64(raw_route_information.segmentEndCoordinates[i].startPhantom, hint);
reply.content += hint; reply.content += hint;
reply.content += "\", "; reply.content += "\", ";
} }
EncodeObjectToBase64(rawRoute.segmentEndCoordinates.back().targetPhantom, hint); EncodeObjectToBase64(raw_route_information.segmentEndCoordinates.back().targetPhantom, hint);
reply.content += "\""; reply.content += "\"";
reply.content += hint; reply.content += hint;
reply.content += "\"]"; reply.content += "\"]";
@ -271,8 +288,8 @@ public:
// construct routes names // construct routes names
void GetRouteNames( void GetRouteNames(
std::vector<Segment> & shortestSegments, std::vector<Segment> & shortest_path_segments,
std::vector<Segment> & alternativeSegments, std::vector<Segment> & alternative_path_segments,
const DataFacadeT * facade, const DataFacadeT * facade,
RouteNames & routeNames RouteNames & routeNames
) { ) {
@ -280,20 +297,20 @@ public:
Segment shortestSegment1, shortestSegment2; Segment shortestSegment1, shortestSegment2;
Segment alternativeSegment1, alternativeSegment2; Segment alternativeSegment1, alternativeSegment2;
if(0 < shortestSegments.size()) { if(0 < shortest_path_segments.size()) {
sort(shortestSegments.begin(), shortestSegments.end(), boost::bind(&Segment::length, _1) > boost::bind(&Segment::length, _2) ); sort(shortest_path_segments.begin(), shortest_path_segments.end(), boost::bind(&Segment::length, _1) > boost::bind(&Segment::length, _2) );
shortestSegment1 = shortestSegments[0]; shortestSegment1 = shortest_path_segments[0];
if(0 < alternativeSegments.size()) { if(0 < alternative_path_segments.size()) {
sort(alternativeSegments.begin(), alternativeSegments.end(), boost::bind(&Segment::length, _1) > boost::bind(&Segment::length, _2) ); sort(alternative_path_segments.begin(), alternative_path_segments.end(), boost::bind(&Segment::length, _1) > boost::bind(&Segment::length, _2) );
alternativeSegment1 = alternativeSegments[0]; alternativeSegment1 = alternative_path_segments[0];
} }
std::vector<Segment> shortestDifference(shortestSegments.size()); std::vector<Segment> shortestDifference(shortest_path_segments.size());
std::vector<Segment> alternativeDifference(alternativeSegments.size()); std::vector<Segment> alternativeDifference(alternative_path_segments.size());
std::set_difference(shortestSegments.begin(), shortestSegments.end(), alternativeSegments.begin(), alternativeSegments.end(), shortestDifference.begin(), boost::bind(&Segment::nameID, _1) < boost::bind(&Segment::nameID, _2) ); std::set_difference(shortest_path_segments.begin(), shortest_path_segments.end(), alternative_path_segments.begin(), alternative_path_segments.end(), shortestDifference.begin(), boost::bind(&Segment::name_id, _1) < boost::bind(&Segment::name_id, _2) );
int size_of_difference = shortestDifference.size(); int size_of_difference = shortestDifference.size();
if(0 < size_of_difference ) { if(0 < size_of_difference ) {
int i = 0; int i = 0;
while( i < size_of_difference && shortestDifference[i].nameID == shortestSegments[0].nameID) { while( i < size_of_difference && shortestDifference[i].name_id == shortest_path_segments[0].name_id) {
++i; ++i;
} }
if(i < size_of_difference ) { if(i < size_of_difference ) {
@ -301,11 +318,11 @@ public:
} }
} }
std::set_difference(alternativeSegments.begin(), alternativeSegments.end(), shortestSegments.begin(), shortestSegments.end(), alternativeDifference.begin(), boost::bind(&Segment::nameID, _1) < boost::bind(&Segment::nameID, _2) ); std::set_difference(alternative_path_segments.begin(), alternative_path_segments.end(), shortest_path_segments.begin(), shortest_path_segments.end(), alternativeDifference.begin(), boost::bind(&Segment::name_id, _1) < boost::bind(&Segment::name_id, _2) );
size_of_difference = alternativeDifference.size(); size_of_difference = alternativeDifference.size();
if(0 < size_of_difference ) { if(0 < size_of_difference ) {
int i = 0; int i = 0;
while( i < size_of_difference && alternativeDifference[i].nameID == alternativeSegments[0].nameID) { while( i < size_of_difference && alternativeDifference[i].name_id == alternative_path_segments[0].name_id) {
++i; ++i;
} }
if(i < size_of_difference ) { if(i < size_of_difference ) {
@ -319,17 +336,17 @@ public:
std::swap(alternativeSegment1, alternativeSegment2); std::swap(alternativeSegment1, alternativeSegment2);
routeNames.shortestPathName1 = facade->GetEscapedNameForNameID( routeNames.shortestPathName1 = facade->GetEscapedNameForNameID(
shortestSegment1.nameID shortestSegment1.name_id
); );
routeNames.shortestPathName2 = facade->GetEscapedNameForNameID( routeNames.shortestPathName2 = facade->GetEscapedNameForNameID(
shortestSegment2.nameID shortestSegment2.name_id
); );
routeNames.alternativePathName1 = facade->GetEscapedNameForNameID( routeNames.alternativePathName1 = facade->GetEscapedNameForNameID(
alternativeSegment1.nameID alternativeSegment1.name_id
); );
routeNames.alternativePathName2 = facade->GetEscapedNameForNameID( routeNames.alternativePathName2 = facade->GetEscapedNameForNameID(
alternativeSegment2.nameID alternativeSegment2.name_id
); );
} }
} }
@ -342,46 +359,45 @@ public:
//TODO: reorder parameters //TODO: reorder parameters
inline void BuildTextualDescription( inline void BuildTextualDescription(
DescriptionFactory & descriptionFactory, DescriptionFactory & description_factory,
http::Reply & reply, http::Reply & reply,
const int lengthOfRoute, const int route_length,
const DataFacadeT * facade, const DataFacadeT * facade,
std::vector<Segment> & segmentVector std::vector<Segment> & route_segments_list
) { ) {
//Segment information has following format: //Segment information has following format:
//["instruction","streetname",length,position,time,"length","earth_direction",azimuth] //["instruction","streetname",length,position,time,"length","earth_direction",azimuth]
//Example: ["Turn left","High Street",200,4,10,"200m","NE",22.5] //Example: ["Turn left","High Street",200,4,10,"200m","NE",22.5]
//See also: http://developers.cloudmade.com/wiki/navengine/JSON_format //See also: http://developers.cloudmade.com/wiki/navengine/JSON_format
unsigned prefixSumOfNecessarySegments = 0; unsigned prefixSumOfNecessarySegments = 0;
roundAbout.leaveAtExit = 0; roundAbout.leave_at_exit = 0;
roundAbout.nameID = 0; roundAbout.name_id = 0;
std::string tmpDist, tmpLength, tmpDuration, tmpBearing, tmpInstruction; std::string tmpDist, tmpLength, tmpDuration, tmpBearing, tmpInstruction;
//Fetch data from Factory and generate a string from it. //Fetch data from Factory and generate a string from it.
BOOST_FOREACH(const SegmentInformation & segment, descriptionFactory.pathDescription) { BOOST_FOREACH(const SegmentInformation & segment, description_factory.pathDescription) {
TurnInstruction currentInstruction = segment.turnInstruction & TurnInstructions.InverseAccessRestrictionFlag; TurnInstruction current_instruction = segment.turnInstruction & TurnInstructions.InverseAccessRestrictionFlag;
numberOfEnteredRestrictedAreas += (currentInstruction != segment.turnInstruction); entered_restricted_area_count += (current_instruction != segment.turnInstruction);
if(TurnInstructions.TurnIsNecessary( currentInstruction) ) { if(TurnInstructions.TurnIsNecessary( current_instruction) ) {
if(TurnInstructions.EnterRoundAbout == currentInstruction) { if(TurnInstructions.EnterRoundAbout == current_instruction) {
roundAbout.nameID = segment.nameID; roundAbout.name_id = segment.nameID;
roundAbout.startIndex = prefixSumOfNecessarySegments; roundAbout.start_index = prefixSumOfNecessarySegments;
} else { } else {
if(0 != prefixSumOfNecessarySegments){ if(0 != prefixSumOfNecessarySegments){
reply.content += ","; reply.content += ",";
} }
reply.content += "[\""; reply.content += "[\"";
if(TurnInstructions.LeaveRoundAbout == currentInstruction) { if(TurnInstructions.LeaveRoundAbout == current_instruction) {
intToString(TurnInstructions.EnterRoundAbout, tmpInstruction); intToString(TurnInstructions.EnterRoundAbout, tmpInstruction);
reply.content += tmpInstruction; reply.content += tmpInstruction;
reply.content += "-"; reply.content += "-";
intToString(roundAbout.leaveAtExit+1, tmpInstruction); intToString(roundAbout.leave_at_exit+1, tmpInstruction);
reply.content += tmpInstruction; reply.content += tmpInstruction;
roundAbout.leaveAtExit = 0; roundAbout.leave_at_exit = 0;
} else { } else {
intToString(currentInstruction, tmpInstruction); intToString(current_instruction, tmpInstruction);
reply.content += tmpInstruction; reply.content += tmpInstruction;
} }
reply.content += "\",\""; reply.content += "\",\"";
reply.content += facade->GetEscapedNameForNameID(segment.nameID); reply.content += facade->GetEscapedNameForNameID(segment.nameID);
reply.content += "\","; reply.content += "\",";
@ -403,15 +419,21 @@ public:
reply.content += tmpBearing; reply.content += tmpBearing;
reply.content += "]"; reply.content += "]";
segmentVector.push_back( Segment(segment.nameID, segment.length, segmentVector.size() )); route_segments_list.push_back(
Segment(
segment.nameID,
segment.length,
route_segments_list.size()
)
);
} }
} else if(TurnInstructions.StayOnRoundAbout == currentInstruction) { } else if(TurnInstructions.StayOnRoundAbout == current_instruction) {
++roundAbout.leaveAtExit; ++roundAbout.leave_at_exit;
} }
if(segment.necessary) if(segment.necessary)
++prefixSumOfNecessarySegments; ++prefixSumOfNecessarySegments;
} }
if(INT_MAX != lengthOfRoute) { if(INT_MAX != route_length) {
reply.content += ",[\""; reply.content += ",[\"";
intToString(TurnInstructions.ReachedYourDestination, tmpInstruction); intToString(TurnInstructions.ReachedYourDestination, tmpInstruction);
reply.content += tmpInstruction; reply.content += tmpInstruction;