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