Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
NWWriter_DlrNavteq.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2012-2024 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>
38#include "NWFrame.h"
39#include "NWWriter_DlrNavteq.h"
40
41
42// ---------------------------------------------------------------------------
43// static members
44// ---------------------------------------------------------------------------
45const std::string NWWriter_DlrNavteq::UNDEFINED("-1");
46
47// ---------------------------------------------------------------------------
48// static methods
49// ---------------------------------------------------------------------------
50void
52 // check whether a matsim-file shall be generated
53 if (!oc.isSet("dlr-navteq-output")) {
54 return;
55 }
56 std::map<const 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: V" << oc.getString("dlr-navteq.version") << " \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
79void
80NWWriter_DlrNavteq::writeNodesUnsplitted(const OptionsCont& oc, const NBNodeCont& nc, const NBEdgeCont& ec, std::map<const NBEdge*, std::string>& internalNodes) {
81 // For "real" nodes we simply use the node id.
82 // For internal nodes (geometry vectors describing edge geometry in the parlance of this format)
83 // we use the id of the edge and do not bother with
84 // compression (each direction gets its own internal node).
85 OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_nodes_unsplitted.txt");
86 writeHeader(device, oc);
88 const bool haveGeo = gch.usingGeoProjection();
89 const double geoScale = pow(10.0f, haveGeo ? 5 : 2); // see NIImporter_DlrNavteq::GEO_SCALE
90 device.setPrecision(oc.getInt("dlr-navteq.precision"));
91 if (!haveGeo) {
92 WRITE_WARNING(TL("DlrNavteq node data will be written in (floating point) cartesian coordinates"));
93 }
94 // write format specifier
95 device << "# NODE_ID\tIS_BETWEEN_NODE\tamount_of_geocoordinates\tx1\ty1\t[x2 y2 ... xn yn]\n";
96 // write header
97 Boundary boundary = gch.getConvBoundary();
98 Position min(boundary.xmin(), boundary.ymin());
99 Position max(boundary.xmax(), boundary.ymax());
100 gch.cartesian2geo(min);
101 min.mul(geoScale);
102 gch.cartesian2geo(max);
103 max.mul(geoScale);
104 int multinodes = 0;
105 for (std::map<std::string, NBEdge*>::const_iterator i = ec.begin(); i != ec.end(); ++i) {
106 if ((*i).second->getGeometry().size() > 2) {
107 multinodes++;
108 }
109 }
110 device << "# [xmin_region] " << min.x() << "\n";
111 device << "# [xmax_region] " << max.x() << "\n";
112 device << "# [ymin_region] " << min.y() << "\n";
113 device << "# [ymax_region] " << max.y() << "\n";
114 device << "# [elements_multinode] " << multinodes << "\n";
115 device << "# [elements_normalnode] " << nc.size() << "\n";
116 device << "# [xmin] " << min.x() << "\n";
117 device << "# [xmax] " << max.x() << "\n";
118 device << "# [ymin] " << min.y() << "\n";
119 device << "# [ymax] " << max.y() << "\n";
120 // write normal nodes
121 for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
122 NBNode* n = (*i).second;
123 Position pos = n->getPosition();
124 gch.cartesian2geo(pos);
125 pos.mul(geoScale);
126 device << n->getID() << "\t0\t1\t" << pos.x() << "\t" << pos.y() << "\n";
127 }
128 // write "internal" nodes
129 std::vector<std::string> avoid;
130 std::set<std::string> reservedNodeIDs;
131 const bool numericalIDs = oc.getBool("numerical-ids");
132 if (oc.isSet("reserved-ids")) {
133 NBHelpers::loadPrefixedIDsFomFile(oc.getString("reserved-ids"), "node:", reservedNodeIDs); // backward compatibility
134 NBHelpers::loadPrefixedIDsFomFile(oc.getString("reserved-ids"), "junction:", reservedNodeIDs); // selection format
135 }
136 if (numericalIDs) {
137 avoid = nc.getAllNames();
138 std::vector<std::string> avoid2 = ec.getAllNames();
139 avoid.insert(avoid.end(), avoid2.begin(), avoid2.end());
140 avoid.insert(avoid.end(), reservedNodeIDs.begin(), reservedNodeIDs.end());
141 }
142 IDSupplier idSupplier("", avoid);
143 for (const auto& edgeIt : ec) {
144 const NBEdge* const e = edgeIt.second;
145 PositionVector geom = e->getGeometry();
146 if (geom.size() > 2) {
147 // the import NIImporter_DlrNavteq checks for the presence of a
148 // negated edge id to determine spread type. We may need to do some
149 // shifting to make this consistent
150 const bool hasOppositeID = ec.getOppositeByID(e->getID()) != nullptr;
151 if (e->getLaneSpreadFunction() == LaneSpreadFunction::RIGHT && !hasOppositeID) {
152 // need to write center-line geometry instead
153 try {
154 geom.move2side(e->getTotalWidth() / 2);
155 } catch (InvalidArgument& exception) {
156 WRITE_WARNINGF(TL("Could not reconstruct shape for edge:'%' (%)."), e->getID(), exception.what());
157 }
158 } else if (e->getLaneSpreadFunction() == LaneSpreadFunction::CENTER && hasOppositeID) {
159 // need to write left-border geometry instead
160 try {
161 geom.move2side(-e->getTotalWidth() / 2);
162 } catch (InvalidArgument& exception) {
163 WRITE_WARNINGF(TL("Could not reconstruct shape for edge:'%' (%)."), e->getID(), exception.what());
164 }
165 }
166
167 if (geom.size() > 2) { // move2side might have changed the number of nodes
168 std::string internalNodeID = e->getID();
169 if (internalNodeID == UNDEFINED
170 || (nc.retrieve(internalNodeID) != nullptr)
171 || reservedNodeIDs.count(internalNodeID) > 0
172 ) {
173 // need to invent a new name to avoid clashing with the id of a 'real' node or a reserved name
174 if (numericalIDs) {
175 internalNodeID = idSupplier.getNext();
176 } else {
177 internalNodeID += "_geometry";
178 }
179 }
180 internalNodes[e] = internalNodeID;
181 device << internalNodeID << "\t1\t" << geom.size() - 2;
182 for (int ii = 1; ii < (int)geom.size() - 1; ++ii) {
183 Position pos = geom[(int)ii];
184 gch.cartesian2geo(pos);
185 pos.mul(geoScale);
186 device << "\t" << pos.x() << "\t" << pos.y();
187 }
188 device << "\n";
189 }
190 }
191 }
192 device.close();
193}
194
195
196void
197NWWriter_DlrNavteq::writeLinksUnsplitted(const OptionsCont& oc, const NBEdgeCont& ec, const std::map<const NBEdge*, std::string>& internalNodes) {
198 const int majorVersion = StringUtils::toInt(StringTokenizer(oc.getString("dlr-navteq.version"), ".").next());
199 std::map<const std::string, std::string> nameIDs;
200 OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_links_unsplitted.txt");
201 writeHeader(device, oc);
202 // write format specifier
203 device << "# LINK_ID\tNODE_ID_FROM\tNODE_ID_TO\tBETWEEN_NODE_ID\tLENGTH\tVEHICLE_TYPE\tFORM_OF_WAY\tBRUNNEL_TYPE\t"
204 << "FUNCTIONAL_ROAD_CLASS\tSPEED_CATEGORY\tNUMBER_OF_LANES\tSPEED_LIMIT\tSPEED_RESTRICTION\t"
205 << "NAME_ID1_REGIONAL\tNAME_ID2_LOCAL\tHOUSENUMBERS_RIGHT\tHOUSENUMBERS_LEFT\tZIP_CODE\t"
206 << "AREA_ID\tSUBAREA_ID\tTHROUGH_TRAFFIC\tSPECIAL_RESTRICTIONS\tEXTENDED_NUMBER_OF_LANES\tISRAMP\tCONNECTION";
207 if (majorVersion > 6) {
208 device << "\tMAXHEIGHT\tMAXWIDTH\tMAXWEIGHT\tSURFACE";
209 }
210 device << "\n";
211 // write edges
212 for (const auto& edgeIt : ec) {
213 const NBEdge* const e = edgeIt.second;
214 const int kph = speedInKph(e->getSpeed());
215 const auto& internalIt = internalNodes.find(e);
216 const std::string& betweenNodeID = internalIt != internalNodes.end() ? internalIt->second : UNDEFINED;
217 std::string nameID = UNDEFINED;
218 std::string nameIDRegional = UNDEFINED;
219 if (oc.getBool("output.street-names")) {
220 const std::string& name = e->getStreetName();
221 if (name != "") {
222 if (nameIDs.count(name) == 0) {
223 const int tmp = (int)nameIDs.size();
224 nameIDs[name] = toString(tmp);
225 }
226 nameID = nameIDs[name];
227 }
228 const std::string& name2 = e->getParameter("ref", "");
229 if (name2 != "") {
230 if (nameIDs.count(name2) == 0) {
231 const int tmp = (int)nameIDs.size();
232 nameIDs[name2] = toString(tmp);
233 }
234 nameIDRegional = nameIDs[name2];
235 }
236 }
237 device << e->getID() << "\t"
238 << e->getFromNode()->getID() << "\t"
239 << e->getToNode()->getID() << "\t"
240 << betweenNodeID << "\t"
241 << getGraphLength(e) << "\t"
242 << getAllowedTypes(e->getPermissions()) << "\t"
243 << getFormOfWay(e) << "\t"
244 << getBrunnelType(e) << "\t"
245 << getRoadClass(e) << "\t"
246 << getSpeedCategory(kph) << "\t"
247 << getNavteqLaneCode(e->getNumLanes()) << "\t"
248 << getSpeedCategoryUpperBound(kph) << "\t"
249 << kph << "\t"
250 << nameIDRegional << "\t"
251 << nameID << "\t" // NAME_ID2_LOCAL
252 << UNDEFINED << "\t" // housenumbers_right
253 << UNDEFINED << "\t" // housenumbers_left
254 << getSinglePostalCode(e->getParameter("postal_code", UNDEFINED), e->getID()) << "\t" // ZIP_CODE
255 << UNDEFINED << "\t" // AREA_ID
256 << UNDEFINED << "\t" // SUBAREA_ID
257 << "1\t" // through_traffic (allowed)
258 << UNDEFINED << "\t" // special_restrictions
259 << UNDEFINED << "\t" // extended_number_of_lanes
260 << UNDEFINED << "\t" // isRamp
261 << "0"; // connection (between nodes always in order)
262 if (majorVersion > 6) {
263 device << "\t" << e->getParameter("maxheight", UNDEFINED)
264 << "\t" << e->getParameter("maxwidth", UNDEFINED)
265 << "\t" << e->getParameter("maxweight", UNDEFINED)
266 << "\t" << e->getParameter("surface", UNDEFINED);
267 }
268 device << "\n";
269 }
270 if (oc.getBool("output.street-names")) {
271 OutputDevice& namesDevice = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_names.txt");
272 writeHeader(namesDevice, oc);
273 // write format specifier
274 namesDevice << "# NAME_ID\tPERMANENT_ID_INFO\tName\n";
275 namesDevice << "# [elements] " << nameIDs.size() << "\n";
276 for (std::map<const std::string, std::string>::const_iterator i = nameIDs.begin(); i != nameIDs.end(); ++i) {
277 namesDevice
278 << i->second << "\t"
279 << 0 << "\t"
280 << i->first << "\n";
281 }
282 namesDevice.close();
283 }
284 device.close();
285}
286
287
288std::string
290 if (permissions == SVCAll) {
291 return "100000000000";
292 }
293 std::ostringstream oss;
294 oss << "0";
295 oss << ((permissions & SVC_PASSENGER) > 0 ? 1 : 0);
296 oss << ((permissions & SVC_PASSENGER) > 0 ? 1 : 0); // residential
297 oss << ((permissions & SVC_HOV) > 0 ? 1 : 0);
298 oss << ((permissions & SVC_EMERGENCY) > 0 ? 1 : 0);
299 oss << ((permissions & SVC_TAXI) > 0 ? 1 : 0);
300 oss << ((permissions & (SVC_BUS | SVC_COACH)) > 0 ? 1 : 0);
301 oss << ((permissions & SVC_DELIVERY) > 0 ? 1 : 0);
302 oss << ((permissions & (SVC_TRUCK | SVC_TRAILER)) > 0 ? 1 : 0);
303 oss << ((permissions & SVC_MOTORCYCLE) > 0 ? 1 : 0);
304 oss << ((permissions & SVC_BICYCLE) > 0 ? 1 : 0);
305 oss << ((permissions & SVC_PEDESTRIAN) > 0 ? 1 : 0);
306 return oss.str();
307}
308
309
310int
312 // quoting the navteq manual:
313 // As a general rule, Functional Road Class assignments have no direct
314 // correlation with other road attributes like speed, controlled access, route type, etc.
315 // if the network is based on OSM, we can use the highway types for determining FRC
316 std::string type = edge->getTypeID();
317 if (StringUtils::startsWith(type, "highway.")) {
318 type = type.substr(8);
319 }
320 if (StringUtils::startsWith(type, "motorway")) {
321 return 0;
322 } else if (StringUtils::startsWith(type, "trunk")) {
323 return 1;
324 } else if (StringUtils::startsWith(type, "primary")) {
325 return 1;
326 } else if (StringUtils::startsWith(type, "secondary")) {
327 return 2;
328 } else if (StringUtils::startsWith(type, "tertiary")) {
329 return 3;
330 } else if (type == "unclassified") {
331 return 3;
332 } else if (type == "living_street" || type == "residential" || type == "road" || type == "service" || type == "track" || type == "cycleway" || type == "path" || type == "footway") {
333 return 4;
334 }
335 // as a fallback we do a simple speed / lane-count mapping anyway
336 // the resulting functional road class layers probably won't be connected as required
337 const int kph = speedInKph(edge->getSpeed());
338 if ((kph) > 100) {
339 return 0;
340 }
341 if ((kph) > 70) {
342 return 1;
343 }
344 if ((kph) > 50) {
345 return (edge->getNumLanes() > 1 ? 2 : 3);
346 }
347 if ((kph) > 30) {
348 return 3;
349 }
350 return 4;
351}
352
353
354int
356 if ((kph) > 130) {
357 return 1;
358 }
359 if ((kph) > 100) {
360 return 2;
361 }
362 if ((kph) > 90) {
363 return 3;
364 }
365 if ((kph) > 70) {
366 return 4;
367 }
368 if ((kph) > 50) {
369 return 5;
370 }
371 if ((kph) > 30) {
372 return 6;
373 }
374 if ((kph) > 10) {
375 return 7;
376 }
377 return 8;
378}
379
380
381int
383 if ((kph) > 130) {
384 return 131;
385 }
386 if ((kph) > 100) {
387 return 130;
388 }
389 if ((kph) > 90) {
390 return 100;
391 }
392 if ((kph) > 70) {
393 return 90;
394 }
395 if ((kph) > 50) {
396 return 70;
397 }
398 if ((kph) > 30) {
399 return 50;
400 }
401 if ((kph) > 10) {
402 return 30;
403 }
404 return 10;
405}
406
407
408int
410 const int code = (numLanes == 1 ? 1 :
411 (numLanes < 4 ? 2 : 3));
412 return numLanes * 10 + code;
413}
414
415
416int
418 if (edge->hasParameter("bridge")) {
419 return 1;
420 } else if (edge->hasParameter("tunnel")) {
421 return 4;
422 } else if (edge->getTypeID() == "route.ferry") {
423 return 10;
424 }
425 return -1; // UNDEFINED
426}
427
428
429int
431 if (edge->getPermissions() == SVC_PEDESTRIAN) {
432 return 15;
434 return 4;
435 } else if (edge->getTypeID() == "highway.service") {
436 return 14;
437 } else if (edge->getTypeID().find("_link") != std::string::npos) {
438 return 10;
439 }
440 return 3; // speed category 1-8;
441}
442
443
444double
446 PositionVector geom = edge->getGeometry();
449 return geom.length();
450}
451
452
453std::string
454NWWriter_DlrNavteq::getSinglePostalCode(const std::string& zipCode, const std::string edgeID) {
455 // might be multiple codes
456 if (zipCode.find_first_of(" ,;") != std::string::npos) {
457 WRITE_WARNINGF("ambiguous zip code '%' for edge '%'. (using first value)", zipCode, edgeID);
458 StringTokenizer st(zipCode, " ,;", true);
459 std::vector<std::string> ret = st.getVector();
460 return ret[0];
461 } else if (zipCode.size() > 16) {
462 WRITE_WARNINGF("long zip code '%' for edge '%'", zipCode, edgeID);
463 }
464 return zipCode;
465}
466
467void
469 OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_traffic_signals.txt");
470 writeHeader(device, oc);
472 const bool haveGeo = gch.usingGeoProjection();
473 const double geoScale = pow(10.0f, haveGeo ? 5 : 2); // see NIImporter_DlrNavteq::GEO_SCALE
474 device.setPrecision(oc.getInt("dlr-navteq.precision"));
475 // write format specifier
476 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";
477 // write record for every edge incoming to a tls controlled node
478 for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
479 NBNode* n = (*i).second;
480 if (n->isTLControlled()) {
481 Position pos = n->getPosition();
482 gch.cartesian2geo(pos);
483 pos.mul(geoScale);
484 const EdgeVector& incoming = n->getIncomingEdges();
485 for (EdgeVector::const_iterator it = incoming.begin(); it != incoming.end(); ++it) {
486 NBEdge* e = *it;
487 device << e->getID() << "\t"
488 << "12\t" // POICOL_TYPE
489 << "LSA;NODEIDS#" << n->getID() << "#;LOCATION#-1#;\t"
490 << pos.x() << "\t"
491 << pos.y() << "\t"
492 << e->getID() << "\n";
493 }
494 }
495 }
496 device.close();
497}
498
499
500void
502 OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_prohibited_manoeuvres.txt");
503 writeHeader(device, oc);
504 // need to invent id for relation
505 std::set<std::string> reservedRelIDs;
506 if (oc.isSet("reserved-ids")) {
507 NBHelpers::loadPrefixedIDsFomFile(oc.getString("reserved-ids"), "rel:", reservedRelIDs);
508 }
509 std::vector<std::string> avoid = ec.getAllNames(); // already used for tls RELATREC_ID
510 avoid.insert(avoid.end(), reservedRelIDs.begin(), reservedRelIDs.end());
511 IDSupplier idSupplier("", avoid); // @note: use a global relRecIDsupplier if this is used more often
512 // write format specifier
513 device << "#No driving allowed from ID1 to ID2 or the complete chain from ID1 to IDn\n";
514 device << "#RELATREC_ID\tPERMANENT_ID_INFO\tVALIDITY_PERIOD\tTHROUGH_TRAFFIC\tVEHICLE_TYPE\tNAVTEQ_LINK_ID1\t[NAVTEQ_LINK_ID2 ...]\n";
515 // write record for every pair of incoming/outgoing edge that are not connected despite having common permissions
516 for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
517 NBNode* n = (*i).second;
518 const EdgeVector& incoming = n->getIncomingEdges();
519 const EdgeVector& outgoing = n->getOutgoingEdges();
520 for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
521 NBEdge* inEdge = *j;
522 const SVCPermissions inPerm = inEdge->getPermissions();
523 for (EdgeVector::const_iterator k = outgoing.begin(); k != outgoing.end(); ++k) {
524 NBEdge* outEdge = *k;
525 const SVCPermissions outPerm = outEdge->getPermissions();
526 const SVCPermissions commonPerm = inPerm & outPerm;
527 if (commonPerm != 0 && commonPerm != SVC_PEDESTRIAN && !inEdge->isConnectedTo(outEdge)) {
528 device
529 << idSupplier.getNext() << "\t"
530 << 1 << "\t" // permanent id
531 << UNDEFINED << "\t"
532 << 1 << "\t"
533 << getAllowedTypes(SVCAll) << "\t"
534 << inEdge->getID() << "\t" << outEdge->getID() << "\n";
535 }
536 }
537 }
538 }
539 device.close();
540}
541
542
543void
545 OutputDevice& device = OutputDevice::getDevice(oc.getString("dlr-navteq-output") + "_connected_lanes.txt");
546 writeHeader(device, oc);
547 // write format specifier
548 device << "#Lane connections related to LINK-IDs and NODE-ID.\n";
549 device << "#column format like pointcollection.\n";
550 device << "#NODE-ID\tVEHICLE-TYPE\tFROM_LANE\tTO_LANE\tTHROUGH_TRAFFIC\tLINK_IDs[2..*]\n";
551 // write record for every connection
552 for (std::map<std::string, NBNode*>::const_iterator i = nc.begin(); i != nc.end(); ++i) {
553 NBNode* n = (*i).second;
554 const EdgeVector& incoming = n->getIncomingEdges();
555 for (EdgeVector::const_iterator j = incoming.begin(); j != incoming.end(); ++j) {
556 NBEdge* from = *j;
557 const SVCPermissions fromPerm = from->getPermissions();
558 const std::vector<NBEdge::Connection>& connections = from->getConnections();
559 for (std::vector<NBEdge::Connection>::const_iterator it_c = connections.begin(); it_c != connections.end(); it_c++) {
560 const NBEdge::Connection& c = *it_c;
561 device
562 << n->getID() << "\t"
563 << getAllowedTypes(fromPerm & c.toEdge->getPermissions()) << "\t"
564 << c.fromLane + 1 << "\t" // one-based
565 << c.toLane + 1 << "\t" // one-based
566 << 1 << "\t" // no information regarding permissibility of through traffic
567 << from->getID() << "\t"
568 << c.toEdge->getID() << "\t"
569 << "\n";
570 }
571 }
572 }
573 device.close();
574}
575
576
577/****************************************************************************/
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:296
#define WRITE_WARNING(msg)
Definition MsgHandler.h:295
#define TL(string)
Definition MsgHandler.h:315
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
Definition NBCont.h:42
const SVCPermissions SVCAll
all VClasses are allowed
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ 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
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:130
double xmin() const
Returns minimum x-coordinate.
Definition Boundary.cpp:118
double ymax() const
Returns maximum y-coordinate.
Definition Boundary.cpp:136
double xmax() const
Returns maximum x-coordinate.
Definition Boundary.cpp:124
static methods for processing the coordinates conversion for the current net
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
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.
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:171
NBEdge * getOppositeByID(const std::string &edgeID) const
Returns the edge with negated id if it exists.
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
Definition NBEdgeCont.h:178
std::vector< std::string > getAllNames() const
Returns all ids of known edges.
The representation of a single edge during network building.
Definition NBEdge.h:92
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
Definition NBEdge.cpp:4378
const std::vector< Connection > & getConnections() const
Returns the connections.
Definition NBEdge.h:1041
@ ROUNDABOUT
Definition NBEdge.h:387
NBNode * getToNode() const
Returns the destination node of the edge.
Definition NBEdge.h:546
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition NBEdge.h:783
LaneSpreadFunction getLaneSpreadFunction() const
Returns how this edge's lanes' lateral offset is computed.
Definition NBEdge.cpp:998
double getSpeed() const
Returns the speed allowed on this edge.
Definition NBEdge.h:619
const std::string & getID() const
Definition NBEdge.h:1528
int getNumLanes() const
Returns the number of lanes.
Definition NBEdge.h:520
double getTotalWidth() const
Returns the combined width of all lanes of this edge.
Definition NBEdge.cpp:4216
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:1330
int getJunctionPriority(const NBNode *const node) const
Returns the junction priority (normalised for the node currently build)
Definition NBEdge.cpp:2132
const std::string & getTypeID() const
get ID of type
Definition NBEdge.h:1181
const std::string & getStreetName() const
Returns the street name of this edge.
Definition NBEdge.h:669
NBNode * getFromNode() const
Returns the origin node of the edge.
Definition NBEdge.h:539
static void loadPrefixedIDsFomFile(const std::string &file, const std::string prefix, std::set< std::string > &into)
Add prefixed ids defined in file.
Instance responsible for building networks.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBEdgeCont & getEdgeCont()
Container for nodes during the netbuilding process.
Definition NBNodeCont.h:57
int size() const
Returns the number of nodes stored in this container.
Definition NBNodeCont.h:307
std::map< std::string, NBNode * >::const_iterator begin() const
Returns the pointer to the begin of the stored nodes.
Definition NBNodeCont.h:113
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
std::map< std::string, NBNode * >::const_iterator end() const
Returns the pointer to the end of the stored nodes.
Definition NBNodeCont.h:118
std::vector< std::string > getAllNames() const
get all node names
Represents a single node (junction) during network building.
Definition NBNode.h:66
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
Definition NBNode.h:268
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
Definition NBNode.h:273
const Position & getPosition() const
Definition NBNode.h:260
bool isTLControlled() const
Returns whether this node is controlled by any tls.
Definition NBNode.h:331
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 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 writeTrafficSignals(const OptionsCont &oc, NBNodeCont &nc)
Writes the traffic_signals file.
static double getGraphLength(const NBEdge *const 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 int getFormOfWay(const NBEdge *const edge)
get the form of way
static int getBrunnelType(const NBEdge *const edge)
get the navteq brunnel type
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 int getRoadClass(const NBEdge *const edge)
get the navteq road class
static void writeNodesUnsplitted(const OptionsCont &oc, const NBNodeCont &nc, const NBEdgeCont &ec, std::map< const NBEdge *, std::string > &internalNodes)
Writes the nodes_unsplitted file.
static void writeProhibitedManoeuvres(const OptionsCont &oc, const NBNodeCont &nc, const NBEdgeCont &ec)
Writes the prohibited_manoeuvres file.
static void writeLinksUnsplitted(const OptionsCont &oc, const NBEdgeCont &ec, const std::map< const NBEdge *, std::string > &internalNodes)
Writes the links_unsplitted 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)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
void writeConfiguration(std::ostream &os, const bool filled, const bool complete, const bool addComments, const std::string &relativeTo="", const bool forceRelative=false, const bool inComment=false) const
Writes the configuration.
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.
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, bool usePrefix=true)
Returns the described OutputDevice.
bool hasParameter(const std::string &key) const
Returns whether the parameter is set.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
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 position 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 amount
void push_back_noDoublePos(const Position &p)
insert in back a non double position
std::vector< std::string > getVector()
return vector of strings
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
A structure which describes a connection between edges or lanes.
Definition NBEdge.h:201
int fromLane
The lane the connections starts at.
Definition NBEdge.h:210
int toLane
The lane the connections yields in.
Definition NBEdge.h:216
NBEdge * toEdge
The edge the connections yields in.
Definition NBEdge.h:213