40 #ifdef CHECK_MEMORY_LEAKS
42 #endif // CHECK_MEMORY_LEAKS
61 bool dontSplit = oc.
getBool(
"ramps.no-split");
62 std::set<NBEdge*> incremented;
64 if (oc.
getBool(
"ramps.guess")) {
68 std::set<NBNode*> potOnRamps;
69 std::set<NBNode*> potOffRamps;
70 for (std::map<std::string, NBNode*>::const_iterator i = nc.
begin(); i != nc.
end(); ++i) {
73 potOnRamps.insert(cur);
76 potOffRamps.insert(cur);
79 for (std::set<NBNode*>::const_iterator i = potOnRamps.begin(); i != potOnRamps.end(); ++i) {
80 buildOnRamp(*i, nc, ec, dc, rampLength, dontSplit, incremented);
82 for (std::set<NBNode*>::const_iterator i = potOffRamps.begin(); i != potOffRamps.end(); ++i) {
83 buildOffRamp(*i, nc, ec, dc, rampLength, dontSplit, incremented);
87 if (oc.
isSet(
"ramps.set")) {
92 for (std::vector<std::string>::iterator i = edges.begin(); i != edges.end(); ++i) {
95 WRITE_WARNING(
"Can not build on ramp on edge '" + *i +
"' - the edge is not known.");
100 buildOnRamp(from, nc, ec, dc, rampLength, dontSplit, incremented);
105 WRITE_WARNING(
"Can not build off ramp on edge '" + *i +
"' - the edge is not known.");
110 buildOffRamp(to, nc, ec, dc, rampLength, dontSplit, incremented);
122 NBEdge* potHighway, *potRamp, *cont;
135 NBEdge* potHighway, *potRamp, *prev;
143 NBEdge* potHighway, *potRamp, *cont;
146 const unsigned int firstLaneNumber = potHighway->
getNumLanes();
151 if (toAdd > 0 && find(incremented.begin(), incremented.end(), cont) == incremented.end()) {
154 if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
157 incremented.insert(curr);
175 if (curr != 0 && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
177 bool wasFirst = first == curr;
180 throw ProcessError(
"Ups - could not build on-ramp for edge '" + curr->
getID() +
"' (node could not be build)!");
182 std::string name = curr->
getID();
185 WRITE_ERROR(
"Ups - could not build on-ramp for edge '" + curr->
getID() +
"'!");
191 incremented.insert(curr);
198 if (curr == cont && dontSplit) {
199 WRITE_WARNING(
"Could not build on-ramp for edge '" + curr->
getID() +
"' due to option '--ramps.no-split'");
228 NBEdge* potHighway, *potRamp, *prev;
231 const unsigned int firstLaneNumber = potHighway->
getNumLanes();
236 if (toAdd > 0 && find(incremented.begin(), incremented.end(), prev) == incremented.end()) {
239 if (find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
242 incremented.insert(curr);
260 if (curr != 0 && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
262 bool wasFirst = first == curr;
266 throw ProcessError(
"Ups - could not build on-ramp for edge '" + curr->
getID() +
"' (node could not be build)!");
268 std::string name = curr->
getID();
271 WRITE_ERROR(
"Ups - could not build on-ramp for edge '" + curr->
getID() +
"'!");
274 curr = ec.
retrieve(name +
"-AddedOffRampEdge");
276 incremented.insert(curr);
283 if (curr == prev && dontSplit) {
284 WRITE_WARNING(
"Could not build off-ramp for edge '" + curr->
getID() +
"' due to option '--ramps.no-split'");
329 if (fabs((*potHighway)->getSpeed() - (*potRamp)->getSpeed()) < .1) {
332 if ((*potHighway)->getSpeed() < (*potRamp)->getSpeed()) {
333 std::swap(*potHighway, *potRamp);
341 if ((*potHighway)->getNumLanes() == (*potRamp)->getNumLanes()) {
344 if ((*potHighway)->getNumLanes() < (*potRamp)->getNumLanes()) {
345 std::swap(*potHighway, *potRamp);
355 assert(edges.size() == 2);
356 *potHighway = edges[0];
369 const std::vector<NBEdge*>& edges2 = n->
getEdges();
370 std::vector<NBEdge*>::const_iterator i = std::find(edges2.begin(), edges2.end(), *other);
372 if ((*i) == *potHighway) {
373 std::swap(*potHighway, *potRamp);
382 *potHighway = edges[0];
384 assert(edges.size() == 2);
396 const std::vector<NBEdge*>& edges2 = n->
getEdges();
397 std::vector<NBEdge*>::const_iterator i = std::find(edges2.begin(), edges2.end(), *other);
399 if ((*i) == *potRamp) {
400 std::swap(*potHighway, *potRamp);
423 if (maxSpeed < minHighwaySpeed) {
432 if (maxRampSpeed > 0 && maxRampSpeed < potRamp->getSpeed()) {