reduce numbers of intersections in findNextIntersection, don't normalise for turn lanes

This commit is contained in:
Moritz Kobitzsch
2016-11-15 11:21:26 +01:00
parent 01a57ff1d8
commit a1127c3e09
17 changed files with 203 additions and 125 deletions
@@ -1,6 +1,7 @@
#ifndef OSRM_EXTRACTOR_COORDINATE_EXTRACTOR_HPP_
#define OSRM_EXTRACTOR_COORDINATE_EXTRACTOR_HPP_
#include <utility>
#include <vector>
#include "extractor/compressed_edge_container.hpp"
@@ -28,6 +29,7 @@ class CoordinateExtractor
/* Find a interpolated coordinate a long the compressed geometries. The desired coordinate
* should be in a certain distance. This method is dedicated to find representative coordinates
* at turns.
* Since we are computing the length of the segment anyhow, we also return it.
*/
OSRM_ATTR_WARN_UNUSED
util::Coordinate GetCoordinateAlongRoad(const NodeID intersection_node,
@@ -36,12 +38,23 @@ class CoordinateExtractor
const NodeID to_node,
const std::uint8_t number_of_in_lanes) const;
// instead of finding only a single coordinate, we can also list all coordinates along a road.
// same as above, only with precomputed coordinate vector (move it in)
OSRM_ATTR_WARN_UNUSED
std::vector<util::Coordinate> GetCoordinatesAlongRoad(const NodeID intersection_node,
const EdgeID turn_edge,
const bool traversed_in_reverse,
const NodeID to_node) const;
util::Coordinate
ExtractRepresentativeCoordinate(const NodeID intersection_node,
const EdgeID turn_edge,
const bool traversed_in_reverse,
const NodeID to_node,
const std::uint8_t intersection_lanes,
std::vector<util::Coordinate> coordinates) const;
// instead of finding only a single coordinate, we can also list all coordinates along a
// road.
OSRM_ATTR_WARN_UNUSED std::vector<util::Coordinate>
GetCoordinatesAlongRoad(const NodeID intersection_node,
const EdgeID turn_edge,
const bool traversed_in_reverse,
const NodeID to_node) const;
// wrapper in case of normal forward edges (traversed_in_reverse = false, to_node =
// node_based_graph.GetTarget(turn_edge)
+6 -1
View File
@@ -9,6 +9,8 @@
#include "util/node_based_graph.hpp"
#include "util/typedefs.hpp" // EdgeID
#include <boost/optional.hpp>
namespace osrm
{
namespace extractor
@@ -53,10 +55,13 @@ struct ConnectedRoad final : public TurnOperation
{
using Base = TurnOperation;
ConnectedRoad(const TurnOperation turn, const bool entry_allowed = false);
ConnectedRoad(const TurnOperation turn,
const bool entry_allowed = false,
const boost::optional<double> segment_length = {});
// a turn may be relevant to good instructions, even if we cannot enter the road
bool entry_allowed;
boost::optional<double> segment_length;
// used to sort the set of connected roads (we require sorting throughout turn handling)
bool compareByAngle(const ConnectedRoad &other) const;
+3 -3
View File
@@ -68,6 +68,9 @@ class TurnAnalysis
std::vector<TurnOperation>
transformIntersectionIntoTurns(const Intersection &intersection) const;
Intersection
assignTurnTypes(const NodeID from_node, const EdgeID via_eid, Intersection intersection) const;
const IntersectionGenerator &GetIntersectionGenerator() const;
private:
@@ -79,9 +82,6 @@ class TurnAnalysis
const TurnHandler turn_handler;
const SliproadHandler sliproad_handler;
Intersection
assignTurnTypes(const NodeID from_node, const EdgeID via_eid, Intersection intersection) const;
// Utility function, setting basic turn types. Prepares for normal turn handling.
Intersection
setTurnTypes(const NodeID from, const EdgeID via_edge, Intersection intersection) const;
@@ -22,7 +22,7 @@ namespace lanes
bool findPreviousIntersection(
const NodeID node,
const EdgeID via_edge,
const Intersection intersection,
const Intersection &intersection,
const IntersectionGenerator &intersection_generator,
const util::NodeBasedDynamicGraph &node_based_graph, // query edge data
// output parameters, will be in an arbitrary state on failure