Rember Intersection Shapes

Changes the processing order in the edge based graph factory.
Instead of iterating over all outgoing edges in order, we compute the edge
expanded graph in the order of intersections.
This allows to remember intersection shapes and re-use them for all possible ingoing edges.

Also: use low accuracry mode for intersections degree 2 intersections

We can use lower accuracy here, since the `bearing`
after the turn is not as relevant for off-route detection.
Getting lost is near impossible here.
This commit is contained in:
Moritz Kobitzsch
2016-11-18 09:38:26 +01:00
parent 5775679f64
commit 561b7cc58e
29 changed files with 1035 additions and 608 deletions
+19 -4
View File
@@ -17,11 +17,9 @@ namespace extractor
namespace guidance
{
ConnectedRoad::ConnectedRoad(const TurnOperation turn,
const bool entry_allowed,
boost::optional<double> segment_length)
: TurnOperation(turn), entry_allowed(entry_allowed), segment_length(segment_length)
bool IntersectionViewData::CompareByAngle(const IntersectionViewData &other) const
{
return angle < other.angle;
}
bool ConnectedRoad::compareByAngle(const ConnectedRoad &other) const { return angle < other.angle; }
@@ -72,6 +70,23 @@ std::string toString(const ConnectedRoad &road)
return result;
}
IntersectionView::Base::iterator IntersectionView::findClosestTurn(double angle)
{
// use the const operator to avoid code duplication
return begin() +
std::distance(cbegin(),
static_cast<const IntersectionView *>(this)->findClosestTurn(angle));
}
IntersectionView::Base::const_iterator IntersectionView::findClosestTurn(double angle) const
{
return std::min_element(
begin(), end(), [angle](const IntersectionViewData &lhs, const IntersectionViewData &rhs) {
return util::guidance::angularDeviation(lhs.angle, angle) <
util::guidance::angularDeviation(rhs.angle, angle);
});
}
Intersection::Base::iterator Intersection::findClosestTurn(double angle)
{
// use the const operator to avoid code duplication