42 #ifdef CHECK_MEMORY_LEAKS
44 #endif // CHECK_MEMORY_LEAKS
63 bool dontSplit = oc.
getBool(
"ramps.no-split");
64 std::set<NBEdge*> incremented;
66 if (oc.
getBool(
"ramps.guess")) {
70 std::set<NBNode*> potOnRamps;
71 std::set<NBNode*> potOffRamps;
72 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
75 potOnRamps.insert(cur);
78 potOffRamps.insert(cur);
81 for (std::set<NBNode*>::const_iterator i = potOnRamps.begin(); i != potOnRamps.end(); ++i) {
82 buildOnRamp(*i, nc, ec, dc, rampLength, dontSplit, incremented);
84 for (std::set<NBNode*>::const_iterator i = potOffRamps.begin(); i != potOffRamps.end(); ++i) {
85 buildOffRamp(*i, nc, ec, dc, rampLength, dontSplit, incremented);
89 if (oc.
isSet(
"ramps.set")) {
94 for (std::vector<std::string>::iterator i = edges.begin(); i != edges.end(); ++i) {
97 WRITE_WARNING(
"Can not build on ramp on edge '" + *i +
"' - the edge is not known.");
102 buildOnRamp(from, nc, ec, dc, rampLength, dontSplit, incremented);
107 WRITE_WARNING(
"Can not build off ramp on edge '" + *i +
"' - the edge is not known.");
112 buildOffRamp(to, nc, ec, dc, rampLength, dontSplit, incremented);
124 NBEdge* potHighway, *potRamp, *cont;
137 NBEdge* potHighway, *potRamp, *prev;
145 NBEdge* potHighway, *potRamp, *cont;
148 const unsigned int firstLaneNumber = cont->
getNumLanes();
153 if (toAdd > 0 && find(incremented.begin(), incremented.end(), cont) == incremented.end()) {
156 if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
159 incremented.insert(curr);
173 }
else if (curr == potHighway || curr == potRamp) {
183 if (curr != 0 && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
185 bool wasFirst = first == curr;
188 throw ProcessError(
"Ups - could not build on-ramp for edge '" + curr->
getID() +
"' (node could not be build)!");
190 std::string name = curr->
getID();
193 WRITE_ERROR(
"Ups - could not build on-ramp for edge '" + curr->
getID() +
"'!");
199 incremented.insert(curr);
206 if (curr == cont && dontSplit) {
207 WRITE_WARNING(
"Could not build on-ramp for edge '" + curr->
getID() +
"' due to option '--ramps.no-split'");
236 NBEdge* potHighway, *potRamp, *prev;
239 const unsigned int firstLaneNumber = prev->
getNumLanes();
244 if (toAdd > 0 && find(incremented.begin(), incremented.end(), prev) == incremented.end()) {
247 if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
250 incremented.insert(curr);
264 }
else if (curr == potHighway || curr == potRamp) {
274 if (curr != 0 && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
276 bool wasFirst = first == curr;
280 throw ProcessError(
"Ups - could not build on-ramp for edge '" + curr->
getID() +
"' (node could not be build)!");
282 std::string name = curr->
getID();
285 WRITE_ERROR(
"Ups - could not build on-ramp for edge '" + curr->
getID() +
"'!");
288 curr = ec.
retrieve(name +
"-AddedOffRampEdge");
290 incremented.insert(curr);
297 if (curr == prev && dontSplit) {
298 WRITE_WARNING(
"Could not build off-ramp for edge '" + curr->
getID() +
"' due to option '--ramps.no-split'");
343 if (fabs((*potHighway)->getSpeed() - (*potRamp)->getSpeed()) < .1) {
346 if ((*potHighway)->getSpeed() < (*potRamp)->getSpeed()) {
347 std::swap(*potHighway, *potRamp);
355 if ((*potHighway)->getNumLanes() == (*potRamp)->getNumLanes()) {
358 if ((*potHighway)->getNumLanes() < (*potRamp)->getNumLanes()) {
359 std::swap(*potHighway, *potRamp);
369 assert(edges.size() == 2);
370 *potHighway = edges[0];
383 const std::vector<NBEdge*>& edges2 = n->
getEdges();
384 std::vector<NBEdge*>::const_iterator i = std::find(edges2.begin(), edges2.end(), *other);
386 if ((*i) == *potHighway) {
387 std::swap(*potHighway, *potRamp);
396 *potHighway = edges[0];
398 assert(edges.size() == 2);
410 const std::vector<NBEdge*>& edges2 = n->
getEdges();
411 std::vector<NBEdge*>::const_iterator i = std::find(edges2.begin(), edges2.end(), *other);
413 if ((*i) == *potRamp) {
414 std::swap(*potHighway, *potRamp);
436 if (maxSpeed < minHighwaySpeed) {
459 if (maxRampSpeed > 0 && maxRampSpeed < potRamp->getSpeed()) {