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 +
".");
208 for (NIVisumTL_Map::iterator j =
myTLS.begin(); j !=
myTLS.end(); j++) {
214 (*k).first->addShape((*k).second);
330 if (speedS.find(
"km/h") != std::string::npos) {
331 speedS = speedS.substr(0, speedS.find(
"km/h"));
364 bool oneway_checked = oneway;
369 oneway_checked =
false;
372 oneway_checked =
false;
380 oneway_checked =
false;
384 if (nolanes != 0 && speed != 0) {
401 if (nolanes != 0 && speed != 0) {
420 myEdges[id] = std::make_pair(from, to);
466 std::string
id = bez +
"-" + dest->getID();
469 if (dir.length() == 0) {
473 if (dir.find(
'Q') != std::string::npos) {
474 const EdgeVector& edges = dest->getOutgoingEdges();
475 bool hasContinuation =
false;
476 for (EdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
477 if (!(*i)->isMacroscopicConnector()) {
478 hasContinuation =
true;
481 if (!hasContinuation) {
483 WRITE_WARNING(
"Incoming connector '" +
id +
"' will not be build - would be not connected to network.");
487 WRITE_ERROR(
"The district '" + bez +
"' could not be built.");
490 NBEdge* edge =
new NBEdge(
id, src, dest,
"VisumConnector",
497 WRITE_ERROR(
"A duplicate edge id occured (ID='" +
id +
"').");
507 if (dir.find(
'Z') != std::string::npos) {
508 const EdgeVector& edges = dest->getIncomingEdges();
509 bool hasPredeccessor =
false;
510 for (EdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
511 if (!(*i)->isMacroscopicConnector()) {
512 hasPredeccessor =
true;
515 if (!hasPredeccessor) {
517 WRITE_WARNING(
"Outgoing connector '" +
id +
"' will not be build - would be not connected to network.");
521 WRITE_ERROR(
"The district '" + bez +
"' could not be built.");
525 NBEdge* edge =
new NBEdge(
id, dest, src,
"VisumConnector",
532 WRITE_ERROR(
"A duplicate edge id occured (ID='" +
id +
"').");
554 if (from == 0 || via == 0 || to == 0) {
614 WRITE_ERROR(
"Error in geometry description from node '" + from->
getID() +
"' to node '" + to->
getID() +
"'.");
619 WRITE_ERROR(
"Unable to project coordinates for node '" + from->
getID() +
"'.");
657 if (node == 0 || edge == 0) {
668 WRITE_ERROR(
"A lane number for edge '" + edge->
getID() +
"' is not numeric (" + laneS +
").");
673 WRITE_ERROR(
"A lane number for edge '" + edge->
getID() +
"' is not positive (" + laneS +
").");
689 WRITE_ERROR(
"A lane length for edge '" + edge->
getID() +
"' is not numeric (" + lengthS +
").");
693 WRITE_ERROR(
"A lane length for edge '" + edge->
getID() +
"' is not positive (" + lengthS +
").");
710 if (edge->
getID().substr(edge->
getID().length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
723 bool mustRecheck =
true;
725 while (mustRecheck) {
726 if (edge->
getID().substr(edge->
getID().length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
728 std::string sub = edge->
getID();
729 sub = sub.substr(sub.rfind(
'_', sub.rfind(
'_') - 1));
730 sub = sub.substr(1, sub.find(
'_', 1) - 1);
751 SUMOReal useLength = length - seenLength;
752 useLength = edge->
getLength() - useLength;
753 std::string edgeID = edge->
getID();
755 if (edgeID.substr(edgeID.length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
756 edgeID = edgeID.substr(0, edgeID.find(
'_'));
762 std::string nid = edgeID +
"_" +
toString((
size_t) length) +
"_" + node->
getID();
767 while (nedge->
getID().substr(nedge->
getID().length() - node->
getID().length() - 1) ==
"_" + node->
getID()) {
808 WRITE_ERROR(
"Could not find TLS '" + LSAid +
"' for setting the signal group.");
829 if (from == 0 && to == 0) {
838 if (edg1 != 0 && edg2 != 0) {
841 if (edg1->
getID()[0] ==
'-') {
842 sid = edg1->
getID().substr(1);
844 sid =
"-" + edg1->
getID();
846 if (sid.find(
'_') != std::string::npos) {
847 sid = sid.substr(0, sid.find(
'_'));
853 if (edg2->
getID()[0] ==
'-') {
854 sid = edg2->
getID().substr(1);
856 sid =
"-" + edg2->
getID();
858 if (sid.find(
'_') != std::string::npos) {
859 sid = sid.substr(0, sid.find(
'_'));
873 WRITE_ERROR(
"Unknown edge in TEILFLAECHENELEMENT");
889 if (dir.length() > 0 && dir[0] ==
'1') {
898 for (std::vector<SUMOLong>::const_iterator i = areas.begin(); i != areas.end(); ++i) {
906 if (dir.length() > 0 && dir[0] ==
'1') {
938 SG.
phases()[Phaseid] = PH;
951 if (fromEdge == 0 || toEdge == 0) {
955 int fromLaneOffset = 0;
965 int toLaneOffset = 0;
979 WRITE_ERROR(
"A from-lane number for edge '" + fromEdge->
getID() +
"' is not numeric (" + fromLaneS +
").");
984 WRITE_ERROR(
"A from-lane number for edge '" + fromEdge->
getID() +
"' is not positive (" + fromLaneS +
").");
993 WRITE_ERROR(
"A to-lane number for edge '" + toEdge->
getID() +
"' is not numeric (" + toLaneS +
").");
998 WRITE_ERROR(
"A to-lane number for edge '" + toEdge->
getID() +
"' is not positive (" + toLaneS +
").");
1002 if (fromLane - fromLaneOffset < 0) {
1005 fromLane = fromEdge->
getNumLanes() - (fromLane - fromLaneOffset) - 1;
1007 if (toLane - toLaneOffset < 0) {
1010 toLane = toEdge->
getNumLanes() - (toLane - toLaneOffset) - 1;
1014 WRITE_ERROR(
"A from-lane number for edge '" + fromEdge->
getID() +
"' is larger than the edge's lane number (" + fromLaneS +
").");
1018 WRITE_ERROR(
"A to-lane number for edge '" + toEdge->
getID() +
"' is larger than the edge's lane number (" + toLaneS +
").");
1064 NBNode* node = myNetBuilder.getNodeCont().retrieve(nodeS);
1066 WRITE_ERROR(
"The node '" + nodeS +
"' is not known.");
1074 if (myLineParser.know(fieldName1)) {
1075 return getNamedNode(fieldName1);
1077 return getNamedNode(fieldName2);
1085 NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(edgeS);
1087 WRITE_ERROR(
"The edge '" + edgeS +
"' is not known.");
1095 if (myLineParser.know(fieldName1)) {
1096 return getNamedEdge(fieldName1);
1098 return getNamedEdge(fieldName2);
1107 if (edge->
getID()[0] ==
'-') {
1108 sid = edge->
getID().substr(1);
1110 sid =
"-" + edge->
getID();
1112 if (sid.find(
'_') != std::string::npos) {
1113 sid = sid.substr(0, sid.find(
'_'));
1125 std::string edgeID = ret->
getID();
1133 if (nedges.size() != 1) {
1138 NBEdge* next = nedges[0];
1139 if (ret->
getID().substr(0, edgeID.length()) != next->
getID().substr(0, edgeID.length())) {
1159 if (nedges.size() != 1) {
1164 NBEdge* next = nedges[0];
1165 if (ret->
getID().substr(0, edgeID.length()) != next->
getID().substr(0, edgeID.length())) {
1183 NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(edgeS);
1185 WRITE_ERROR(
"The edge '" + edgeS +
"' is not known.");
1187 return getNamedEdgeContinuating(edge, node);
1194 if (myLineParser.know(fieldName1)) {
1195 return getNamedEdgeContinuating(fieldName1, node);
1197 return getNamedEdgeContinuating(fieldName2, node);
1204 EdgeVector::const_iterator i;
1206 if (ToNode == (*i)->getToNode()) {
1228 return defaultValue;
1235 if (myLineParser.know(fieldName1)) {
1236 return getNamedFloat(fieldName1);
1238 return getNamedFloat(fieldName2);
1263 if (myLineParser.know(fieldName1)) {
1264 return getNamedString(fieldName1);
1266 return getNamedString(fieldName2);
1285 nid =
id +
"-" + dest->
getID();
1291 WRITE_ERROR(
"Could not build connector node '" + nid +
"'.");
1301 WRITE_ERROR(
" The from-node was not found within the net");
1304 WRITE_ERROR(
" The to-node was not found within the net");
1309 return from != 0 && to != 0 && from != to;