Big Restructuring / Cleanup
This commit is contained in:
@@ -52,7 +52,7 @@ int Contractor::Run()
|
||||
#ifdef WIN32
|
||||
#pragma message("Memory consumption on Windows can be higher due to different bit packing")
|
||||
#else
|
||||
static_assert(sizeof(extractor::NodeBasedEdge) == 24,
|
||||
static_assert(sizeof(extractor::NodeBasedEdge) == 20,
|
||||
"changing extractor::NodeBasedEdge type has influence on memory consumption!");
|
||||
static_assert(sizeof(extractor::EdgeBasedEdge) == 16,
|
||||
"changing EdgeBasedEdge type has influence on memory consumption!");
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
using TurnType = osrm::extractor::guidance::TurnType;
|
||||
using DirectionModifier = osrm::extractor::guidance::DirectionModifier;
|
||||
using TurnInstruction = osrm::extractor::guidance::TurnInstruction;
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
@@ -24,14 +28,36 @@ namespace json
|
||||
namespace detail
|
||||
{
|
||||
|
||||
std::string instructionTypeToString(guidance::TurnType type)
|
||||
const constexpr char *modifier_names[] = {"uturn", "sharp right", "right", "slight right",
|
||||
"straight", "slight left", "left", "sharp left"};
|
||||
|
||||
// translations of TurnTypes. Not all types are exposed to the outside world.
|
||||
// invalid types should never be returned as part of the API
|
||||
const constexpr char *turn_type_names[] = {
|
||||
"invalid", "no turn", "waypoint", "invalid", "new name", "continue",
|
||||
"turn", "merge", "ramp", "fork", "end of road", "roundabout",
|
||||
"invalid", "roundabout", "invalid", "traffic circle", "invalid", "traffic circle",
|
||||
"invalid", "invalid", "restriction", "notification"};
|
||||
|
||||
// Check whether to include a modifier in the result of the API
|
||||
inline bool isValidModifier(const TurnType type,
|
||||
const DirectionModifier modifier)
|
||||
{
|
||||
return guidance::turn_type_names[static_cast<std::size_t>(type)];
|
||||
if (type == TurnType::Location && modifier != DirectionModifier::Left &&
|
||||
modifier != DirectionModifier::Straight &&
|
||||
modifier != DirectionModifier::Right)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string instructionModifierToString(guidance::DirectionModifier modifier)
|
||||
std::string instructionTypeToString(TurnType type)
|
||||
{
|
||||
return guidance::modifier_names[static_cast<std::size_t>(modifier)];
|
||||
return turn_type_names[static_cast<std::size_t>(type)];
|
||||
}
|
||||
|
||||
std::string instructionModifierToString(DirectionModifier modifier)
|
||||
{
|
||||
return modifier_names[static_cast<std::size_t>(modifier)];
|
||||
}
|
||||
|
||||
util::json::Array coordinateToLonLat(const util::Coordinate coordinate)
|
||||
@@ -100,9 +126,9 @@ util::json::Object makeStepManeuver(const guidance::StepManeuver &maneuver)
|
||||
{
|
||||
util::json::Object step_maneuver;
|
||||
step_maneuver.values["type"] = detail::instructionTypeToString(maneuver.instruction.type);
|
||||
if( guidance::isValidModifier( maneuver.instruction.type, maneuver.instruction.direction_modifier ) )
|
||||
step_maneuver.values["modifier"] =
|
||||
detail::instructionModifierToString(maneuver.instruction.direction_modifier);
|
||||
if (detail::isValidModifier(maneuver.instruction.type, maneuver.instruction.direction_modifier))
|
||||
step_maneuver.values["modifier"] =
|
||||
detail::instructionModifierToString(maneuver.instruction.direction_modifier);
|
||||
step_maneuver.values["location"] = detail::coordinateToLonLat(maneuver.location);
|
||||
step_maneuver.values["bearing_before"] = maneuver.bearing_before;
|
||||
step_maneuver.values["bearing_after"] = maneuver.bearing_after;
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "engine/guidance/classification_data.hpp"
|
||||
|
||||
#include <osmium/osm.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
{
|
||||
namespace guidance
|
||||
{
|
||||
void RoadClassificationData::invalidate() { road_class = FunctionalRoadClass::UNKNOWN; }
|
||||
|
||||
void RoadClassificationData::augment(const osmium::Way &way)
|
||||
{
|
||||
const char *data = way.get_value_by_key("highway");
|
||||
if (data)
|
||||
road_class = functionalRoadClassFromTag(data);
|
||||
}
|
||||
} // namespace guidance
|
||||
} // namespace engine
|
||||
} // namespace osrm
|
||||
@@ -1,10 +1,15 @@
|
||||
#include "engine/guidance/post_processing.hpp"
|
||||
#include "engine/guidance/turn_instruction.hpp"
|
||||
#include "engine/guidance/guidance_toolkit.hpp"
|
||||
#include "extractor/guidance/turn_instruction.hpp"
|
||||
|
||||
#include "engine/guidance/toolkit.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <iostream>
|
||||
|
||||
using TurnInstruction = osrm::extractor::guidance::TurnInstruction;
|
||||
using TurnType = osrm::extractor::guidance::TurnType;
|
||||
using DirectionModifier = osrm::extractor::guidance::DirectionModifier;
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace engine
|
||||
@@ -118,10 +123,11 @@ std::vector<std::vector<PathData>> postProcess(std::vector<std::vector<PathData>
|
||||
{
|
||||
if (!on_roundabout)
|
||||
{
|
||||
BOOST_ASSERT(leg_data[0][0].turn_instruction.type == TurnInstruction::NO_TURN());
|
||||
if (path_data[data_index].turn_instruction.type == ExitRoundabout)
|
||||
BOOST_ASSERT(leg_data[0][0].turn_instruction.type ==
|
||||
TurnInstruction::NO_TURN());
|
||||
if (path_data[data_index].turn_instruction.type == TurnType::ExitRoundabout)
|
||||
leg_data[0][0].turn_instruction.type = TurnType::EnterRoundabout;
|
||||
if (path_data[data_index].turn_instruction.type == ExitRotary)
|
||||
if (path_data[data_index].turn_instruction.type == TurnType::ExitRotary)
|
||||
leg_data[0][0].turn_instruction.type = TurnType::EnterRotary;
|
||||
path_data[data_index].exit += 1;
|
||||
}
|
||||
|
||||
@@ -140,9 +140,9 @@ InternalRouteResult TripPlugin::ComputeRoute(const std::vector<PhantomNode> &sna
|
||||
{
|
||||
uturns.resize(trip.size() + 1);
|
||||
std::transform(trip.begin(), trip.end(), uturns.begin(), [¶meters](const NodeID idx)
|
||||
{
|
||||
return parameters.uturns[idx];
|
||||
});
|
||||
{
|
||||
return parameters.uturns[idx];
|
||||
});
|
||||
BOOST_ASSERT(uturns.size() > 0);
|
||||
uturns.back() = parameters.uturns[trip.front()];
|
||||
}
|
||||
@@ -248,9 +248,9 @@ Status TripPlugin::HandleRequest(const api::TripParameters ¶meters,
|
||||
for (const auto &trip : trips)
|
||||
{
|
||||
routes.push_back(ComputeRoute(snapped_phantoms, parameters, trip));
|
||||
ordered_coordinates.push_back( std::vector<util::Coordinate>() );
|
||||
for( const auto nid : trip )
|
||||
ordered_coordinates.back().push_back( parameters.coordinates[nid] );
|
||||
ordered_coordinates.push_back(std::vector<util::Coordinate>());
|
||||
for (const auto nid : trip)
|
||||
ordered_coordinates.back().push_back(parameters.coordinates[nid]);
|
||||
}
|
||||
|
||||
api::TripAPI trip_api{BasePlugin::facade, parameters};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "extractor/edge_based_edge.hpp"
|
||||
#include "extractor/edge_based_graph_factory.hpp"
|
||||
#include "extractor/turn_analysis.hpp"
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
#include "util/percent.hpp"
|
||||
@@ -10,8 +9,7 @@
|
||||
#include "util/timing_util.hpp"
|
||||
#include "util/exception.hpp"
|
||||
|
||||
#include "engine/guidance/turn_classification.hpp"
|
||||
#include "engine/guidance/guidance_toolkit.hpp"
|
||||
#include "extractor/guidance/toolkit.hpp"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/numeric/conversion/cast.hpp>
|
||||
@@ -307,56 +305,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
// Three nested loop look super-linear, but we are dealing with a (kind of)
|
||||
// linear number of turns only.
|
||||
util::Percent progress(m_node_based_graph->GetNumberOfNodes());
|
||||
|
||||
struct CompareTurnPossibilities
|
||||
{
|
||||
bool operator()(const std::vector<engine::guidance::TurnPossibility> &left,
|
||||
const std::vector<engine::guidance::TurnPossibility> &right) const
|
||||
{
|
||||
if (left.size() < right.size())
|
||||
return true;
|
||||
if (left.size() > right.size())
|
||||
return false;
|
||||
for (std::size_t i = 0; i < left.size(); ++i)
|
||||
{
|
||||
if ((((int)left[i].angle + 16) % 256) / 32 <
|
||||
(((int)right[i].angle + 16) % 256) / 32)
|
||||
return true;
|
||||
if ((((int)left[i].angle + 16) % 256) / 32 >
|
||||
(((int)right[i].angle + 16) % 256) / 32)
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// temporary switch to allow display of turn types
|
||||
#define SHOW_TURN_TYPES 0
|
||||
#if SHOW_TURN_TYPES
|
||||
std::map<std::vector<engine::guidance::TurnPossibility>,
|
||||
std::vector<util::FixedPointCoordinate>, CompareTurnPossibilities> turn_types;
|
||||
#endif
|
||||
|
||||
for (const auto node_u : util::irange(0u, m_node_based_graph->GetNumberOfNodes()))
|
||||
{
|
||||
#if SHOW_TURN_TYPES
|
||||
auto turn_possibilities = classifyIntersection(
|
||||
node_u, *m_node_based_graph, m_compressed_edge_container, m_node_info_list);
|
||||
if (turn_possibilities.empty())
|
||||
continue;
|
||||
auto set = turn_types.find(turn_possibilities);
|
||||
if (set != turn_types.end())
|
||||
{
|
||||
if (set->second.size() < 5)
|
||||
set->second.emplace_back(m_node_info_list[node_u].lat,
|
||||
m_node_info_list[node_u].lon);
|
||||
}
|
||||
else
|
||||
{
|
||||
turn_types[turn_possibilities] = std::vector<util::FixedPointCoordinate>(
|
||||
1, {m_node_info_list[node_u].lat, m_node_info_list[node_u].lon});
|
||||
}
|
||||
#endif
|
||||
// progress.printStatus(node_u);
|
||||
for (const EdgeID edge_from_u : m_node_based_graph->GetAdjacentEdgeRange(node_u))
|
||||
{
|
||||
@@ -366,8 +316,9 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
}
|
||||
|
||||
++node_based_edge_counter;
|
||||
auto turn_candidates = turn_analysis::getTurns(node_u, edge_from_u, m_node_based_graph, m_node_info_list, m_restriction_map, m_barrier_nodes,
|
||||
m_compressed_edge_container);
|
||||
auto turn_candidates = guidance::getTurns(
|
||||
node_u, edge_from_u, m_node_based_graph, m_node_info_list, m_restriction_map,
|
||||
m_barrier_nodes, m_compressed_edge_container);
|
||||
|
||||
const NodeID node_v = m_node_based_graph->GetTarget(edge_from_u);
|
||||
|
||||
@@ -396,7 +347,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
const int turn_penalty = GetTurnPenalty(turn_angle, lua_state);
|
||||
const auto turn_instruction = turn.instruction;
|
||||
|
||||
if (isUturn(turn_instruction))
|
||||
if (guidance::isUturn(turn_instruction))
|
||||
{
|
||||
distance += speed_profile.u_turn_penalty;
|
||||
}
|
||||
@@ -471,21 +422,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
}
|
||||
}
|
||||
}
|
||||
#if SHOW_TURN_TYPES
|
||||
std::cout << "[info] found " << turn_types.size() << " turn types." << std::endl;
|
||||
for (const auto &tt : turn_types)
|
||||
{
|
||||
std::cout << tt.second.size();
|
||||
for (auto coord : tt.second)
|
||||
std::cout << " " << coord.lat << " " << coord.lon;
|
||||
|
||||
std::cout << " " << tt.first.size();
|
||||
for (auto tte : tt.first)
|
||||
std::cout << " " << (int)tte.angle;
|
||||
|
||||
std::cout << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
FlushVectorToStream(edge_data_file, original_edge_data_vector);
|
||||
|
||||
|
||||
@@ -188,7 +188,6 @@ int Extractor::run()
|
||||
local_state, "way_function",
|
||||
boost::cref(static_cast<const osmium::Way &>(*entity)),
|
||||
boost::ref(result_way));
|
||||
result_way.road_classification_data.augment(static_cast<const osmium::Way &>(*entity));
|
||||
resulting_ways.push_back(std::make_pair(x, result_way));
|
||||
break;
|
||||
case osmium::item_type::relation:
|
||||
|
||||
@@ -128,6 +128,14 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME this need to be moved into the profiles
|
||||
const char *data = input_way.get_value_by_key("highway");
|
||||
guidance::RoadClassificationData road_classification;
|
||||
if (data)
|
||||
{
|
||||
road_classification.road_class = guidance::functionalRoadClassFromTag(data);
|
||||
}
|
||||
|
||||
// Get the unique identifier for the street name
|
||||
const auto &string_map_iterator = string_map.find(parsed_way.name);
|
||||
unsigned name_id = external_memory.name_lengths.size();
|
||||
@@ -173,7 +181,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
||||
name_id, backward_weight_data, true, false,
|
||||
parsed_way.roundabout, parsed_way.is_access_restricted,
|
||||
parsed_way.is_startpoint, parsed_way.backward_travel_mode,
|
||||
false,parsed_way.road_classification_data));
|
||||
false, road_classification));
|
||||
});
|
||||
|
||||
external_memory.way_start_end_id_list.push_back(
|
||||
@@ -193,7 +201,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
||||
name_id, forward_weight_data, true, !forward_only,
|
||||
parsed_way.roundabout, parsed_way.is_access_restricted,
|
||||
parsed_way.is_startpoint, parsed_way.forward_travel_mode,
|
||||
split_edge,parsed_way.road_classification_data));
|
||||
split_edge, road_classification));
|
||||
});
|
||||
if (split_edge)
|
||||
{
|
||||
@@ -206,7 +214,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti
|
||||
OSMNodeID(first_node.ref()), OSMNodeID(last_node.ref()), name_id,
|
||||
backward_weight_data, false, true, parsed_way.roundabout,
|
||||
parsed_way.is_access_restricted, parsed_way.is_startpoint,
|
||||
parsed_way.backward_travel_mode, true,parsed_way.road_classification_data));
|
||||
parsed_way.backward_travel_mode, true, road_classification));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "extractor/turn_analysis.hpp"
|
||||
#include "extractor/guidance/turn_analysis.hpp"
|
||||
|
||||
#include "util/simple_logger.hpp"
|
||||
|
||||
@@ -8,8 +8,7 @@ namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
{
|
||||
|
||||
namespace turn_analysis
|
||||
namespace guidance
|
||||
{
|
||||
// configuration of turn classification
|
||||
const bool constexpr INVERT = true;
|
||||
@@ -29,26 +28,6 @@ const unsigned constexpr INVALID_NAME_ID = 0;
|
||||
|
||||
using EdgeData = util::NodeBasedDynamicGraph::EdgeData;
|
||||
|
||||
using engine::guidance::TurnPossibility;
|
||||
using engine::guidance::TurnInstruction;
|
||||
using engine::guidance::DirectionModifier;
|
||||
using engine::guidance::TurnType;
|
||||
using engine::guidance::FunctionalRoadClass;
|
||||
|
||||
using engine::guidance::classifyIntersection;
|
||||
using engine::guidance::isLowPriorityRoadClass;
|
||||
using engine::guidance::angularDeviation;
|
||||
using engine::guidance::getTurnDirection;
|
||||
using engine::guidance::getRepresentativeCoordinate;
|
||||
using engine::guidance::isBasic;
|
||||
using engine::guidance::isRampClass;
|
||||
using engine::guidance::isUturn;
|
||||
using engine::guidance::isConflict;
|
||||
using engine::guidance::isSlightTurn;
|
||||
using engine::guidance::isSlightModifier;
|
||||
using engine::guidance::mirrorDirectionModifier;
|
||||
using engine::guidance::canBeSuppressed;
|
||||
|
||||
#define PRINT_DEBUG_CANDIDATES 0
|
||||
std::vector<TurnCandidate>
|
||||
getTurns(const NodeID from,
|
||||
@@ -419,7 +398,8 @@ handleFromMotorway(const NodeID from,
|
||||
if (candidate.valid)
|
||||
{
|
||||
BOOST_ASSERT(isRampClass(candidate.eid, node_based_graph));
|
||||
candidate.instruction = TurnInstruction::SUPPRESSED(getTurnDirection(candidate.angle));
|
||||
candidate.instruction =
|
||||
TurnInstruction::SUPPRESSED(getTurnDirection(candidate.angle));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -447,27 +427,26 @@ handleFromMotorway(const NodeID from,
|
||||
if (candidate.angle == continue_angle)
|
||||
{
|
||||
if (continues)
|
||||
candidate.instruction = TurnInstruction::SUPPRESSED(DirectionModifier::Straight);
|
||||
candidate.instruction =
|
||||
TurnInstruction::SUPPRESSED(DirectionModifier::Straight);
|
||||
else // TODO handle turn direction correctly
|
||||
candidate.instruction = {TurnType::Merge, DirectionModifier::Straight};
|
||||
}
|
||||
else if (candidate.angle < continue_angle)
|
||||
{
|
||||
BOOST_ASSERT(isRampClass(node_based_graph->GetEdgeData(candidate.eid)
|
||||
.road_classification.road_class));
|
||||
candidate.instruction = {TurnType::Ramp,
|
||||
(candidate.angle < 145)
|
||||
? DirectionModifier::Right
|
||||
: DirectionModifier::SlightRight};
|
||||
candidate.instruction = {
|
||||
isRampClass(candidate.eid, node_based_graph) ? TurnType::Ramp
|
||||
: TurnType::Turn,
|
||||
(candidate.angle < 145) ? DirectionModifier::Right
|
||||
: DirectionModifier::SlightRight};
|
||||
}
|
||||
else if (candidate.angle > continue_angle)
|
||||
{
|
||||
BOOST_ASSERT(isRampClass(node_based_graph->GetEdgeData(candidate.eid)
|
||||
.road_classification.road_class));
|
||||
candidate.instruction = {TurnType::Ramp,
|
||||
(candidate.angle > 215)
|
||||
? DirectionModifier::Left
|
||||
: DirectionModifier::SlightLeft};
|
||||
candidate.instruction = {
|
||||
isRampClass(candidate.eid, node_based_graph) ? TurnType::Ramp
|
||||
: TurnType::Turn,
|
||||
(candidate.angle > 215) ? DirectionModifier::Left
|
||||
: DirectionModifier::SlightLeft};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -633,7 +612,8 @@ handleMotorwayJunction(const NodeID from,
|
||||
const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph)
|
||||
{
|
||||
(void)from;
|
||||
BOOST_ASSERT(!turn_candidates[0].valid);
|
||||
// BOOST_ASSERT(!turn_candidates[0].valid); //This fails due to @themarex handling of dead end
|
||||
// streets
|
||||
const auto &in_data = node_based_graph->GetEdgeData(via_edge);
|
||||
|
||||
// coming from motorway
|
||||
@@ -766,6 +746,7 @@ handleOneWayTurn(const NodeID from,
|
||||
std::vector<TurnCandidate> turn_candidates,
|
||||
const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph)
|
||||
{
|
||||
BOOST_ASSERT(turn_candidates[0].angle < 0.001);
|
||||
(void)from, (void)via_edge, (void)node_based_graph;
|
||||
if (!turn_candidates[0].valid)
|
||||
{
|
||||
@@ -773,8 +754,6 @@ handleOneWayTurn(const NodeID from,
|
||||
<< "Graph Broken. Dead end without exit found or missing reverse edge.";
|
||||
}
|
||||
|
||||
BOOST_ASSERT(turn_candidates[0].instruction.type == TurnType::Turn &&
|
||||
turn_candidates[0].instruction.direction_modifier == DirectionModifier::UTurn);
|
||||
#if PRINT_DEBUG_CANDIDATES
|
||||
std::cout << "Basic (one) Turn Candidates:\n";
|
||||
for (auto tc : turn_candidates)
|
||||
@@ -791,8 +770,7 @@ handleTwoWayTurn(const NodeID from,
|
||||
std::vector<TurnCandidate> turn_candidates,
|
||||
const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph)
|
||||
{
|
||||
BOOST_ASSERT(turn_candidates[0].instruction.type == TurnType::Turn &&
|
||||
turn_candidates[0].instruction.direction_modifier == DirectionModifier::UTurn);
|
||||
BOOST_ASSERT(turn_candidates[0].angle < 0.001);
|
||||
|
||||
turn_candidates[1].instruction =
|
||||
getInstructionForObvious(from, via_edge, turn_candidates[1], node_based_graph);
|
||||
@@ -813,6 +791,7 @@ handleThreeWayTurn(const NodeID from,
|
||||
std::vector<TurnCandidate> turn_candidates,
|
||||
const std::shared_ptr<const util::NodeBasedDynamicGraph> node_based_graph)
|
||||
{
|
||||
BOOST_ASSERT(turn_candidates[0].angle < 0.001);
|
||||
const auto isObviousOfTwo = [](const TurnCandidate turn, const TurnCandidate other)
|
||||
{
|
||||
return (angularDeviation(turn.angle, STRAIGHT_ANGLE) < NARROW_TURN_ANGLE &&
|
||||
@@ -971,7 +950,8 @@ handleThreeWayTurn(const NodeID from,
|
||||
{
|
||||
if (isObviousOfTwo(turn_candidates[1], turn_candidates[2]))
|
||||
{
|
||||
turn_candidates[1].instruction = TurnInstruction::SUPPRESSED(DirectionModifier::Straight);
|
||||
turn_candidates[1].instruction =
|
||||
TurnInstruction::SUPPRESSED(DirectionModifier::Straight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -988,7 +968,8 @@ handleThreeWayTurn(const NodeID from,
|
||||
{
|
||||
if (isObviousOfTwo(turn_candidates[2], turn_candidates[1]))
|
||||
{
|
||||
turn_candidates[2].instruction = TurnInstruction::SUPPRESSED(DirectionModifier::Straight);
|
||||
turn_candidates[2].instruction =
|
||||
TurnInstruction::SUPPRESSED(DirectionModifier::Straight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1199,8 +1180,7 @@ optimizeCandidates(const EdgeID via_eid,
|
||||
for (std::size_t turn_index = 0; turn_index < turn_candidates.size(); ++turn_index)
|
||||
{
|
||||
auto &turn = turn_candidates[turn_index];
|
||||
if (!isBasic(turn.instruction.type) || isUturn(turn.instruction) ||
|
||||
isOnRoundabout(turn.instruction))
|
||||
if (!isBasic(turn.instruction.type) || isUturn(turn.instruction))
|
||||
continue;
|
||||
auto &left = turn_candidates[getLeft(turn_index)];
|
||||
if (turn.angle == left.angle)
|
||||
@@ -1393,8 +1373,7 @@ bool isObviousChoice(const EdgeID via_eid,
|
||||
node_based_graph->GetEdgeData(candidate.eid).road_classification.road_class))
|
||||
{
|
||||
bool is_only_normal_road = true;
|
||||
BOOST_ASSERT(turn_candidates[0].instruction.type == TurnType::Turn &&
|
||||
turn_candidates[0].instruction.direction_modifier == DirectionModifier::UTurn);
|
||||
// TODO find out why this can also be reached for non-u-turns
|
||||
for (size_t i = 0; i < turn_candidates.size(); ++i)
|
||||
{
|
||||
if (i == turn_index || turn_candidates[i].angle == 0) // skip self and u-turn
|
||||
@@ -1554,7 +1533,7 @@ suppressTurns(const EdgeID via_eid,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (engine::guidance::canBeSuppressed(candidate.instruction.type))
|
||||
if (canBeSuppressed(candidate.instruction.type))
|
||||
candidate.instruction.type = TurnType::NewName;
|
||||
}
|
||||
}
|
||||
@@ -1841,21 +1820,20 @@ handleConflicts(const NodeID from,
|
||||
(void)from;
|
||||
(void)via_edge;
|
||||
(void)node_based_graph;
|
||||
const auto isConflict = []( const TurnCandidate &left, const TurnCandidate &right )
|
||||
const auto isConflict = [](const TurnCandidate &left, const TurnCandidate &right)
|
||||
{
|
||||
// most obvious, same instructions conflict
|
||||
if( left.instruction == right.instruction )
|
||||
return true;
|
||||
if (left.instruction == right.instruction)
|
||||
return true;
|
||||
|
||||
return left.instruction.direction_modifier != DirectionModifier::UTurn &&
|
||||
left.instruction.direction_modifier == right.instruction.direction_modifier;
|
||||
};
|
||||
|
||||
|
||||
return turn_candidates;
|
||||
}
|
||||
|
||||
} // anemspace detail
|
||||
} // namespace turn_analysis
|
||||
} // namespace guidance
|
||||
} // namespace extractor
|
||||
} // namespace osrm
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "util/static_rtree.hpp"
|
||||
#include "engine/datafacade/datafacade_base.hpp"
|
||||
#include "extractor/travel_mode.hpp"
|
||||
#include "engine/guidance/turn_instruction.hpp"
|
||||
#include "extractor/guidance/turn_instruction.hpp"
|
||||
#include "storage/storage.hpp"
|
||||
#include "storage/shared_datatype.hpp"
|
||||
#include "storage/shared_barriers.hpp"
|
||||
@@ -225,7 +225,7 @@ int Storage::Run()
|
||||
number_of_original_edges);
|
||||
shared_layout_ptr->SetBlockSize<extractor::TravelMode>(SharedDataLayout::TRAVEL_MODE,
|
||||
number_of_original_edges);
|
||||
shared_layout_ptr->SetBlockSize<engine::guidance::TurnInstruction>(
|
||||
shared_layout_ptr->SetBlockSize<extractor::guidance::TurnInstruction>(
|
||||
SharedDataLayout::TURN_INSTRUCTION, number_of_original_edges);
|
||||
|
||||
boost::filesystem::ifstream hsgr_input_stream(hsgr_path, std::ios::binary);
|
||||
@@ -390,8 +390,8 @@ int Storage::Run()
|
||||
shared_layout_ptr->GetBlockPtr<extractor::TravelMode, true>(shared_memory_ptr,
|
||||
SharedDataLayout::TRAVEL_MODE);
|
||||
|
||||
engine::guidance::TurnInstruction *turn_instructions_ptr =
|
||||
shared_layout_ptr->GetBlockPtr<engine::guidance::TurnInstruction, true>(
|
||||
extractor::guidance::TurnInstruction *turn_instructions_ptr =
|
||||
shared_layout_ptr->GetBlockPtr<extractor::guidance::TurnInstruction, true>(
|
||||
shared_memory_ptr, SharedDataLayout::TURN_INSTRUCTION);
|
||||
|
||||
extractor::OriginalEdgeData current_edge_data;
|
||||
|
||||
@@ -260,10 +260,11 @@ double computeAngle(const Coordinate first, const Coordinate second, const Coord
|
||||
Coordinate interpolateLinear(double factor, const Coordinate from, const Coordinate to)
|
||||
{
|
||||
BOOST_ASSERT(0 <= factor && factor <= 1.0);
|
||||
return {from.lon + toFixed(FloatLongitude(
|
||||
factor * static_cast<double>(toFloating(to.lon - from.lon)))),
|
||||
from.lat + toFixed(FloatLatitude(
|
||||
factor * static_cast<double>(toFloating(to.lat - from.lat))))};
|
||||
return {
|
||||
from.lon +
|
||||
toFixed(FloatLongitude(factor * static_cast<double>(toFloating(to.lon - from.lon)))),
|
||||
from.lat +
|
||||
toFixed(FloatLatitude(factor * static_cast<double>(toFloating(to.lat - from.lat))))};
|
||||
}
|
||||
|
||||
namespace mercator
|
||||
|
||||
Reference in New Issue
Block a user