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