refactor ExtractionTurn and ProcessTurn c++ code

This commit is contained in:
Kajari Ghosh
2017-11-03 13:08:11 -04:00
parent c95d845876
commit cbc96ec492
5 changed files with 177 additions and 120 deletions
+12 -20
View File
@@ -14,41 +14,33 @@ namespace extractor
struct ExtractionTurn
{
ExtractionTurn(const guidance::ConnectedRoad &turn,
ExtractionTurn(double angle,
int number_of_roads,
bool is_u_turn,
bool has_traffic_light,
bool source_restricted,
bool target_restricted,
bool is_left_hand_driving)
: angle(180. - turn.angle), turn_type(turn.instruction.type),
direction_modifier(turn.instruction.direction_modifier),
bool is_left_hand_driving,
TravelMode source_mode,
TravelMode target_mode)
: angle(180. - angle), number_of_roads(number_of_roads), is_u_turn(is_u_turn),
has_traffic_light(has_traffic_light), source_restricted(source_restricted),
target_restricted(target_restricted), is_left_hand_driving(is_left_hand_driving),
weight(0.), duration(0.)
{
}
ExtractionTurn(bool has_traffic_light,
bool source_restricted,
bool target_restricted,
bool is_left_hand_driving)
: angle(0), turn_type(guidance::TurnType::NoTurn),
direction_modifier(guidance::DirectionModifier::Straight),
has_traffic_light(has_traffic_light), source_restricted(source_restricted),
target_restricted(target_restricted), is_left_hand_driving(is_left_hand_driving),
weight(0.), duration(0.)
weight(0.), duration(0.), source_mode(source_mode), target_mode(target_mode)
{
}
const double angle;
const guidance::TurnType::Enum turn_type;
const guidance::DirectionModifier::Enum direction_modifier;
const int number_of_roads;
const bool is_u_turn;
const bool has_traffic_light;
const bool source_restricted;
const bool target_restricted;
const bool is_left_hand_driving;
double weight;
double duration;
TravelMode source_mode;
TravelMode target_mode;
};
}
}
@@ -68,7 +68,7 @@ class Sol2ScriptingEnvironment final : public ScriptingEnvironment
{
public:
static const constexpr int SUPPORTED_MIN_API_VERSION = 0;
static const constexpr int SUPPORTED_MAX_API_VERSION = 3;
static const constexpr int SUPPORTED_MAX_API_VERSION = 4;
explicit Sol2ScriptingEnvironment(
const std::string &file_name,