45 std::map<const ROEdge*, int> lastOccurence;
46 for (
int ii = 0; ii < (int)edges.size(); ++ii) {
47 std::map<const ROEdge*, int>::iterator it_pre = lastOccurence.find(edges[ii]);
48 if (it_pre != lastOccurence.end() &&
49 noMandatory(mandatory, edges.begin() + it_pre->second, edges.begin() + ii)) {
50 edges.erase(edges.begin() + it_pre->second, edges.begin() + ii);
53 lastOccurence[edges[ii]] = ii;
59 const RONode* start = edges[0]->getFromJunction();
61 for (
int i = 1; i < (int)edges.size(); i++) {
62 if (edges[i]->getFromJunction() == start) {
66 if (lastStart > 0 &&
noMandatory(mandatory, edges.begin(), edges.begin() + lastStart - 1)) {
67 edges.erase(edges.begin(), edges.begin() + lastStart - 1);
71 const RONode* end = edges.back()->getToJunction();
72 for (
int i = 0; i < (int)edges.size() - 1; i++) {
73 if (edges[i]->getToJunction() == end &&
noMandatory(mandatory, edges.begin() + i + 2, edges.end())) {
74 edges.erase(edges.begin() + i + 2, edges.end());
105 ConstROEdgeVector::const_iterator start,
106 ConstROEdgeVector::const_iterator end) {
107 for (
const ROEdge* m : mandatory) {
108 for (
auto it = start; it != end; it++) {
void recheckForLoops(ConstROEdgeVector &edges, const ConstROEdgeVector &mandatory)
Checks whether the given edge list contains loops and removes them.
bool noMandatory(const ConstROEdgeVector &mandatory, ConstROEdgeVector::const_iterator start, ConstROEdgeVector::const_iterator end)
std::vector< const ROEdge * > ConstROEdgeVector
Some helping methods for router.
A basic edge for routing applications.
Base class for nodes used by the router.