Implement Turn Lane Api
This commit is contained in:
@@ -35,7 +35,7 @@ inline void printTurnAssignmentData(const NodeID at,
|
||||
for (const auto &road)
|
||||
std::cout << "\t" << toString(road) << "\n";
|
||||
|
||||
//flushes as well
|
||||
// flushes as well
|
||||
print(turn_lane_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ struct TurnOperation final
|
||||
EdgeID eid;
|
||||
double angle;
|
||||
TurnInstruction instruction;
|
||||
LaneDataID lane_data_id;
|
||||
};
|
||||
|
||||
// A Connected Road is the internal representation of a potential turn. Internally, we require
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include "extractor/guidance/intersection.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
#include "extractor/restriction_map.hpp"
|
||||
#include "util/name_table.hpp"
|
||||
#include "util/node_based_graph.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
#include "util/name_table.hpp"
|
||||
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include "util/coordinate.hpp"
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
#include "util/guidance/toolkit.hpp"
|
||||
#include "util/guidance/turn_lanes.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
#include "extractor/compressed_edge_container.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
@@ -20,10 +22,12 @@
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@@ -32,6 +36,9 @@ namespace extractor
|
||||
namespace guidance
|
||||
{
|
||||
|
||||
using util::guidance::LaneTupelIdPair;
|
||||
using LaneDataIdMap = std::unordered_map<LaneTupelIdPair, LaneDataID, boost::hash<LaneTupelIdPair>>;
|
||||
|
||||
using util::guidance::angularDeviation;
|
||||
|
||||
namespace detail
|
||||
|
||||
@@ -51,7 +51,7 @@ class TurnAnalysis
|
||||
std::vector<TurnOperation>
|
||||
transformIntersectionIntoTurns(const Intersection &intersection) const;
|
||||
|
||||
const IntersectionGenerator& getGenerator() const;
|
||||
const IntersectionGenerator &getGenerator() const;
|
||||
|
||||
private:
|
||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||
|
||||
@@ -77,16 +77,14 @@ struct TurnInstruction
|
||||
{
|
||||
using LaneTupel = util::guidance::LaneTupel;
|
||||
TurnInstruction(const TurnType::Enum type = TurnType::Invalid,
|
||||
const DirectionModifier::Enum direction_modifier = DirectionModifier::Straight,
|
||||
const LaneTupel lane_tupel = {0, INVALID_LANEID})
|
||||
: type(type), direction_modifier(direction_modifier), lane_tupel(lane_tupel)
|
||||
const DirectionModifier::Enum direction_modifier = DirectionModifier::UTurn)
|
||||
: type(type), direction_modifier(direction_modifier)
|
||||
{
|
||||
}
|
||||
|
||||
TurnType::Enum type : 5;
|
||||
DirectionModifier::Enum direction_modifier : 3;
|
||||
// the lane tupel that is used for the turn
|
||||
LaneTupel lane_tupel;
|
||||
|
||||
static TurnInstruction INVALID() { return {TurnType::Invalid, DirectionModifier::UTurn}; }
|
||||
|
||||
@@ -147,18 +145,16 @@ struct TurnInstruction
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(sizeof(TurnInstruction) == 3, "TurnInstruction does not fit three byte");
|
||||
static_assert(sizeof(TurnInstruction) == 1, "TurnInstruction does not fit a byte");
|
||||
|
||||
inline bool operator!=(const TurnInstruction lhs, const TurnInstruction rhs)
|
||||
{
|
||||
return lhs.type != rhs.type || lhs.direction_modifier != rhs.direction_modifier ||
|
||||
lhs.lane_tupel != rhs.lane_tupel;
|
||||
return lhs.type != rhs.type || lhs.direction_modifier != rhs.direction_modifier;
|
||||
}
|
||||
|
||||
inline bool operator==(const TurnInstruction lhs, const TurnInstruction rhs)
|
||||
{
|
||||
return lhs.type == rhs.type && lhs.direction_modifier == rhs.direction_modifier &&
|
||||
lhs.lane_tupel == rhs.lane_tupel;
|
||||
return lhs.type == rhs.type && lhs.direction_modifier == rhs.direction_modifier;
|
||||
}
|
||||
|
||||
} // namespace guidance
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_HANDLER_HPP_
|
||||
|
||||
#include "extractor/guidance/intersection.hpp"
|
||||
#include "extractor/guidance/toolkit.hpp"
|
||||
#include "extractor/guidance/turn_analysis.hpp"
|
||||
#include "extractor/guidance/turn_lane_data.hpp"
|
||||
#include "extractor/query_node.hpp"
|
||||
@@ -13,7 +14,6 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@@ -38,13 +38,12 @@ class TurnLaneHandler
|
||||
const std::vector<QueryNode> &node_info_list,
|
||||
const TurnAnalysis &turn_analysis);
|
||||
|
||||
Intersection
|
||||
assignTurnLanes(const NodeID at, const EdgeID via_edge, Intersection intersection) const;
|
||||
Intersection assignTurnLanes(const NodeID at,
|
||||
const EdgeID via_edge,
|
||||
Intersection intersection,
|
||||
LaneDataIdMap &id_map) const;
|
||||
|
||||
private:
|
||||
using LaneTupel = util::guidance::LaneTupel;
|
||||
std::unordered_map<LaneTupel, std::uint16_t> lane_tupels;
|
||||
|
||||
// we need to be able to look at previous intersections to, in some cases, find the correct turn
|
||||
// lanes for a turn
|
||||
const util::NodeBasedDynamicGraph &node_based_graph;
|
||||
@@ -58,7 +57,9 @@ class TurnLaneHandler
|
||||
|
||||
// in case of a simple intersection, assign the lane entries
|
||||
Intersection simpleMatchTuplesToTurns(Intersection intersection,
|
||||
const LaneDataVector &lane_data) const;
|
||||
const LaneDataVector &lane_data,
|
||||
const LaneStringID lane_string_id,
|
||||
LaneDataIdMap &id_map) const;
|
||||
|
||||
// partition lane data into lane data relevant at current turn and at next turn
|
||||
std::pair<TurnLaneHandler::LaneDataVector, TurnLaneHandler::LaneDataVector> partitionLaneData(
|
||||
@@ -68,7 +69,8 @@ class TurnLaneHandler
|
||||
// intersection whose turns might be related to this current intersection
|
||||
Intersection handleTurnAtPreviousIntersection(const NodeID at,
|
||||
const EdgeID via_edge,
|
||||
Intersection intersection) const;
|
||||
Intersection intersection,
|
||||
LaneDataIdMap &id_map) const;
|
||||
};
|
||||
|
||||
} // namespace lanes
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
#define OSRM_EXTRACTOR_GUIDANCE_TURN_LANE_MATCHER_HPP_
|
||||
|
||||
#include "extractor/guidance/intersection.hpp"
|
||||
#include "extractor/guidance/toolkit.hpp"
|
||||
#include "extractor/guidance/turn_instruction.hpp"
|
||||
#include "extractor/guidance/turn_lane_data.hpp"
|
||||
|
||||
#include "util/guidance/turn_lanes.hpp"
|
||||
#include "util/node_based_graph.hpp"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
@@ -44,7 +47,9 @@ bool canMatchTrivially(const Intersection &intersection, const LaneDataVector &l
|
||||
// perform a trivial match on the turn lanes
|
||||
Intersection triviallyMatchLanesToTurns(Intersection intersection,
|
||||
const LaneDataVector &lane_data,
|
||||
const util::NodeBasedDynamicGraph &node_based_graph);
|
||||
const util::NodeBasedDynamicGraph &node_based_graph,
|
||||
const LaneStringID lane_string_id,
|
||||
LaneDataIdMap &lane_data_to_id);
|
||||
|
||||
} // namespace lanes
|
||||
} // namespace guidance
|
||||
|
||||
Reference in New Issue
Block a user