Format with clang-format 3.8

This commit is contained in:
Patrick Niklaus
2016-05-27 21:05:04 +02:00
parent 21c47514da
commit 6e16eab6ec
202 changed files with 2485 additions and 1863 deletions
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include <algorithm>
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp"
@@ -38,12 +38,13 @@ IntersectionHandler::~IntersectionHandler() {}
std::size_t IntersectionHandler::countValid(const Intersection &intersection) const
{
return std::count_if(intersection.begin(), intersection.end(),
[](const ConnectedRoad &road) { return road.entry_allowed; });
return std::count_if(intersection.begin(), intersection.end(), [](const ConnectedRoad &road) {
return road.entry_allowed;
});
}
TurnType::Enum IntersectionHandler::findBasicTurnType(const EdgeID via_edge,
const ConnectedRoad &road) const
const ConnectedRoad &road) const
{
const auto &in_data = node_based_graph.GetEdgeData(via_edge);
@@ -94,9 +95,9 @@ TurnInstruction IntersectionHandler::getInstructionForObvious(const std::size_t
// obvious turn onto a through street is a merge
if (through_street)
{
return {TurnType::Merge, road.turn.angle > STRAIGHT_ANGLE
? DirectionModifier::SlightRight
: DirectionModifier::SlightLeft};
return {TurnType::Merge,
road.turn.angle > STRAIGHT_ANGLE ? DirectionModifier::SlightRight
: DirectionModifier::SlightLeft};
}
else
{
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_scenario_three_way.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp"
+30 -18
View File
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/motorway_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/guidance/toolkit.hpp"
@@ -233,8 +233,10 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
BOOST_ASSERT(!detail::isRampClass(intersection[1].turn.eid, node_based_graph));
intersection[1].turn.instruction =
getInstructionForObvious(intersection.size(), via_eid,
isThroughStreet(1, intersection), intersection[1]);
getInstructionForObvious(intersection.size(),
via_eid,
isThroughStreet(1, intersection),
intersection[1]);
}
else
{
@@ -275,8 +277,10 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
if (exiting_motorways == 2 && intersection.size() == 2)
{
intersection[1].turn.instruction =
getInstructionForObvious(intersection.size(), via_eid,
isThroughStreet(1, intersection), intersection[1]);
getInstructionForObvious(intersection.size(),
via_eid,
isThroughStreet(1, intersection),
intersection[1]);
util::SimpleLogger().Write(logDEBUG) << "Disabled U-Turn on a freeway";
intersection[0].entry_allowed = false; // UTURN on the freeway
}
@@ -329,7 +333,9 @@ Intersection MotorwayHandler::fromMotorway(const EdgeID via_eid, Intersection in
}
}
}
assignFork(via_eid, intersection[third_valid], intersection[second_valid],
assignFork(via_eid,
intersection[third_valid],
intersection[second_valid],
intersection[first_valid]);
}
else
@@ -389,8 +395,10 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
else // passing by the end of a motorway
{
intersection[1].turn.instruction =
getInstructionForObvious(intersection.size(), via_eid,
isThroughStreet(1, intersection), intersection[1]);
getInstructionForObvious(intersection.size(),
via_eid,
isThroughStreet(1, intersection),
intersection[1]);
}
}
else
@@ -414,8 +422,10 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
else // passing the end of a highway
{
intersection[2].turn.instruction =
getInstructionForObvious(intersection.size(), via_eid,
isThroughStreet(2, intersection), intersection[2]);
getInstructionForObvious(intersection.size(),
via_eid,
isThroughStreet(2, intersection),
intersection[2]);
}
}
}
@@ -472,8 +482,8 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
}
else if (detail::isMotorwayClass(edge_data.road_classification.road_class))
{
road.turn.instruction = {TurnType::Merge, passed_highway_entry
? DirectionModifier::SlightRight
road.turn.instruction = {TurnType::Merge,
passed_highway_entry ? DirectionModifier::SlightRight
: DirectionModifier::SlightLeft};
}
else
@@ -516,16 +526,18 @@ Intersection MotorwayHandler::fallback(Intersection intersection) const
road.turn.instruction = {type, DirectionModifier::Straight};
else
{
road.turn.instruction = {type, road.turn.angle > STRAIGHT_ANGLE
? DirectionModifier::SlightLeft
: DirectionModifier::SlightRight};
road.turn.instruction = {type,
road.turn.angle > STRAIGHT_ANGLE
? DirectionModifier::SlightLeft
: DirectionModifier::SlightRight};
}
}
else
{
road.turn.instruction = {type, road.turn.angle < STRAIGHT_ANGLE
? DirectionModifier::SlightLeft
: DirectionModifier::SlightRight};
road.turn.instruction = {type,
road.turn.angle < STRAIGHT_ANGLE
? DirectionModifier::SlightLeft
: DirectionModifier::SlightRight};
}
}
return intersection;
+41 -34
View File
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/roundabout_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "util/coordinate_calculation.hpp"
@@ -52,8 +52,11 @@ operator()(const NodeID from_nid, const EdgeID via_eid, Intersection intersectio
const auto flags = getRoundaboutFlags(from_nid, via_eid, intersection);
const auto roundabout_type = getRoundaboutType(node_based_graph.GetTarget(via_eid));
// find the radius of the roundabout
return handleRoundabouts(roundabout_type, via_eid, flags.on_roundabout,
flags.can_exit_separately, std::move(intersection));
return handleRoundabouts(roundabout_type,
via_eid,
flags.on_roundabout,
flags.can_exit_separately,
std::move(intersection));
}
detail::RoundaboutFlags RoundaboutHandler::getRoundaboutFlags(
@@ -169,9 +172,13 @@ bool RoundaboutHandler::qualifiesAsRoundaboutIntersection(
// there is a single non-roundabout edge
const auto src_coordinate = getCoordinate(node);
const auto next_coordinate = getRepresentativeCoordinate(
node, node_based_graph.GetTarget(edge), edge, edge_data.reversed,
compressed_edge_container, node_info_list);
const auto next_coordinate =
getRepresentativeCoordinate(node,
node_based_graph.GetTarget(edge),
edge,
edge_data.reversed,
compressed_edge_container,
node_info_list);
result.push_back(
util::coordinate_calculation::bearing(src_coordinate, next_coordinate));
break;
@@ -206,40 +213,40 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const
unsigned roundabout_name_id = 0;
std::unordered_set<unsigned> connected_names;
const auto getNextOnRoundabout = [this, &roundabout_name_id,
&connected_names](const NodeID node) {
EdgeID continue_edge = SPECIAL_EDGEID;
for (const auto edge : node_based_graph.GetAdjacentEdgeRange(node))
{
const auto &edge_data = node_based_graph.GetEdgeData(edge);
if (!edge_data.reversed && edge_data.roundabout)
const auto getNextOnRoundabout =
[this, &roundabout_name_id, &connected_names](const NodeID node) {
EdgeID continue_edge = SPECIAL_EDGEID;
for (const auto edge : node_based_graph.GetAdjacentEdgeRange(node))
{
if (SPECIAL_EDGEID != continue_edge)
const auto &edge_data = node_based_graph.GetEdgeData(edge);
if (!edge_data.reversed && edge_data.roundabout)
{
// fork in roundabout
return SPECIAL_EDGEID;
if (SPECIAL_EDGEID != continue_edge)
{
// fork in roundabout
return SPECIAL_EDGEID;
}
// roundabout does not keep its name
if (roundabout_name_id != 0 && roundabout_name_id != edge_data.name_id &&
requiresNameAnnounced(name_table.GetNameForID(roundabout_name_id),
name_table.GetNameForID(edge_data.name_id),
street_name_suffix_table))
{
return SPECIAL_EDGEID;
}
roundabout_name_id = edge_data.name_id;
continue_edge = edge;
}
// roundabout does not keep its name
if (roundabout_name_id != 0 && roundabout_name_id != edge_data.name_id &&
requiresNameAnnounced(name_table.GetNameForID(roundabout_name_id),
name_table.GetNameForID(edge_data.name_id),
street_name_suffix_table))
else if (!edge_data.roundabout)
{
return SPECIAL_EDGEID;
// remember all connected road names
connected_names.insert(edge_data.name_id);
}
roundabout_name_id = edge_data.name_id;
continue_edge = edge;
}
else if (!edge_data.roundabout)
{
// remember all connected road names
connected_names.insert(edge_data.name_id);
}
}
return continue_edge;
};
return continue_edge;
};
// the roundabout radius has to be the same for all locations we look at it from
// to guarantee this, we search the full roundabout for its vertices
// and select the three smalles ids
+6 -5
View File
@@ -1,5 +1,5 @@
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/turn_analysis.hpp"
#include "extractor/guidance/constants.hpp"
#include "util/coordinate.hpp"
#include "util/coordinate_calculation.hpp"
@@ -109,9 +109,9 @@ TurnAnalysis::setTurnTypes(const NodeID from_nid, const EdgeID, Intersection int
const EdgeID onto_edge = road.turn.eid;
const NodeID to_nid = node_based_graph.GetTarget(onto_edge);
road.turn.instruction = {TurnType::Turn, (from_nid == to_nid)
? DirectionModifier::UTurn
: getTurnDirection(road.turn.angle)};
road.turn.instruction = {TurnType::Turn,
(from_nid == to_nid) ? DirectionModifier::UTurn
: getTurnDirection(road.turn.angle)};
}
return intersection;
}
@@ -142,7 +142,8 @@ Intersection TurnAnalysis::handleSliproads(const EdgeID source_edge_id,
// Find the continuation of the intersection we're on
auto next_road = std::find_if(
intersection.begin(), intersection.end(),
intersection.begin(),
intersection.end(),
[this, source_edge_data](const ConnectedRoad &road) {
const auto road_edge_data = node_based_graph.GetEdgeData(road.turn.eid);
// Test to see if the source edge and the one we're looking at are the same road
@@ -52,10 +52,10 @@ classifyIntersection(NodeID nid,
turns.push_back({road.entry_allowed, bearing});
}
std::sort(turns.begin(), turns.end(),
[](const TurnPossibility left, const TurnPossibility right) {
return left.bearing < right.bearing;
});
std::sort(
turns.begin(), turns.end(), [](const TurnPossibility left, const TurnPossibility right) {
return left.bearing < right.bearing;
});
util::guidance::EntryClass entry_class;
util::guidance::BearingClass bearing_class;
@@ -81,7 +81,7 @@ classifyIntersection(NodeID nid,
std::size_t number = 0;
if (canBeDiscretized)
{
if(util::guidance::BearingClass::getDiscreteBearing(turns.back().bearing) <
if (util::guidance::BearingClass::getDiscreteBearing(turns.back().bearing) <
util::guidance::BearingClass::getDiscreteBearing(turns.front().bearing))
{
turns.insert(turns.begin(), turns.back());
+10 -6
View File
@@ -1,7 +1,7 @@
#include "extractor/guidance/turn_handler.hpp"
#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection_scenario_three_way.hpp"
#include "extractor/guidance/toolkit.hpp"
#include "extractor/guidance/turn_handler.hpp"
#include "util/guidance/toolkit.hpp"
@@ -257,9 +257,11 @@ Intersection TurnHandler::handleComplexTurn(const EdgeID via_edge, Intersection
// check whether the obvious choice is actually a through street
if (obvious_index != 0)
{
intersection[obvious_index].turn.instruction = getInstructionForObvious(
intersection.size(), via_edge, isThroughStreet(obvious_index, intersection),
intersection[obvious_index]);
intersection[obvious_index].turn.instruction =
getInstructionForObvious(intersection.size(),
via_edge,
isThroughStreet(obvious_index, intersection),
intersection[obvious_index]);
if (has_same_name_turn &&
node_based_graph.GetEdgeData(intersection[obvious_index].turn.eid).name_id !=
in_data.name_id &&
@@ -314,8 +316,10 @@ Intersection TurnHandler::handleComplexTurn(const EdgeID via_edge, Intersection
}
else if (fork_range.second - fork_range.first == 2)
{
assignFork(via_edge, intersection[fork_range.second],
intersection[fork_range.first + 1], intersection[fork_range.first]);
assignFork(via_edge,
intersection[fork_range.second],
intersection[fork_range.first + 1],
intersection[fork_range.first]);
}
// assign left/right turns
intersection = assignLeftTurns(via_edge, std::move(intersection), fork_range.second + 1);