Prints turn types and modifiers as strings

This commit is contained in:
Daniel J. Hofmann 2017-11-01 18:33:50 -04:00 committed by Daniel J. H
parent c5b48e3506
commit aed7bd852d
16 changed files with 188 additions and 184 deletions

View File

@ -33,22 +33,8 @@ namespace json
namespace detail namespace detail
{ {
std::string instructionTypeToString(extractor::guidance::TurnType::Enum type);
std::string instructionModifierToString(extractor::guidance::DirectionModifier::Enum modifier);
/**
* Returns a string representing all instruction types (including internal types that
* are normally not exposed in route responses)
*
* @param type the TurnType value to convert into a string
* @return a string representing the turn type (e.g. `turn` or `continue`)
*/
std::string internalInstructionTypeToString(extractor::guidance::TurnType::Enum type);
util::json::Array coordinateToLonLat(const util::Coordinate coordinate); util::json::Array coordinateToLonLat(const util::Coordinate coordinate);
std::string modeToString(const extractor::TravelMode mode);
/** /**
* Ensures that a bearing value is a whole number, and clamped to the range 0-359 * Ensures that a bearing value is a whole number, and clamped to the range 0-359
*/ */

View File

@ -123,7 +123,7 @@ inline void RouteStep::Invalidate()
duration = 0; duration = 0;
distance = 0; distance = 0;
weight = 0; weight = 0;
mode = TRAVEL_MODE_INACCESSIBLE; mode = extractor::TRAVEL_MODE_INACCESSIBLE;
maneuver = getInvalidStepManeuver(); maneuver = getInvalidStepManeuver();
geometry_begin = 0; geometry_begin = 0;
geometry_end = 0; geometry_end = 0;

View File

@ -55,8 +55,8 @@ struct ExtractionWay
turn_lanes_forward.clear(); turn_lanes_forward.clear();
turn_lanes_backward.clear(); turn_lanes_backward.clear();
road_classification = guidance::RoadClassification(); road_classification = guidance::RoadClassification();
forward_travel_mode = TRAVEL_MODE_INACCESSIBLE; forward_travel_mode = extractor::TRAVEL_MODE_INACCESSIBLE;
backward_travel_mode = TRAVEL_MODE_INACCESSIBLE; backward_travel_mode = extractor::TRAVEL_MODE_INACCESSIBLE;
roundabout = false; roundabout = false;
circular = false; circular = false;
is_startpoint = true; is_startpoint = true;
@ -112,8 +112,8 @@ struct ExtractionWay
std::string turn_lanes_forward; std::string turn_lanes_forward;
std::string turn_lanes_backward; std::string turn_lanes_backward;
guidance::RoadClassification road_classification; guidance::RoadClassification road_classification;
TravelMode forward_travel_mode : 4; extractor::TravelMode forward_travel_mode : 4;
TravelMode backward_travel_mode : 4; extractor::TravelMode backward_travel_mode : 4;
// Boolean flags // Boolean flags
bool roundabout : 1; bool roundabout : 1;

View File

@ -3,6 +3,7 @@
#include "extractor/guidance/intersection.hpp" #include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_handler.hpp" #include "extractor/guidance/intersection_handler.hpp"
#include "extractor/guidance/turn_instruction.hpp"
#include "util/log.hpp" #include "util/log.hpp"
@ -45,12 +46,12 @@ class StatisticsHandler final : public IntersectionHandler
util::Log() << "Assigned turn instruction types"; util::Log() << "Assigned turn instruction types";
for (const auto &kv : type_hist) for (const auto &kv : type_hist)
util::Log() << (int)kv.first << ": " << kv.second; util::Log() << internalInstructionTypeToString(kv.first) << ": " << kv.second;
util::Log() << "Assigned turn instruction modifiers"; util::Log() << "Assigned turn instruction modifiers";
for (const auto &kv : modifier_hist) for (const auto &kv : modifier_hist)
util::Log() << (int)kv.first << ": " << kv.second; util::Log() << instructionModifierToString(kv.first) << ": " << kv.second;
} }
bool canProcess(const NodeID, const EdgeID, const Intersection &) const override final bool canProcess(const NodeID, const EdgeID, const Intersection &) const override final

View File

@ -309,6 +309,86 @@ inline DirectionModifier::Enum bearingToDirectionModifier(const double bearing)
return extractor::guidance::DirectionModifier::Left; return extractor::guidance::DirectionModifier::Left;
} }
namespace detail
{
const constexpr char *modifier_names[] = {"uturn",
"sharp right",
"right",
"slight right",
"straight",
"slight left",
"left",
"sharp left"};
/**
* Human readable values for TurnType enum values
*/
struct TurnTypeName
{
// String value we return with our API
const char *external_name;
// Internal only string name for the turn type - useful for debugging
// and used by debug tiles for visualizing hidden turn types
const char *internal_name;
};
// Indexes in this list correspond to the Enum values of osrm::extractor::guidance::TurnType
const constexpr TurnTypeName turn_type_names[] = {
{"invalid", "(not set)"},
{"new name", "new name"},
{"continue", "continue"},
{"turn", "turn"},
{"merge", "merge"},
{"on ramp", "on ramp"},
{"off ramp", "off ramp"},
{"fork", "fork"},
{"end of road", "end of road"},
{"notification", "notification"},
{"roundabout", "enter roundabout"},
{"exit roundabout", "enter and exit roundabout"},
{"rotary", "enter rotary"},
{"exit rotary", "enter and exit rotary"},
{"roundabout turn", "enter roundabout turn"},
{"roundabout turn", "enter and exit roundabout turn"},
{"use lane", "use lane"},
{"invalid", "(noturn)"},
{"invalid", "(suppressed)"},
{"roundabout", "roundabout"},
{"exit roundabout", "exit roundabout"},
{"rotary", "rotary"},
{"exit rotary", "exit rotary"},
{"roundabout turn", "roundabout turn"},
{"exit roundabout", "exit roundabout turn"},
{"invalid", "(stay on roundabout)"},
{"invalid", "(sliproad)"}};
} // ns detail
inline std::string instructionTypeToString(const TurnType::Enum type)
{
static_assert(sizeof(detail::turn_type_names) / sizeof(detail::turn_type_names[0]) >=
TurnType::MaxTurnType,
"Some turn types have no string representation.");
return detail::turn_type_names[static_cast<std::size_t>(type)].external_name;
}
inline std::string internalInstructionTypeToString(const TurnType::Enum type)
{
static_assert(sizeof(detail::turn_type_names) / sizeof(detail::turn_type_names[0]) >=
TurnType::MaxTurnType,
"Some turn types have no string representation.");
return detail::turn_type_names[static_cast<std::size_t>(type)].internal_name;
}
inline std::string instructionModifierToString(const DirectionModifier::Enum modifier)
{
static_assert(sizeof(detail::modifier_names) / sizeof(detail::modifier_names[0]) >=
DirectionModifier::MaxDirectionModifier,
"Some direction modifiers have no string representation.");
return detail::modifier_names[static_cast<std::size_t>(modifier)];
}
} // namespace guidance } // namespace guidance
} // namespace extractor } // namespace extractor
} // namespace osrm } // namespace osrm

View File

@ -21,7 +21,7 @@ struct OriginalEdgeData
LaneDataID lane_data_id, LaneDataID lane_data_id,
guidance::TurnInstruction turn_instruction, guidance::TurnInstruction turn_instruction,
EntryClassID entry_classid, EntryClassID entry_classid,
TravelMode travel_mode, extractor::TravelMode travel_mode,
util::guidance::TurnBearing pre_turn_bearing, util::guidance::TurnBearing pre_turn_bearing,
util::guidance::TurnBearing post_turn_bearing) util::guidance::TurnBearing post_turn_bearing)
: via_geometry(via_geometry), name_id(name_id), entry_classid(entry_classid), : via_geometry(via_geometry), name_id(name_id), entry_classid(entry_classid),
@ -34,7 +34,8 @@ struct OriginalEdgeData
: via_geometry{std::numeric_limits<unsigned>::max() >> 1, false}, : via_geometry{std::numeric_limits<unsigned>::max() >> 1, false},
name_id(std::numeric_limits<unsigned>::max()), entry_classid(INVALID_ENTRY_CLASSID), name_id(std::numeric_limits<unsigned>::max()), entry_classid(INVALID_ENTRY_CLASSID),
lane_data_id(INVALID_LANE_DATAID), turn_instruction(guidance::TurnInstruction::INVALID()), lane_data_id(INVALID_LANE_DATAID), turn_instruction(guidance::TurnInstruction::INVALID()),
travel_mode(TRAVEL_MODE_INACCESSIBLE), pre_turn_bearing(0.0), post_turn_bearing(0.0) travel_mode(extractor::TRAVEL_MODE_INACCESSIBLE), pre_turn_bearing(0.0),
post_turn_bearing(0.0)
{ {
} }
@ -43,7 +44,7 @@ struct OriginalEdgeData
EntryClassID entry_classid; EntryClassID entry_classid;
LaneDataID lane_data_id; LaneDataID lane_data_id;
guidance::TurnInstruction turn_instruction; guidance::TurnInstruction turn_instruction;
TravelMode travel_mode; extractor::TravelMode travel_mode;
util::guidance::TurnBearing pre_turn_bearing; util::guidance::TurnBearing pre_turn_bearing;
util::guidance::TurnBearing post_turn_bearing; util::guidance::TurnBearing post_turn_bearing;
}; };

View File

@ -29,6 +29,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define TRAVEL_MODE_HPP #define TRAVEL_MODE_HPP
#include <cstdint> #include <cstdint>
#include <string>
namespace osrm namespace osrm
{ {
@ -38,8 +39,6 @@ namespace extractor
// This is a char instead of a typed enum, so that we can // This is a char instead of a typed enum, so that we can
// pack it into e.g. a "TravelMode mode : 4" packed bitfield // pack it into e.g. a "TravelMode mode : 4" packed bitfield
using TravelMode = std::uint8_t; using TravelMode = std::uint8_t;
}
}
const constexpr osrm::extractor::TravelMode TRAVEL_MODE_INACCESSIBLE = 0; const constexpr osrm::extractor::TravelMode TRAVEL_MODE_INACCESSIBLE = 0;
const constexpr osrm::extractor::TravelMode TRAVEL_MODE_DRIVING = 1; const constexpr osrm::extractor::TravelMode TRAVEL_MODE_DRIVING = 1;
@ -55,4 +54,56 @@ const constexpr osrm::extractor::TravelMode TRAVEL_MODE_RIVER_UP = 10;
const constexpr osrm::extractor::TravelMode TRAVEL_MODE_RIVER_DOWN = 11; const constexpr osrm::extractor::TravelMode TRAVEL_MODE_RIVER_DOWN = 11;
const constexpr osrm::extractor::TravelMode TRAVEL_MODE_ROUTE = 12; const constexpr osrm::extractor::TravelMode TRAVEL_MODE_ROUTE = 12;
// FIXME this actually needs to be configurable from the profiles
inline std::string travelModeToString(const TravelMode mode)
{
std::string token;
switch (mode)
{
case TRAVEL_MODE_INACCESSIBLE:
token = "inaccessible";
break;
case TRAVEL_MODE_DRIVING:
token = "driving";
break;
case TRAVEL_MODE_CYCLING:
token = "cycling";
break;
case TRAVEL_MODE_WALKING:
token = "walking";
break;
case TRAVEL_MODE_FERRY:
token = "ferry";
break;
case TRAVEL_MODE_TRAIN:
token = "train";
break;
case TRAVEL_MODE_PUSHING_BIKE:
token = "pushing bike";
break;
case TRAVEL_MODE_STEPS_UP:
token = "steps up";
break;
case TRAVEL_MODE_STEPS_DOWN:
token = "steps down";
break;
case TRAVEL_MODE_RIVER_UP:
token = "river upstream";
break;
case TRAVEL_MODE_RIVER_DOWN:
token = "river downstream";
break;
case TRAVEL_MODE_ROUTE:
token = "route";
break;
default:
token = "other";
break;
}
return token;
}
} // ns extractor
} // ns osrm
#endif /* TRAVEL_MODE_HPP */ #endif /* TRAVEL_MODE_HPP */

View File

@ -1,5 +1,7 @@
#include "engine/api/json_factory.hpp" #include "extractor/guidance/turn_instruction.hpp"
#include "extractor/travel_mode.hpp"
#include "engine/api/json_factory.hpp"
#include "engine/hint.hpp" #include "engine/hint.hpp"
#include "engine/polyline_compressor.hpp" #include "engine/polyline_compressor.hpp"
#include "util/integer_range.hpp" #include "util/integer_range.hpp"
@ -32,59 +34,6 @@ namespace json
namespace detail namespace detail
{ {
const constexpr char *modifier_names[] = {"uturn",
"sharp right",
"right",
"slight right",
"straight",
"slight left",
"left",
"sharp left"};
/**
* Human readable values for TurnType enum values
*/
struct TurnTypeName
{
// String value we return with our API
const char *external_name;
// Internal only string name for the turn type - useful for debugging
// and used by debug tiles for visualizing hidden turn types
const char *internal_name;
};
// Indexes in this list correspond to the Enum values of osrm::extractor::guidance::TurnType
const constexpr TurnTypeName turn_type_names[] = {
{"invalid", "(not set)"},
{"new name", "new name"},
{"continue", "continue"},
{"turn", "turn"},
{"merge", "merge"},
{"on ramp", "on ramp"},
{"off ramp", "off ramp"},
{"fork", "fork"},
{"end of road", "end of road"},
{"notification", "notification"},
{"roundabout", "enter roundabout"},
{"exit roundabout", "enter and exit roundabout"},
{"rotary", "enter rotary"},
{"exit rotary", "enter and exit rotary"},
{"roundabout turn", "enter roundabout turn"},
{"roundabout turn", "enter and exit roundabout turn"},
{"use lane", "use lane"},
{"invalid", "(noturn)"},
{"invalid", "(suppressed)"},
{"roundabout", "roundabout"},
{"exit roundabout", "exit roundabout"},
{"rotary", "rotary"},
{"exit rotary", "exit rotary"},
{"roundabout turn", "roundabout turn"},
{"exit roundabout", "exit roundabout turn"},
{"invalid", "(stay on roundabout)"},
{"invalid", "(sliproad)"}};
const constexpr char *waypoint_type_names[] = {"invalid", "arrive", "depart"};
// Check whether to include a modifier in the result of the API // Check whether to include a modifier in the result of the API
inline bool isValidModifier(const guidance::StepManeuver maneuver) inline bool isValidModifier(const guidance::StepManeuver maneuver)
{ {
@ -97,20 +46,6 @@ inline bool hasValidLanes(const guidance::IntermediateIntersection &intersection
return intersection.lanes.lanes_in_turn > 0; return intersection.lanes.lanes_in_turn > 0;
} }
std::string instructionTypeToString(const TurnType::Enum type)
{
static_assert(sizeof(turn_type_names) / sizeof(turn_type_names[0]) >= TurnType::MaxTurnType,
"Some turn types have no string representation.");
return turn_type_names[static_cast<std::size_t>(type)].external_name;
}
std::string internalInstructionTypeToString(const TurnType::Enum type)
{
static_assert(sizeof(turn_type_names) / sizeof(turn_type_names[0]) >= TurnType::MaxTurnType,
"Some turn types have no string representation.");
return turn_type_names[static_cast<std::size_t>(type)].internal_name;
}
util::json::Array lanesFromIntersection(const guidance::IntermediateIntersection &intersection) util::json::Array lanesFromIntersection(const guidance::IntermediateIntersection &intersection)
{ {
BOOST_ASSERT(intersection.lanes.lanes_in_turn >= 1); BOOST_ASSERT(intersection.lanes.lanes_in_turn >= 1);
@ -135,13 +70,7 @@ util::json::Array lanesFromIntersection(const guidance::IntermediateIntersection
return result; return result;
} }
std::string instructionModifierToString(const DirectionModifier::Enum modifier) const constexpr char *waypoint_type_names[] = {"invalid", "arrive", "depart"};
{
static_assert(sizeof(modifier_names) / sizeof(modifier_names[0]) >=
DirectionModifier::MaxDirectionModifier,
"Some direction modifiers has not string representation.");
return modifier_names[static_cast<std::size_t>(modifier)];
}
std::string waypointTypeToString(const guidance::WaypointType waypoint_type) std::string waypointTypeToString(const guidance::WaypointType waypoint_type)
{ {
@ -159,55 +88,6 @@ util::json::Array coordinateToLonLat(const util::Coordinate coordinate)
return array; return array;
} }
// FIXME this actually needs to be configurable from the profiles
std::string modeToString(const extractor::TravelMode mode)
{
std::string token;
switch (mode)
{
case TRAVEL_MODE_INACCESSIBLE:
token = "inaccessible";
break;
case TRAVEL_MODE_DRIVING:
token = "driving";
break;
case TRAVEL_MODE_CYCLING:
token = "cycling";
break;
case TRAVEL_MODE_WALKING:
token = "walking";
break;
case TRAVEL_MODE_FERRY:
token = "ferry";
break;
case TRAVEL_MODE_TRAIN:
token = "train";
break;
case TRAVEL_MODE_PUSHING_BIKE:
token = "pushing bike";
break;
case TRAVEL_MODE_STEPS_UP:
token = "steps up";
break;
case TRAVEL_MODE_STEPS_DOWN:
token = "steps down";
break;
case TRAVEL_MODE_RIVER_UP:
token = "river upstream";
break;
case TRAVEL_MODE_RIVER_DOWN:
token = "river downstream";
break;
case TRAVEL_MODE_ROUTE:
token = "route";
break;
default:
token = "other";
break;
}
return token;
}
} // namespace detail } // namespace detail
util::json::Object makeStepManeuver(const guidance::StepManeuver &maneuver) util::json::Object makeStepManeuver(const guidance::StepManeuver &maneuver)
@ -217,7 +97,7 @@ util::json::Object makeStepManeuver(const guidance::StepManeuver &maneuver)
std::string maneuver_type; std::string maneuver_type;
if (maneuver.waypoint_type == guidance::WaypointType::None) if (maneuver.waypoint_type == guidance::WaypointType::None)
maneuver_type = detail::instructionTypeToString(maneuver.instruction.type); maneuver_type = extractor::guidance::instructionTypeToString(maneuver.instruction.type);
else else
maneuver_type = detail::waypointTypeToString(maneuver.waypoint_type); maneuver_type = detail::waypointTypeToString(maneuver.waypoint_type);
@ -227,8 +107,8 @@ util::json::Object makeStepManeuver(const guidance::StepManeuver &maneuver)
step_maneuver.values["type"] = std::move(maneuver_type); step_maneuver.values["type"] = std::move(maneuver_type);
if (detail::isValidModifier(maneuver)) if (detail::isValidModifier(maneuver))
step_maneuver.values["modifier"] = step_maneuver.values["modifier"] = extractor::guidance::instructionModifierToString(
detail::instructionModifierToString(maneuver.instruction.direction_modifier); maneuver.instruction.direction_modifier);
step_maneuver.values["location"] = detail::coordinateToLonLat(maneuver.location); step_maneuver.values["location"] = detail::coordinateToLonLat(maneuver.location);
step_maneuver.values["bearing_before"] = detail::roundAndClampBearing(maneuver.bearing_before); step_maneuver.values["bearing_before"] = detail::roundAndClampBearing(maneuver.bearing_before);
@ -312,7 +192,7 @@ util::json::Object makeRouteStep(guidance::RouteStep step, util::json::Value geo
} }
} }
route_step.values["mode"] = detail::modeToString(std::move(step.mode)); route_step.values["mode"] = extractor::travelModeToString(std::move(step.mode));
route_step.values["maneuver"] = makeStepManeuver(std::move(step.maneuver)); route_step.values["maneuver"] = makeStepManeuver(std::move(step.maneuver));
route_step.values["geometry"] = std::move(geometry); route_step.values["geometry"] = std::move(geometry);

View File

@ -1,3 +1,5 @@
#include "extractor/guidance/turn_instruction.hpp"
#include "engine/plugins/tile.hpp" #include "engine/plugins/tile.hpp"
#include "engine/plugins/plugin_base.hpp" #include "engine/plugins/plugin_base.hpp"
@ -712,10 +714,10 @@ void encodeVectorTile(const DataFacadeBase &facade,
point_float_index.add(t.weight / 10.0); // Note conversion to float here point_float_index.add(t.weight / 10.0); // Note conversion to float here
auto turntype_idx = auto turntype_idx =
point_string_index.add(api::json::detail::internalInstructionTypeToString( point_string_index.add(extractor::guidance::internalInstructionTypeToString(
t.turn_instruction.type)); t.turn_instruction.type));
auto turnmodifier_idx = auto turnmodifier_idx =
point_string_index.add(api::json::detail::instructionModifierToString( point_string_index.add(extractor::guidance::instructionModifierToString(
t.turn_instruction.direction_modifier)); t.turn_instruction.direction_modifier));
return EncodedTurnData{t.coordinate, return EncodedTurnData{t.coordinate,
angle_idx, angle_idx,

View File

@ -90,18 +90,19 @@ void ExtractorCallbacks::ProcessRestriction(const InputConditionalTurnRestrictio
*/ */
void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const ExtractionWay &parsed_way) void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const ExtractionWay &parsed_way)
{ {
if ((parsed_way.forward_travel_mode == TRAVEL_MODE_INACCESSIBLE || if ((parsed_way.forward_travel_mode == extractor::TRAVEL_MODE_INACCESSIBLE ||
parsed_way.forward_speed <= 0) && parsed_way.forward_speed <= 0) &&
(parsed_way.backward_travel_mode == TRAVEL_MODE_INACCESSIBLE || (parsed_way.backward_travel_mode == extractor::TRAVEL_MODE_INACCESSIBLE ||
parsed_way.backward_speed <= 0) && parsed_way.backward_speed <= 0) &&
parsed_way.duration <= 0) parsed_way.duration <= 0)
{ // Only true if the way is assigned a valid speed/duration { // Only true if the way is assigned a valid speed/duration
return; return;
} }
if (!fallback_to_duration && (parsed_way.forward_travel_mode == TRAVEL_MODE_INACCESSIBLE || if (!fallback_to_duration &&
parsed_way.forward_rate <= 0) && (parsed_way.forward_travel_mode == extractor::TRAVEL_MODE_INACCESSIBLE ||
(parsed_way.backward_travel_mode == TRAVEL_MODE_INACCESSIBLE || parsed_way.forward_rate <= 0) &&
(parsed_way.backward_travel_mode == extractor::TRAVEL_MODE_INACCESSIBLE ||
parsed_way.backward_rate <= 0) && parsed_way.backward_rate <= 0) &&
parsed_way.weight <= 0) parsed_way.weight <= 0)
{ // Only true if the way is assigned a valid rate/weight and there is no duration fallback { // Only true if the way is assigned a valid rate/weight and there is no duration fallback
@ -145,7 +146,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
} }
}; };
if (parsed_way.forward_travel_mode != TRAVEL_MODE_INACCESSIBLE) if (parsed_way.forward_travel_mode != extractor::TRAVEL_MODE_INACCESSIBLE)
{ {
BOOST_ASSERT(parsed_way.duration > 0 || parsed_way.forward_speed > 0); BOOST_ASSERT(parsed_way.duration > 0 || parsed_way.forward_speed > 0);
forward_duration_data = forward_duration_data =
@ -162,7 +163,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
toValueByEdgeOrByMeter(parsed_way.weight, parsed_way.forward_rate); toValueByEdgeOrByMeter(parsed_way.weight, parsed_way.forward_rate);
} }
} }
if (parsed_way.backward_travel_mode != TRAVEL_MODE_INACCESSIBLE) if (parsed_way.backward_travel_mode != extractor::TRAVEL_MODE_INACCESSIBLE)
{ {
BOOST_ASSERT(parsed_way.duration > 0 || parsed_way.backward_speed > 0); BOOST_ASSERT(parsed_way.duration > 0 || parsed_way.backward_speed > 0);
backward_duration_data = backward_duration_data =
@ -380,12 +381,12 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
const bool in_forward_direction = const bool in_forward_direction =
(parsed_way.forward_speed > 0 || parsed_way.forward_rate > 0 || parsed_way.duration > 0 || (parsed_way.forward_speed > 0 || parsed_way.forward_rate > 0 || parsed_way.duration > 0 ||
parsed_way.weight > 0) && parsed_way.weight > 0) &&
(parsed_way.forward_travel_mode != TRAVEL_MODE_INACCESSIBLE); (parsed_way.forward_travel_mode != extractor::TRAVEL_MODE_INACCESSIBLE);
const bool in_backward_direction = const bool in_backward_direction =
(parsed_way.backward_speed > 0 || parsed_way.backward_rate > 0 || parsed_way.duration > 0 || (parsed_way.backward_speed > 0 || parsed_way.backward_rate > 0 || parsed_way.duration > 0 ||
parsed_way.weight > 0) && parsed_way.weight > 0) &&
(parsed_way.backward_travel_mode != TRAVEL_MODE_INACCESSIBLE); (parsed_way.backward_travel_mode != extractor::TRAVEL_MODE_INACCESSIBLE);
// split an edge into two edges if forwards/backwards behavior differ // split an edge into two edges if forwards/backwards behavior differ
const bool split_edge = const bool split_edge =

View File

@ -34,7 +34,8 @@ bool SuppressModeHandler::canProcess(const NodeID,
using std::end; using std::end;
// travel modes for which navigation should be suppressed // travel modes for which navigation should be suppressed
static const constexpr char suppressed[] = {TRAVEL_MODE_TRAIN, TRAVEL_MODE_FERRY}; static const constexpr char suppressed[] = {extractor::TRAVEL_MODE_TRAIN,
extractor::TRAVEL_MODE_FERRY};
// If the approach way is not on the suppression blacklist, and not all the exit ways share that // If the approach way is not on the suppression blacklist, and not all the exit ways share that
// mode, there are no ways to suppress by this criteria. // mode, there are no ways to suppress by this criteria.

View File

@ -111,29 +111,29 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
context.state.new_enum("mode", context.state.new_enum("mode",
"inaccessible", "inaccessible",
TRAVEL_MODE_INACCESSIBLE, extractor::TRAVEL_MODE_INACCESSIBLE,
"driving", "driving",
TRAVEL_MODE_DRIVING, extractor::TRAVEL_MODE_DRIVING,
"cycling", "cycling",
TRAVEL_MODE_CYCLING, extractor::TRAVEL_MODE_CYCLING,
"walking", "walking",
TRAVEL_MODE_WALKING, extractor::TRAVEL_MODE_WALKING,
"ferry", "ferry",
TRAVEL_MODE_FERRY, extractor::TRAVEL_MODE_FERRY,
"train", "train",
TRAVEL_MODE_TRAIN, extractor::TRAVEL_MODE_TRAIN,
"pushing_bike", "pushing_bike",
TRAVEL_MODE_PUSHING_BIKE, extractor::TRAVEL_MODE_PUSHING_BIKE,
"steps_up", "steps_up",
TRAVEL_MODE_STEPS_UP, extractor::TRAVEL_MODE_STEPS_UP,
"steps_down", "steps_down",
TRAVEL_MODE_STEPS_DOWN, extractor::TRAVEL_MODE_STEPS_DOWN,
"river_up", "river_up",
TRAVEL_MODE_RIVER_UP, extractor::TRAVEL_MODE_RIVER_UP,
"river_down", "river_down",
TRAVEL_MODE_RIVER_DOWN, extractor::TRAVEL_MODE_RIVER_DOWN,
"route", "route",
TRAVEL_MODE_ROUTE); extractor::TRAVEL_MODE_ROUTE);
context.state.new_enum("road_priority_class", context.state.new_enum("road_priority_class",
"motorway", "motorway",
@ -395,8 +395,8 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
"get_relations", "get_relations",
[&getTypedRefBySol](ExtractionRelationContainer &cont, const sol::object &obj) [&getTypedRefBySol](ExtractionRelationContainer &cont, const sol::object &obj)
-> const ExtractionRelationContainer::RelationIDList & { -> const ExtractionRelationContainer::RelationIDList & {
return cont.GetRelations(getTypedRefBySol(obj)); return cont.GetRelations(getTypedRefBySol(obj));
}, },
"relation", "relation",
[](ExtractionRelationContainer &cont, const ExtractionRelation::OsmIDTyped &rel_id) [](ExtractionRelationContainer &cont, const ExtractionRelation::OsmIDTyped &rel_id)
-> const ExtractionRelation & { return cont.GetRelationData(rel_id); }); -> const ExtractionRelation & { return cont.GetRelationData(rel_id); });

View File

@ -46,7 +46,7 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
0.2, 0.2,
1.9076601161280742, 1.9076601161280742,
0.2, 0.2,
TRAVEL_MODE_DRIVING, extractor::TRAVEL_MODE_DRIVING,
{{FloatLongitude{-73.981492}, FloatLatitude{40.768258}}, {{FloatLongitude{-73.981492}, FloatLatitude{40.768258}},
329, 329,
348, 348,
@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(trim_short_segments)
0, 0,
0, 0,
0, 0,
TRAVEL_MODE_DRIVING, extractor::TRAVEL_MODE_DRIVING,
{{FloatLongitude{-73.981495}, FloatLatitude{40.768275}}, {{FloatLongitude{-73.981495}, FloatLatitude{40.768275}},
0, 0,
0, 0,

View File

@ -1,4 +1,5 @@
#include "engine/api/json_factory.hpp" #include "engine/api/json_factory.hpp"
#include "extractor/guidance/turn_instruction.hpp"
#include <boost/test/test_case_template.hpp> #include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>

View File

@ -216,7 +216,7 @@ class ContiguousInternalMemoryDataFacade<routing_algorithms::offline::Algorithm>
extractor::TravelMode GetTravelMode(const NodeID /*id*/) const override extractor::TravelMode GetTravelMode(const NodeID /*id*/) const override
{ {
return TRAVEL_MODE_DRIVING; return extractor::TRAVEL_MODE_DRIVING;
} }
std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate /*south_west*/, std::vector<RTreeLeaf> GetEdgesInBox(const util::Coordinate /*south_west*/,

View File

@ -199,7 +199,7 @@ class MockBaseDataFacade : public engine::datafacade::BaseDataFacade
extractor::TravelMode GetTravelMode(const NodeID /* id */) const override extractor::TravelMode GetTravelMode(const NodeID /* id */) const override
{ {
return TRAVEL_MODE_INACCESSIBLE; return extractor::TRAVEL_MODE_INACCESSIBLE;
} }
extractor::ClassData GetClassData(const NodeID /*id*/) const override final { return 0; } extractor::ClassData GetClassData(const NodeID /*id*/) const override final { return 0; }