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