wip
This commit is contained in:
@@ -70,6 +70,7 @@ class EdgeBasedGraphFactory
|
||||
const CompressedEdgeContainer &compressed_edge_container,
|
||||
const std::unordered_set<NodeID> &barrier_nodes,
|
||||
const TrafficSignals &traffic_signals,
|
||||
const StopSigns &stop_signs,
|
||||
const std::vector<util::Coordinate> &coordinates,
|
||||
const NameTable &name_table,
|
||||
const std::unordered_set<EdgeID> &segregated_edges,
|
||||
@@ -136,6 +137,8 @@ class EdgeBasedGraphFactory
|
||||
|
||||
const std::unordered_set<NodeID> &m_barrier_nodes;
|
||||
const TrafficSignals &m_traffic_signals;
|
||||
const StopSigns &m_stop_signs;
|
||||
|
||||
const CompressedEdgeContainer &m_compressed_edge_container;
|
||||
|
||||
const NameTable &name_table;
|
||||
|
||||
@@ -30,17 +30,24 @@ class ExtractionContainers
|
||||
using ReferencedWays = std::unordered_map<OSMWayID, NodesOfWay>;
|
||||
using ReferencedTrafficSignals =
|
||||
std::pair<std::unordered_set<OSMNodeID>, std::unordered_multimap<OSMNodeID, OSMNodeID>>;
|
||||
using ReferencedStopSigns =
|
||||
std::pair<std::unordered_set<OSMNodeID>, std::unordered_multimap<OSMNodeID, OSMNodeID>>;
|
||||
|
||||
// The relationship between way and nodes is lost during node preparation.
|
||||
// We identify the ways and nodes relevant to restrictions/overrides/signals prior to
|
||||
// node processing so that they can be referenced in the preparation phase.
|
||||
ReferencedWays IdentifyRestrictionWays();
|
||||
ReferencedWays IdentifyManeuverOverrideWays();
|
||||
ReferencedTrafficSignals IdentifyTrafficSignals();
|
||||
ReferencedStopSigns IdentifyStopSigns();
|
||||
|
||||
|
||||
void PrepareNodes();
|
||||
void PrepareManeuverOverrides(const ReferencedWays &maneuver_override_ways);
|
||||
void PrepareRestrictions(const ReferencedWays &restriction_ways);
|
||||
void PrepareTrafficSignals(const ReferencedTrafficSignals &referenced_traffic_signals);
|
||||
void PrepareStopSigns(const ReferencedStopSigns &referenced_stop_signs);
|
||||
|
||||
void PrepareEdges(ScriptingEnvironment &scripting_environment);
|
||||
|
||||
void WriteCharData(const std::string &file_name);
|
||||
@@ -55,6 +62,8 @@ class ExtractionContainers
|
||||
using WayIDVector = std::vector<OSMWayID>;
|
||||
using WayNodeIDOffsets = std::vector<size_t>;
|
||||
using InputTrafficSignal = std::pair<OSMNodeID, TrafficLightClass::Direction>;
|
||||
using InputStopSign = std::pair<OSMNodeID, StopSign::Direction>;
|
||||
using InputGiveWay = std::pair<OSMNodeID, GiveWay::Direction>;
|
||||
|
||||
std::vector<OSMNodeID> barrier_nodes;
|
||||
NodeIDVector used_node_id_list;
|
||||
@@ -72,6 +81,13 @@ class ExtractionContainers
|
||||
std::vector<InputTrafficSignal> external_traffic_signals;
|
||||
TrafficSignals internal_traffic_signals;
|
||||
|
||||
|
||||
std::vector<InputStopSign> external_stop_signs;
|
||||
StopSigns internal_stop_signs;
|
||||
|
||||
std::vector<InputStopSign> external_give_ways;
|
||||
GiveWaySigns internal_give_ways;
|
||||
|
||||
std::vector<NodeBasedEdge> used_edges;
|
||||
|
||||
// List of restrictions (conditional and unconditional) before we transform them into the
|
||||
|
||||
@@ -2,22 +2,30 @@
|
||||
#define EXTRACTION_NODE_HPP
|
||||
|
||||
#include "traffic_lights.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
{
|
||||
|
||||
|
||||
struct ExtractionNode
|
||||
{
|
||||
ExtractionNode() : traffic_lights(TrafficLightClass::NONE), barrier(false) {}
|
||||
void clear()
|
||||
{
|
||||
traffic_lights = TrafficLightClass::NONE;
|
||||
stop_sign = StopSign::Direction::NONE;
|
||||
give_way = GiveWay::Direction::NONE;
|
||||
barrier = false;
|
||||
}
|
||||
TrafficLightClass::Direction traffic_lights;
|
||||
bool barrier;
|
||||
|
||||
|
||||
StopSign::Direction stop_sign;
|
||||
GiveWay::Direction give_way;
|
||||
};
|
||||
} // namespace extractor
|
||||
} // namespace osrm
|
||||
|
||||
@@ -51,6 +51,7 @@ struct ExtractionTurn
|
||||
int number_of_roads,
|
||||
bool is_u_turn,
|
||||
bool has_traffic_light,
|
||||
bool has_stop_sign,
|
||||
bool is_left_hand_driving,
|
||||
bool source_restricted,
|
||||
TravelMode source_mode,
|
||||
@@ -75,7 +76,7 @@ struct ExtractionTurn
|
||||
const std::vector<ExtractionTurnLeg> &roads_on_the_right,
|
||||
const std::vector<ExtractionTurnLeg> &roads_on_the_left)
|
||||
: angle(180. - angle), number_of_roads(number_of_roads), is_u_turn(is_u_turn),
|
||||
has_traffic_light(has_traffic_light), is_left_hand_driving(is_left_hand_driving),
|
||||
has_traffic_light(has_traffic_light), has_stop_sign(has_stop_sign), is_left_hand_driving(is_left_hand_driving),
|
||||
|
||||
source_restricted(source_restricted), source_mode(source_mode),
|
||||
source_is_motorway(source_is_motorway), source_is_link(source_is_link),
|
||||
@@ -100,6 +101,7 @@ struct ExtractionTurn
|
||||
const int number_of_roads;
|
||||
const bool is_u_turn;
|
||||
const bool has_traffic_light;
|
||||
const bool has_stop_sign;
|
||||
const bool is_left_hand_driving;
|
||||
|
||||
// source info
|
||||
|
||||
@@ -67,6 +67,7 @@ class Extractor
|
||||
std::vector<TurnRestriction> turn_restrictions;
|
||||
std::vector<UnresolvedManeuverOverride> unresolved_maneuver_overrides;
|
||||
TrafficSignals traffic_signals;
|
||||
StopSigns stop_signs;
|
||||
std::unordered_set<NodeID> barriers;
|
||||
std::vector<util::Coordinate> osm_coordinates;
|
||||
extractor::PackedOSMIDs osm_node_ids;
|
||||
@@ -87,6 +88,7 @@ class Extractor
|
||||
const CompressedEdgeContainer &compressed_edge_container,
|
||||
const std::unordered_set<NodeID> &barrier_nodes,
|
||||
const TrafficSignals &traffic_signals,
|
||||
const StopSigns &stop_signs,
|
||||
const RestrictionGraph &restriction_graph,
|
||||
const std::unordered_set<EdgeID> &segregated_edges,
|
||||
const NameTable &name_table,
|
||||
|
||||
@@ -27,6 +27,7 @@ class GraphCompressor
|
||||
public:
|
||||
void Compress(const std::unordered_set<NodeID> &barrier_nodes,
|
||||
const TrafficSignals &traffic_signals,
|
||||
const StopSigns &stop_signs,
|
||||
ScriptingEnvironment &scripting_environment,
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||
|
||||
@@ -42,6 +42,8 @@ class NodeBasedGraphFactory
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||
const TrafficSignals &traffic_signals,
|
||||
const StopSigns &stop_signs,
|
||||
|
||||
std::unordered_set<NodeID> &&barriers,
|
||||
std::vector<util::Coordinate> &&coordinates,
|
||||
extractor::PackedOSMIDs &&osm_node_ids,
|
||||
@@ -73,7 +75,8 @@ class NodeBasedGraphFactory
|
||||
void Compress(ScriptingEnvironment &scripting_environment,
|
||||
std::vector<TurnRestriction> &turn_restrictions,
|
||||
std::vector<UnresolvedManeuverOverride> &maneuver_overrides,
|
||||
const TrafficSignals &traffic_signals);
|
||||
const TrafficSignals &traffic_signals,
|
||||
const StopSigns &stop_signs);
|
||||
|
||||
// Most ways are bidirectional, making the geometry in forward and backward direction the same,
|
||||
// except for reversal. We make use of this fact by keeping only one representation of the
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef OSRM_EXTRACTOR_TRAFFIC_LIGHTS_DATA_HPP_
|
||||
#define OSRM_EXTRACTOR_TRAFFIC_LIGHTS_DATA_HPP_
|
||||
|
||||
#include <cstdint>
|
||||
namespace osrm
|
||||
{
|
||||
namespace extractor
|
||||
@@ -19,6 +20,36 @@ enum Direction
|
||||
};
|
||||
} // namespace TrafficLightClass
|
||||
|
||||
// Stop Signs tagged on nodes can be present or not. In addition Stop Signs have
|
||||
// an optional way direction they apply to. If the direction is unknown from the
|
||||
// data we have to compute by checking the distance to the next intersection.
|
||||
//
|
||||
// Impl. detail: namespace + enum instead of enum class to make Luabind happy
|
||||
namespace StopSign
|
||||
{
|
||||
enum Direction : std::uint8_t
|
||||
{
|
||||
NONE = 0,
|
||||
DIRECTION_ALL = 1,
|
||||
DIRECTION_FORWARD = 2,
|
||||
DIRECTION_REVERSE = 3
|
||||
};
|
||||
}
|
||||
|
||||
// Give Way is the complement to priority roads. Tagging is the same as Stop Signs.
|
||||
// See explanation above.
|
||||
namespace GiveWay
|
||||
{
|
||||
enum Direction : std::uint8_t
|
||||
{
|
||||
NONE = 0,
|
||||
DIRECTION_ALL = 1,
|
||||
DIRECTION_FORWARD = 2,
|
||||
DIRECTION_REVERSE = 3
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
} // namespace extractor
|
||||
} // namespace osrm
|
||||
|
||||
|
||||
@@ -11,7 +11,8 @@ namespace osrm
|
||||
namespace extractor
|
||||
{
|
||||
|
||||
struct TrafficSignals
|
||||
// TODO: better naming
|
||||
struct RoadObjects
|
||||
{
|
||||
std::unordered_set<NodeID> bidirectional_nodes;
|
||||
std::unordered_set<std::pair<NodeID, NodeID>, boost::hash<std::pair<NodeID, NodeID>>>
|
||||
@@ -22,6 +23,14 @@ struct TrafficSignals
|
||||
return bidirectional_nodes.count(to) > 0 || unidirectional_segments.count({from, to}) > 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct TrafficSignals final : public RoadObjects {};
|
||||
|
||||
// TODO: better naming ?
|
||||
struct StopSigns final : public RoadObjects {};
|
||||
struct GiveWaySigns final : public RoadObjects {};
|
||||
|
||||
|
||||
} // namespace extractor
|
||||
} // namespace osrm
|
||||
|
||||
|
||||
Reference in New Issue
Block a user