46 #ifdef CHECK_MEMORY_LEAKS
48 #endif // CHECK_MEMORY_LEAKS
60 if (!oc.
isSet(
"visum-file")) {
66 oc.
getBool(
"visum.use-type-priority"));
76 const std::string& file,
79 : myNetBuilder(nb), myFileName(file),
80 myCapacity2Lanes(capacity2Lanes), myUseVisumPrio(useVisumPrio) {
133 for (NIVisumTL_Map::iterator j =
myTLS.begin(); j !=
myTLS.end(); j++) {
158 if (line.length() > 0 && line[0] ==
'$') {
159 ParserVector::iterator i;
161 std::string dataName =
"$" + (*i).name +
":";
162 if (line.substr(0, dataName.length()) == dataName) {
164 (*i).pattern = line.substr(dataName.length());
172 if ((*i).position < 0) {
184 bool singleDataEndFound =
false;
187 if (line.length() == 0 || line[0] ==
'*' || line[0] ==
'$') {
188 singleDataEndFound =
true;
193 (this->*(*i).function)();
195 WRITE_ERROR(
"Too short value line in " + (*i).name +
" occured.");
199 WRITE_ERROR(
"One of the needed values ('" + std::string(e.what()) +
"') is missing in " + (*i).name +
".");
207 for (NIVisumTL_Map::iterator j =
myTLS.begin(); j !=
myTLS.end(); j++) {
212 (*k).first->addShape((*k).second);
328 if (speedS.find(
"km/h") != std::string::npos) {
329 speedS = speedS.substr(0, speedS.find(
"km/h"));
362 bool oneway_checked = oneway;
367 oneway_checked =
false;
370 oneway_checked =
false;
378 oneway_checked =
false;
382 if (nolanes != 0 && speed != 0) {
399 if (nolanes != 0 && speed != 0) {
418 myEdges[id] = std::make_pair(from, to);
464 std::string
id = bez +
"-" + dest->getID();
467 if (dir.length() == 0) {
471 if (dir.find(
'Q') != std::string::npos) {
472 const EdgeVector& edges = dest->getOutgoingEdges();
473 bool hasContinuation =
false;
474 for (EdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
475 if (!(*i)->isMacroscopicConnector()) {
476 hasContinuation =
true;
479 if (!hasContinuation) {
481 WRITE_WARNING(
"Incoming connector '" +
id +
"' will not be build - would be not connected to network.");
485 WRITE_ERROR(
"The district '" + bez +
"' could not be built.");
488 NBEdge* edge =
new NBEdge(
id, src, dest,
"VisumConnector",
495 WRITE_ERROR(
"A duplicate edge id occured (ID='" +
id +
"').");
505 if (dir.find(
'Z') != std::string::npos) {
506 const EdgeVector& edges = dest->getIncomingEdges();
507 bool hasPredeccessor =
false;
508 for (EdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
509 if (!(*i)->isMacroscopicConnector()) {
510 hasPredeccessor =
true;
513 if (!hasPredeccessor) {
515 WRITE_WARNING(
"Outgoing connector '" +
id +
"' will not be build - would be not connected to network.");
519 WRITE_ERROR(
"The district '" + bez +
"' could not be built.");
523 NBEdge* edge =
new NBEdge(
id, dest, src,
"VisumConnector",
530 WRITE_ERROR(
"A duplicate edge id occured (ID='" +
id +
"').");
552 if (from == 0 || via == 0 || to == 0) {
612 WRITE_ERROR(
"Error in geometry description from node '" + from->
getID() +
"' to node '" + to->
getID() +
"'.");
617 WRITE_ERROR(
"Unable to project coordinates for node '" + from->
getID() +
"'.");
655 if (node == 0 || edge == 0) {
666 WRITE_ERROR(
"A lane number for edge '" + edge->
getID() +
"' is not numeric (" + laneS +
").");
671 WRITE_ERROR(
"A lane number for edge '" + edge->
getID() +
"' is not positive (" + laneS +
").");
687 WRITE_ERROR(
"A lane length for edge '" + edge->
getID() +
"' is not numeric (" + lengthS +
").");
691 WRITE_ERROR(
"A lane length for edge '" + edge->
getID() +
"' is not positive (" + lengthS +
").");
708 if (edge->
getID().substr(edge->
getID().length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
721 bool mustRecheck =
true;
723 while (mustRecheck) {
724 if (edge->
getID().substr(edge->
getID().length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
726 std::string sub = edge->
getID();
727 sub = sub.substr(sub.rfind(
'_', sub.rfind(
'_') - 1));
728 sub = sub.substr(1, sub.find(
'_', 1) - 1);
749 SUMOReal useLength = length - seenLength;
750 useLength = edge->
getLength() - useLength;
751 std::string edgeID = edge->
getID();
753 if (edgeID.substr(edgeID.length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
754 edgeID = edgeID.substr(0, edgeID.find(
'_'));
760 std::string nid = edgeID +
"_" +
toString((
size_t) length) +
"_" + node->
getID();
765 while (nedge->
getID().substr(nedge->
getID().length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
806 WRITE_ERROR(
"Could not find TLS '" + LSAid +
"' for setting the signal group.");
827 if (from == 0 && to == 0) {
836 if (edg1 != 0 && edg2 != 0) {
839 if (edg1->
getID()[0] ==
'-') {
840 sid = edg1->
getID().substr(1);
842 sid =
"-" + edg1->
getID();
844 if (sid.find(
'_') != std::string::npos) {
845 sid = sid.substr(0, sid.find(
'_'));
851 if (edg2->
getID()[0] ==
'-') {
852 sid = edg2->
getID().substr(1);
854 sid =
"-" + edg2->
getID();
856 if (sid.find(
'_') != std::string::npos) {
857 sid = sid.substr(0, sid.find(
'_'));
871 WRITE_ERROR(
"Unknown edge in TEILFLAECHENELEMENT");
887 if (dir.length() > 0 && dir[0] ==
'1') {
896 for (std::vector<SUMOLong>::const_iterator i = areas.begin(); i != areas.end(); ++i) {
904 if (dir.length() > 0 && dir[0] ==
'1') {
936 SG.
phases()[Phaseid] = PH;
949 if (fromEdge == 0 || toEdge == 0) {
953 int fromLaneOffset = 0;
963 int toLaneOffset = 0;
977 WRITE_ERROR(
"A from-lane number for edge '" + fromEdge->
getID() +
"' is not numeric (" + fromLaneS +
").");
982 WRITE_ERROR(
"A from-lane number for edge '" + fromEdge->
getID() +
"' is not positive (" + fromLaneS +
").");
991 WRITE_ERROR(
"A to-lane number for edge '" + toEdge->
getID() +
"' is not numeric (" + toLaneS +
").");
996 WRITE_ERROR(
"A to-lane number for edge '" + toEdge->
getID() +
"' is not positive (" + toLaneS +
").");
1000 if (fromLane - fromLaneOffset < 0) {
1003 fromLane = fromEdge->
getNumLanes() - (fromLane - fromLaneOffset) - 1;
1005 if (toLane - toLaneOffset < 0) {
1008 toLane = toEdge->
getNumLanes() - (toLane - toLaneOffset) - 1;
1012 WRITE_ERROR(
"A from-lane number for edge '" + fromEdge->
getID() +
"' is larger than the edge's lane number (" + fromLaneS +
").");
1016 WRITE_ERROR(
"A to-lane number for edge '" + toEdge->
getID() +
"' is larger than the edge's lane number (" + toLaneS +
").");
1064 WRITE_ERROR(
"The node '" + nodeS +
"' is not known.");
1085 WRITE_ERROR(
"The edge '" + edgeS +
"' is not known.");
1105 if (edge->
getID()[0] ==
'-') {
1106 sid = edge->
getID().substr(1);
1108 sid =
"-" + edge->
getID();
1110 if (sid.find(
'_') != std::string::npos) {
1111 sid = sid.substr(0, sid.find(
'_'));
1123 std::string edgeID = ret->
getID();
1131 if (nedges.size() != 1) {
1136 NBEdge* next = nedges[0];
1137 if (ret->
getID().substr(0, edgeID.length()) != next->
getID().substr(0, edgeID.length())) {
1157 if (nedges.size() != 1) {
1162 NBEdge* next = nedges[0];
1163 if (ret->
getID().substr(0, edgeID.length()) != next->
getID().substr(0, edgeID.length())) {
1183 WRITE_ERROR(
"The edge '" + edgeS +
"' is not known.");
1202 EdgeVector::const_iterator i;
1204 if (ToNode == (*i)->getToNode()) {
1226 return defaultValue;
1260 const std::string& fieldName2) {
1283 nid =
id +
"-" + dest->
getID();
1289 WRITE_ERROR(
"Could not build connector node '" + nid +
"'.");
1299 WRITE_ERROR(
" The from-node was not found within the net");
1302 WRITE_ERROR(
" The to-node was not found within the net");
1307 return from != 0 && to != 0 && from != to;