refactor list of const static int into scoped enum
This commit is contained in:
@@ -68,7 +68,7 @@ void DescriptionFactory::SetStartSegment(const PhantomNode &source,
|
||||
const bool source_traversed_in_reverse)
|
||||
{
|
||||
start_phantom = source;
|
||||
AppendSegment(source.location, PathData(0, source.name_id, 10, source.forward_weight));
|
||||
AppendSegment(source.location, PathData(0, source.name_id, TurnInstruction::HeadOn, source.forward_weight));
|
||||
}
|
||||
|
||||
void DescriptionFactory::SetEndSegment(const PhantomNode &target,
|
||||
@@ -76,7 +76,7 @@ void DescriptionFactory::SetEndSegment(const PhantomNode &target,
|
||||
{
|
||||
target_phantom = target;
|
||||
path_description.emplace_back(
|
||||
target.location, target.name_id, 0, target.reverse_weight, 0, true);
|
||||
target.location, target.name_id, 0, target.reverse_weight, TurnInstruction::NoTurn, true);
|
||||
}
|
||||
|
||||
void DescriptionFactory::AppendSegment(const FixedPointCoordinate &coordinate,
|
||||
|
||||
@@ -119,7 +119,7 @@ class DescriptionFactory
|
||||
// unsigned lastTurn = 0;
|
||||
// for(unsigned i = 1; i < path_description.size(); ++i) {
|
||||
// string1 = sEngine.GetEscapedNameForNameID(path_description[i].name_id);
|
||||
// if(TurnInstructionsClass::GoStraight == path_description[i].turn_instruction) {
|
||||
// if(TurnInstruction::GoStraight == path_description[i].turn_instruction) {
|
||||
// if(std::string::npos != string0.find(string1+";")
|
||||
// || std::string::npos != string0.find(";"+string1)
|
||||
// || std::string::npos != string0.find(string1+" ;")
|
||||
@@ -129,7 +129,7 @@ class DescriptionFactory
|
||||
// string1;
|
||||
// for(; lastTurn != i; ++lastTurn)
|
||||
// path_description[lastTurn].name_id = path_description[i].name_id;
|
||||
// path_description[i].turn_instruction = TurnInstructionsClass::NoTurn;
|
||||
// path_description[i].turn_instruction = TurnInstruction::NoTurn;
|
||||
// } else if(std::string::npos != string1.find(string0+";")
|
||||
// || std::string::npos != string1.find(";"+string0)
|
||||
// || std::string::npos != string1.find(string0+" ;")
|
||||
@@ -138,10 +138,10 @@ class DescriptionFactory
|
||||
// SimpleLogger().Write() << "->prev correct: " << string1 << " contains " <<
|
||||
// string0;
|
||||
// path_description[i].name_id = path_description[i-1].name_id;
|
||||
// path_description[i].turn_instruction = TurnInstructionsClass::NoTurn;
|
||||
// path_description[i].turn_instruction = TurnInstruction::NoTurn;
|
||||
// }
|
||||
// }
|
||||
// if (TurnInstructionsClass::NoTurn != path_description[i].turn_instruction) {
|
||||
// if (TurnInstruction::NoTurn != path_description[i].turn_instruction) {
|
||||
// lastTurn = i;
|
||||
// }
|
||||
// string0 = string1;
|
||||
@@ -159,7 +159,7 @@ class DescriptionFactory
|
||||
path_description[segment_start_index].length = segment_length;
|
||||
path_description[segment_start_index].duration = segment_duration;
|
||||
|
||||
if (TurnInstructionsClass::NoTurn != path_description[i].turn_instruction)
|
||||
if (TurnInstruction::NoTurn != path_description[i].turn_instruction)
|
||||
{
|
||||
BOOST_ASSERT(path_description[i].necessary);
|
||||
segment_length = 0;
|
||||
@@ -175,7 +175,7 @@ class DescriptionFactory
|
||||
{
|
||||
path_description.pop_back();
|
||||
path_description.back().necessary = true;
|
||||
path_description.back().turn_instruction = TurnInstructionsClass::NoTurn;
|
||||
path_description.back().turn_instruction = TurnInstruction::NoTurn;
|
||||
target_phantom.name_id = (path_description.end() - 2)->name_id;
|
||||
}
|
||||
}
|
||||
@@ -184,7 +184,7 @@ class DescriptionFactory
|
||||
if (path_description.size() > 2)
|
||||
{
|
||||
path_description.erase(path_description.begin());
|
||||
path_description[0].turn_instruction = TurnInstructionsClass::HeadOn;
|
||||
path_description[0].turn_instruction = TurnInstruction::HeadOn;
|
||||
path_description[0].necessary = true;
|
||||
start_phantom.name_id = path_description[0].name_id;
|
||||
}
|
||||
|
||||
@@ -438,12 +438,11 @@ template <class DataFacadeT> class JSONDescriptor : public BaseDescriptor<DataFa
|
||||
// Fetch data from Factory and generate a string from it.
|
||||
for (const SegmentInformation &segment : description_factory.path_description)
|
||||
{
|
||||
TurnInstruction current_instruction =
|
||||
segment.turn_instruction & TurnInstructionsClass::InverseAccessRestrictionFlag;
|
||||
TurnInstruction current_instruction = segment.turn_instruction;
|
||||
entered_restricted_area_count += (current_instruction != segment.turn_instruction);
|
||||
if (TurnInstructionsClass::TurnIsNecessary(current_instruction))
|
||||
{
|
||||
if (TurnInstructionsClass::EnterRoundAbout == current_instruction)
|
||||
if (TurnInstruction::EnterRoundAbout == current_instruction)
|
||||
{
|
||||
round_about.name_id = segment.name_id;
|
||||
round_about.start_index = necessary_segments_running_index;
|
||||
@@ -455,9 +454,9 @@ template <class DataFacadeT> class JSONDescriptor : public BaseDescriptor<DataFa
|
||||
reply.content.emplace_back(",");
|
||||
}
|
||||
reply.content.emplace_back("[\"");
|
||||
if (TurnInstructionsClass::LeaveRoundAbout == current_instruction)
|
||||
if (TurnInstruction::LeaveRoundAbout == current_instruction)
|
||||
{
|
||||
intToString(TurnInstructionsClass::EnterRoundAbout, temp_instruction);
|
||||
intToString(as_integer(TurnInstruction::EnterRoundAbout), temp_instruction);
|
||||
reply.content.emplace_back(temp_instruction);
|
||||
reply.content.emplace_back("-");
|
||||
intToString(round_about.leave_at_exit + 1, temp_instruction);
|
||||
@@ -466,7 +465,7 @@ template <class DataFacadeT> class JSONDescriptor : public BaseDescriptor<DataFa
|
||||
}
|
||||
else
|
||||
{
|
||||
intToString(current_instruction, temp_instruction);
|
||||
intToString(as_integer(current_instruction), temp_instruction);
|
||||
reply.content.emplace_back(temp_instruction);
|
||||
}
|
||||
|
||||
@@ -496,7 +495,7 @@ template <class DataFacadeT> class JSONDescriptor : public BaseDescriptor<DataFa
|
||||
Segment(segment.name_id, segment.length, route_segments_list.size()));
|
||||
}
|
||||
}
|
||||
else if (TurnInstructionsClass::StayOnRoundAbout == current_instruction)
|
||||
else if (TurnInstruction::StayOnRoundAbout == current_instruction)
|
||||
{
|
||||
++round_about.leave_at_exit;
|
||||
}
|
||||
@@ -508,7 +507,7 @@ template <class DataFacadeT> class JSONDescriptor : public BaseDescriptor<DataFa
|
||||
if (INVALID_EDGE_WEIGHT != route_length)
|
||||
{
|
||||
reply.content.emplace_back(",[\"");
|
||||
intToString(TurnInstructionsClass::ReachedYourDestination, temp_instruction);
|
||||
intToString(as_integer(TurnInstruction::ReachedYourDestination), temp_instruction);
|
||||
reply.content.emplace_back(temp_instruction);
|
||||
reply.content.emplace_back("\",\"");
|
||||
reply.content.emplace_back("\",");
|
||||
|
||||
Reference in New Issue
Block a user