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());