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