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.
63 lines
1.7 KiB
C++
63 lines
1.7 KiB
C++
#ifndef QUERYEDGE_HPP
|
|
#define QUERYEDGE_HPP
|
|
|
|
#include "util/typedefs.hpp"
|
|
|
|
#include <tuple>
|
|
|
|
namespace osrm
|
|
{
|
|
namespace contractor
|
|
{
|
|
|
|
struct QueryEdge
|
|
{
|
|
NodeID source;
|
|
NodeID target;
|
|
struct EdgeData
|
|
{
|
|
EdgeData() : id(0), shortcut(false), weight(0), forward(false), backward(false) {}
|
|
|
|
template <class OtherT> EdgeData(const OtherT &other)
|
|
{
|
|
weight = other.weight;
|
|
shortcut = other.shortcut;
|
|
id = other.id;
|
|
forward = other.forward;
|
|
backward = other.backward;
|
|
}
|
|
// this ID is either the middle node of the shortcut, or the ID of the edge based node (node
|
|
// based edge) storing the appropriate data. If `shortcut` is set to true, we get the middle
|
|
// node. Otherwise we see the edge based node to access node data.
|
|
NodeID id : 31;
|
|
bool shortcut : 1;
|
|
int weight : 30;
|
|
bool forward : 1;
|
|
bool backward : 1;
|
|
} data;
|
|
|
|
QueryEdge() : source(SPECIAL_NODEID), target(SPECIAL_NODEID) {}
|
|
|
|
QueryEdge(NodeID source, NodeID target, EdgeData data)
|
|
: source(source), target(target), data(std::move(data))
|
|
{
|
|
}
|
|
|
|
bool operator<(const QueryEdge &rhs) const
|
|
{
|
|
return std::tie(source, target) < std::tie(rhs.source, rhs.target);
|
|
}
|
|
|
|
bool operator==(const QueryEdge &right) const
|
|
{
|
|
return (source == right.source && target == right.target &&
|
|
data.weight == right.data.weight && data.shortcut == right.data.shortcut &&
|
|
data.forward == right.data.forward && data.backward == right.data.backward &&
|
|
data.id == right.data.id);
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif // QUERYEDGE_HPP
|