48 std::map<const ROEdge*, int> lastOccurrence;
49 for (
int ii = 0; ii < (int)edges.size(); ++ii) {
50 std::map<const ROEdge*, int>::iterator it_pre = lastOccurrence.find(edges[ii]);
51 if (it_pre != lastOccurrence.end() &&
52 noMandatory(mandatory, edges.begin() + it_pre->second, edges.begin() + ii)) {
53 edges.erase(edges.begin() + it_pre->second, edges.begin() + ii);
58 lastOccurrence[edges[ii]] = ii;
65 const RONode* start = edges[0]->getFromJunction();
66 if (start ==
nullptr && edges.size() > 1) {
68 start = edges[1]->getFromJunction();
70 if (start !=
nullptr) {
72 for (
int i = 1; i < (int)edges.size(); i++) {
73 if (edges[i]->getFromJunction() == start) {
77 if (lastStart > 0 &&
noMandatory(mandatory, edges.begin(), edges.begin() + lastStart - 1)) {
78 edges.erase(edges.begin(), edges.begin() + lastStart - 1);
83 const RONode* end = edges.back()->getToJunction();
84 if (end ==
nullptr && edges.size() > 1) {
86 end = edges[edges.size() - 2]->getToJunction();
89 for (
int i = 0; i < (int)edges.size() - 1; i++) {
90 if (edges[i]->getToJunction() == end &&
noMandatory(mandatory, edges.begin() + i + 2, edges.end())) {
91 edges.erase(edges.begin() + i + 2, edges.end());
123 ConstROEdgeVector::const_iterator start,
124 ConstROEdgeVector::const_iterator end) {
125 for (
const ROEdge* m : mandatory) {
126 for (
auto it = start; it != end; it++) {
std::vector< const ROEdge * > ConstROEdgeVector
A basic edge for routing applications.
Base class for nodes used by the router.
Some helping methods for router.
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)