Skip to content

Commit

Permalink
Remove IntersectionGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
oxidase committed Dec 4, 2017
1 parent f53b574 commit b3c8a5d
Show file tree
Hide file tree
Showing 30 changed files with 181 additions and 319 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# UNRELEASED
- Changes from 5.14
- Internals
- Guidance refactoring step to decouple intersection connectivity analysis and turn instructions generation

# 5.14.1
- Changes from 5.14.0
Expand Down
2 changes: 1 addition & 1 deletion include/extractor/geojson_debug_policies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ operator()(const NodeID intersection_node,
const boost::optional<util::json::Object> &way_style) const
{
// request the number of lanes. This process needs to be in sync with what happens over at
// intersection_generator
// intersection analysis
const auto intersection_lanes =
intersection.FindMaximum(guidance::makeExtractLanesForRoad(node_based_graph));

Expand Down
3 changes: 1 addition & 2 deletions include/extractor/guidance/driveway_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ namespace guidance
class DrivewayHandler final : public IntersectionHandler
{
public:
DrivewayHandler(const IntersectionGenerator &intersection_generator,
const util::NodeBasedDynamicGraph &node_based_graph,
DrivewayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container,
const std::vector<util::Coordinate> &coordinates,
const extractor::CompressedEdgeContainer &compressed_geometries,
Expand Down
70 changes: 0 additions & 70 deletions include/extractor/guidance/intersection_generator.hpp

This file was deleted.

13 changes: 5 additions & 8 deletions include/extractor/guidance/intersection_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define OSRM_EXTRACTOR_GUIDANCE_INTERSECTION_HANDLER_HPP_

#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/node_based_graph_walker.hpp"
#include "extractor/intersection/intersection_analysis.hpp"
#include "extractor/query_node.hpp"
Expand Down Expand Up @@ -41,8 +40,7 @@ class IntersectionHandler
const std::unordered_set<NodeID> &barrier_nodes,
const guidance::TurnLanesIndexedArray &turn_lanes_data,
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table,
const IntersectionGenerator &intersection_generator);
const SuffixTable &street_name_suffix_table);

virtual ~IntersectionHandler() = default;

Expand All @@ -64,7 +62,6 @@ class IntersectionHandler
const guidance::TurnLanesIndexedArray &turn_lanes_data;
const util::NameTable &name_table;
const SuffixTable &street_name_suffix_table;
const IntersectionGenerator &intersection_generator;
const NodeBasedGraphWalker graph_walker; // for skipping traffic signal, distances etc.

// Decide on a basic turn types
Expand Down Expand Up @@ -576,9 +573,9 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
// try to find whether there is a turn going to the opposite direction of our obvious
// turn, this should be alright.
const auto previous_intersection = [&]() -> IntersectionView {
const auto parameters = intersection_generator.SkipDegreeTwoNodes(
node_at_intersection, intersection[0].eid);
if (node_based_graph.GetTarget(parameters.via_eid) == node_at_intersection)
const auto parameters = intersection::skipDegreeTwoNodes(
node_based_graph, {node_at_intersection, intersection[0].eid});
if (node_based_graph.GetTarget(parameters.edge) == node_at_intersection)
return {};

return intersection::getConnectedRoads(node_based_graph,
Expand All @@ -588,7 +585,7 @@ std::size_t IntersectionHandler::findObviousTurn(const EdgeID via_edge,
node_restriction_map,
barrier_nodes,
turn_lanes_data,
{parameters.nid, parameters.via_eid});
parameters);
}();

if (!previous_intersection.empty())
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions include/extractor/guidance/mergable_road_detector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class MergableRoadDetector
const RestrictionMap &node_restriction_map,
const std::unordered_set<NodeID> &barrier_nodes,
const guidance::TurnLanesIndexedArray &turn_lanes_data,
const IntersectionGenerator &intersection_generator,
const CoordinateExtractor &coordinate_extractor,
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table);
Expand Down Expand Up @@ -171,7 +170,6 @@ class MergableRoadDetector
const RestrictionMap &node_restriction_map;
const std::unordered_set<NodeID> &barrier_nodes;
const guidance::TurnLanesIndexedArray &turn_lanes_data;
const IntersectionGenerator &intersection_generator;
const CoordinateExtractor &coordinate_extractor;

// name detection
Expand Down
4 changes: 1 addition & 3 deletions include/extractor/guidance/motorway_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define OSRM_EXTRACTOR_GUIDANCE_MOTORWAY_HANDLER_HPP_

#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/query_node.hpp"

Expand Down Expand Up @@ -31,8 +30,7 @@ class MotorwayHandler : public IntersectionHandler
const std::unordered_set<NodeID> &barrier_nodes,
const guidance::TurnLanesIndexedArray &turn_lanes_data,
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table,
const IntersectionGenerator &intersection_generator);
const SuffixTable &street_name_suffix_table);

~MotorwayHandler() override final = default;

Expand Down
4 changes: 1 addition & 3 deletions include/extractor/guidance/roundabout_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "extractor/compressed_edge_container.hpp"
#include "extractor/guidance/coordinate_extractor.hpp"
#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/guidance/roundabout_type.hpp"
#include "extractor/query_node.hpp"
Expand Down Expand Up @@ -47,8 +46,7 @@ class RoundaboutHandler : public IntersectionHandler
const std::unordered_set<NodeID> &barrier_nodes,
const guidance::TurnLanesIndexedArray &turn_lanes_data,
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table,
const IntersectionGenerator &intersection_generator);
const SuffixTable &street_name_suffix_table);

~RoundaboutHandler() override final = default;

Expand Down
4 changes: 1 addition & 3 deletions include/extractor/guidance/sliproad_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define OSRM_EXTRACTOR_GUIDANCE_SLIPROAD_HANDLER_HPP_

#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/query_node.hpp"

Expand All @@ -24,8 +23,7 @@ namespace guidance
class SliproadHandler final : public IntersectionHandler
{
public:
SliproadHandler(const IntersectionGenerator &intersection_generator,
const util::NodeBasedDynamicGraph &node_based_graph,
SliproadHandler(const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container,
const std::vector<util::Coordinate> &coordinates,
const extractor::CompressedEdgeContainer &compressed_geometries,
Expand Down
6 changes: 2 additions & 4 deletions include/extractor/guidance/statistics_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ namespace guidance
class StatisticsHandler final : public IntersectionHandler
{
public:
StatisticsHandler(const IntersectionGenerator &intersection_generator,
const util::NodeBasedDynamicGraph &node_based_graph,
StatisticsHandler(const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container,
const std::vector<util::Coordinate> &coordinates,
const extractor::CompressedEdgeContainer &compressed_geometries,
Expand All @@ -45,8 +44,7 @@ class StatisticsHandler final : public IntersectionHandler
barrier_nodes,
turn_lanes_data,
name_table,
street_name_suffix_table,
intersection_generator)
street_name_suffix_table)
{
}

Expand Down
4 changes: 1 addition & 3 deletions include/extractor/guidance/suppress_mode_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "extractor/guidance/constants.hpp"
#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/travel_mode.hpp"
#include "util/node_based_graph.hpp"
Expand All @@ -21,8 +20,7 @@ namespace guidance
class SuppressModeHandler final : public IntersectionHandler
{
public:
SuppressModeHandler(const IntersectionGenerator &intersection_generator,
const util::NodeBasedDynamicGraph &node_based_graph,
SuppressModeHandler(const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container,
const std::vector<util::Coordinate> &coordinates,
const extractor::CompressedEdgeContainer &compressed_geometries,
Expand Down
3 changes: 0 additions & 3 deletions include/extractor/guidance/turn_analysis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include "extractor/compressed_edge_container.hpp"
#include "extractor/guidance/driveway_handler.hpp"
#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/intersection_normalization_operation.hpp"
#include "extractor/guidance/motorway_handler.hpp"
#include "extractor/guidance/roundabout_handler.hpp"
#include "extractor/guidance/sliproad_handler.hpp"
Expand Down Expand Up @@ -64,7 +62,6 @@ class TurnAnalysis

private:
const util::NodeBasedDynamicGraph &node_based_graph;
const IntersectionGenerator intersection_generator;
const RoundaboutHandler roundabout_handler;
const MotorwayHandler motorway_handler;
const TurnHandler turn_handler;
Expand Down
13 changes: 12 additions & 1 deletion include/extractor/guidance/turn_discovery.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,27 @@
#define OSRM_EXTRACTOR_GUIDANCE_TURN_DISCOVERY_HPP_

#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/turn_lane_data.hpp"
#include "extractor/restriction_index.hpp"
#include "util/typedefs.hpp"

#include <unordered_set>

namespace osrm
{
namespace util
{
class Coordinate;
}

namespace extractor
{

class CompressedEdgeContainer;

namespace guidance
{

namespace lanes
{

Expand Down
4 changes: 1 addition & 3 deletions include/extractor/guidance/turn_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define OSRM_EXTRACTOR_GUIDANCE_TURN_HANDLER_HPP_

#include "extractor/guidance/intersection.hpp"
#include "extractor/guidance/intersection_generator.hpp"
#include "extractor/guidance/intersection_handler.hpp"
#include "extractor/query_node.hpp"

Expand Down Expand Up @@ -35,8 +34,7 @@ class TurnHandler : public IntersectionHandler
const std::unordered_set<NodeID> &barrier_nodes,
const guidance::TurnLanesIndexedArray &turn_lanes_data,
const util::NameTable &name_table,
const SuffixTable &street_name_suffix_table,
const IntersectionGenerator &intersection_generator);
const SuffixTable &street_name_suffix_table);

~TurnHandler() override final = default;

Expand Down
3 changes: 3 additions & 0 deletions include/extractor/intersection/intersection_analysis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ getConnectedRoads(const util::NodeBasedDynamicGraph &graph,
const std::unordered_set<NodeID> &barrier_nodes,
const guidance::TurnLanesIndexedArray &turn_lanes_data,
const IntersectionEdge &incoming_edge);

IntersectionEdge skipDegreeTwoNodes(const util::NodeBasedDynamicGraph &graph,
IntersectionEdge road);
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions src/extractor/edge_based_graph_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,20 +426,13 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
const auto &turn_lanes_data = transformTurnLaneMapIntoArrays(lane_description_map);
guidance::CoordinateExtractor coordinate_extractor(
m_node_based_graph, m_compressed_edge_container, m_coordinates);
guidance::IntersectionGenerator intersection_generator(m_node_based_graph,
m_edge_based_node_container,
node_restriction_map,
m_barrier_nodes,
m_coordinates,
m_compressed_edge_container);
guidance::MergableRoadDetector mergable_road_detector(m_node_based_graph,
m_edge_based_node_container,
m_coordinates,
m_compressed_edge_container,
node_restriction_map,
m_barrier_nodes,
turn_lanes_data,
intersection_generator,
coordinate_extractor,
name_table,
street_name_suffix_table);
Expand Down
6 changes: 2 additions & 4 deletions src/extractor/guidance/driveway_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ namespace extractor
namespace guidance
{

DrivewayHandler::DrivewayHandler(const IntersectionGenerator &intersection_generator,
const util::NodeBasedDynamicGraph &node_based_graph,
DrivewayHandler::DrivewayHandler(const util::NodeBasedDynamicGraph &node_based_graph,
const EdgeBasedNodeDataContainer &node_data_container,
const std::vector<util::Coordinate> &node_coordinates,
const extractor::CompressedEdgeContainer &compressed_geometries,
Expand All @@ -30,8 +29,7 @@ DrivewayHandler::DrivewayHandler(const IntersectionGenerator &intersection_gener
barrier_nodes,
turn_lanes_data,
name_table,
street_name_suffix_table,
intersection_generator)
street_name_suffix_table)
{
}

Expand Down
Loading

0 comments on commit b3c8a5d

Please sign in to comment.