Eclipse SUMO - Simulation of Urban MObility
NIImporter_VISUM.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // A VISUM network importer
18 /****************************************************************************/
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <string>
29 #include <utils/common/ToString.h>
33 #include <netbuild/NBDistrict.h>
34 
35 #include <netbuild/NBNetBuilder.h>
36 #include "NILoader.h"
37 #include "NIImporter_VISUM.h"
38 
39 
41  { "VSYS", VISUM_SYS },
42  { "STRECKENTYP", VISUM_LINKTYPE },
43  { "KNOTEN", VISUM_NODE },
44  { "BEZIRK", VISUM_DISTRICT },
45  { "PUNKT", VISUM_POINT },
46  { "STRECKE", VISUM_LINK },
47  { "V0IV", VISUM_V0 },
48  { "VSYSSET", VISUM_TYPES },
49  { "RANG", VISUM_RANK },
50  { "KAPIV", VISUM_CAPACITY },
51  { "XKOORD", VISUM_XCOORD },
52  { "YKOORD", VISUM_YCOORD },
53  { "ID", VISUM_ID },
54  { "CODE", VISUM_CODE },
55  { "VONKNOTNR", VISUM_FROMNODE },
56  { "NACHKNOTNR", VISUM_TONODE },
57  { "TYPNR", VISUM_TYPE },
58  { "TYP", VISUM_TYP },
59  { "ANBINDUNG", VISUM_DISTRICT_CONNECTION },
60  { "BEZNR", VISUM_SOURCE_DISTRICT },
61  { "KNOTNR", VISUM_FROMNODENO },
62  { "RICHTUNG", VISUM_DIRECTION },
63  { "FLAECHEID", VISUM_SURFACEID },
64  { "TFLAECHEID", VISUM_FACEID },
65  { "VONPUNKTID", VISUM_FROMPOINTID },
66  { "NACHPUNKTID", VISUM_TOPOINTID },
67  { "KANTE", VISUM_EDGE },
68  { "ABBIEGER", VISUM_TURN },
69  { "UEBERKNOTNR", VISUM_VIANODENO },
70  { "ANZFAHRSTREIFEN", VISUM_NUMLANES },
71  { "INDEX", VISUM_INDEX },
72  { "STRECKENPOLY", VISUM_LINKPOLY },
73  { "FLAECHENELEMENT", VISUM_SURFACEITEM },
74  { "TEILFLAECHENELEMENT", VISUM_FACEITEM },
75  { "KANTEID", VISUM_EDGEID },
76  { "Q", VISUM_ORIGIN },
77  { "Z", VISUM_DESTINATION },
78  { "NR", VISUM_NO } // must be the last one
79 };
80 
81 
82 
84 
85 // ===========================================================================
86 // method definitions
87 // ===========================================================================
88 // ---------------------------------------------------------------------------
89 // static methods (interface in this case)
90 // ---------------------------------------------------------------------------
91 void
93  // check whether the option is set (properly)
94  if (!oc.isSet("visum-file")) {
95  return;
96  }
97  // build the handler
98  NIImporter_VISUM loader(nb, oc.getString("visum-file"),
99  NBCapacity2Lanes(oc.getFloat("lanes-from-capacity.norm")),
100  oc.getBool("visum.use-type-priority"),
101  oc.getString("visum.language-file"));
102  loader.load();
103 }
104 
105 
106 
107 // ---------------------------------------------------------------------------
108 // loader methods
109 // ---------------------------------------------------------------------------
111  const std::string& file,
112  NBCapacity2Lanes capacity2Lanes,
113  bool useVisumPrio,
114  const std::string& languageFile) :
115  myNetBuilder(nb), myFileName(file),
116  myCapacity2Lanes(capacity2Lanes), myUseVisumPrio(useVisumPrio) {
117  if (languageFile != "") {
118  loadLanguage(languageFile);
119  }
120 
121  // the order of process is important!
122  // set1
128 
129  // set2
130  // two types of "strecke"
133 
134  // set3
135  if (OptionsCont::getOptions().getBool("visum.no-connectors")) {
137  } else {
139  }
140  // two types of "abbieger"
141  addParser("ABBIEGEBEZIEHUNG", &NIImporter_VISUM::parse_Turns);
143 
145  addParser("FAHRSTREIFEN", &NIImporter_VISUM::parse_Lanes);
147 
148 
149  // set4
150  // two types of lsa
153  // two types of knotenzulsa
157  // two types of signalgruppe
158  addParser("LSASIGNALGRUPPE", &NIImporter_VISUM::parse_SignalGroups);
160  // three types of ABBZULSASIGNALGRUPPE
161  addParser("ABBZULSASIGNALGRUPPE", &NIImporter_VISUM::parse_TurnsToSignalGroups);
162  addParser("SIGNALGRUPPEZUABBIEGER", &NIImporter_VISUM::parse_TurnsToSignalGroups);
163  addParser("SIGNALGRUPPEZUFSABBIEGER", &NIImporter_VISUM::parse_TurnsToSignalGroups);
164 
166 
167  // two types of LSAPHASE
170 
171  addParser("LSASIGNALGRUPPEZULSAPHASE", &NIImporter_VISUM::parse_SignalGroupsToPhases);
172  addParser("FAHRSTREIFENABBIEGER", &NIImporter_VISUM::parse_LanesConnections);
173 }
174 
175 
177  for (NIVisumTL_Map::iterator j = myTLS.begin(); j != myTLS.end(); j++) {
178  delete j->second;
179  }
180 }
181 
182 
183 void
184 NIImporter_VISUM::addParser(const std::string& name, ParsingFunction function) {
185  TypeParser p;
186  p.name = name;
187  p.function = function;
188  p.position = -1;
189  mySingleDataParsers.push_back(p);
190 }
191 
192 
193 void
195  // open the file
197  throw ProcessError("Can not open visum-file '" + myFileName + "'.");
198  }
199  // scan the file for data positions
200  while (myLineReader.hasMore()) {
201  std::string line = myLineReader.readLine();
202  if (line.length() > 0 && line[0] == '$') {
203  ParserVector::iterator i;
204  for (i = mySingleDataParsers.begin(); i != mySingleDataParsers.end(); i++) {
205  std::string dataName = "$" + (*i).name + ":";
206  if (line.substr(0, dataName.length()) == dataName) {
207  (*i).position = myLineReader.getPosition();
208  (*i).pattern = line.substr(dataName.length());
209  WRITE_MESSAGE("Found: " + dataName + " at " + toString<int>(myLineReader.getPosition()));
210  }
211  }
212  }
213  }
214  // go through the parsers and process all entries
215  for (ParserVector::iterator i = mySingleDataParsers.begin(); i != mySingleDataParsers.end(); i++) {
216  if ((*i).position < 0) {
217  // do not process using parsers for which no information was found
218  continue;
219  }
220  // ok, the according information is stored in the file
221  PROGRESS_BEGIN_MESSAGE("Parsing " + (*i).name);
222  // reset the line reader and let it point to the begin of the according data field
224  myLineReader.setPos((*i).position);
225  // prepare the line parser
226  myLineParser.reinit((*i).pattern);
227  // read
228  bool singleDataEndFound = false;
229  while (myLineReader.hasMore() && !singleDataEndFound) {
230  std::string line = myLineReader.readLine();
231  if (line.length() == 0 || line[0] == '*' || line[0] == '$') {
232  singleDataEndFound = true;
233  } else {
234  myLineParser.parseLine(line);
235  try {
236  myCurrentID = "<unknown>";
237  (this->*(*i).function)();
238  } catch (OutOfBoundsException&) {
239  WRITE_ERROR("Too short value line in " + (*i).name + " occurred.");
240  } catch (NumberFormatException&) {
241  WRITE_ERROR("A value in " + (*i).name + " should be numeric but is not (id='" + myCurrentID + "').");
242  } catch (UnknownElement& e) {
243  WRITE_ERROR("One of the needed values ('" + std::string(e.what()) + "') is missing in " + (*i).name + ".");
244  }
245  }
246  }
247  // close single reader processing
249  }
251 
252  // build traffic lights
253  for (NIVisumTL_Map::iterator j = myTLS.begin(); j != myTLS.end(); j++) {
254  j->second->build(myNetBuilder.getEdgeCont(), myNetBuilder.getTLLogicCont());
255  }
256  // build district shapes
257  for (std::map<NBDistrict*, PositionVector>::const_iterator k = myDistrictShapes.begin(); k != myDistrictShapes.end(); ++k) {
258  (*k).first->addShape((*k).second);
259  }
260 }
261 
262 
263 
264 
265 
266 void
268  std::string name = myLineParser.know("VSysCode") ? myLineParser.get("VSysCode").c_str() : myLineParser.get(KEYS.getString(VISUM_CODE)).c_str();
269  std::string type = myLineParser.know("VSysMode") ? myLineParser.get("VSysMode").c_str() : myLineParser.get(KEYS.getString(VISUM_TYP)).c_str();
270  myVSysTypes[name] = type;
271 }
272 
273 
274 void
276  // get the id
278  // get the maximum speed
279  double speed = getWeightedFloat2("v0-IV", KEYS.getString(VISUM_V0), "km/h");
280  if (speed == 0) {
281  // unlimited speed
282  speed = 3600;
283  } else if (speed < 0) {
284  WRITE_ERROR("Type '" + myCurrentID + "' has speed " + toString(speed));
285  }
286  // get the permissions
288  // get the priority
289  const int priority = 1000 - StringUtils::toInt(myLineParser.get(KEYS.getString(VISUM_RANK)));
290  // try to retrieve the number of lanes
291  const int numLanes = myCapacity2Lanes.get(getNamedFloat("Kap-IV", KEYS.getString(VISUM_CAPACITY)));
292  // insert the type
293  myNetBuilder.getTypeCont().insert(myCurrentID, numLanes, speed / (double) 3.6, priority, permissions, NBEdge::UNSPECIFIED_WIDTH, false, NBEdge::UNSPECIFIED_WIDTH, NBEdge::UNSPECIFIED_WIDTH, 0, 0, 0);
299 }
300 
301 
302 void
304  // get the id
306  // get the position
309  Position pos(x, y);
311  WRITE_ERROR("Unable to project coordinates for node " + myCurrentID + ".");
312  return;
313  }
314  // add to the list
316  WRITE_ERROR("Duplicate node occurred ('" + myCurrentID + "').");
317  }
318 }
319 
320 
321 void
323  // get the id
325  // get the information whether the source and the destination
326  // connections are weighted
327  //bool sourcesWeighted = getWeightedBool("Proz_Q");
328  //bool destWeighted = getWeightedBool("Proz_Z");
329  // get the node information
332  Position pos(x, y);
333  if (!NBNetBuilder::transformCoordinate(pos, false)) {
334  WRITE_ERROR("Unable to project coordinates for district " + myCurrentID + ".");
335  return;
336  }
337  // build the district
338  NBDistrict* district = new NBDistrict(myCurrentID, pos);
339  if (!myNetBuilder.getDistrictCont().insert(district)) {
340  WRITE_ERROR("Duplicate district occurred ('" + myCurrentID + "').");
341  delete district;
342  return;
343  }
345  long long int flaecheID = StringUtils::toLong(myLineParser.get(KEYS.getString(VISUM_SURFACEID)));
346  myShapeDistrictMap[flaecheID] = district;
347  }
348 }
349 
350 
351 void
356  Position pos(x, y);
357  if (!NBNetBuilder::transformCoordinate(pos, false)) {
358  WRITE_ERROR("Unable to project coordinates for point " + toString(id) + ".");
359  return;
360  }
361  myPoints[id] = pos;
362 }
363 
364 
365 void
368  // no vehicle allowed; don't add
369  return;
370  }
371  // get the id
373  // get the from- & to-node and validate them
374  NBNode* from = getNamedNode("VonKnot", KEYS.getString(VISUM_FROMNODE));
375  NBNode* to = getNamedNode("NachKnot", KEYS.getString(VISUM_TONODE));
376  if (!checkNodes(from, to)) {
377  return;
378  }
379  // get the type
381  // get the speed
382  double speed = myNetBuilder.getTypeCont().getSpeed(type);
383  if (!OptionsCont::getOptions().getBool("visum.use-type-speed")) {
384  try {
385  std::string speedS = myLineParser.know("v0-IV") ? myLineParser.get("v0-IV") : myLineParser.get(KEYS.getString(VISUM_V0));
386  if (speedS.find("km/h") != std::string::npos) {
387  speedS = speedS.substr(0, speedS.find("km/h"));
388  }
389  speed = StringUtils::toDouble(speedS) / 3.6;
390  } catch (OutOfBoundsException&) {}
391  }
392  if (speed <= 0) {
393  speed = myNetBuilder.getTypeCont().getSpeed(type);
394  }
395 
396  // get the information whether the edge is a one-way
397  bool oneway = myLineParser.know("Einbahn")
398  ? StringUtils::toBool(myLineParser.get("Einbahn"))
399  : true;
400  // get the number of lanes
401  int nolanes = myNetBuilder.getTypeCont().getNumLanes(type);
402  if (!OptionsCont::getOptions().getBool("visum.recompute-lane-number")) {
403  if (!OptionsCont::getOptions().getBool("visum.use-type-laneno")) {
404  if (myLineParser.know("Fahrstreifen")) {
405  nolanes = StringUtils::toInt(myLineParser.get("Fahrstreifen"));
408  }
409  }
410  } else {
413  } else if (myLineParser.know("KAP-IV")) {
415  }
416  }
417  // check whether the id is already used
418  // (should be the opposite direction)
419  bool oneway_checked = oneway;
421  if (previous != nullptr) {
422  myCurrentID = '-' + myCurrentID;
424  oneway_checked = false;
425  }
426  if (find(myTouchedEdges.begin(), myTouchedEdges.end(), myCurrentID) != myTouchedEdges.end()) {
427  oneway_checked = false;
428  }
429  std::string tmpid = '-' + myCurrentID;
430  if (find(myTouchedEdges.begin(), myTouchedEdges.end(), tmpid) != myTouchedEdges.end()) {
431  previous = myNetBuilder.getEdgeCont().retrieve(tmpid);
432  if (previous != nullptr) {
434  }
435  oneway_checked = false;
436  }
437  // add the edge
439  int prio = myUseVisumPrio ? myNetBuilder.getTypeCont().getPriority(type) : -1;
440  if (nolanes != 0 && speed != 0) {
441  LaneSpreadFunction lsf = oneway_checked ? LANESPREAD_CENTER : LANESPREAD_RIGHT;
442  // @todo parse name from visum files
443  NBEdge* e = new NBEdge(myCurrentID, from, to, type, speed, nolanes, prio,
445  e->setPermissions(permissions);
446  if (!myNetBuilder.getEdgeCont().insert(e)) {
447  delete e;
448  WRITE_ERROR("Duplicate edge occurred ('" + myCurrentID + "').");
449  }
450  }
451  myTouchedEdges.push_back(myCurrentID);
452  // nothing more to do, when the edge is a one-way street
453  if (oneway) {
454  return;
455  }
456  // add the opposite edge
457  myCurrentID = '-' + myCurrentID;
458  if (nolanes != 0 && speed != 0) {
459  LaneSpreadFunction lsf = oneway_checked ? LANESPREAD_CENTER : LANESPREAD_RIGHT;
460  // @todo parse name from visum files
461  NBEdge* e = new NBEdge(myCurrentID, from, to, type, speed, nolanes, prio,
463  e->setPermissions(permissions);
464  if (!myNetBuilder.getEdgeCont().insert(e)) {
465  delete e;
466  WRITE_ERROR("Duplicate edge occurred ('" + myCurrentID + "').");
467  }
468  }
469  myTouchedEdges.push_back(myCurrentID);
470 }
471 
472 
473 void
478  myEdges[id] = std::make_pair(from, to);
479 }
480 
481 
482 void
484  long long int flaecheID = StringUtils::toLong(myLineParser.get(KEYS.getString(VISUM_SURFACEID)));
485  long long int flaechePartID = StringUtils::toLong(myLineParser.get(KEYS.getString(VISUM_FACEID)));
486  if (mySubPartsAreas.find(flaechePartID) == mySubPartsAreas.end()) {
487  mySubPartsAreas[flaechePartID] = std::vector<long long int>();
488  }
489  mySubPartsAreas[flaechePartID].push_back(flaecheID);
490 }
491 
492 
493 void
495  // get the source district
497  // get the destination node
499  if (dest == nullptr) {
500  return;
501  }
502  // get the weight of the connection
503  double proz = 1;
504  if (myLineParser.know("Proz") || myLineParser.know("Proz(IV)")) {
505  proz = getNamedFloat("Proz", "Proz(IV)") / 100;
506  }
507  // get the information whether this is a sink or a source
508  std::string dir = myLineParser.get(KEYS.getString(VISUM_DIRECTION));
509  if (dir.length() == 0) {
511  }
512  // build the source when needed
513  if (dir.find(KEYS.getString(VISUM_ORIGIN)) != std::string::npos) {
514  for (NBEdge* edge : dest->getOutgoingEdges()) {
515  myNetBuilder.getDistrictCont().addSource(bez, edge, proz);
516  }
517  }
518  // build the sink when needed
519  if (dir.find(KEYS.getString(VISUM_DESTINATION)) != std::string::npos) {
520  for (NBEdge* edge : dest->getIncomingEdges()) {
521  myNetBuilder.getDistrictCont().addSink(bez, edge, proz);
522  }
523  }
524 }
525 
526 
527 
528 void
530  // get the source district
532  // get the destination node
534  if (dest == nullptr) {
535  return;
536  }
537  // get the weight of the connection
538  double proz = 1;
539  if (myLineParser.know("Proz") || myLineParser.know("Proz(IV)")) {
540  proz = getNamedFloat("Proz", "Proz(IV)") / 100;
541  }
542  // get the duration to wait (unused)
543 // double retard = -1;
544 // if (myLineParser.know("t0-IV")) {
545 // retard = getNamedFloat("t0-IV", -1);
546 // }
547  // get the type;
548  // use a standard type with a large speed when a type is not given
549 
550  std::string type = myLineParser.know(KEYS.getString(VISUM_TYP))
552  : "";
553  // add the connectors as an edge
554  std::string id = bez + "-" + dest->getID();
555  // get the information whether this is a sink or a source
556  std::string dir = myLineParser.get(KEYS.getString(VISUM_DIRECTION));
557  if (dir.length() == 0) {
559  }
560  // build the source when needed
561  if (dir.find(KEYS.getString(VISUM_ORIGIN)) != std::string::npos) {
562  const EdgeVector& edges = dest->getOutgoingEdges();
563  bool hasContinuation = false;
564  for (EdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
565  if (!(*i)->isMacroscopicConnector()) {
566  hasContinuation = true;
567  }
568  }
569  if (!hasContinuation) {
570  // obviously, there is no continuation on the net
571  WRITE_WARNING("Incoming connector '" + id + "' will not be build - would be not connected to network.");
572  } else {
573  NBNode* src = buildDistrictNode(bez, dest, true);
574  if (src == nullptr) {
575  WRITE_ERROR("The district '" + bez + "' could not be built.");
576  return;
577  }
578  NBEdge* edge = new NBEdge(id, src, dest, "VisumConnector",
579  OptionsCont::getOptions().getFloat("visum.connector-speeds"),
580  OptionsCont::getOptions().getInt("visum.connectors-lane-number"),
582  "", LANESPREAD_RIGHT);
584  if (!myNetBuilder.getEdgeCont().insert(edge)) {
585  WRITE_ERROR("A duplicate edge id occurred (ID='" + id + "').");
586  return;
587  }
588  edge = myNetBuilder.getEdgeCont().retrieve(id);
589  if (edge != nullptr) {
590  myNetBuilder.getDistrictCont().addSource(bez, edge, proz);
591  }
592  }
593  }
594  // build the sink when needed
595  if (dir.find(KEYS.getString(VISUM_DESTINATION)) != std::string::npos) {
596  const EdgeVector& edges = dest->getIncomingEdges();
597  bool hasPredeccessor = false;
598  for (EdgeVector::const_iterator i = edges.begin(); i != edges.end(); ++i) {
599  if (!(*i)->isMacroscopicConnector()) {
600  hasPredeccessor = true;
601  }
602  }
603  if (!hasPredeccessor) {
604  // obviously, the network is not connected to this node
605  WRITE_WARNING("Outgoing connector '" + id + "' will not be build - would be not connected to network.");
606  } else {
607  NBNode* src = buildDistrictNode(bez, dest, false);
608  if (src == nullptr) {
609  WRITE_ERROR("The district '" + bez + "' could not be built.");
610  return;
611  }
612  id = "-" + id;
613  NBEdge* edge = new NBEdge(id, dest, src, "VisumConnector",
614  OptionsCont::getOptions().getFloat("visum.connector-speeds"),
615  OptionsCont::getOptions().getInt("visum.connectors-lane-number"),
617  "", LANESPREAD_RIGHT);
619  if (!myNetBuilder.getEdgeCont().insert(edge)) {
620  WRITE_ERROR("A duplicate edge id occurred (ID='" + id + "').");
621  return;
622  }
623  edge = myNetBuilder.getEdgeCont().retrieve(id);
624  if (edge != nullptr) {
625  myNetBuilder.getDistrictCont().addSink(bez, edge, proz);
626  }
627  }
628  }
629 }
630 
631 
632 void
635  // no vehicle allowed; don't add
636  return;
637  }
638  // retrieve the nodes
639  NBNode* from = getNamedNode("VonKnot", KEYS.getString(VISUM_FROMNODE));
640  NBNode* via = getNamedNode("UeberKnot", KEYS.getString(VISUM_VIANODENO));
641  NBNode* to = getNamedNode("NachKnot", KEYS.getString(VISUM_TONODE));
642  if (from == nullptr || via == nullptr || to == nullptr) {
643  return;
644  }
645  // all nodes are known
646  std::string type = myLineParser.know("VSysCode")
647  ? myLineParser.get("VSysCode")
649  if (myVSysTypes.find(type) != myVSysTypes.end() && myVSysTypes.find(type)->second == "IV") {
650  // try to set the turning definition
651  NBEdge* src = from->getConnectionTo(via);
652  NBEdge* dest = via->getConnectionTo(to);
653  // check both
654  if (src == nullptr) {
655  if (OptionsCont::getOptions().getBool("visum.verbose-warnings")) {
656  WRITE_WARNING("There is no edge from node '" + from->getID() + "' to node '" + via->getID() + "'.");
657  }
658  return;
659  }
660  if (dest == nullptr) {
661  if (OptionsCont::getOptions().getBool("visum.verbose-warnings")) {
662  WRITE_WARNING("There is no edge from node '" + via->getID() + "' to node '" + to->getID() + "'.");
663  }
664  return;
665  }
666  // both edges found
667  // set them into the edge
668  src->addEdge2EdgeConnection(dest);
669  }
670 }
671 
672 
673 void
675  // get the from- & to-node and validate them
676  NBNode* from = getNamedNode("VonKnot", KEYS.getString(VISUM_FROMNODE));
677  NBNode* to = getNamedNode("NachKnot", KEYS.getString(VISUM_TONODE));
678  if (!checkNodes(from, to)) {
679  return;
680  }
681  bool failed = false;
682  int index;
683  double x, y;
684  try {
688  } catch (NumberFormatException&) {
689  WRITE_ERROR("Error in geometry description from node '" + from->getID() + "' to node '" + to->getID() + "'.");
690  return;
691  }
692  Position pos(x, y);
694  WRITE_ERROR("Unable to project coordinates for node '" + from->getID() + "'.");
695  return;
696  }
697  NBEdge* e = from->getConnectionTo(to);
698  if (e != nullptr) {
699  e->addGeometryPoint(index, pos);
700  } else {
701  failed = true;
702  }
703  e = to->getConnectionTo(from);
704  if (e != nullptr) {
705  e->addGeometryPoint(-index, pos);
706  failed = false;
707  }
708  // check whether the operation has failed
709  if (failed) {
710  if (OptionsCont::getOptions().getBool("visum.verbose-warnings")) {
711  WRITE_WARNING("There is no edge from node '" + from->getID() + "' to node '" + to->getID() + "'.");
712  }
713  }
714 }
715 
716 
717 void
719  // The base number of lanes for the edge was already defined in STRECKE
720  // this refines lane specific attribute (width) and optionally introduces splits for additional lanes
721  // It is permitted for KNOTNR to be 0
722  //
723  // get the edge
724  NBEdge* baseEdge = getNamedEdge("STRNR");
725  if (baseEdge == nullptr) {
726  return;
727  }
728  NBEdge* edge = baseEdge;
729  // get the node
730  NBNode* node = getNamedNodeSecure("KNOTNR");
731  if (node == nullptr) {
732  node = edge->getToNode();
733  } else {
734  edge = getNamedEdgeContinuating("STRNR", node);
735  }
736  // check
737  if (edge == nullptr) {
738  return;
739  }
740  // get the lane
741  std::string laneS = myLineParser.know("FSNR")
744  int lane = -1;
745  try {
746  lane = StringUtils::toInt(laneS);
747  } catch (NumberFormatException&) {
748  WRITE_ERROR("A lane number for edge '" + edge->getID() + "' is not numeric (" + laneS + ").");
749  return;
750  }
751  lane -= 1;
752  if (lane < 0) {
753  WRITE_ERROR("A lane number for edge '" + edge->getID() + "' is not positive (" + laneS + ").");
754  return;
755  }
756  // get the direction
757  std::string dirS = NBHelpers::normalIDRepresentation(myLineParser.get("RICHTTYP"));
758  int prevLaneNo = baseEdge->getNumLanes();
759  if ((dirS == "1" && !(node->hasIncoming(edge))) || (dirS == "0" && !(node->hasOutgoing(edge)))) {
760  // get the last part of the turnaround direction
761  NBEdge* cand = getReversedContinuating(edge, node);
762  if (cand) {
763  edge = cand;
764  }
765  }
766  // get the length
767  std::string lengthS = NBHelpers::normalIDRepresentation(myLineParser.get("LAENGE"));
768  double length = -1;
769  try {
770  length = StringUtils::toDouble(lengthS);
771  } catch (NumberFormatException&) {
772  WRITE_ERROR("A lane length for edge '" + edge->getID() + "' is not numeric (" + lengthS + ").");
773  return;
774  }
775  if (length < 0) {
776  WRITE_ERROR("A lane length for edge '" + edge->getID() + "' is not positive (" + lengthS + ").");
777  return;
778  }
779  //
780  if (dirS == "1") {
781  lane -= prevLaneNo;
782  }
783  //
784  if (length == 0) {
785  if ((int) edge->getNumLanes() > lane) {
786  // ok, we know this already...
787  return;
788  }
789  // increment by one
790  edge->incLaneNo(1);
791  } else {
792  // check whether this edge already has been created
793  if (isSplitEdge(edge, node)) {
794  if (edge->getID().substr(edge->getID().find('_')) == "_" + toString(length) + "_" + node->getID()) {
795  if ((int) edge->getNumLanes() > lane) {
796  // ok, we know this already...
797  return;
798  }
799  // increment by one
800  edge->incLaneNo(1);
801  return;
802  }
803  }
804  // nope, we have to split the edge...
805  // maybe it is not the proper edge to split - VISUM seems not to sort the splits...
806  bool mustRecheck = true;
807  double seenLength = 0;
808  while (mustRecheck) {
809  if (isSplitEdge(edge, node)) {
810  // ok, we have a previously created edge here
811  std::string sub = edge->getID();
812  sub = sub.substr(sub.rfind('_', sub.rfind('_') - 1));
813  sub = sub.substr(1, sub.find('_', 1) - 1);
814  double dist = StringUtils::toDouble(sub);
815  if (dist < length) {
816  seenLength += edge->getLength();
817  if (dirS == "1") {
818  // incoming -> move back
819  edge = edge->getFromNode()->getIncomingEdges()[0];
820  } else {
821  // outgoing -> move forward
822  edge = edge->getToNode()->getOutgoingEdges()[0];
823  }
824  } else {
825  mustRecheck = false;
826  }
827  } else {
828  // we have the center edge - do not continue...
829  mustRecheck = false;
830  }
831  }
832  // compute position
833  Position p;
834  double useLength = length - seenLength;
835  useLength = edge->getLength() - useLength;
836  if (useLength < 0 || useLength > edge->getLength()) {
837  WRITE_WARNING("Could not find split position for edge '" + edge->getID() + "'.");
838  return;
839  }
840  std::string edgeID = edge->getID();
841  p = edge->getGeometry().positionAtOffset(useLength);
842  if (isSplitEdge(edge, node)) {
843  edgeID = edgeID.substr(0, edgeID.find('_'));
844  }
845  NBNode* rn = new NBNode(edgeID + "_" + toString((int) length) + "_" + node->getID(), p);
846  if (!myNetBuilder.getNodeCont().insert(rn)) {
847  throw ProcessError("Ups - could not insert node!");
848  }
849  std::string nid = edgeID + "_" + toString((int) length) + "_" + node->getID();
851  edge->getID(), nid, edge->getNumLanes() + 0, edge->getNumLanes() + 1);
852  // old edge is deleted and a new edge with the same name created
853  edge = myNetBuilder.getEdgeCont().retrieve(edgeID);
854  NBEdge* nedge = myNetBuilder.getEdgeCont().retrieve(nid);
855  nedge = nedge->getToNode()->getOutgoingEdges()[0];
856  while (isSplitEdge(edge, node)) {
857  assert(nedge->getToNode()->getOutgoingEdges().size() > 0);
858  nedge->incLaneNo(1);
859  nedge = nedge->getToNode()->getOutgoingEdges()[0];
860  }
861  }
862 }
863 
864 
865 void
868  SUMOTime cycleTime = (SUMOTime) getWeightedFloat2("Umlaufzeit", "UMLZEIT", "s");
869  SUMOTime intermediateTime = (SUMOTime) getWeightedFloat2("StdZwischenzeit", "STDZWZEIT", "s");
870  bool phaseBased = myLineParser.know("PhasenBasiert")
871  ? StringUtils::toBool(myLineParser.get("PhasenBasiert"))
872  : false;
873  SUMOTime offset = myLineParser.know("ZEITVERSATZ") ? TIME2STEPS(getWeightedFloat("ZEITVERSATZ", "s")) : 0;
874  // add to the list
875  myTLS[myCurrentID] = new NIVisumTL(myCurrentID, cycleTime, offset, intermediateTime, phaseBased);
876 }
877 
878 
879 void
881  std::string node = myLineParser.get("KnotNr").c_str();
882  if (node == "0") {
883  // this is a dummy value which cannot be assigned to
884  return;
885  }
886  std::string trafficLight = myLineParser.get("LsaNr").c_str();
887  // add to the list
889  auto tlIt = myTLS.find(trafficLight);
890  if (n != nullptr && tlIt != myTLS.end()) {
891  tlIt->second->addNode(n);
892  } else {
893  WRITE_ERROR("Could not assign" + std::string(n == nullptr ? " missing" : "") + " node '" + node
894  + "' to" + std::string(tlIt == myTLS.end() ? " missing" : "") + " traffic light '" + trafficLight + "'");
895  }
896 }
897 
898 
899 void
902  std::string LSAid = NBHelpers::normalIDRepresentation(myLineParser.get("LsaNr"));
903  double startTime = getNamedFloat("GzStart", "GRUENANF");
904  double endTime = getNamedFloat("GzEnd", "GRUENENDE");
905  double yellowTime = myLineParser.know("GELB") ? getNamedFloat("GELB") : -1;
906  // add to the list
907  if (myTLS.find(LSAid) == myTLS.end()) {
908  WRITE_ERROR("Could not find TLS '" + LSAid + "' for setting the signal group.");
909  return;
910  }
911  myTLS.find(LSAid)->second->addSignalGroup(myCurrentID, (SUMOTime) startTime, (SUMOTime) endTime, (SUMOTime) yellowTime);
912 }
913 
914 
915 void
917  // get the id
918  std::string SGid = getNamedString("SGNR", "SIGNALGRUPPENNR");
919  if (!myLineParser.know("LsaNr")) {
921  WRITE_WARNING("Ignoring SIGNALGRUPPEZUFSABBIEGER because LsaNr is not known");
922  return;
923  }
924  std::string LSAid = getNamedString("LsaNr");
925  // nodes
926  NBNode* from = myLineParser.know("VonKnot") ? getNamedNode("VonKnot") : nullptr;
927  NBNode* via = myLineParser.know("KNOTNR")
928  ? getNamedNode("KNOTNR")
929  : getNamedNode("UeberKnot", "UeberKnotNr");
930  NBNode* to = myLineParser.know("NachKnot") ? getNamedNode("NachKnot") : nullptr;
931  // edges
932  NBEdge* edg1 = nullptr;
933  NBEdge* edg2 = nullptr;
934  if (from == nullptr && to == nullptr) {
935  edg1 = getNamedEdgeContinuating("VONSTRNR", via);
936  edg2 = getNamedEdgeContinuating("NACHSTRNR", via);
937  } else {
938  edg1 = getEdge(from, via);
939  edg2 = getEdge(via, to);
940  }
941  // add to the list
942  NIVisumTL::SignalGroup& SG = myTLS.find(LSAid)->second->getSignalGroup(SGid);
943  if (edg1 != nullptr && edg2 != nullptr) {
944  if (!via->hasIncoming(edg1)) {
945  std::string sid;
946  if (edg1->getID()[0] == '-') {
947  sid = edg1->getID().substr(1);
948  } else {
949  sid = "-" + edg1->getID();
950  }
951  if (sid.find('_') != std::string::npos) {
952  sid = sid.substr(0, sid.find('_'));
953  }
955  }
956  if (!via->hasOutgoing(edg2)) {
957  std::string sid;
958  if (edg2->getID()[0] == '-') {
959  sid = edg2->getID().substr(1);
960  } else {
961  sid = "-" + edg2->getID();
962  }
963  if (sid.find('_') != std::string::npos) {
964  sid = sid.substr(0, sid.find('_'));
965  }
967  }
968  SG.connections().push_back(NBConnection(edg1, edg2));
969  }
970 }
971 
972 
973 void
977  if (myEdges.find(edgeid) == myEdges.end()) {
978  WRITE_ERROR("Unknown edge in TEILFLAECHENELEMENT");
979  return;
980  }
981  std::string dir = myLineParser.get(KEYS.getString(VISUM_DIRECTION));
982 // get index (unused)
983 // std::string indexS = NBHelpers::normalIDRepresentation(myLineParser.get("INDEX"));
984 // int index = -1;
985 // try {
986 // index = StringUtils::toInt(indexS) - 1;
987 // } catch (NumberFormatException&) {
988 // WRITE_ERROR("An index for a TEILFLAECHENELEMENT is not numeric (id='" + toString(id) + "').");
989 // return;
990 // }
991  PositionVector shape;
992  shape.push_back(myPoints[myEdges[edgeid].first]);
993  shape.push_back(myPoints[myEdges[edgeid].second]);
994  if (dir.length() > 0 && dir[0] == '1') {
995  shape = shape.reverse();
996  }
997  if (mySubPartsAreas.find(id) == mySubPartsAreas.end()) {
998  WRITE_ERROR("Unkown are for area part '" + myCurrentID + "'.");
999  return;
1000  }
1001 
1002  const std::vector<long long int>& areas = mySubPartsAreas.find(id)->second;
1003  for (std::vector<long long int>::const_iterator i = areas.begin(); i != areas.end(); ++i) {
1004  NBDistrict* d = myShapeDistrictMap[*i];
1005  if (d == nullptr) {
1006  continue;
1007  }
1008  if (myDistrictShapes.find(d) == myDistrictShapes.end()) {
1010  }
1011  if (dir.length() > 0 && dir[0] == '1') {
1012  myDistrictShapes[d].push_back(myPoints[myEdges[edgeid].second]);
1013  myDistrictShapes[d].push_back(myPoints[myEdges[edgeid].first]);
1014  } else {
1015  myDistrictShapes[d].push_back(myPoints[myEdges[edgeid].first]);
1016  myDistrictShapes[d].push_back(myPoints[myEdges[edgeid].second]);
1017  }
1018  }
1019 }
1020 
1021 
1022 void
1024  // get the id
1026  std::string LSAid = NBHelpers::normalIDRepresentation(myLineParser.get("LsaNr"));
1027  double startTime = getNamedFloat("GzStart", "GRUENANF");
1028  double endTime = getNamedFloat("GzEnd", "GRUENENDE");
1029  double yellowTime = myLineParser.know("GELB") ? getNamedFloat("GELB") : -1;
1030  myTLS.find(LSAid)->second->addPhase(phaseid, (SUMOTime) startTime, (SUMOTime) endTime, (SUMOTime) yellowTime);
1031 }
1032 
1033 
1035  // get the id
1036  std::string Phaseid = NBHelpers::normalIDRepresentation(myLineParser.get("PsNr"));
1037  std::string LSAid = NBHelpers::normalIDRepresentation(myLineParser.get("LsaNr"));
1038  std::string SGid = NBHelpers::normalIDRepresentation(myLineParser.get("SGNR"));
1039  // insert
1040  NIVisumTL* LSA = myTLS.find(LSAid)->second;
1041  NIVisumTL::SignalGroup& SG = LSA->getSignalGroup(SGid);
1042  NIVisumTL::Phase* PH = LSA->getPhases().find(Phaseid)->second;
1043  SG.phases()[Phaseid] = PH;
1044 }
1045 
1046 
1048  NBNode* node = nullptr;
1049  NBEdge* fromEdge = nullptr;
1050  NBEdge* toEdge = nullptr;
1051  // get the node and edges depending on network format
1052  const std::string nodeID = getNamedString("KNOTNR", "KNOT");
1053  if (nodeID == "0") {
1054  fromEdge = getNamedEdge("VONSTRNR", "VONSTR");
1055  toEdge = getNamedEdge("NACHSTRNR", "NACHSTR");
1056  if (fromEdge == nullptr) {
1057  return;
1058  }
1059  node = fromEdge->getToNode();
1060  WRITE_WARNING("Ignoring lane-to-lane connection (not yet implemented for this format version)");
1061  return;
1062  } else {
1063  node = getNamedNode("KNOTNR", "KNOT");
1064  if (node == nullptr) {
1065  return;
1066  }
1067  fromEdge = getNamedEdgeContinuating("VONSTRNR", "VONSTR", node);
1068  toEdge = getNamedEdgeContinuating("NACHSTRNR", "NACHSTR", node);
1069  }
1070  if (fromEdge == nullptr || toEdge == nullptr) {
1071  return;
1072  }
1073 
1074  int fromLaneOffset = 0;
1075  if (!node->hasIncoming(fromEdge)) {
1076  fromLaneOffset = fromEdge->getNumLanes();
1077  fromEdge = getReversedContinuating(fromEdge, node);
1078  } else {
1079  fromEdge = getReversedContinuating(fromEdge, node);
1080  NBEdge* tmp = myNetBuilder.getEdgeCont().retrieve(fromEdge->getID().substr(0, fromEdge->getID().find('_')));
1081  fromLaneOffset = tmp->getNumLanes();
1082  }
1083 
1084  int toLaneOffset = 0;
1085  if (!node->hasOutgoing(toEdge)) {
1086  toLaneOffset = toEdge->getNumLanes();
1087  toEdge = getReversedContinuating(toEdge, node);
1088  } else {
1089  NBEdge* tmp = myNetBuilder.getEdgeCont().retrieve(toEdge->getID().substr(0, toEdge->getID().find('_')));
1090  toLaneOffset = tmp->getNumLanes();
1091  }
1092  // get the from-lane
1093  std::string fromLaneS = NBHelpers::normalIDRepresentation(myLineParser.get("VONFSNR"));
1094  int fromLane = -1;
1095  try {
1096  fromLane = StringUtils::toInt(fromLaneS);
1097  } catch (NumberFormatException&) {
1098  WRITE_ERROR("A from-lane number for edge '" + fromEdge->getID() + "' is not numeric (" + fromLaneS + ").");
1099  return;
1100  }
1101  fromLane -= 1;
1102  if (fromLane < 0) {
1103  WRITE_ERROR("A from-lane number for edge '" + fromEdge->getID() + "' is not positive (" + fromLaneS + ").");
1104  return;
1105  }
1106  // get the from-lane
1107  std::string toLaneS = NBHelpers::normalIDRepresentation(myLineParser.get("NACHFSNR"));
1108  int toLane = -1;
1109  try {
1110  toLane = StringUtils::toInt(toLaneS);
1111  } catch (NumberFormatException&) {
1112  WRITE_ERROR("A to-lane number for edge '" + toEdge->getID() + "' is not numeric (" + toLaneS + ").");
1113  return;
1114  }
1115  toLane -= 1;
1116  if (toLane < 0) {
1117  WRITE_ERROR("A to-lane number for edge '" + toEdge->getID() + "' is not positive (" + toLaneS + ").");
1118  return;
1119  }
1120  // !!! the next is probably a hack
1121  if (fromLane - fromLaneOffset < 0) {
1122  //fromLaneOffset = 0;
1123  } else {
1124  fromLane = (int)fromEdge->getNumLanes() - (fromLane - fromLaneOffset) - 1;
1125  }
1126  if (toLane - toLaneOffset < 0) {
1127  //toLaneOffset = 0;
1128  } else {
1129  toLane = (int)toEdge->getNumLanes() - (toLane - toLaneOffset) - 1;
1130  }
1131  //
1132  if ((int) fromEdge->getNumLanes() <= fromLane) {
1133  WRITE_ERROR("A from-lane number for edge '" + fromEdge->getID() + "' is larger than the edge's lane number (" + fromLaneS + ").");
1134  return;
1135  }
1136  if ((int) toEdge->getNumLanes() <= toLane) {
1137  WRITE_ERROR("A to-lane number for edge '" + toEdge->getID() + "' is larger than the edge's lane number (" + toLaneS + ").");
1138  return;
1139  }
1140  //
1141  fromEdge->addLane2LaneConnection(fromLane, toEdge, toLane, NBEdge::L2L_VALIDATED);
1142 }
1143 
1144 
1145 
1146 
1147 
1148 
1149 
1150 
1151 
1152 
1153 
1154 
1155 
1156 double
1157 NIImporter_VISUM::getWeightedFloat(const std::string& name, const std::string& suffix) {
1158  try {
1159  std::string val = myLineParser.get(name);
1160  if (val.find(suffix) != std::string::npos) {
1161  val = val.substr(0, val.find(suffix));
1162  }
1163  return StringUtils::toDouble(val);
1164  } catch (...) {}
1165  return -1;
1166 }
1167 
1168 
1169 double
1170 NIImporter_VISUM::getWeightedFloat2(const std::string& name, const std::string& name2, const std::string& suffix) {
1171  double result = getWeightedFloat(name, suffix);
1172  if (result != -1) {
1173  return result;
1174  } else {
1175  return getWeightedFloat(name2, suffix);
1176  }
1177 }
1178 
1179 bool
1180 NIImporter_VISUM::getWeightedBool(const std::string& name) {
1181  try {
1182  return StringUtils::toBool(myLineParser.get(name));
1183  } catch (...) {}
1184  try {
1185  return StringUtils::toBool(myLineParser.get((name + "(IV)")));
1186  } catch (...) {}
1187  return false;
1188 }
1189 
1191 NIImporter_VISUM::getPermissions(const std::string& name, bool warn, SVCPermissions unknown) {
1192  SVCPermissions result = 0;
1193  for (std::string v : StringTokenizer(myLineParser.get(name), ",").getVector()) {
1194  // common values in english and german
1195  // || v == "funiculaire-telecabine" ---> no matching
1196  std::transform(v.begin(), v.end(), v.begin(), tolower);
1197  if (v == "bus" || v == "tcsp" || v == "acces tc" || v == "Accès tc" || v == "accès tc") {
1198  result |= SVC_BUS;
1199  } else if (v == "walk" || v == "w" || v == "f" || v == "ped" || v == "map") {
1200  result |= SVC_PEDESTRIAN;
1201  } else if (v == "l" || v == "lkw" || v == "h" || v == "hgv" || v == "lw" || v == "truck" || v == "tru" || v == "pl") {
1202  result |= SVC_TRUCK;
1203  } else if (v == "b" || v == "bike" || v == "velo") {
1204  result |= SVC_BICYCLE;
1205  } else if (v == "train" || v == "rail") {
1206  result |= SVC_RAIL;
1207  } else if (v == "tram") {
1208  result |= SVC_TRAM;
1209  } else if (v == "p" || v == "pkw" || v == "car" || v == "c" || v == "vp" || v == "2rm") {
1210  result |= SVC_PASSENGER;
1211  } else {
1212  if (warn) {
1213  WRITE_WARNING("Encountered unknown vehicle category '" + v + "' in type '" + myLineParser.get(KEYS.getString(VISUM_NO)) + "'");
1214  }
1215  result |= unknown;
1216  }
1217  }
1218  return result;
1219 }
1220 
1221 NBNode*
1222 NIImporter_VISUM::getNamedNode(const std::string& fieldName) {
1223  std::string nodeS = NBHelpers::normalIDRepresentation(myLineParser.get(fieldName));
1224  NBNode* node = myNetBuilder.getNodeCont().retrieve(nodeS);
1225  if (node == nullptr) {
1226  WRITE_ERROR("The node '" + nodeS + "' is not known.");
1227  }
1228  return node;
1229 }
1230 
1231 NBNode*
1232 NIImporter_VISUM::getNamedNodeSecure(const std::string& fieldName, NBNode* fallback) {
1233  std::string nodeS = NBHelpers::normalIDRepresentation(myLineParser.get(fieldName));
1234  NBNode* node = myNetBuilder.getNodeCont().retrieve(nodeS);
1235  if (node == nullptr) {
1236  return fallback;
1237  }
1238  return node;
1239 }
1240 
1241 
1242 NBNode*
1243 NIImporter_VISUM::getNamedNode(const std::string& fieldName1, const std::string& fieldName2) {
1244  if (myLineParser.know(fieldName1)) {
1245  return getNamedNode(fieldName1);
1246  } else {
1247  return getNamedNode(fieldName2);
1248  }
1249 }
1250 
1251 
1252 NBEdge*
1253 NIImporter_VISUM::getNamedEdge(const std::string& fieldName) {
1254  std::string edgeS = NBHelpers::normalIDRepresentation(myLineParser.get(fieldName));
1255  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(edgeS);
1256  if (edge == nullptr) {
1257  WRITE_ERROR("The edge '" + edgeS + "' is not known.");
1258  }
1259  return edge;
1260 }
1261 
1262 
1263 NBEdge*
1264 NIImporter_VISUM::getNamedEdge(const std::string& fieldName1, const std::string& fieldName2) {
1265  if (myLineParser.know(fieldName1)) {
1266  return getNamedEdge(fieldName1);
1267  } else {
1268  return getNamedEdge(fieldName2);
1269  }
1270 }
1271 
1272 
1273 
1274 NBEdge*
1276  std::string sid;
1277  if (edge->getID()[0] == '-') {
1278  sid = edge->getID().substr(1);
1279  } else {
1280  sid = "-" + edge->getID();
1281  }
1282  if (sid.find('_') != std::string::npos) {
1283  sid = sid.substr(0, sid.find('_'));
1284  }
1286 }
1287 
1288 
1289 NBEdge*
1291  if (begin == nullptr) {
1292  return nullptr;
1293  }
1294  NBEdge* ret = begin;
1295  std::string edgeID = ret->getID();
1296  // hangle forward
1297  while (ret != nullptr) {
1298  // ok, this is the edge we are looking for
1299  if (ret->getToNode() == node) {
1300  return ret;
1301  }
1302  const EdgeVector& nedges = ret->getToNode()->getOutgoingEdges();
1303  if (nedges.size() != 1) {
1304  // too many edges follow
1305  ret = nullptr;
1306  continue;
1307  }
1308  NBEdge* next = nedges[0];
1309  if (ret->getID().substr(0, edgeID.length()) != next->getID().substr(0, edgeID.length())) {
1310  // ok, another edge is next...
1311  ret = nullptr;
1312  continue;
1313  }
1314  if (next->getID().substr(next->getID().length() - node->getID().length()) != node->getID()) {
1315  ret = nullptr;
1316  continue;
1317  }
1318  ret = next;
1319  }
1320 
1321  ret = begin;
1322  // hangle backward
1323  while (ret != nullptr) {
1324  // ok, this is the edge we are looking for
1325  if (ret->getFromNode() == node) {
1326  return ret;
1327  }
1328  const EdgeVector& nedges = ret->getFromNode()->getIncomingEdges();
1329  if (nedges.size() != 1) {
1330  // too many edges follow
1331  ret = nullptr;
1332  continue;
1333  }
1334  NBEdge* next = nedges[0];
1335  if (ret->getID().substr(0, edgeID.length()) != next->getID().substr(0, edgeID.length())) {
1336  // ok, another edge is next...
1337  ret = nullptr;
1338  continue;
1339  }
1340  if (next->getID().substr(next->getID().length() - node->getID().length()) != node->getID()) {
1341  ret = nullptr;
1342  continue;
1343  }
1344  ret = next;
1345  }
1346  return nullptr;
1347 }
1348 
1349 
1350 NBEdge*
1351 NIImporter_VISUM::getNamedEdgeContinuating(const std::string& fieldName, NBNode* node) {
1352  std::string edgeS = NBHelpers::normalIDRepresentation(myLineParser.get(fieldName));
1353  NBEdge* edge = myNetBuilder.getEdgeCont().retrieve(edgeS);
1354  if (edge == nullptr) {
1355  WRITE_ERROR("The edge '" + edgeS + "' is not known.");
1356  }
1357  return getNamedEdgeContinuating(edge, node);
1358 }
1359 
1360 
1361 NBEdge*
1362 NIImporter_VISUM::getNamedEdgeContinuating(const std::string& fieldName1, const std::string& fieldName2,
1363  NBNode* node) {
1364  if (myLineParser.know(fieldName1)) {
1365  return getNamedEdgeContinuating(fieldName1, node);
1366  } else {
1367  return getNamedEdgeContinuating(fieldName2, node);
1368  }
1369 }
1370 
1371 
1372 NBEdge*
1374  EdgeVector::const_iterator i;
1375  for (i = FromNode->getOutgoingEdges().begin(); i != FromNode->getOutgoingEdges().end(); i++) {
1376  if (ToNode == (*i)->getToNode()) {
1377  return (*i);
1378  }
1379  }
1381  return nullptr;
1382 }
1383 
1384 
1385 double
1386 NIImporter_VISUM::getNamedFloat(const std::string& fieldName) {
1387  std::string value = myLineParser.get(fieldName);
1388  if (StringUtils::endsWith(myLineParser.get(fieldName), "km/h")) {
1389  value = value.substr(0, value.length() - 4);
1390  }
1391  return StringUtils::toDouble(value);
1392 }
1393 
1394 
1395 double
1396 NIImporter_VISUM::getNamedFloat(const std::string& fieldName, double defaultValue) {
1397  try {
1398  return StringUtils::toDouble(myLineParser.get(fieldName));
1399  } catch (...) {
1400  return defaultValue;
1401  }
1402 }
1403 
1404 
1405 double
1406 NIImporter_VISUM::getNamedFloat(const std::string& fieldName1, const std::string& fieldName2) {
1407  if (myLineParser.know(fieldName1)) {
1408  return getNamedFloat(fieldName1);
1409  } else {
1410  return getNamedFloat(fieldName2);
1411  }
1412 }
1413 
1414 
1415 double
1416 NIImporter_VISUM::getNamedFloat(const std::string& fieldName1, const std::string& fieldName2,
1417  double defaultValue) {
1418  if (myLineParser.know(fieldName1)) {
1419  return getNamedFloat(fieldName1, defaultValue);
1420  } else {
1421  return getNamedFloat(fieldName2, defaultValue);
1422  }
1423 }
1424 
1425 
1426 std::string
1427 NIImporter_VISUM::getNamedString(const std::string& fieldName) {
1429 }
1430 
1431 
1432 std::string
1433 NIImporter_VISUM::getNamedString(const std::string& fieldName1,
1434  const std::string& fieldName2) {
1435  if (myLineParser.know(fieldName1)) {
1436  return getNamedString(fieldName1);
1437  } else {
1438  return getNamedString(fieldName2);
1439  }
1440 }
1441 
1442 
1443 
1444 
1445 
1446 
1447 NBNode*
1448 NIImporter_VISUM::buildDistrictNode(const std::string& id, NBNode* dest,
1449  bool isSource) {
1450  // get the district
1452  if (dist == nullptr) {
1453  return nullptr;
1454  }
1455  // build the id
1456  std::string nid;
1457  nid = id + "-" + dest->getID();
1458  if (!isSource) {
1459  nid = "-" + nid;
1460  }
1461  // insert the node
1462  if (!myNetBuilder.getNodeCont().insert(nid, dist->getPosition())) {
1463  WRITE_ERROR("Could not build connector node '" + nid + "'.");
1464  }
1465  // return the node
1466  return myNetBuilder.getNodeCont().retrieve(nid);
1467 }
1468 
1469 
1470 bool
1472  if (from == nullptr) {
1473  WRITE_ERROR(" The from-node was not found within the net");
1474  }
1475  if (to == nullptr) {
1476  WRITE_ERROR(" The to-node was not found within the net");
1477  }
1478  if (from == to) {
1479  WRITE_ERROR(" Both nodes are the same");
1480  }
1481  return from != nullptr && to != nullptr && from != to;
1482 }
1483 
1484 bool
1486  return (edge->getID().length() > node->getID().length() + 1
1487  && (edge->getID().substr(edge->getID().length() - node->getID().length() - 1) == "_" + node->getID()));
1488 }
1489 
1490 void
1491 NIImporter_VISUM::loadLanguage(const std::string& file) {
1492  std::ifstream strm(file.c_str());
1493  if (!strm.good()) {
1494  throw ProcessError("Could not load VISUM language map from '" + file + "'.");
1495  }
1496  while (strm.good()) {
1497  std::string keyDE;
1498  std::string keyNew;
1499  strm >> keyDE;
1500  strm >> keyNew;
1501  if (KEYS.hasString(keyDE)) {
1502  VISUM_KEY key = KEYS.get(keyDE);
1503  KEYS.remove(keyDE, key);
1504  KEYS.insert(keyNew, key);
1505  } else if (keyDE != "") {
1506  WRITE_WARNING("Unknown entry '" + keyDE + "' in VISUM language map");
1507  }
1508  }
1509 
1510 }
1511 
1512 /****************************************************************************/
NIImporter_VISUM::getNamedString
std::string getNamedString(const std::string &fieldName)
Returns the value from the named column as a normalised string.
Definition: NIImporter_VISUM.cpp:1427
OptionsCont::isSet
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
Definition: OptionsCont.cpp:135
NBEdge::UNSPECIFIED_OFFSET
static const double UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:318
SVC_PEDESTRIAN
pedestrian
Definition: SUMOVehicleClass.h:156
NIImporter_VISUM::parse_VSysTypes
void parse_VSysTypes()
Parses VSYS.
Definition: NIImporter_VISUM.cpp:267
NBNode::hasOutgoing
bool hasOutgoing(const NBEdge *const e) const
Returns whether the given edge starts at this node.
Definition: NBNode.cpp:1537
NIImporter_VISUM::getEdge
NBEdge * getEdge(NBNode *FromNode, NBNode *ToNode)
Returns the edge that connects both nodes.
Definition: NIImporter_VISUM.cpp:1373
ToString.h
NIImporter_VISUM::getWeightedBool
bool getWeightedBool(const std::string &name)
tries to get a bool which is possibly assigned to a certain modality
Definition: NIImporter_VISUM.cpp:1180
NBEdgeCont::retrieve
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:246
StringUtils::toBool
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
Definition: StringUtils.cpp:374
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:275
NIImporter_VISUM::parse_Connectors
void parse_Connectors()
Parses ANBINDUNG.
Definition: NIImporter_VISUM.cpp:494
NBNetBuilder
Instance responsible for building networks.
Definition: NBNetBuilder.h:109
NIImporter_VISUM::VISUM_FROMPOINTID
Definition: NIImporter_VISUM.h:554
NIImporter_VISUM::parse_LanesConnections
void parse_LanesConnections()
Parses FAHRSTREIFENABBIEGER.
Definition: NIImporter_VISUM.cpp:1047
LineReader::readLine
bool readLine(LineHandler &lh)
Reads a single (the next) line from the file and reports it to the given LineHandler.
Definition: LineReader.cpp:68
StringBijection::getString
const std::string & getString(const T key) const
Definition: StringBijection.h:106
NIImporter_VISUM::KEYS_DE
static StringBijection< VISUM_KEY >::Entry KEYS_DE[]
Strings for the keywords.
Definition: NIImporter_VISUM.h:571
OptionsCont.h
NIImporter_VISUM::getWeightedFloat2
double getWeightedFloat2(const std::string &name, const std::string &name2, const std::string &suffix)
as above but with two alternative names
Definition: NIImporter_VISUM.cpp:1170
LineReader::reinit
void reinit()
Reinitialises the reading (of the previous file)
Definition: LineReader.cpp:191
NBNode::getConnectionTo
NBEdge * getConnectionTo(NBNode *n) const
get connection to certain node
Definition: NBNode.cpp:2158
NIImporter_VISUM::VISUM_TOPOINTID
Definition: NIImporter_VISUM.h:555
LANESPREAD_RIGHT
Definition: SUMOXMLDefinitions.h:1098
NIImporter_VISUM::mySubPartsAreas
std::map< long long int, std::vector< long long int > > mySubPartsAreas
A map from area parts to area ids.
Definition: NIImporter_VISUM.h:519
StringUtils::toDouble
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
Definition: StringUtils.cpp:345
NBHelpers::normalIDRepresentation
static std::string normalIDRepresentation(const std::string &id)
converts the numerical id to its "normal" string representation
Definition: NBHelpers.cpp:70
MsgHandler.h
NIImporter_VISUM::myNetBuilder
NBNetBuilder & myNetBuilder
The network builder to fill with loaded values.
Definition: NIImporter_VISUM.h:468
EdgeVector
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:34
NIImporter_VISUM::parse_Districts
void parse_Districts()
Parses BEZIRK.
Definition: NIImporter_VISUM.cpp:322
NBDistrict::getPosition
const Position & getPosition() const
Returns the position of this district's center.
Definition: NBDistrict.h:122
NIImporter_VISUM::VISUM_SOURCE_DISTRICT
Definition: NIImporter_VISUM.h:549
NIImporter_VISUM::VISUM_CAPACITY
Definition: NIImporter_VISUM.h:539
NBNodeCont::insert
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
Definition: NBNodeCont.cpp:78
NIImporter_VISUM::VISUM_ORIGIN
Definition: NIImporter_VISUM.h:565
SUMO_ATTR_NUMLANES
Definition: SUMOXMLDefinitions.h:383
OptionsCont::getString
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
Definition: OptionsCont.cpp:201
LineReader::setFile
bool setFile(const std::string &file)
Reinitialises the reader for reading from the given file.
Definition: LineReader.cpp:177
NBNode::getOutgoingEdges
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
Definition: NBNode.h:260
NIImporter_VISUM::myUseVisumPrio
bool myUseVisumPrio
Information whether VISUM priority information shall be used.
Definition: NIImporter_VISUM.h:503
NIImporter_VISUM::parse_Lanes
void parse_Lanes()
Parses FAHRSTREIFEN.
Definition: NIImporter_VISUM.cpp:718
NBEdge::addEdge2EdgeConnection
bool addEdge2EdgeConnection(NBEdge *dest)
Adds a connection to another edge.
Definition: NBEdge.cpp:960
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
GeoConvHelper.h
NIImporter_VISUM::parse_SignalGroups
void parse_SignalGroups()
Parses LSASIGNALGRUPPE/SIGNALGRUPPE.
Definition: NIImporter_VISUM.cpp:900
OptionsCont::getBool
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Definition: OptionsCont.cpp:222
SVC_BICYCLE
vehicle is a bicycle
Definition: SUMOVehicleClass.h:179
NIImporter_VISUM::VISUM_YCOORD
Definition: NIImporter_VISUM.h:541
NBTypeCont::insert
void insert(const std::string &id, int numLanes, double maxSpeed, int prio, SVCPermissions permissions, double width, bool oneWayIsDefault, double sidewalkWidth, double bikeLaneWidth, double widthResolution, double maxWidth, double minWidth)
Adds a type into the list.
Definition: NBTypeCont.cpp:53
OptionsCont::getOptions
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:57
NIImporter_VISUM::VISUM_FACEID
Definition: NIImporter_VISUM.h:553
NIImporter_VISUM::getPermissions
SVCPermissions getPermissions(const std::string &name, bool warn=false, SVCPermissions unknown=SVCAll)
parse permissions
Definition: NIImporter_VISUM.cpp:1191
SUMO_ATTR_SPEED
Definition: SUMOXMLDefinitions.h:384
NBNetBuilder::transformCoordinate
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
Definition: NBNetBuilder.cpp:633
NBEdgeCont::insert
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
Definition: NBEdgeCont.cpp:153
NIImporter_VISUM::VISUM_TYPES
Definition: NIImporter_VISUM.h:537
NBEdge::setPermissions
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:3376
NBEdge::setLaneSpreadFunction
void setLaneSpreadFunction(LaneSpreadFunction spread)
(Re)sets how the lanes lateral offset shall be computed
Definition: NBEdge.cpp:885
PositionVector
A list of positions.
Definition: PositionVector.h:45
NIImporter_VISUM::buildDistrictNode
NBNode * buildDistrictNode(const std::string &id, NBNode *dest, bool isSource)
Builds a node for the given district and returns it.
Definition: NIImporter_VISUM.cpp:1448
NamedColumnsParser::parseLine
void parseLine(const std::string &line)
Parses the contents of the line.
Definition: NamedColumnsParser.cpp:61
NBDistrictCont::retrieve
NBDistrict * retrieve(const std::string &id) const
Returns the districts with the given id.
Definition: NBDistrictCont.cpp:59
LANESPREAD_CENTER
Definition: SUMOXMLDefinitions.h:1099
SVC_RAIL
vehicle is a not electrified rail
Definition: SUMOVehicleClass.h:188
NBEdgeCont::splitAt
bool splitAt(NBDistrictCont &dc, NBEdge *edge, NBNode *node)
Splits the edge at the position nearest to the given node.
Definition: NBEdgeCont.cpp:557
NIImporter_VISUM::getNamedNodeSecure
NBNode * getNamedNodeSecure(const std::string &fieldName, NBNode *fallback=0)
Definition: NIImporter_VISUM.cpp:1232
LineReader::setPos
void setPos(unsigned long pos)
Sets the current position within the file to the given value.
Definition: LineReader.cpp:208
NBDistrict.h
NBNetBuilder::getEdgeCont
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:150
NBEdge
The representation of a single edge during network building.
Definition: NBEdge.h:91
NIImporter_VISUM::KEYS
static StringBijection< VISUM_KEY > KEYS
link directions
Definition: NIImporter_VISUM.h:574
NIImporter_VISUM::TypeParser::position
long position
Position of the according db within the file.
Definition: NIImporter_VISUM.h:378
NIImporter_VISUM::myShapeDistrictMap
std::map< long long int, NBDistrict * > myShapeDistrictMap
A map from district shape definition name to the district.
Definition: NIImporter_VISUM.h:516
NIVisumTL::SignalGroup
A signal group can be defined either by a time period or by phases.
Definition: NIVisumTL.h:101
NIImporter_VISUM::parse_NodesToTrafficLights
void parse_NodesToTrafficLights()
Parses KNOTENZULSA/SIGNALANLAGEZUKNOTEN.
Definition: NIImporter_VISUM.cpp:880
NIImporter_VISUM::VISUM_DESTINATION
Definition: NIImporter_VISUM.h:566
SVC_TRAM
vehicle is a light rail
Definition: SUMOVehicleClass.h:184
NIImporter_VISUM::VISUM_FACEITEM
Definition: NIImporter_VISUM.h:563
NIImporter_VISUM::VISUM_FROMNODENO
Definition: NIImporter_VISUM.h:550
NumberFormatException
Definition: UtilExceptions.h:95
NamedColumnsParser::get
std::string get(const std::string &name, bool prune=false) const
Returns the named information.
Definition: NamedColumnsParser.cpp:67
NIImporter_VISUM::VISUM_NODE
Definition: NIImporter_VISUM.h:532
NIImporter_VISUM::~NIImporter_VISUM
~NIImporter_VISUM()
destructor
Definition: NIImporter_VISUM.cpp:176
NBDistrictCont::addSource
bool addSource(const std::string &dist, NBEdge *const source, double weight)
Adds a source to the named district.
Definition: NBDistrictCont.cpp:75
NBEdge::getToNode
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:498
NBCapacity2Lanes::get
int get(double capacity) const
Returns the number of lanes computed from the given capacity.
Definition: NBCapacity2Lanes.h:60
NBEdge::getGeometry
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:692
StringBijection
Definition: StringBijection.h:43
SVC_TRUCK
vehicle is a large transport vehicle
Definition: SUMOVehicleClass.h:171
StringUtils::endsWith
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
Definition: StringUtils.cpp:180
NIImporter_VISUM::myFileName
std::string myFileName
The name of the parsed file, for error reporting.
Definition: NIImporter_VISUM.h:471
NIImporter_VISUM::parse_Connectors_legacy
void parse_Connectors_legacy()
Definition: NIImporter_VISUM.cpp:529
NIVisumTL::SignalGroup::connections
NBConnectionVector & connections()
Returns the connections vector.
Definition: NIVisumTL.h:111
NIImporter_VISUM::VISUM_CODE
Definition: NIImporter_VISUM.h:547
NIImporter_VISUM::VISUM_EDGEID
Definition: NIImporter_VISUM.h:564
SVCPermissions
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
Definition: SUMOVehicleClass.h:218
NIImporter_VISUM::isSplitEdge
static bool isSplitEdge(NBEdge *edge, NBNode *node)
whether the edge id ends with _nodeID
Definition: NIImporter_VISUM.cpp:1485
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:58
NIImporter_VISUM::myCapacity2Lanes
NBCapacity2Lanes myCapacity2Lanes
The converter to compute the lane number of edges from their capacity.
Definition: NIImporter_VISUM.h:482
NIImporter_VISUM::NIImporter_VISUM
NIImporter_VISUM(NBNetBuilder &nb, const std::string &file, NBCapacity2Lanes capacity2Lanes, bool useVisumPrio, const std::string &languageFile)
constructor
Definition: NIImporter_VISUM.cpp:110
NIImporter_VISUM::VISUM_POINT
Definition: NIImporter_VISUM.h:534
StringBijection::insert
void insert(const std::string str, const T key, bool checkDuplicates=true)
Definition: StringBijection.h:71
NIImporter_VISUM::VISUM_FROMNODE
Definition: NIImporter_VISUM.h:542
NBTypeCont::getSpeed
double getSpeed(const std::string &type) const
Returns the maximal velocity for the given type [m/s].
Definition: NBTypeCont.cpp:177
NIImporter_VISUM::parse_Turns
void parse_Turns()
Parses ABBIEGEBEZIEHUNG/ABBIEGER.
Definition: NIImporter_VISUM.cpp:633
StringBijection::get
T get(const std::string &str) const
Definition: StringBijection.h:97
NBEdge::setAsMacroscopicConnector
void setAsMacroscopicConnector()
Definition: NBEdge.h:1022
StringTokenizer
Definition: StringTokenizer.h:61
NIImporter_VISUM::getNamedNode
NBNode * getNamedNode(const std::string &fieldName)
Tries to get the node which name is stored in the given field.
Definition: NIImporter_VISUM.cpp:1222
NIImporter_VISUM::TypeParser
A complete call description for parsing a single db.
Definition: NIImporter_VISUM.h:363
NIImporter_VISUM::load
void load()
Parses the VISUM-network file storing the parsed structures within myNetBuilder.
Definition: NIImporter_VISUM.cpp:194
SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
Definition: SUMOVehicleClass.h:159
PositionVector::positionAtOffset
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Definition: PositionVector.cpp:248
NIImporter_VISUM::parse_PartOfArea
void parse_PartOfArea()
Parses FLAECHENELEMENT.
Definition: NIImporter_VISUM.cpp:483
NBEdge::getNumLanes
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:477
NBNetBuilder.h
NIImporter_VISUM::VISUM_XCOORD
Definition: NIImporter_VISUM.h:540
NIImporter_VISUM::VISUM_TURN
Definition: NIImporter_VISUM.h:559
ProcessError
Definition: UtilExceptions.h:39
OutOfBoundsException
Definition: UtilExceptions.h:134
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
NIImporter_VISUM::VISUM_KEY
VISUM_KEY
Definition: NIImporter_VISUM.h:529
NIVisumTL
Intermediate class for storing visum traffic lights during their import.
Definition: NIVisumTL.h:43
NIImporter_VISUM::myLineParser
NamedColumnsParser myLineParser
the parser to parse the information from the data lines
Definition: NIImporter_VISUM.h:479
NIImporter_VISUM::VISUM_LINKPOLY
Definition: NIImporter_VISUM.h:561
NIImporter_VISUM::getNamedEdgeContinuating
NBEdge * getNamedEdgeContinuating(const std::string &fieldName, NBNode *node)
Tries to get the edge which name is stored in the given field continuating the search for a subedge t...
Definition: NIImporter_VISUM.cpp:1351
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
NIImporter_VISUM
A VISUM network importer.
Definition: NIImporter_VISUM.h:68
NIImporter_VISUM::VISUM_VIANODENO
Definition: NIImporter_VISUM.h:557
LineReader::getPosition
unsigned long getPosition()
Returns the current position within the file.
Definition: LineReader.cpp:185
NBTypeCont::getPriority
int getPriority(const std::string &type) const
Returns the priority for the given type.
Definition: NBTypeCont.cpp:183
NIImporter_VISUM::myEdges
std::map< long long int, std::pair< long long int, long long int > > myEdges
A map of edge (not road, but "edge" in this case) ids to from/to-points.
Definition: NIImporter_VISUM.h:513
NIImporter_VISUM::VISUM_SURFACEID
Definition: NIImporter_VISUM.h:552
NBConnection
Definition: NBConnection.h:43
LineReader::hasMore
bool hasMore() const
Returns whether another line may be read (the file was not read completely)
Definition: LineReader.cpp:52
NamedColumnsParser::reinit
void reinit(const std::string &def, const std::string &defDelim=";", const std::string &lineDelim=";", bool chomp=false, bool ignoreCase=true)
Reinitialises the parser.
Definition: NamedColumnsParser.cpp:50
SUMO_ATTR_ONEWAY
Definition: SUMOXMLDefinitions.h:385
NIImporter_VISUM::myDistrictShapes
std::map< NBDistrict *, PositionVector > myDistrictShapes
A temporary storage for district shapes as they are filled incrementally.
Definition: NIImporter_VISUM.h:522
NIImporter_VISUM::VISUM_ID
Definition: NIImporter_VISUM.h:546
NIImporter_VISUM::checkNodes
bool checkNodes(NBNode *from, NBNode *to)
Returns whether both nodes are a valid combination of from/to-nodes.
Definition: NIImporter_VISUM.cpp:1471
NIImporter_VISUM::VISUM_NUMLANES
Definition: NIImporter_VISUM.h:558
NBEdge::L2L_VALIDATED
The connection was computed and validated.
Definition: NBEdge.h:135
NamedColumnsParser::know
bool know(const std::string &name) const
Returns the information whether the named column is known.
Definition: NamedColumnsParser.cpp:88
NBCapacity2Lanes
A helper class which computes the lane number from given capacity.
Definition: NBCapacity2Lanes.h:39
NIImporter_VISUM::parse_Edges
void parse_Edges()
Parses STRECKE/STRECKEN.
Definition: NIImporter_VISUM.cpp:366
NBNodeCont::retrieve
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:107
NIImporter_VISUM::TypeParser::name
std::string name
The name of the db.
Definition: NIImporter_VISUM.h:367
NIImporter_VISUM::TypeParser::function
ParsingFunction function
Pointer to the function used for parsing.
Definition: NIImporter_VISUM.h:372
NIImporter_VISUM::getReversedContinuating
NBEdge * getReversedContinuating(NBEdge *edge, NBNode *node)
Returns the opposite direction of the given edge.
Definition: NIImporter_VISUM.cpp:1275
NIImporter_VISUM::parse_TrafficLights
void parse_TrafficLights()
Parses LSA/SIGNALANLAGE.
Definition: NIImporter_VISUM.cpp:866
OptionsCont::getFloat
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
Definition: OptionsCont.cpp:208
NBEdge::getLength
double getLength() const
Returns the computed length of the edge.
Definition: NBEdge.h:545
NIImporter_VISUM::VISUM_SURFACEITEM
Definition: NIImporter_VISUM.h:562
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:47
StringUtils.h
NIImporter_VISUM::VISUM_LINKTYPE
Definition: NIImporter_VISUM.h:531
StringUtils::toInt
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
Definition: StringUtils.cpp:278
SUMO_ATTR_PRIORITY
Definition: SUMOXMLDefinitions.h:382
NILoader.h
NBEdgeCont::reduceGeometries
void reduceGeometries(const double minDist)
Definition: NBEdgeCont.cpp:744
NIImporter_VISUM::VISUM_EDGE
Definition: NIImporter_VISUM.h:556
PROGRESS_BEGIN_MESSAGE
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:278
UnknownElement
Definition: UtilExceptions.h:147
NBEdge::addGeometryPoint
void addGeometryPoint(int index, const Position &p)
Adds a further geometry point.
Definition: NBEdge.cpp:891
NIImporter_VISUM::addParser
void addParser(const std::string &name, ParsingFunction function)
Adds a parser into the sorted list of parsers to use.
Definition: NIImporter_VISUM.cpp:184
NBTypeCont::getPermissions
SVCPermissions getPermissions(const std::string &type) const
Returns allowed vehicle classes for the given type.
Definition: NBTypeCont.cpp:221
NIVisumTL::Phase
A phase.
Definition: NIVisumTL.h:86
PositionVector::reverse
PositionVector reverse() const
reverse position vector
Definition: PositionVector.cpp:1086
NBNetBuilder::getTLLogicCont
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:165
NIImporter_VISUM::VISUM_V0
Definition: NIImporter_VISUM.h:536
NIImporter_VISUM::myPoints
std::map< long long int, Position > myPoints
A map of point ids to positions.
Definition: NIImporter_VISUM.h:510
NIImporter_VISUM::VISUM_DISTRICT_CONNECTION
Definition: NIImporter_VISUM.h:548
NIImporter_VISUM::parse_SignalGroupsToPhases
void parse_SignalGroupsToPhases()
Parses LSASIGNALGRUPPEZULSAPHASE.
Definition: NIImporter_VISUM.cpp:1034
NIImporter_VISUM::loadLanguage
void loadLanguage(const std::string &file)
Definition: NIImporter_VISUM.cpp:1491
NIImporter_VISUM::parse_Kante
void parse_Kante()
Parses FLAECHENELEMENT.
Definition: NIImporter_VISUM.cpp:474
NBNode::getIncomingEdges
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
Definition: NBNode.h:255
NBTypeCont::markAsSet
bool markAsSet(const std::string &id, const SumoXMLAttr attr)
Marks an attribute of a type as set.
Definition: NBTypeCont.cpp:88
NIImporter_VISUM.h
PROGRESS_DONE_MESSAGE
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:279
NBDistrictCont::insert
bool insert(NBDistrict *const district)
Adds a district to the dictionary.
Definition: NBDistrictCont.cpp:48
StringBijection::Entry
Definition: StringBijection.h:51
NBTypeCont::getNumLanes
int getNumLanes(const std::string &type) const
Returns the number of lanes for the given type.
Definition: NBTypeCont.cpp:171
NBNetBuilder::getDistrictCont
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:170
SUMO_ATTR_ALLOW
Definition: SUMOXMLDefinitions.h:782
NIImporter_VISUM::VISUM_RANK
Definition: NIImporter_VISUM.h:538
NBEdge::UNSPECIFIED_WIDTH
static const double UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:315
NIImporter_VISUM::parse_TurnsToSignalGroups
void parse_TurnsToSignalGroups()
Parses ABBZULSASIGNALGRUPPE/SIGNALGRUPPEZUABBIEGER.
Definition: NIImporter_VISUM.cpp:916
NIImporter_VISUM::parse_Types
void parse_Types()
Parses STRECKENTYP.
Definition: NIImporter_VISUM.cpp:275
NIImporter_VISUM::parse_Nodes
void parse_Nodes()
Parses KNOTEN.
Definition: NIImporter_VISUM.cpp:303
NIImporter_VISUM::getNamedEdge
NBEdge * getNamedEdge(const std::string &fieldName)
Tries to get the edge which name is stored in the given field.
Definition: NIImporter_VISUM.cpp:1253
LaneSpreadFunction
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
Definition: SUMOXMLDefinitions.h:1097
NBDistrictCont::addSink
bool addSink(const std::string &dist, NBEdge *const destination, double weight)
Adds a sink to the named district.
Definition: NBDistrictCont.cpp:86
NIImporter_VISUM::VISUM_TYP
Definition: NIImporter_VISUM.h:545
NBNode::hasIncoming
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
Definition: NBNode.cpp:1531
config.h
NIImporter_VISUM::myVSysTypes
VSysTypeNames myVSysTypes
The used vsystypes.
Definition: NIImporter_VISUM.h:487
NIImporter_VISUM::VISUM_NO
Definition: NIImporter_VISUM.h:567
NIImporter_VISUM::parse_Point
void parse_Point()
Parses PUNKT.
Definition: NIImporter_VISUM.cpp:352
StringBijection::hasString
bool hasString(const std::string &str) const
Definition: StringBijection.h:116
SVC_BUS
vehicle is a bus
Definition: SUMOVehicleClass.h:165
NIImporter_VISUM::loadNetwork
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads network definition from the assigned option and stores it in the given network builder.
Definition: NIImporter_VISUM.cpp:92
NIVisumTL::SignalGroup::phases
std::map< std::string, Phase * > & phases()
Returns the phases map.
Definition: NIVisumTL.h:116
NBEdge::incLaneNo
void incLaneNo(int by)
increment lane
Definition: NBEdge.cpp:3150
StringUtils::toLong
static long long int toLong(const std::string &sData)
converts a string into the long value described by it by calling the char-type converter,...
Definition: StringUtils.cpp:297
NIImporter_VISUM::VISUM_DISTRICT
Definition: NIImporter_VISUM.h:533
NIImporter_VISUM::myLineReader
LineReader myLineReader
The line reader to use to read from the file.
Definition: NIImporter_VISUM.h:474
NBNode
Represents a single node (junction) during network building.
Definition: NBNode.h:67
NIImporter_VISUM::myTouchedEdges
std::vector< std::string > myTouchedEdges
Already read edges.
Definition: NIImporter_VISUM.h:500
NIImporter_VISUM::VISUM_LINK
Definition: NIImporter_VISUM.h:535
NIImporter_VISUM::myTLS
NIVisumTL_Map myTLS
List of visum traffic lights.
Definition: NIImporter_VISUM.h:497
NIImporter_VISUM::getWeightedFloat
double getWeightedFloat(const std::string &name, const std::string &suffix)
tries to get a double which is possibly assigned to a certain modality
Definition: NIImporter_VISUM.cpp:1157
NBNetBuilder::getNodeCont
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:155
NIImporter_VISUM::myCurrentID
std::string myCurrentID
The name of the currently parsed item used for error reporting.
Definition: NIImporter_VISUM.h:506
NBNetBuilder::getTypeCont
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:160
NIImporter_VISUM::VISUM_DIRECTION
Definition: NIImporter_VISUM.h:551
NIImporter_VISUM::VISUM_INDEX
Definition: NIImporter_VISUM.h:560
StringBijection::remove
void remove(const std::string str, const T key)
Definition: StringBijection.h:91
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
POSITION_EPS
#define POSITION_EPS
Definition: config.h:172
NIImporter_VISUM::parse_EdgePolys
void parse_EdgePolys()
Parses STRECKENPOLY.
Definition: NIImporter_VISUM.cpp:674
NIImporter_VISUM::getNamedFloat
double getNamedFloat(const std::string &fieldName)
Returns the value from the named column as a float.
Definition: NIImporter_VISUM.cpp:1386
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:283
NBEdge::addLane2LaneConnection
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED, SVCPermissions=SVC_UNSPECIFIED)
Adds a connection between the specified this edge's lane and an approached one.
Definition: NBEdge.cpp:984
NBDistrict
A class representing a single district.
Definition: NBDistrict.h:64
NBEdge::getFromNode
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:491
WRITE_MESSAGE
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:277
NIImporter_VISUM::VISUM_SYS
Definition: NIImporter_VISUM.h:530
NIImporter_VISUM::parse_Phases
void parse_Phases()
Parses LSAPHASE/PHASE.
Definition: NIImporter_VISUM.cpp:1023
NIImporter_VISUM::VISUM_TYPE
Definition: NIImporter_VISUM.h:544
NIImporter_VISUM::VISUM_TONODE
Definition: NIImporter_VISUM.h:543
NIImporter_VISUM::mySingleDataParsers
ParserVector mySingleDataParsers
List of known parsers.
Definition: NIImporter_VISUM.h:492
NIImporter_VISUM::parse_AreaSubPartElement
void parse_AreaSubPartElement()
Parses ABBZULSASIGNALGRUPPE/SIGNALGRUPPEZUABBIEGER.
Definition: NIImporter_VISUM.cpp:974
NBEdge::getID
const std::string & getID() const
Definition: NBEdge.h:1380