47 #ifdef CHECK_MEMORY_LEAKS
49 #endif // CHECK_MEMORY_LEAKS
61 if (!oc.
isSet(
"visum-file")) {
67 oc.
getBool(
"visum.use-type-priority"));
77 const std::string& file,
80 : myNetBuilder(nb), myFileName(file),
81 myCapacity2Lanes(capacity2Lanes), myUseVisumPrio(useVisumPrio) {
134 for (NIVisumTL_Map::iterator j =
myTLS.begin(); j !=
myTLS.end(); j++) {
159 if (line.length() > 0 && line[0] ==
'$') {
160 ParserVector::iterator i;
162 std::string dataName =
"$" + (*i).name +
":";
163 if (line.substr(0, dataName.length()) == dataName) {
165 (*i).pattern = line.substr(dataName.length());
173 if ((*i).position < 0) {
185 bool singleDataEndFound =
false;
188 if (line.length() == 0 || line[0] ==
'*' || line[0] ==
'$') {
189 singleDataEndFound =
true;
194 (this->*(*i).function)();
196 WRITE_ERROR(
"Too short value line in " + (*i).name +
" occured.");
200 WRITE_ERROR(
"One of the needed values ('" + std::string(e.what()) +
"') is missing in " + (*i).name +
".");
208 for (NIVisumTL_Map::iterator j =
myTLS.begin(); j !=
myTLS.end(); j++) {
213 (*k).first->addShape((*k).second);
361 bool oneway_checked = oneway;
366 oneway_checked =
false;
369 oneway_checked =
false;
377 oneway_checked =
false;
381 if (nolanes != 0 && speed != 0) {
398 if (nolanes != 0 && speed != 0) {
417 myEdges[id] = std::make_pair(from, to);
463 std::string
id = bez +
"-" + dest->getID();
466 if (dir.length() == 0) {
470 if (dir.find(
'Q') != std::string::npos) {
471 const EdgeVector& edges = dest->getOutgoingEdges();
472 bool hasContinuation =
false;
473 for (EdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
474 if (!(*i)->isMacroscopicConnector()) {
475 hasContinuation =
true;
478 if (!hasContinuation) {
480 WRITE_WARNING(
"Incoming connector '" +
id +
"' will not be build - would be not connected to network.");
484 WRITE_ERROR(
"The district '" + bez +
"' could not be built.");
487 NBEdge* edge =
new NBEdge(
id, src, dest,
"VisumConnector",
494 WRITE_ERROR(
"A duplicate edge id occured (ID='" +
id +
"').");
504 if (dir.find(
'Z') != std::string::npos) {
505 const EdgeVector& edges = dest->getIncomingEdges();
506 bool hasPredeccessor =
false;
507 for (EdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
508 if (!(*i)->isMacroscopicConnector()) {
509 hasPredeccessor =
true;
512 if (!hasPredeccessor) {
514 WRITE_WARNING(
"Outgoing connector '" +
id +
"' will not be build - would be not connected to network.");
518 WRITE_ERROR(
"The district '" + bez +
"' could not be built.");
522 NBEdge* edge =
new NBEdge(
id, dest, src,
"VisumConnector",
529 WRITE_ERROR(
"A duplicate edge id occured (ID='" +
id +
"').");
551 if (from == 0 || via == 0 || to == 0) {
611 WRITE_ERROR(
"Error in geometry description from node '" + from->
getID() +
"' to node '" + to->
getID() +
"'.");
616 WRITE_ERROR(
"Unable to project coordinates for node '" + from->
getID() +
"'.");
654 if (node == 0 || edge == 0) {
665 WRITE_ERROR(
"A lane number for edge '" + edge->
getID() +
"' is not numeric (" + laneS +
").");
670 WRITE_ERROR(
"A lane number for edge '" + edge->
getID() +
"' is not positive (" + laneS +
").");
686 WRITE_ERROR(
"A lane length for edge '" + edge->
getID() +
"' is not numeric (" + lengthS +
").");
690 WRITE_ERROR(
"A lane length for edge '" + edge->
getID() +
"' is not positive (" + lengthS +
").");
707 if (edge->
getID().substr(edge->
getID().length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
720 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);
753 SUMOReal useLength = length - seenLength;
754 useLength = edge->
getLength() - useLength;
755 std::string edgeID = edge->
getID();
757 if (edgeID.substr(edgeID.length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
758 edgeID = edgeID.substr(0, edgeID.find(
'_'));
764 std::string nid = edgeID +
"_" +
toString((
size_t) length) +
"_" + node->
getID();
769 while (nedge->
getID().substr(nedge->
getID().length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
815 WRITE_ERROR(
"Could not find TLS '" + LSAid +
"' for setting the signal group.");
836 if (from == 0 && to == 0) {
845 if (edg1 != 0 && edg2 != 0) {
848 if (edg1->
getID()[0] ==
'-') {
849 sid = edg1->
getID().substr(1);
851 sid =
"-" + edg1->
getID();
853 if (sid.find(
'_') != std::string::npos) {
854 sid = sid.substr(0, sid.find(
'_'));
860 if (edg2->
getID()[0] ==
'-') {
861 sid = edg2->
getID().substr(1);
863 sid =
"-" + edg2->
getID();
865 if (sid.find(
'_') != std::string::npos) {
866 sid = sid.substr(0, sid.find(
'_'));
880 WRITE_ERROR(
"Unknown edge in TEILFLAECHENELEMENT");
889 WRITE_ERROR(
"An index for a TEILFLAECHENELEMENT is not numeric (id='" +
toString(
id) +
"').");
895 if (dir.length() > 0 && dir[0] ==
'1') {
904 for (std::vector<long>::const_iterator i = areas.begin(); i != areas.end(); ++i) {
912 if (dir.length() > 0 && dir[0] ==
'1') {
946 SG.
phases()[Phaseid] = PH;
959 if (fromEdge == 0 || toEdge == 0) {
963 int fromLaneOffset = 0;
973 int toLaneOffset = 0;
987 WRITE_ERROR(
"A from-lane number for edge '" + fromEdge->
getID() +
"' is not numeric (" + fromLaneS +
").");
992 WRITE_ERROR(
"A from-lane number for edge '" + fromEdge->
getID() +
"' is not positive (" + fromLaneS +
").");
1001 WRITE_ERROR(
"A to-lane number for edge '" + toEdge->
getID() +
"' is not numeric (" + toLaneS +
").");
1006 WRITE_ERROR(
"A to-lane number for edge '" + toEdge->
getID() +
"' is not positive (" + toLaneS +
").");
1010 if (fromLane - fromLaneOffset < 0) {
1013 fromLane = fromEdge->
getNumLanes() - (fromLane - fromLaneOffset) - 1;
1015 if (toLane - toLaneOffset < 0) {
1018 toLane = toEdge->
getNumLanes() - (toLane - toLaneOffset) - 1;
1022 WRITE_ERROR(
"A from-lane number for edge '" + fromEdge->
getID() +
"' is larger than the edge's lane number (" + fromLaneS +
").");
1026 WRITE_ERROR(
"A to-lane number for edge '" + toEdge->
getID() +
"' is larger than the edge's lane number (" + toLaneS +
").");
1072 NBNode* node = myNetBuilder.getNodeCont().retrieve(nodeS);
1074 WRITE_ERROR(
"The node '" + nodeS +
"' is not known.");
1082 if (myLineParser.know(fieldName1)) {
1083 return getNamedNode(fieldName1);
1085 return getNamedNode(fieldName2);
1093 NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(edgeS);
1095 WRITE_ERROR(
"The edge '" + edgeS +
"' is not known.");
1103 if (myLineParser.know(fieldName1)) {
1104 return getNamedEdge(fieldName1);
1106 return getNamedEdge(fieldName2);
1115 if (edge->
getID()[0] ==
'-') {
1116 sid = edge->
getID().substr(1);
1118 sid =
"-" + edge->
getID();
1120 if (sid.find(
'_') != std::string::npos) {
1121 sid = sid.substr(0, sid.find(
'_'));
1133 std::string edgeID = ret->
getID();
1141 if (nedges.size() != 1) {
1146 NBEdge* next = nedges[0];
1147 if (ret->
getID().substr(0, edgeID.length()) != next->
getID().substr(0, edgeID.length())) {
1167 if (nedges.size() != 1) {
1172 NBEdge* next = nedges[0];
1173 if (ret->
getID().substr(0, edgeID.length()) != next->
getID().substr(0, edgeID.length())) {
1191 NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(edgeS);
1193 WRITE_ERROR(
"The edge '" + edgeS +
"' is not known.");
1195 return getNamedEdgeContinuating(edge, node);
1202 if (myLineParser.know(fieldName1)) {
1203 return getNamedEdgeContinuating(fieldName1, node);
1205 return getNamedEdgeContinuating(fieldName2, node);
1212 EdgeVector::const_iterator i;
1214 if (ToNode == (*i)->getToNode()) {
1236 return defaultValue;
1243 if (myLineParser.know(fieldName1)) {
1244 return getNamedFloat(fieldName1);
1246 return getNamedFloat(fieldName2);
1271 if (myLineParser.know(fieldName1)) {
1272 return getNamedString(fieldName1);
1274 return getNamedString(fieldName2);
1293 nid =
id +
"-" + dest->
getID();
1299 WRITE_ERROR(
"Could not build connector node '" + nid +
"'.");
1309 WRITE_ERROR(
" The from-node was not found within the net");
1312 WRITE_ERROR(
" The to-node was not found within the net");
1317 return from != 0 && to != 0 && from != to;