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