SUMO - Simulation of Urban MObility
NIImporter_DlrNavteq.cpp
Go to the documentation of this file.
1 /****************************************************************************/
9 // Importer for networks stored in Elmar's format
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <string>
34 #include <sstream>
35 #include <limits>
41 #include <utils/common/ToString.h>
46 #include <netbuild/NBNetBuilder.h>
47 #include <netbuild/NBNode.h>
48 #include <netbuild/NBNodeCont.h>
49 #include <netbuild/NBEdge.h>
50 #include <netbuild/NBEdgeCont.h>
51 #include <netbuild/NBTypeCont.h>
52 #include <netbuild/NBOwnTLDef.h>
54 #include "NILoader.h"
55 #include "NIImporter_DlrNavteq.h"
56 
57 
58 #ifdef CHECK_MEMORY_LEAKS
59 #include <foreign/nvwa/debug_new.h>
60 #endif // CHECK_MEMORY_LEAKS
61 
62 // ---------------------------------------------------------------------------
63 // static members
64 // ---------------------------------------------------------------------------
67 
68 // ===========================================================================
69 // method definitions
70 // ===========================================================================
71 // ---------------------------------------------------------------------------
72 // static methods
73 // ---------------------------------------------------------------------------
74 void
76  // check whether the option is set (properly)
77  if (!oc.isSet("dlr-navteq-prefix")) {
78  return;
79  }
80  // parse file(s)
81  LineReader lr;
82  // load nodes
83  std::map<std::string, PositionVector> myGeoms;
84  PROGRESS_BEGIN_MESSAGE("Loading nodes");
85  std::string file = oc.getString("dlr-navteq-prefix") + "_nodes_unsplitted.txt";
86  NodesHandler handler1(nb.getNodeCont(), file, myGeoms);
87  if (!lr.setFile(file)) {
88  throw ProcessError("The file '" + file + "' could not be opened.");
89  }
90  lr.readAll(handler1);
92 
93  // load street names if given and wished
94  std::map<std::string, std::string> streetNames; // nameID : name
95  if (oc.getBool("output.street-names")) {
96  file = oc.getString("dlr-navteq-prefix") + "_names.txt";
97  if (lr.setFile(file)) {
98  PROGRESS_BEGIN_MESSAGE("Loading Street Names");
99  NamesHandler handler4(file, streetNames);
100  lr.readAll(handler4);
102  } else {
103  WRITE_WARNING("Output will not contain street names because the file '" + file + "' was not found");
104  }
105  }
106 
107  // load edges
108  PROGRESS_BEGIN_MESSAGE("Loading edges");
109  file = oc.getString("dlr-navteq-prefix") + "_links_unsplitted.txt";
110  // parse the file
111  EdgesHandler handler2(nb.getNodeCont(), nb.getEdgeCont(), nb.getTypeCont(), file, myGeoms, streetNames);
112  if (!lr.setFile(file)) {
113  throw ProcessError("The file '" + file + "' could not be opened.");
114  }
115  lr.readAll(handler2);
118 
119  // load traffic lights if given
120  file = oc.getString("dlr-navteq-prefix") + "_traffic_signals.txt";
121  if (lr.setFile(file)) {
122  PROGRESS_BEGIN_MESSAGE("Loading traffic lights");
123  TrafficlightsHandler handler3(nb.getNodeCont(), nb.getTLLogicCont(), nb.getEdgeCont(), file);
124  lr.readAll(handler3);
126  }
127 
128  // load time restrictions if given
129  file = oc.getString("dlr-navteq-prefix") + "_links_timerestrictions.txt";
130  if (lr.setFile(file)) {
131  PROGRESS_BEGIN_MESSAGE("Loading time restrictions");
132  time_t csTime;
133  time(&csTime);
134  if (!oc.isDefault("construction-date")) {
135  csTime = readDate(oc.getString("construction-date"));
136  }
137  TimeRestrictionsHandler handler5(nb.getEdgeCont(), nb.getDistrictCont(), csTime);
138  lr.readAll(handler5);
139  handler5.printSummary();
141  }
142 }
143 
144 
145 // ---------------------------------------------------------------------------
146 // definitions of NIImporter_DlrNavteq::NodesHandler-methods
147 // ---------------------------------------------------------------------------
149  const std::string& file,
150  std::map<std::string, PositionVector>& geoms)
151  : myNodeCont(nc), myGeoms(geoms) {
152  UNUSED_PARAMETER(file);
153 }
154 
155 
157 
158 
159 bool
160 NIImporter_DlrNavteq::NodesHandler::report(const std::string& result) {
161  if (result[0] == '#') {
162  return true;
163  }
164  std::string id;
165  double x, y;
166  int no_geoms, intermediate;
167  // parse
168  std::istringstream stream(result);
169  // id
170  stream >> id;
171  if (stream.fail()) {
172  throw ProcessError("Something is wrong with the following data line\n" + result);
173  }
174  // intermediate?
175  stream >> intermediate;
176  if (stream.fail()) {
177  if (myNodeCont.size() == 0) { // be generous with extra data at beginning of file
178  return true;
179  }
180  throw ProcessError("Non-numerical value for intermediate status in node " + id + ".");
181  }
182  // number of geometrical information
183  stream >> no_geoms;
184  if (stream.fail()) {
185  throw ProcessError("Non-numerical value for number of geometries in node " + id + ".");
186  }
187  // geometrical information
188  PositionVector geoms;
189  for (int i = 0; i < no_geoms; i++) {
190  stream >> x;
191  if (stream.fail()) {
192  throw ProcessError("Non-numerical value for x-position in node " + id + ".");
193  }
194  stream >> y;
195  if (stream.fail()) {
196  throw ProcessError("Non-numerical value for y-position in node " + id + ".");
197  }
198  Position pos(x, y);
199  if (!NBNetBuilder::transformCoordinate(pos, true)) {
200  throw ProcessError("Unable to project coordinates for node " + id + ".");
201  }
202  geoms.push_back(pos);
203  }
204 
205  if (intermediate == 0) {
206  NBNode* n = new NBNode(id, geoms[0]);
207  if (!myNodeCont.insert(n)) {
208  delete n;
209  throw ProcessError("Could not add node '" + id + "'.");
210  }
211  } else {
212  myGeoms[id] = geoms;
213  }
214  return true;
215 }
216 
217 
218 // ---------------------------------------------------------------------------
219 // definitions of NIImporter_DlrNavteq::EdgesHandler-methods
220 // ---------------------------------------------------------------------------
222  NBTypeCont& tc, const std::string& file,
223  std::map<std::string, PositionVector>& geoms,
224  std::map<std::string, std::string>& streetNames):
225  myNodeCont(nc),
226  myEdgeCont(ec),
227  myTypeCont(tc),
228  myGeoms(geoms),
229  myStreetNames(streetNames),
230  myVersion(0),
231  myFile(file) {
232 }
233 
234 
236 
237 
238 bool
239 NIImporter_DlrNavteq::EdgesHandler::report(const std::string& result) {
240  // parse version number from first comment line and initialize column definitions
241  if (result[0] == '#') {
242  if (!myColumns.empty()) {
243  return true;
244  }
245  const std::string marker = "extraction version: v";
246  const std::string lowerCase = StringUtils::to_lower_case(result);
247  if (lowerCase.find(marker) == std::string::npos) {
248  return true;
249  }
250  const int vStart = (int)(lowerCase.find(marker) + marker.size());
251  const int vEnd = (int)result.find(" ", vStart);
252  try {
253  myVersion = TplConvert::_2SUMOReal(result.substr(vStart, vEnd - vStart).c_str());
254  if (myVersion < 0) {
255  throw ProcessError("Invalid version number '" + toString(myVersion) + "' in file '" + myFile + "'.");
256  }
257  // init columns
258  const int NUM_COLUMNS = 25; // @note arrays must match this size!
259  const int MC = MISSING_COLUMN;
260  if (myVersion < 3) {
261  const int columns[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, MC, 12, 13, 14, 15, 16, 17, 18, 19, 20, MC, MC, -21};
262  myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
263  } else if (myVersion < 6) {
264  const int columns[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, MC, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -23};
265  myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
266  } else {
267  const int columns[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24};
268  myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
269  }
270  } catch (NumberFormatException&) {
271  throw ProcessError("Non-numerical value '" + result.substr(vStart, vEnd - vStart) + "' for version string in file '" + myFile + "'.");
272  }
273  return true;
274  }
275  if (myColumns.empty()) {
276  throw ProcessError("Missing version string in file '" + myFile + "'.");
277  }
278  // interpret link attributes
280  const std::string id = getColumn(st, LINK_ID);
281  // form of way (for priority and permissions)
282  int form_of_way;
283  try {
284  form_of_way = TplConvert::_2int(getColumn(st, FORM_OF_WAY).c_str());
285  } catch (NumberFormatException&) {
286  throw ProcessError("Non-numerical value for form_of_way of link '" + id + "'.");
287  }
288  // brunnel type (bridge/tunnel/ferry (for permissions)
289  int brunnel_type;
290  try {
291  brunnel_type = TplConvert::_2int(getColumn(st, BRUNNEL_TYPE).c_str());
292  } catch (NumberFormatException&) {
293  throw ProcessError("Non-numerical value for brunnel_type of link '" + id + "'.");
294  }
295  // priority based on street_type / frc
296  int priority;
297  try {
298  priority = -TplConvert::_2int(getColumn(st, FUNCTIONAL_ROAD_CLASS).c_str());
299  // lower priority using form_of_way
300  if (form_of_way == 11) {
301  priority -= 1; // frontage road, very often with lowered curb
302  } else if (form_of_way > 11) {
303  priority -= 2; // parking/service access assume lowered curb
304  }
305  } catch (NumberFormatException&) {
306  throw ProcessError("Non-numerical value for street_type of link '" + id + "').");
307  }
308  // street name
309  std::string streetName = getStreetNameFromIDs(
312  // try to get the nodes
313  const std::string fromID = getColumn(st, NODE_ID_FROM);
314  const std::string toID = getColumn(st, NODE_ID_TO);
315  NBNode* from = myNodeCont.retrieve(fromID);
316  NBNode* to = myNodeCont.retrieve(toID);
317  if (from == 0) {
318  throw ProcessError("The from-node '" + fromID + "' of link '" + id + "' could not be found");
319  }
320  if (to == 0) {
321  throw ProcessError("The to-node '" + toID + "' of link '" + id + "' could not be found");
322  }
323  // speed
324  SUMOReal speed;
325  try {
326  speed = TplConvert::_2int(getColumn(st, SPEED_RESTRICTION, "-1").c_str()) / 3.6;
327  } catch (NumberFormatException) {
328  throw ProcessError("Non-numerical value for the SPEED_RESTRICTION of link '" + id + "'.");
329  }
330  if (speed < 0) {
331  // speed category as fallback
333  }
334  // number of lanes
335  int numLanes;
336  try {
337  // EXTENDED_NUMBER_OF_LANES is prefered but may not be defined
338  numLanes = TplConvert::_2int(getColumn(st, EXTENDED_NUMBER_OF_LANES, "-1").c_str());
339  if (numLanes == -1) {
340  numLanes = NINavTeqHelper::getLaneNumber(id, getColumn(st, NUMBER_OF_LANES), speed);
341  }
342  } catch (NumberFormatException&) {
343  throw ProcessError("Non-numerical value for the number of lanes of link '" + id + "'.");
344  }
345  // build the edge
346  NBEdge* e = 0;
347  const std::string interID = getColumn(st, BETWEEN_NODE_ID);
348  if (interID == "-1") {
349  e = new NBEdge(id, from, to, "", speed, numLanes, priority,
351  } else {
352  PositionVector geoms = myGeoms[interID];
353  if (getColumn(st, CONNECTION, "0") == "1") {
354  geoms = geoms.reverse();
355  }
356  geoms.insert(geoms.begin(), from->getPosition());
357  geoms.push_back(to->getPosition());
358  e = new NBEdge(id, from, to, "", speed, numLanes, priority,
360  }
361 
362  // NavTeq imports can be done with a typemap (if supplied), if not, the old defaults are used
363  const std::string navTeqTypeId = getColumn(st, VEHICLE_TYPE) + "_" + getColumn(st, FORM_OF_WAY);
364 
365  if (myTypeCont.knows(navTeqTypeId)) {
366  e->setPermissions(myTypeCont.getPermissions(navTeqTypeId));
367  } else {
368  // add vehicle type information to the edge
369  if (myVersion < 6.0) {
371  } else {
373  }
374  if (e->getPermissions() == SVCAll) {
376  }
377  // permission modifications based on form_of_way
378  if (form_of_way == 14) { // pedestrian area (fussgaengerzone)
379  // unfortunately, the veh_type string is misleading in this case
381  }
382  // permission modifications based on brunnel_type
383  if (brunnel_type == 10) { // ferry
384  e->setPermissions(SVC_SHIP, -1);
385  }
386  }
387 
388  // insert the edge to the network
389  if (!myEdgeCont.insert(e)) {
390  delete e;
391  throw ProcessError("Could not add edge '" + id + "'.");
392  }
393  return true;
394 }
395 
396 
397 std::string
398 NIImporter_DlrNavteq::EdgesHandler::getColumn(const StringTokenizer& st, ColumnName name, const std::string fallback) {
399  assert(!myColumns.empty());
400  if (myColumns[name] == MISSING_COLUMN) {
401  if (fallback == "") {
402  throw ProcessError("Missing column " + toString(name) + ".");
403  } else {
404  return fallback;
405  }
406  } else if (myColumns[name] >= 0) {
407  return st.get((int)(myColumns[name]));
408  } else {
409  // negative column number implies an optional column
410  if ((int) st.size() <= -myColumns[name]) {
411  // the column is not present
412  if (fallback == "") {
413  throw ProcessError("Missing optional column " + toString(name) + " without default value.");
414  } else {
415  return fallback;
416  }
417  } else {
418  return st.get((int)(-myColumns[name]));
419  }
420  }
421 }
422 
423 
424 std::string
426  const std::string& regionalID, const std::string& localID) const {
427  std::string result = "";
428  bool hadRegional = false;
429  if (myStreetNames.count(regionalID) > 0) {
430  hadRegional = true;
431  result += myStreetNames[regionalID];
432  }
433  if (myStreetNames.count(localID) > 0) {
434  if (hadRegional) {
435  result += " / ";
436  }
437  result += myStreetNames[localID];
438  }
439  return result;
440 }
441 
442 // ---------------------------------------------------------------------------
443 // definitions of NIImporter_DlrNavteq::TrafficlightsHandler-methods
444 // ---------------------------------------------------------------------------
447  NBEdgeCont& ne,
448  const std::string& file) :
449  myNodeCont(nc),
450  myTLLogicCont(tlc),
451  myEdgeCont(ne) {
452  UNUSED_PARAMETER(file);
453 }
454 
455 
457 
458 
459 bool
461 // #ID POICOL-TYPE DESCRIPTION LONGITUDE LATITUDE NAVTEQ_LINK_ID NODEID
462 
463  if (result[0] == '#') {
464  return true;
465  }
467  const std::string edgeID = st.get(5);
468  NBEdge* edge = myEdgeCont.retrieve(edgeID);
469  if (edge == 0) {
470  WRITE_WARNING("The traffic light edge '" + edgeID + "' could not be found");
471  } else {
472  NBNode* node = edge->getToNode();
473  if (node->getType() != NODETYPE_TRAFFIC_LIGHT) {
474  node->reinit(node->getPosition(), NODETYPE_TRAFFIC_LIGHT);
475  // @note. There may be additional information somewhere in the GDF files about traffic light type ...
477  // @note actually we could use the navteq node ID here
478  NBTrafficLightDefinition* tlDef = new NBOwnTLDef(node->getID(), node, 0, type);
479  if (!myTLLogicCont.insert(tlDef)) {
480  // actually, nothing should fail here
481  delete tlDef;
482  throw ProcessError("Could not allocate tls for '" + node->getID() + "'.");
483  }
484  }
485  }
486  return true;
487 }
488 
489 
490 // ---------------------------------------------------------------------------
491 // definitions of NIImporter_DlrNavteq::NamesHandler-methods
492 // ---------------------------------------------------------------------------
494  const std::string& file, std::map<std::string, std::string>& streetNames) :
495  myStreetNames(streetNames) {
496  UNUSED_PARAMETER(file);
497 }
498 
499 
501 
502 
503 bool
504 NIImporter_DlrNavteq::NamesHandler::report(const std::string& result) {
505 // # NAME_ID Name
506  if (result[0] == '#') {
507  return true;
508  }
510  if (st.size() == 1) {
511  return true; // one line with the number of data containing lines in it (also starts with a comment # since ersion 6.5)
512  }
513  assert(st.size() >= 2);
514  const std::string id = st.next();
515  if (st.size() > 2) {
516  const std::string permanent_id_info = st.next();
517  }
518  myStreetNames[id] = st.next();
519  return true;
520 }
521 
522 
523 // ---------------------------------------------------------------------------
524 // definitions of NIImporter_DlrNavteq::TimeRestrictionsHandler-methods
525 // ---------------------------------------------------------------------------
527  myEdgeCont(ec),
528  myDistrictCont(dc),
529  myConstructionTime(constructionTime),
530  myCS_min(std::numeric_limits<time_t>::max()),
531  myCS_max(std::numeric_limits<time_t>::min()),
532  myConstructionEntries(0),
533  myNotStarted(0),
534  myUnderConstruction(0),
535  myFinished(0),
536  myRemovedEdges(0) {
537 }
538 
539 
541 
542 
543 bool
545 // # NAME_ID Name
546  if (result[0] == '#') {
547  return true;
548  }
550  const std::string id = st.next();
551  const std::string type = st.next();
552  const std::string directionOfFlow = st.next(); // can be ignored since unidirectional edge ids are referenced in the file
553  const std::string throughTraffic = st.next();
554  const std::string vehicleType = st.next();
555  const std::string validityPeriod = st.next();
556  const std::string warning = "Unrecognized TIME_REC '" + validityPeriod + "'";
557  if (type == "CS") {
559  if (validityPeriod.size() > 1024) {
560  WRITE_WARNING(warning);
561  }
562  // construction
563  char start[1024];
564  char duration[1024];
565 
566  int matched;
567 
568  matched = sscanf(validityPeriod.c_str(), "[(%[^)]){%[^}]}]", start, duration);
569  if (matched == 2) {
570  time_t tStart = readTimeRec(start, "");
571  time_t tEnd = readTimeRec(start, duration);
572  myCS_min = MIN2(myCS_min, tStart);
573  myCS_max = MAX2(myCS_max, tEnd);
574  //std::cout << " start=" << start << " tStart=" << tStart<< " translation=" << asctime(localtime(&tStart)) << "";
575  //std::cout << " duration=" << duration << " tEnd=" << tEnd << " translation=" << asctime(localtime(&tEnd)) << "\n";
576  if (myConstructionTime < tEnd) {
577  NBEdge* edge = myEdgeCont.retrieve(id);
578  if (edge != 0) {
579  myRemovedEdges++;
580  myEdgeCont.extract(myDistrictCont, edge, true);
581  }
582  if (myConstructionTime < tStart) {
583  myNotStarted++;
584  } else {
586  }
587  } else {
588  myFinished++;
589  }
590  } else {
591  WRITE_WARNING(warning);
592  };
593  }
594  return true;
595 }
596 
597 
598 void
600  if (myConstructionEntries > 0) {
601  char buff[1024];
602  std::ostringstream msg;
603  strftime(buff, 1024, "%Y-%m-%d", localtime(&myCS_min));
604  msg << "Parsed " << myConstructionEntries << " construction entries between " << buff;
605  strftime(buff, 1024, "%Y-%m-%d", localtime(&myCS_max));
606  msg << " and " << buff << ".\n";
607  strftime(buff, 1024, "%Y-%m-%d", localtime(&myConstructionTime));
608  msg << "Removed " << myRemovedEdges << " edges not yet constructed at " << buff << ".\n";
609  msg << " not yet started: " << myNotStarted << "\n";
610  msg << " under construction: " << myUnderConstruction << "\n";
611  msg << " finished: " << myFinished << "\n";
612  WRITE_MESSAGE(msg.str());
613  }
614 }
615 
616 
617 int
618 NIImporter_DlrNavteq::readPrefixedInt(const std::string& s, const std::string& prefix, int fallBack) {
619  int result = fallBack;
620  size_t pos = s.find(prefix);
621  if (pos != std::string::npos) {
622  sscanf(s.substr(pos).c_str(), (prefix + "%i").c_str(), &result);
623  }
624  return result;
625 }
626 
627 time_t
628 NIImporter_DlrNavteq::readTimeRec(const std::string& start, const std::string& duration) {
629  // http://www.cplusplus.com/reference/ctime/mktime/
630  struct tm timeinfo;
631  timeinfo.tm_hour = 0;
632  timeinfo.tm_min = 0;
633  timeinfo.tm_sec = 0;
634  timeinfo.tm_year = 0;
635  timeinfo.tm_mon = 0;
636  timeinfo.tm_mday = 1;
637  timeinfo.tm_wday = 0;
638  timeinfo.tm_yday = 0;
639  timeinfo.tm_isdst = 0;
640 
641  timeinfo.tm_year = readPrefixedInt(start, "y") + readPrefixedInt(duration, "y") - 1900;
642  timeinfo.tm_mon = readPrefixedInt(start, "M") + readPrefixedInt(duration, "M") - 1;
643  timeinfo.tm_mday = 7 * (readPrefixedInt(start, "w") + readPrefixedInt(duration, "w"));
644  timeinfo.tm_mday += readPrefixedInt(start, "d") + readPrefixedInt(duration, "d");
645 
646  time_t result = mktime(&timeinfo);
647  return result;
648 }
649 
650 
651 time_t
652 NIImporter_DlrNavteq::readDate(const std::string& yyyymmdd) {
653  struct tm timeinfo;
654  timeinfo.tm_hour = 0;
655  timeinfo.tm_min = 0;
656  timeinfo.tm_sec = 0;
657  timeinfo.tm_wday = 0;
658  timeinfo.tm_yday = 0;
659  timeinfo.tm_isdst = 0;
660 
661  if (yyyymmdd.size() == 10
662  && yyyymmdd[4] == '-'
663  && yyyymmdd[7] == '-') {
664  try {
665  timeinfo.tm_year = TplConvert::_str2int(yyyymmdd.substr(0, 4)) - 1900;
666  timeinfo.tm_mon = TplConvert::_str2int(yyyymmdd.substr(5, 2)) - 1;
667  timeinfo.tm_mday = TplConvert::_str2int(yyyymmdd.substr(8, 2));
668  return mktime(&timeinfo);
669  } catch (...) {
670  }
671  }
672  WRITE_ERROR("Could not parse YYYY-MM-DD date '" + yyyymmdd + "'");
673  time_t now;
674  time(&now);
675  return now;
676 }
677 
678 
679 /****************************************************************************/
bool report(const std::string &result)
Parsing method.
NBNodeCont & myNodeCont
The node container to get the referenced nodes from.
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
Definition: NBEdge.h:244
NBTypeCont & getTypeCont()
Returns a reference to the type container.
Definition: NBNetBuilder.h:154
bool report(const std::string &result)
Parsing method.
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
std::string next()
#define min(a, b)
Definition: polyfonts.c:66
std::map< std::string, std::string > & myStreetNames
Previously read streat names (non-const because operate[] is more convenient)
static SUMOReal _2SUMOReal(const E *const data)
converts a char-type array into the SUMOReal value described by it
Definition: TplConvert.h:297
static const int WHITECHARS
Importer of street names in DLRNavteq&#39;s (aka elmar) format.
Importer of nodes stored in unsplit elmar format.
A container for traffic light definitions and built programs.
Retrieves a file linewise and reports the lines to a handler.
Definition: LineReader.h:58
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
Definition: NBNode.cpp:266
bool report(const std::string &result)
Parsing method.
NodesHandler(NBNodeCont &nc, const std::string &file, std::map< std::string, PositionVector > &geoms)
Constructor.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
The representation of a single edge during network building.
Definition: NBEdge.h:71
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given dlr-navteq (aka Elmar-fomat) folder.
A container for districts.
The base class for traffic light logic definitions.
static void addVehicleClasses(NBEdge &e, const std::string &classS)
Adds vehicle classes parsing the given list of allowed vehicles.
bool report(const std::string &result)
Parsing method.
T MAX2(T a, T b)
Definition: StdDefs.h:70
bool setFile(const std::string &file)
Reinitialises the reader for reading from the given file.
Definition: LineReader.cpp:189
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:2735
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
std::map< std::string, PositionVector > & myGeoms
Previously read edge geometries (manipulated during use)
Importer of street names in DLRNavteq&#39;s (aka elmar) format.
const SVCPermissions SVCAll
NBTypeCont & myTypeCont
The type container to retrieve type info from.
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
Definition: NBEdge.h:247
Importer of traffic lights stored in DLRNavteq&#39;s (aka elmar) format.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:38
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:69
PositionVector reverse() const
reverse position vector
time_t myConstructionTime
The date for which to build the network (in case some edges are still under construction) ...
Importer of edges stored in unsplit elmar format.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
const std::string & getID() const
Returns the id.
Definition: Named.h:66
const Position & getPosition() const
Definition: NBNode.h:232
void readAll(LineHandler &lh)
Reads the whole file linewise, reporting every line to the given LineHandler.
Definition: LineReader.cpp:70
#define max(a, b)
Definition: polyfonts.c:65
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
Definition: NBEdgeCont.cpp:162
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:55
NamesHandler(const std::string &file, std::map< std::string, std::string > &streetNames)
Constructor.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
void extract(NBDistrictCont &dc, NBEdge *edge, bool remember=false)
Removes the given edge from the container like erase but does not delete it.
Definition: NBEdgeCont.cpp:396
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
TimeRestrictionsHandler(NBEdgeCont &ec, NBDistrictCont &dc, time_t constructionTime)
Constructor.
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:144
A list of positions.
static int _str2int(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
Definition: TplConvert.h:160
SumoXMLNodeType getType() const
Returns the type of this node.
Definition: NBNode.h:257
static time_t readTimeRec(const std::string &start, const std::string &duration)
std::map< std::string, PositionVector > & myGeoms
A container for parsed geometries.
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
T MIN2(T a, T b)
Definition: StdDefs.h:64
const std::string myFile
the file being parsed
#define PROGRESS_BEGIN_MESSAGE(msg)
Definition: MsgHandler.h:202
static int readPrefixedInt(const std::string &s, const std::string &prefix, int fallBack=0)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
bool knows(const std::string &type) const
Returns whether the named type is in the container.
Definition: NBTypeCont.cpp:79
vehicle is a passenger car (a "normal" car)
static const int TAB
is an arbitrary ship
static SUMOReal getSpeed(const std::string &id, const std::string &speedClassS)
Returns the speed evaluating the given Navteq-description.
SUMOReal myVersion
version number of current file
std::string getStreetNameFromIDs(const std::string &regionalID, const std::string &localID) const
build the street name for the given ids
NBEdgeCont & myEdgeCont
The edge container to get the referenced edges from.
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:206
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2763
static void addVehicleClassesV6(NBEdge &e, const std::string &classS)
same as addVehicleClasses but for version 6+
static std::string to_lower_case(std::string str)
Transfers the content to lower case.
Definition: StringUtils.cpp:67
static int _2int(const E *const data)
converts a char-type array into the integer value described by it
Definition: TplConvert.h:149
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:423
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
Definition: NBEdgeCont.cpp:255
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:149
Instance responsible for building networks.
Definition: NBNetBuilder.h:112
std::string get(int pos) const
A storage for options typed value containers)
Definition: OptionsCont.h:99
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
Definition: NBNodeCont.cpp:81
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
Definition: NBNetBuilder.h:159
std::map< std::string, std::string > & myStreetNames
The container for storing read names.
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to.
EdgesHandler(NBNodeCont &nc, NBEdgeCont &ec, NBTypeCont &tc, const std::string &file, std::map< std::string, PositionVector > &geoms, std::map< std::string, std::string > &streetNames)
Constructor.
Represents a single node (junction) during network building.
Definition: NBNode.h:75
T get(const std::string &str) const
static const int GEO_SCALE
scaling factor for geo coordinates (DLRNavteq format uses this to increase floating point precisions)...
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
void recheckLaneSpread()
Rechecks whether the lane spread is proper.
Definition: NBEdgeCont.cpp:811
#define SUMOReal
Definition: config.h:208
int size() const
Returns the number of nodes stored in this container.
Definition: NBNodeCont.h:229
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:110
SVCPermissions getPermissions(const std::string &type) const
Returns allowed vehicle classes for the given type.
Definition: NBTypeCont.cpp:215
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:63
TrafficlightsHandler(NBNodeCont &nc, NBTrafficLightLogicCont &tlc, NBEdgeCont &ne, const std::string &file)
Constructor.
#define PROGRESS_DONE_MESSAGE()
Definition: MsgHandler.h:203
A traffic light logics which must be computed (only nodes/edges are given)
Definition: NBOwnTLDef.h:54
static time_t readDate(const std::string &yyyymmdd)
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
Definition: NBNetBuilder.h:164
std::vector< int > myColumns
the version number of the edge file being parsed
void disallowVehicleClass(int lane, SUMOVehicleClass vclass)
set disallowed class for the given lane or for all lanes if -1 is given
Definition: NBEdge.cpp:2638
TrafficLightType
A storage for available types of edges.
Definition: NBTypeCont.h:62
static int getLaneNumber(const std::string &id, const std::string &laneNoS, SUMOReal speed)
Returns the lane number evaluating the given Navteq-description.
std::string getColumn(const StringTokenizer &st, ColumnName name, const std::string fallback="")
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
bool report(const std::string &result)
Parsing method.