SUMO - Simulation of Urban MObility
NWWriter_DlrNavteq.cpp
Go to the documentation of this file.
1 /****************************************************************************/
8 // Exporter writing networks using DlrNavteq (Elmar) format
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 #include <algorithm>
32 #include <ctime>
33 #include <cmath>
35 #include <netbuild/NBEdge.h>
36 #include <netbuild/NBEdgeCont.h>
37 #include <netbuild/NBNode.h>
38 #include <netbuild/NBNodeCont.h>
39 #include <netbuild/NBNetBuilder.h>
40 #include <utils/common/ToString.h>
47 #include "NWFrame.h"
48 #include "NWWriter_DlrNavteq.h"
49 
50 #define OUTPUT_VERSION "6.5"
51 
52 
53 // ---------------------------------------------------------------------------
54 // static members
55 // ---------------------------------------------------------------------------
56 const std::string NWWriter_DlrNavteq::UNDEFINED("-1");
57 
58 // ---------------------------------------------------------------------------
59 // static methods
60 // ---------------------------------------------------------------------------
61 void
63  // check whether a matsim-file shall be generated
64  if (!oc.isSet("dlr-navteq-output")) {
65  return;
66  }
67  std::map<NBEdge*, std::string> internalNodes;
68  writeNodesUnsplitted(oc, nb.getNodeCont(), nb.getEdgeCont(), internalNodes);
69  writeLinksUnsplitted(oc, nb.getEdgeCont(), internalNodes);
73 }
74 
75 
77  time_t rawtime;
78  time(&rawtime);
79  char buffer [80];
80  strftime(buffer, 80, "on %c", localtime(&rawtime));
81  device << "# Generated " << buffer << " by " << oc.getFullName() << "\n";
82  device << "# Format matches Extraction version: V" << OUTPUT_VERSION << " \n";
83  std::stringstream tmp;
84  oc.writeConfiguration(tmp, true, false, false);
85  tmp.seekg(std::ios_base::beg);
86  std::string line;
87  while (!tmp.eof()) {
88  std::getline(tmp, line);
89  device << "# " << line << "\n";
90  }
91  device << "#\n";
92 }
93 
94 void
95 NWWriter_DlrNavteq::writeNodesUnsplitted(const OptionsCont& oc, NBNodeCont& nc, NBEdgeCont& ec, std::map<NBEdge*, std::string>& internalNodes) {
96  // For "real" nodes we simply use the node id.
97  // For internal nodes (geometry vectors describing edge geometry in the parlance of this format)
98  // we use the id of the edge and do not bother with
99  // compression (each direction gets its own internal node).
100  OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_nodes_unsplitted.txt");
101  writeHeader(device, oc);
102  const GeoConvHelper& gch = GeoConvHelper::getFinal();
103  const bool haveGeo = gch.usingGeoProjection();
104  const double geoScale = pow(10.0f, haveGeo ? 5 : 2); // see NIImporter_DlrNavteq::GEO_SCALE
105  device.setPrecision(oc.getInt("dlr-navteq.precision"));
106  if (!haveGeo) {
107  WRITE_WARNING("DlrNavteq node data will be written in (floating point) cartesian coordinates");
108  }
109  // write format specifier
110  device << "# NODE_ID\tIS_BETWEEN_NODE\tamount_of_geocoordinates\tx1\ty1\t[x2 y2 ... xn yn]\n";
111  // write header
112  Boundary boundary = gch.getConvBoundary();
113  Position min(boundary.xmin(), boundary.ymin());
114  Position max(boundary.xmax(), boundary.ymax());
115  gch.cartesian2geo(min);
116  min.mul(geoScale);
117  gch.cartesian2geo(max);
118  max.mul(geoScale);
119  int multinodes = 0;
120  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
121  if ((*i).second->getGeometry().size() > 2) {
122  multinodes++;
123  }
124  }
125  device << "# [xmin_region] " << min.x() << "\n";
126  device << "# [xmax_region] " << max.x() << "\n";
127  device << "# [ymin_region] " << min.y() << "\n";
128  device << "# [ymax_region] " << max.y() << "\n";
129  device << "# [elements_multinode] " << multinodes << "\n";
130  device << "# [elements_normalnode] " << nc.size() << "\n";
131  device << "# [xmin] " << min.x() << "\n";
132  device << "# [xmax] " << max.x() << "\n";
133  device << "# [ymin] " << min.y() << "\n";
134  device << "# [ymax] " << max.y() << "\n";
135  // write normal nodes
136  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
137  NBNode* n = (*i).second;
138  Position pos = n->getPosition();
139  gch.cartesian2geo(pos);
140  pos.mul(geoScale);
141  device << n->getID() << "\t0\t1\t" << pos.x() << "\t" << pos.y() << "\n";
142  }
143  // write "internal" nodes
144  std::vector<std::string> avoid;
145  std::set<std::string> reservedNodeIDs;
146  const bool numericalIDs = oc.getBool("numerical-ids");
147  if (oc.isSet("reserved-ids")) {
148  NBHelpers::loadPrefixedIDsFomFile(oc.getString("reserved-ids"), "node:", reservedNodeIDs);
149  }
150  if (numericalIDs) {
151  avoid = nc.getAllNames();
152  std::vector<std::string> avoid2 = ec.getAllNames();
153  avoid.insert(avoid.end(), avoid2.begin(), avoid2.end());
154  avoid.insert(avoid.end(), reservedNodeIDs.begin(), reservedNodeIDs.end());
155  }
156  IDSupplier idSupplier("", avoid);
157  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
158  NBEdge* e = (*i).second;
159  PositionVector geom = e->getGeometry();
160  if (geom.size() > 2) {
161  // the import NIImporter_DlrNavteq checks for the presence of a
162  // negated edge id to determine spread type. We may need to do some
163  // shifting to make this consistent
164  const bool hasOppositeID = ec.getOppositeByID(e->getID()) != 0;
165  if (e->getLaneSpreadFunction() == LANESPREAD_RIGHT && !hasOppositeID) {
166  // need to write center-line geometry instead
167  try {
168  geom.move2side(e->getTotalWidth() / 2);
169  } catch (InvalidArgument& exception) {
170  WRITE_WARNING("Could not reconstruct shape for edge:'" + e->getID() + "' (" + exception.what() + ").");
171  }
172  } else if (e->getLaneSpreadFunction() == LANESPREAD_CENTER && hasOppositeID) {
173  // need to write left-border geometry instead
174  try {
175  geom.move2side(-e->getTotalWidth() / 2);
176  } catch (InvalidArgument& exception) {
177  WRITE_WARNING("Could not reconstruct shape for edge:'" + e->getID() + "' (" + exception.what() + ").");
178  }
179  }
180 
181  std::string internalNodeID = e->getID();
182  if (internalNodeID == UNDEFINED
183  || (nc.retrieve(internalNodeID) != 0)
184  || reservedNodeIDs.count(internalNodeID) > 0
185  ) {
186  // need to invent a new name to avoid clashing with the id of a 'real' node or a reserved name
187  if (numericalIDs) {
188  internalNodeID = idSupplier.getNext();
189  } else {
190  internalNodeID += "_geometry";
191  }
192  }
193  internalNodes[e] = internalNodeID;
194  device << internalNodeID << "\t1\t" << geom.size() - 2;
195  for (int ii = 1; ii < (int)geom.size() - 1; ++ii) {
196  Position pos = geom[(int)ii];
197  gch.cartesian2geo(pos);
198  pos.mul(geoScale);
199  device << "\t" << pos.x() << "\t" << pos.y();
200  }
201  device << "\n";
202  }
203  }
204  device.close();
205 }
206 
207 
208 void
209 NWWriter_DlrNavteq::writeLinksUnsplitted(const OptionsCont& oc, NBEdgeCont& ec, std::map<NBEdge*, std::string>& internalNodes) {
210  std::map<const std::string, std::string> nameIDs;
211  OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_links_unsplitted.txt");
212  writeHeader(device, oc);
213  // write format specifier
214  device << "# LINK_ID\tNODE_ID_FROM\tNODE_ID_TO\tBETWEEN_NODE_ID\tLENGTH\tVEHICLE_TYPE\tFORM_OF_WAY\tBRUNNEL_TYPE\tFUNCTIONAL_ROAD_CLASS\tSPEED_CATEGORY\tNUMBER_OF_LANES\tSPEED_LIMIT\tSPEED_RESTRICTION\tNAME_ID1_REGIONAL\tNAME_ID2_LOCAL\tHOUSENUMBERS_RIGHT\tHOUSENUMBERS_LEFT\tZIP_CODE\tAREA_ID\tSUBAREA_ID\tTHROUGH_TRAFFIC\tSPECIAL_RESTRICTIONS\tEXTENDED_NUMBER_OF_LANES\tISRAMP\tCONNECTION\n";
215  // write edges
216  for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
217  NBEdge* e = (*i).second;
218  const int kph = speedInKph(e->getSpeed());
219  const std::string& betweenNodeID = (e->getGeometry().size() > 2) ? internalNodes[e] : UNDEFINED;
220  std::string nameID = UNDEFINED;
221  if (oc.getBool("output.street-names")) {
222  const std::string& name = i->second->getStreetName();
223  if (name != "" && nameIDs.count(name) == 0) {
224  nameID = toString(nameIDs.size());
225  nameIDs[name] = nameID;
226  }
227  }
228  device << e->getID() << "\t"
229  << e->getFromNode()->getID() << "\t"
230  << e->getToNode()->getID() << "\t"
231  << betweenNodeID << "\t"
232  << getGraphLength(e) << "\t"
233  << getAllowedTypes(e->getPermissions()) << "\t"
234  << getFormOfWay(e) << "\t"
235  << getBrunnelType(e) << "\t"
236  << getRoadClass(e) << "\t"
237  << getSpeedCategory(kph) << "\t"
238  << getNavteqLaneCode(e->getNumLanes()) << "\t"
239  << getSpeedCategoryUpperBound(kph) << "\t"
240  << kph << "\t"
241  << nameID << "\t" // NAME_ID1_REGIONAL XXX
242  << UNDEFINED << "\t" // NAME_ID2_LOCAL XXX
243  << UNDEFINED << "\t" // housenumbers_right
244  << UNDEFINED << "\t" // housenumbers_left
245  << getSinglePostalCode(e->getParameter("postal_code", UNDEFINED), e->getID()) << "\t" // ZIP_CODE
246  << UNDEFINED << "\t" // AREA_ID
247  << UNDEFINED << "\t" // SUBAREA_ID
248  << "1\t" // through_traffic (allowed)
249  << UNDEFINED << "\t" // special_restrictions
250  << UNDEFINED << "\t" // extended_number_of_lanes
251  << UNDEFINED << "\t" // isRamp
252  << "0\t" // connection (between nodes always in order)
253  << "\n";
254  }
255  if (oc.getBool("output.street-names")) {
256  OutputDevice& namesDevice = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_names.txt");
257  writeHeader(namesDevice, oc);
258  // write format specifier
259  namesDevice << "# NAME_ID\tPERMANENT_ID_INFO\tName\n";
260  namesDevice << "# [elements] " << nameIDs.size() << "\n";
261  for (std::map<const std::string, std::string>::const_iterator i = nameIDs.begin(); i != nameIDs.end(); ++i) {
262  namesDevice
263  << i->second << "\t"
264  << 0 << "\t"
265  << i->first << "\n";
266  }
267  namesDevice.close();
268  }
269  device.close();
270 }
271 
272 
273 std::string
275  if (permissions == SVCAll) {
276  return "100000000000";
277  }
278  std::ostringstream oss;
279  oss << "0";
280  oss << ((permissions & SVC_PASSENGER) > 0 ? 1 : 0);
281  oss << ((permissions & SVC_PASSENGER) > 0 ? 1 : 0); // residential
282  oss << ((permissions & SVC_HOV) > 0 ? 1 : 0);
283  oss << ((permissions & SVC_EMERGENCY) > 0 ? 1 : 0);
284  oss << ((permissions & SVC_TAXI) > 0 ? 1 : 0);
285  oss << ((permissions & (SVC_BUS | SVC_COACH)) > 0 ? 1 : 0);
286  oss << ((permissions & SVC_DELIVERY) > 0 ? 1 : 0);
287  oss << ((permissions & (SVC_TRUCK | SVC_TRAILER)) > 0 ? 1 : 0);
288  oss << ((permissions & SVC_MOTORCYCLE) > 0 ? 1 : 0);
289  oss << ((permissions & SVC_BICYCLE) > 0 ? 1 : 0);
290  oss << ((permissions & SVC_PEDESTRIAN) > 0 ? 1 : 0);
291  return oss.str();
292 }
293 
294 
295 int
297  // quoting the navteq manual:
298  // As a general rule, Functional Road Class assignments have no direct
299  // correlation with other road attributes like speed, controlled access, route type, etc.
300  // if the network is based on OSM, we can use the highway types for determining FRC
301  std::string type = edge->getTypeID();
302  if (StringUtils::startsWith(type, "highway.")) {
303  type = type.substr(8);
304  }
305  if (StringUtils::startsWith(type, "motorway")) {
306  return 0;
307  } else if (StringUtils::startsWith(type, "trunk")) {
308  return 1;
309  } else if (StringUtils::startsWith(type, "primary")) {
310  return 1;
311  } else if (StringUtils::startsWith(type, "secondary")) {
312  return 2;
313  } else if (StringUtils::startsWith(type, "tertiary")) {
314  return 3;
315  } else if (type == "unclassified") {
316  return 3;
317  } else if (type == "living_street" || type == "residential" || type == "road" || type == "service" || type == "track" || type == "cycleway" || type == "path" || type == "footway") {
318  return 4;
319  }
320  // as a fallback we do a simple speed / lane-count mapping anyway
321  // the resulting functional road class layers probably won't be connected as required
322  const int kph = speedInKph(edge->getSpeed());
323  if ((kph) > 100) {
324  return 0;
325  }
326  if ((kph) > 70) {
327  return 1;
328  }
329  if ((kph) > 50) {
330  return (edge->getNumLanes() > 1 ? 2 : 3);
331  }
332  if ((kph) > 30) {
333  return 3;
334  }
335  return 4;
336 }
337 
338 
339 int
341  if ((kph) > 130) {
342  return 1;
343  }
344  if ((kph) > 100) {
345  return 2;
346  }
347  if ((kph) > 90) {
348  return 3;
349  }
350  if ((kph) > 70) {
351  return 4;
352  }
353  if ((kph) > 50) {
354  return 5;
355  }
356  if ((kph) > 30) {
357  return 6;
358  }
359  if ((kph) > 10) {
360  return 7;
361  }
362  return 8;
363 }
364 
365 
366 int
368  if ((kph) > 130) {
369  return 131;
370  }
371  if ((kph) > 100) {
372  return 130;
373  }
374  if ((kph) > 90) {
375  return 100;
376  }
377  if ((kph) > 70) {
378  return 90;
379  }
380  if ((kph) > 50) {
381  return 70;
382  }
383  if ((kph) > 30) {
384  return 50;
385  }
386  if ((kph) > 10) {
387  return 30;
388  }
389  return 10;
390 }
391 
392 
393 int
395  const int code = (numLanes == 1 ? 1 :
396  (numLanes < 4 ? 2 : 3));
397  return numLanes * 10 + code;
398 }
399 
400 
401 int
403  if (edge->knowsParameter("bridge")) {
404  return 1;
405  } else if (edge->knowsParameter("tunnel")) {
406  return 4;
407  } else if (edge->getTypeID() == "route.ferry") {
408  return 10;
409  }
410  return -1; // UNDEFINED
411 }
412 
413 
414 int
416  if (edge->getPermissions() == SVC_PEDESTRIAN) {
417  return 15;
418  } else if (edge->getJunctionPriority(edge->getToNode()) == NBEdge::ROUNDABOUT) {
419  return 4;
420  } else if (edge->getTypeID() == "highway.service") {
421  return 14;
422  } else if (edge->getTypeID().find("_link") != std::string::npos) {
423  return 10;
424  }
425  return 3; // speed category 1-8;
426 }
427 
428 
429 double
431  PositionVector geom = edge->getGeometry();
434  return geom.length();
435 }
436 
437 
438 std::string
439 NWWriter_DlrNavteq::getSinglePostalCode(const std::string& zipCode, const std::string edgeID) {
440  // might be multiple codes
441  if (zipCode.find_first_of(" ,;") != std::string::npos) {
442  WRITE_WARNING("ambiguous zip code '" + zipCode + "' for edge '" + edgeID + "'. (using first value)");
443  StringTokenizer st(zipCode, " ,;", true);
444  std::vector<std::string> ret = st.getVector();
445  return ret[0];
446  } else if (zipCode.size() > 16) {
447  WRITE_WARNING("long zip code '" + zipCode + "' for edge '" + edgeID + "'");
448  }
449  return zipCode;
450 }
451 
452 void
454  OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_traffic_signals.txt");
455  writeHeader(device, oc);
456  const GeoConvHelper& gch = GeoConvHelper::getFinal();
457  const bool haveGeo = gch.usingGeoProjection();
458  const double geoScale = pow(10.0f, haveGeo ? 5 : 2); // see NIImporter_DlrNavteq::GEO_SCALE
459  device.setPrecision(oc.getInt("dlr-navteq.precision"));
460  // write format specifier
461  device << "#Traffic signal related to LINK_ID and NODE_ID with location relative to driving direction.\n#column format like pointcollection.\n#DESCRIPTION->LOCATION: 1-rechts von LINK; 2-links von LINK; 3-oberhalb LINK -1-keineAngabe\n#RELATREC_ID\tPOICOL_TYPE\tDESCRIPTION\tLONGITUDE\tLATITUDE\tLINK_ID\n";
462  // write record for every edge incoming to a tls controlled node
463  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
464  NBNode* n = (*i).second;
465  if (n->isTLControlled()) {
466  Position pos = n->getPosition();
467  gch.cartesian2geo(pos);
468  pos.mul(geoScale);
469  const EdgeVector& incoming = n->getIncomingEdges();
470  for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); ++it) {
471  NBEdge* e = *it;
472  device << e->getID() << "\t"
473  << "12\t" // POICOL_TYPE
474  << "LSA;NODEIDS#" << n->getID() << "#;LOCATION#-1#;\t"
475  << pos.x() << "\t"
476  << pos.y() << "\t"
477  << e->getID() << "\n";
478  }
479  }
480  }
481  device.close();
482 }
483 
484 
485 void
487  OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_prohibited_manoeuvres.txt");
488  writeHeader(device, oc);
489  // need to invent id for relation
490  std::set<std::string> reservedRelIDs;
491  if (oc.isSet("reserved-ids")) {
492  NBHelpers::loadPrefixedIDsFomFile(oc.getString("reserved-ids"), "rel:", reservedRelIDs);
493  }
494  std::vector<std::string> avoid = ec.getAllNames(); // already used for tls RELATREC_ID
495  avoid.insert(avoid.end(), reservedRelIDs.begin(), reservedRelIDs.end());
496  IDSupplier idSupplier("", avoid); // @note: use a global relRecIDsupplier if this is used more often
497  // write format specifier
498  device << "#No driving allowed from ID1 to ID2 or the complete chain from ID1 to IDn\n";
499  device << "#RELATREC_ID\tPERMANENT_ID_INFO\tVALIDITY_PERIOD\tTHROUGH_TRAFFIC\tVEHICLE_TYPE\tNAVTEQ_LINK_ID1\t[NAVTEQ_LINK_ID2 ...]\n";
500  // write record for every pair of incoming/outgoing edge that are not connected despite having common permissions
501  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
502  NBNode* n = (*i).second;
503  const EdgeVector& incoming = n->getIncomingEdges();
504  const EdgeVector& outgoing = n->getOutgoingEdges();
505  for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
506  NBEdge* inEdge = *j;
507  const SVCPermissions inPerm = inEdge->getPermissions();
508  for (EdgeVector::const_iterator k = outgoing.begin(); k != outgoing.end(); ++k) {
509  NBEdge* outEdge = *k;
510  const SVCPermissions outPerm = outEdge->getPermissions();
511  const SVCPermissions commonPerm = inPerm & outPerm;
512  if (commonPerm != 0 && commonPerm != SVC_PEDESTRIAN && !inEdge->isConnectedTo(outEdge)) {
513  device
514  << idSupplier.getNext() << "\t"
515  << 1 << "\t" // permanent id
516  << UNDEFINED << "\t"
517  << 1 << "\t"
518  << getAllowedTypes(SVCAll) << "\t"
519  << inEdge->getID() << "\t" << outEdge->getID() << "\n";
520  }
521  }
522  }
523  }
524  device.close();
525 }
526 
527 
528 void
530  OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_connected_lanes.txt");
531  writeHeader(device, oc);
532  // write format specifier
533  device << "#Lane connections related to LINK-IDs and NODE-ID.\n";
534  device << "#column format like pointcollection.\n";
535  device << "#NODE-ID\tVEHICLE-TYPE\tFROM_LANE\tTO_LANE\tTHROUGH_TRAFFIC\tLINK_IDs[2..*]\n";
536  // write record for every connection
537  for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
538  NBNode* n = (*i).second;
539  const EdgeVector& incoming = n->getIncomingEdges();
540  for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
541  NBEdge* from = *j;
542  const SVCPermissions fromPerm = from->getPermissions();
543  const std::vector<NBEdge::Connection>& connections = from->getConnections();
544  for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
545  const NBEdge::Connection& c = *it_c;
546  device
547  << n->getID() << "\t"
548  << getAllowedTypes(fromPerm & c.toEdge->getPermissions()) << "\t"
549  << c.fromLane + 1 << "\t" // one-based
550  << c.toLane + 1 << "\t" // one-based
551  << 1 << "\t" // no information regarding permissibility of through traffic
552  << from->getID() << "\t"
553  << c.toEdge->getID() << "\t"
554  << "\n";
555  }
556  }
557  }
558  device.close();
559 }
560 
561 /****************************************************************************/
562 
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge&#39;s lanes&#39; lateral offset is computed.
Definition: NBEdge.h:677
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Definition: NBNodeCont.cpp:106
double ymin() const
Returns minimum y-coordinate.
Definition: Boundary.cpp:138
void close()
Closes the device and removes it from the dictionary.
double xmax() const
Returns maximum x-coordinate.
Definition: Boundary.cpp:132
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:164
int toLane
The lane the connections yields in.
Definition: NBEdge.h:190
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
is a pedestrian
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition: NBNodeCont.h:114
NBEdge * toEdge
The edge the connections yields in.
Definition: NBEdge.h:187
#define min(a, b)
Definition: polyfonts.c:66
const Boundary & getConvBoundary() const
Returns the converted boundary.
static void loadPrefixedIDsFomFile(const std::string &file, const std::string prefix, std::set< std::string > &into)
Add prefixed ids defined in file.
Definition: NBHelpers.cpp:111
static double getGraphLength(NBEdge *edge)
get the length of the edge when measured up to the junction center
bool isConnectedTo(const NBEdge *e) const
Returns the information whethe a connection to the given edge has been added (or computed) ...
Definition: NBEdge.cpp:1057
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition: NBNodeCont.h:119
static void writeHeader(OutputDevice &device, const OptionsCont &oc)
write header comments (input paramters, date, etc...)
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
Definition: NBEdge.cpp:1556
static int getRoadClass(NBEdge *edge)
get the navteq road class
NBEdge * getOppositeByID(const std::string &edgeID) const
Returns the edge with negated id if it exists.
Definition: NBEdgeCont.cpp:823
static int speedInKph(double metersPerSecond)
get edge speed rounded to kmh
const std::string & getTypeID() const
get ID of type
Definition: NBEdge.h:971
double y() const
Returns the y-position.
Definition: Position.h:68
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
#define OUTPUT_VERSION
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
static int getSpeedCategory(int kph)
get the navteq speed class based on the speed in km/h
The representation of a single edge during network building.
Definition: NBEdge.h:71
static void writeLinksUnsplitted(const OptionsCont &oc, NBEdgeCont &ec, std::map< NBEdge *, std::string > &internalNodes)
Writes the links_unsplitted file.
double x() const
Returns the x-position.
Definition: Position.h:63
static void writeProhibitedManoeuvres(const OptionsCont &oc, const NBNodeCont &nc, const NBEdgeCont &ec)
Writes the prohibited_manoeuvres file.
void setPrecision(int precision=gPrecision)
Sets the precison or resets it to default.
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
Definition: NBEdgeCont.h:198
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::string & getID() const
Returns the id.
Definition: Named.h:66
const SVCPermissions SVCAll
all VClasses are allowed
static int getSpeedCategoryUpperBound(int kph)
get the SPEED_LIMIT as defined by elmar (upper bound of speed category)
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
const EdgeVector & getOutgoingEdges() const
Returns this node&#39;s outgoing edges (The edges which start at this node)
Definition: NBNode.h:245
static const std::string UNDEFINED
magic value for undefined stuff
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition: NBNode.h:288
static int getNavteqLaneCode(const int numLanes)
get the lane number encoding
void push_front_noDoublePos(const Position &p)
insert in front a non double position
static void writeConnectedLanes(const OptionsCont &oc, NBNodeCont &nc)
Writes the connected_lanes file.
#define max(a, b)
Definition: polyfonts.c:65
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
Definition: NBEdgeCont.h:190
bool knowsParameter(const std::string &key) const
Returns whether the parameter is known.
std::string getNext()
Returns the next id.
Definition: IDSupplier.cpp:59
static methods for processing the coordinates conversion for the current net
Definition: GeoConvHelper.h:60
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:56
int size() const
Returns the number of nodes stored in this container.
Definition: NBNodeCont.h:229
int getNumLanes() const
Returns the number of lanes.
Definition: NBEdge.h:413
int fromLane
The lane the connections starts at.
Definition: NBEdge.h:184
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
NBEdgeCont & getEdgeCont()
Definition: NBNetBuilder.h:155
A list of positions.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static std::string getSinglePostalCode(const std::string &zipCode, const std::string edgeID)
Storage for edges, including some functionality operating on multiple edges.
Definition: NBEdgeCont.h:66
double xmin() const
Returns minimum x-coordinate.
Definition: Boundary.cpp:126
static void writeNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Writes the network into XML-files (nodes, edges, connections, traffic lights)
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition: NBEdge.cpp:2913
void move2side(double amount)
move position vector to side using certain ammount
double getSpeed() const
Returns the speed allowed on this edge.
Definition: NBEdge.h:507
std::vector< std::string > getVector()
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:595
static std::string getAllowedTypes(SVCPermissions permissions)
build the ascii-bit-vector for column vehicle_type
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
std::vector< std::string > getAllNames() const
get all node names
double length() const
Returns the length.
const EdgeVector & getIncomingEdges() const
Returns this node&#39;s incoming edges (The edges which yield in this node)
Definition: NBNode.h:240
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition: NBEdge.h:834
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Definition: NBNetBuilder.h:160
Instance responsible for building networks.
Definition: NBNetBuilder.h:114
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition: NBCont.h:41
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
Definition: NBEdge.cpp:2831
A storage for options typed value containers)
Definition: OptionsCont.h:99
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
const Position & getPosition() const
Definition: NBNode.h:232
Represents a single node (junction) during network building.
Definition: NBNode.h:75
const std::string & getFullName() const
Definition: OptionsCont.h:658
static int getBrunnelType(NBEdge *edge)
get the navteq brunnel type
static int getFormOfWay(NBEdge *edge)
get the form of way
static void writeTrafficSignals(const OptionsCont &oc, NBNodeCont &nc)
Writes the traffic_signals file.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
void writeConfiguration(std::ostream &os, const bool filled, const bool complete, const bool addComments, const bool maskDoubleHyphen=false) const
Writes the configuration.
void push_back_noDoublePos(const Position &p)
insert in back a non double position
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition: NBEdge.h:427
Container for nodes during the netbuilding process.
Definition: NBNodeCont.h:63
void mul(double val)
Multiplies both positions with the given value.
Definition: Position.h:113
double ymax() const
Returns maximum y-coordinate.
Definition: Boundary.cpp:144
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
Definition: NBEdgeCont.cpp:542
static void writeNodesUnsplitted(const OptionsCont &oc, NBNodeCont &nc, NBEdgeCont &ec, std::map< NBEdge *, std::string > &internalNodes)
Writes the nodes_unsplitted file.
NBNode * getToNode() const
Returns the destination node of the edge.
Definition: NBEdge.h:434