111 importer.
load(oc, nb);
123 delete myEdge.second;
127 delete myPlatformShape.second;
134 if (!oc.
isSet(
"osm-files")) {
142 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
145 WRITE_ERROR(
"Could not open osm-file '" + *file +
"'.");
157 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
166 if (!oc.
getBool(
"osm.skip-duplicates-check")) {
169 std::set<const Edge*, CompareEdges> dupsFinder;
171 if (dupsFinder.count(it->second) > 0) {
176 dupsFinder.insert(it->second);
187 std::map<long long int, int> nodeUsage;
189 for (std::map<long long int, Edge*>::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
190 Edge* e = (*i).second;
192 for (std::vector<long long int>::const_iterator j = e->
myCurrentNodes.begin();
195 if (nodeUsage.find(*j) == nodeUsage.end()) {
198 nodeUsage[*j] = nodeUsage[*j] + 1;
202 for (std::map<long long int, NIOSMNode*>::const_iterator nodesIt =
myOSMNodes.begin();
205 if (nodesIt->second->tlsControlled ) {
208 nodeUsage[nodesIt->first] += 1;
218 Edge* e = myEdge.second;
231 std::vector<long long int> passed;
233 passed.push_back(*j);
236 running =
insertEdge(e, running, currentFrom, currentTo, passed, nb);
237 currentFrom = currentTo;
239 passed.push_back(*j);
245 insertEdge(e, running, currentFrom, last, passed, nb);
248 const double layerElevation = oc.
getFloat(
"osm.layer-elevation");
249 if (layerElevation > 0) {
262 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
297 if (!tlsc.
insert(tlDef)) {
309 const std::vector<long long int>& passed,
NBNetBuilder& nb) {
318 if (from == 0 || to == 0) {
319 WRITE_ERROR(
"Discarding edge '" +
id +
"' because the nodes could not be built.");
328 assert(passed.size() >= 2);
329 if (passed.size() == 2) {
330 WRITE_WARNING(
"Discarding edge '" +
id +
"' which connects two identical nodes without geometry.");
334 int intermediateIndex = (int) passed.size() / 2;
336 std::vector<long long int> part1(passed.begin(), passed.begin() + intermediateIndex + 1);
337 std::vector<long long int> part2(passed.begin() + intermediateIndex, passed.end());
338 index =
insertEdge(e, index, from, intermediate, part1, nb);
339 return insertEdge(e, index, intermediate, to, part2, nb);
341 const int newIndex = index + 1;
345 for (
long long i : passed) {
350 if (existingPtStop !=
nullptr) {
364 shape.push_back(pos);
367 WRITE_ERROR(
"Unable to project coordinates for edge '" +
id +
"'.");
372 if (!tc.
knows(type)) {
381 std::vector<std::string> types;
383 std::string t = tok.
next();
385 if (std::find(types.begin(), types.end(), t) == types.end()) {
388 }
else if (tok.
size() > 1) {
390 "Discarding unknown compound '" + t +
"' in type '" + type +
"' (first occurence for edge '" 396 WRITE_WARNING(
"Discarding unusable type '" + type +
"' (first occurence for edge '" +
id +
"').");
402 if (tc.
knows(newType)) {
415 bool defaultIsOneWay =
false;
418 for (
auto& type2 : types) {
436 "Discarding compound type '" + newType +
"' (first occurence for edge '" +
id +
"').");
441 WRITE_MESSAGE(
"Adding new type '" + type +
"' (first occurence for edge '" +
id +
"').");
442 tc.
insert(newType, numLanes, maxSpeed, prio, permissions, width, defaultIsOneWay, sidewalkWidth,
444 for (
auto& type3 : types) {
465 double forwardWidth = tc.
getWidth(type);
466 double backwardWidth = tc.
getWidth(type);
470 bool addForward =
true;
471 bool addBackward =
true;
474 e->
getParameter(
"railway:preferred_direction",
"") !=
"both")) {
488 if (addForward && !addBackward) {
490 }
else if (!addForward && addBackward) {
498 numLanesForward = (int) std::ceil(e->
myNoLanes / 2.0);
500 numLanesBackward = e->
myNoLanes - numLanesForward;
503 numLanesForward =
MAX2(1, numLanesForward);
504 numLanesBackward =
MAX2(1, numLanesBackward);
507 WRITE_WARNING(
"Skipping edge '" +
id +
"' because it has zero lanes.");
532 numLanesBackward = 1;
546 numLanesBackward = 1;
555 const std::string reverseID =
"-" + id;
558 assert(numLanesForward > 0);
582 assert(numLanesBackward > 0);
602 throw ProcessError(
"Could not add edge '-" +
id +
"'.");
637 std::set<NIOSMNode*, CompareNodes>& uniqueNodes,
644 myIsInValidNodeTag(false),
647 myImportElevation(oc.getBool(
"osm.elevation")),
666 auto id = attrs.
get<
long 670 if (action ==
"delete") {
701 auto* toAdd =
new NIOSMNode(
id, tlon, tlat);
709 toAdd = *similarNode;
717 WRITE_ERROR(
"Tag element on wrong XML hierarchy level.");
723 if (key ==
"highway" || key ==
"ele" || key ==
"crossing" || key ==
"railway" || key ==
"public_transport" 724 || key ==
"name" || key ==
"train" || key ==
"bus" || key ==
"tram" || key ==
"light_rail" || key ==
"subway" || key ==
"station") {
726 if (key ==
"highway" && value.find(
"traffic_signal") != std::string::npos) {
728 }
else if (key ==
"crossing" && value.find(
"traffic_signals") != std::string::npos) {
730 }
else if (key ==
"railway" && value.find(
"crossing") != std::string::npos) {
732 }
else if (key ==
"public_transport" && value.find(
"stop_position") != std::string::npos) {
738 }
else if (key ==
"name") {
740 }
else if (key ==
"train") {
743 }
else if (key ==
"subway" || key ==
"light_rail" 744 || (key ==
"station" && (value ==
"subway" || value ==
"light_rail"))) {
747 }
else if (key ==
"bus") {
750 }
else if (key ==
"tram") {
757 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in node '" +
778 const std::map<long long int, NIOSMNode*>& osmNodes,
779 std::map<long long int, Edge*>& toFill, std::map<long long int, Edge*>& platformShapes)
784 myPlatformShapesMap(platformShapes) {
804 auto id = attrs.
get<
long 808 if (action ==
"delete") {
821 auto ref = attrs.
get<
long 831 ref = node->second->id;
849 const std::string cyclewaySpec = key.substr(9);
851 if (cyclewaySpec ==
"right") {
853 }
else if (cyclewaySpec ==
"left") {
855 }
else if (cyclewaySpec ==
"both") {
866 const std::string buswaySpec = key.substr(7);
868 if (buswaySpec ==
"right") {
870 }
else if (buswaySpec ==
"left") {
872 }
else if (buswaySpec ==
"both") {
883 && key !=
"maxspeed" && key !=
"junction" && key !=
"name" && key !=
"tracks" && key !=
"layer" 886 && key !=
"postal_code" && key !=
"railway:preferred_direction" && key !=
"public_transport") {
891 if ((key ==
"highway" && value !=
"platform") || key ==
"railway" || key ==
"waterway" || key ==
"cycleway" 892 || key ==
"busway" || key ==
"route") {
895 if (key ==
"cycleway") {
899 if (value ==
"opposite_track") {
901 }
else if (value ==
"opposite_lane") {
906 if (key ==
"busway") {
910 if (value ==
"opposite_track") {
912 }
else if (value ==
"opposite_lane") {
919 const std::string singleTypeID = key +
"." + value;
925 types.push_back(singleTypeID);
930 }
else if (key ==
"lanes") {
936 std::vector<std::string> list = st.
getVector();
937 if (list.size() >= 2) {
938 int minLanes = std::numeric_limits<int>::max();
940 for (
auto& i : list) {
942 minLanes =
MIN2(minLanes, numLanes);
946 "Using minimum lane number from list (" + value +
") for edge '" 950 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
955 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
958 }
else if (key ==
"lanes:forward") {
962 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
965 }
else if (key ==
"lanes:backward") {
970 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
973 }
else if (key ==
"maxspeed") {
977 double conversion = 1;
982 conversion = 1.609344;
987 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
991 }
else if (key ==
"junction") {
995 }
else if (key ==
"oneway") {
997 }
else if (key ==
"name") {
999 }
else if (key ==
"layer") {
1003 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
1006 }
else if (key ==
"tracks") {
1014 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
1019 }
else if (key ==
"railway:preferred_direction") {
1022 }
else if (key ==
"public_transport" && value ==
"platform") {
1057 const std::map<long long int, NIOSMNode*>& osmNodes,
1058 const std::map<long long int, Edge*>& osmEdges,
NBPTStopCont* nbptStopCont,
1059 const std::map<long long int, Edge*>& platformShapes,
1065 myOSMEdges(osmEdges),
1067 myNBPTStopCont(nbptStopCont),
1068 myNBPTLineCont(nbptLineCont),
1103 if (action ==
"delete" || !ok) {
1115 auto ref = attrs.
get<
long 1118 if (role ==
"via") {
1123 }
else if (memberType ==
"node") {
1128 "No node found for reference '" +
toString(ref) +
"' in relation '" 1137 }
else if (role ==
"stop") {
1139 }
else if (role ==
"platform") {
1141 if (memberType ==
"way") {
1142 const std::map<
long long int,
1147 platform.
isWay =
true;
1151 }
else if (memberType ==
"node") {
1153 platform.
isWay =
false;
1158 }
else if (role.empty()) {
1160 if (memberType ==
"way") {
1171 if (key ==
"type" || key ==
"restriction") {
1173 if (key ==
"type" && value ==
"restriction") {
1177 if (key ==
"type" && value ==
"route") {
1181 if (key ==
"restriction") {
1184 if (value.substr(0, 5) ==
"only_") {
1186 }
else if (value.substr(0, 3) ==
"no_") {
1195 }
else if (key ==
"public_transport") {
1197 if (value ==
"stop_area") {
1200 }
else if (key ==
"route") {
1202 if (value ==
"train" || value ==
"subway" || value ==
"light_rail" || value ==
"monorail" || value ==
"tram" || value ==
"bus" 1203 || value ==
"trolleybus" || value ==
"arialway" || value ==
"ferry") {
1207 }
else if (key ==
"name") {
1210 }
else if (key ==
"ref") {
1258 for (
long long ref :
myStops) {
1262 +
"' does not exist. Probably OSM file is incomplete.");
1271 +
toString(n->
id) +
"'. Probably OSM file is incomplete.");
1275 if (myPlatform.isWay) {
1278 if (edge->myCurrentNodes[0] == *(edge->myCurrentNodes.end() - 1)) {
1280 +
"' is given as polygon, which currently is not supported.");
1285 for (
auto nodeRef : edge->myCurrentNodes) {
1289 +
"' does not exist. Probably OSM file is incomplete.");
1298 p.push_back(pNodePos);
1300 if (p.size() == 0) {
1303 +
"' is corrupt. Probably OSM file is incomplete.");
1312 +
"' does not exist. Probably OSM file is incomplete.");
1321 "osm.stop-output.length"));
1331 for (
long long ref :
myStops) {
1335 +
"' does not exist. Probably OSM file is incomplete.");
1349 +
"' refers to a non existing pt stop at node: '" +
toString(n->
id)
1350 +
"'. Probably OSM file is incomplete.");
1365 for (
long long& myWay :
myWays) {
1368 Edge* edge = entr->second;
1398 WRITE_WARNING(
"from-edge of restriction relation could not be determined");
1402 WRITE_WARNING(
"to-edge of restriction relation could not be determined");
1412 WRITE_WARNING(
"direction of restriction relation could not be determined");
1420 const std::vector<NBEdge*>& candidates)
const {
1421 const std::string prefix =
toString(wayRef);
1422 const std::string backPrefix =
"-" + prefix;
1425 for (
auto candidate : candidates) {
1426 if ((candidate->getID().substr(0, prefix.size()) == prefix) ||
1427 (candidate->getID().substr(0, backPrefix.size()) == backPrefix)) {
1433 WRITE_WARNING(
"Ambigous way reference '" + prefix +
"' in restriction relation");
1446 std::map<NBNode*, std::vector<std::pair<double, double> > > layerForces;
1449 std::set<NBNode*> knownElevation;
1450 for (
auto& myEdge :
myEdges) {
1451 Edge* e = myEdge.second;
1456 knownElevation.insert(node);
1462 #ifdef DEBUG_LAYER_ELEVATION 1463 std::cout <<
"known elevations:\n";
1464 for (std::set<NBNode*>::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1465 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[*it];
1466 std::cout <<
" node=" << (*it)->
getID() <<
" ele=";
1467 for (std::vector<std::pair<double, double> >::const_iterator it_ele = primaryLayers.begin(); it_ele != primaryLayers.end(); ++it_ele) {
1468 std::cout << it_ele->first <<
" ";
1476 std::map<NBNode*, double> knownEleMax;
1477 for (
auto it : knownElevation) {
1478 double eleMax = -std::numeric_limits<double>::max();
1479 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[it];
1480 for (
const auto& primaryLayer : primaryLayers) {
1481 eleMax =
MAX2(eleMax, primaryLayer.first);
1483 knownEleMax[it] = eleMax;
1486 bool changed =
true;
1489 for (
auto it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1492 / gradeThreshold * 3,
1494 for (
auto& neighbor : neighbors) {
1495 if (knownElevation.count(neighbor.first) != 0) {
1496 const double grade = fabs(knownEleMax[*it] - knownEleMax[neighbor.first])
1498 #ifdef DEBUG_LAYER_ELEVATION 1499 std::cout <<
" grade at node=" << (*it)->getID() <<
" ele=" << knownEleMax[*it] <<
" neigh=" << it_neigh->first->getID() <<
" neighEle=" << knownEleMax[it_neigh->first] <<
" grade=" << grade <<
" dist=" << it_neigh->second.first <<
" speed=" << it_neigh->second.second <<
"\n";
1501 if (grade > gradeThreshold * 50 / 3.6 / neighbor.second.second) {
1503 const double eleMax =
MAX2(knownEleMax[*it], knownEleMax[neighbor.first]);
1504 if (knownEleMax[*it] < eleMax) {
1505 knownEleMax[*it] = eleMax;
1507 knownEleMax[neighbor.first] = eleMax;
1517 std::set<NBNode*> unknownElevation;
1518 for (
auto it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1519 const double eleMax = knownEleMax[*it];
1520 const double maxDist = fabs(eleMax) * 100 / layerElevation;
1521 std::map<NBNode*, std::pair<double, double> > neighbors =
getNeighboringNodes(*it, maxDist, knownElevation);
1522 for (
auto& neighbor : neighbors) {
1523 if (knownElevation.count(neighbor.first) == 0) {
1524 unknownElevation.insert(neighbor.first);
1525 layerForces[neighbor.first].emplace_back(eleMax, neighbor.second.first);
1531 for (
auto it = unknownElevation.begin(); it != unknownElevation.end(); ++it) {
1532 double eleMax = -std::numeric_limits<double>::max();
1533 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[*it];
1534 for (
const auto& primaryLayer : primaryLayers) {
1535 eleMax =
MAX2(eleMax, primaryLayer.first);
1537 const double maxDist = fabs(eleMax) * 100 / layerElevation;
1538 std::map<NBNode*, std::pair<double, double> > neighbors =
getNeighboringNodes(*it, maxDist, knownElevation);
1539 for (
auto& neighbor : neighbors) {
1540 if (knownElevation.count(neighbor.first) == 0 && unknownElevation.count(neighbor.first) == 0) {
1541 layerForces[*it].emplace_back(0, neighbor.second.first);
1546 #ifdef DEBUG_LAYER_ELEVATION 1547 std::cout <<
"summation of forces\n";
1549 std::map<NBNode*, double> nodeElevation;
1550 for (
auto& layerForce : layerForces) {
1551 const std::vector<std::pair<double, double> >& forces = layerForce.second;
1552 if (knownElevation.count(layerForce.first) != 0) {
1560 #ifdef DEBUG_LAYER_ELEVATION 1561 std::cout <<
" node=" << it->first->getID() <<
" knownElevation=" << knownEleMax[it->first] <<
"\n";
1563 nodeElevation[layerForce.first] = knownEleMax[layerForce.first];
1564 }
else if (forces.size() == 1) {
1565 nodeElevation[layerForce.first] = forces.front().first;
1569 for (
const auto& force : forces) {
1570 distSum += force.second;
1572 double weightSum = 0;
1573 double elevation = 0;
1574 #ifdef DEBUG_LAYER_ELEVATION 1575 std::cout <<
" node=" << it->first->getID() <<
" distSum=" << distSum <<
"\n";
1577 for (
const auto& force : forces) {
1578 const double weight = (distSum - force.second) / distSum;
1579 weightSum += weight;
1580 elevation += force.first * weight;
1582 #ifdef DEBUG_LAYER_ELEVATION 1583 std::cout <<
" force=" << it_force->first <<
" dist=" << it_force->second <<
" weight=" << weight <<
" ele=" << elevation <<
"\n";
1586 nodeElevation[layerForce.first] = elevation / weightSum;
1589 #ifdef DEBUG_LAYER_ELEVATION 1590 std::cout <<
"final elevations:\n";
1591 for (std::map<NBNode*, double>::iterator it = nodeElevation.begin(); it != nodeElevation.end(); ++it) {
1592 std::cout <<
" node=" << (it->first)->getID() <<
" ele=" << it->second <<
"\n";;
1596 for (
auto& it : nodeElevation) {
1603 for (
const auto& it : ec) {
1604 NBEdge* edge = it.second;
1606 const double length = geom.
length2D();
1607 const double zFrom = nodeElevation[edge->
getFromNode()];
1608 const double zTo = nodeElevation[edge->
getToNode()];
1613 for (
auto it_pos = geom.begin(); it_pos != geom.end(); ++it_pos) {
1614 if (it_pos != geom.begin()) {
1615 dist += (*it_pos).distanceTo2D(*(it_pos - 1));
1617 newGeom.push_back((*it_pos) +
Position(0, 0, zFrom + (zTo - zFrom) * dist / length));
1623 std::map<NBNode*, std::pair<double, double> >
1625 std::map<NBNode*, std::pair<double, double> > result;
1626 std::set<NBNode*> visited;
1627 std::vector<NBNode*> open;
1628 open.push_back(node);
1629 result[node] = std::make_pair(0, 0);
1630 while (!open.empty()) {
1633 if (visited.count(n) != 0) {
1638 for (
auto e : edges) {
1641 s = e->getFromNode();
1645 const double dist = result[n].first + e->getGeometry().length2D();
1646 const double speed =
MAX2(e->getSpeed(), result[n].second);
1647 if (result.count(s) == 0) {
1648 result[s] = std::make_pair(dist, speed);
1650 result[s] = std::make_pair(
MIN2(dist, result[s].first),
MAX2(speed, result[s].second));
1652 if (dist < maxDist && knownElevation.count(s) == 0) {
const std::map< long long int, NIOSMNode * > & myOSMNodes
The previously parsed nodes.
An internal definition of a loaded edge.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
void insert(const std::string &id, int numLanes, double maxSpeed, int prio, SVCPermissions permissions, double width, bool oneWayIsDefault, double sidewalkWidth, double bikeLaneWidth)
Adds a type into the list.
const bool myImportElevation
whether elevation data should be imported
const std::map< long long int, Edge * > & myOSMEdges
The previously parsed edges.
std::map< long long int, Edge * > & myPlatformShapesMap
A map of built edges.
The only invalid connection is declared.
void myStartElement(int element, const SUMOSAXAttributes &attrs) override
Called on the opening of a tag;.
An internal representation of an OSM-node.
const long long int id
The edge's id.
double length2D() const
Returns the length.
void reviseStops(NBEdgeCont &cont)
revise pt stops and remove stops on non existing (removed) edges
double getSpeed(const std::string &type) const
Returns the maximal velocity for the given type [m/s].
~RelationHandler() override
Destructor.
~EdgesHandler() override
Destructor.
std::string streetName
The edge's street name.
NBTypeCont & getTypeCont()
Returns a reference to the type container.
NBPTLineCont * myNBPTLineCont
PT Line container to be filled.
RestrictionType myRestrictionType
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
const std::map< long long int, NIOSMNode * > & myOSMNodes
The previously parsed nodes.
const long long int id
The node's id.
static bool isReadable(std::string path)
Checks whether the given file is readable.
The only valid connection is declared.
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
WayType myBuswayType
Information about the kind of busway along this road.
The relation tag was missing.
long long int myFromWay
the origination way for the current restriction
vehicle is a not electrified rail
A container for traffic light definitions and built programs.
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
std::string myRef
ref of the pt line
std::map< NBNode *, std::pair< double, double > > getNeighboringNodes(NBNode *node, double maxDist, const std::set< NBNode *> &knownElevation)
collect neighboring nodes with their road distance and maximum between-speed. Search does not continu...
NIImporter_OpenStreetMap()
const double SUMO_const_laneWidth
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
The representation of a single edge during network building.
int getPriority(const std::string &type) const
Returns the priority for the given type.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false)
Removes the specified connection(s)
long long int myCurrentRelation
The currently parsed relation.
bool checkEdgeRef(long long int ref) const
check whether a referenced way has a corresponding edge
void addPTStop(NBPTStop *pStop)
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
std::vector< NIIPTPlatform > myPlatforms
bus stop platforms
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
PositionVector reverse() const
reverse position vector
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
int getNumLanes(const std::string &type) const
Returns the number of lanes for the given type.
bool getShallBeDiscarded(const std::string &type) const
Returns the information whether edges of this type shall be discarded.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::string & getID() const
Returns the id.
RelationHandler(const std::map< long long int, NIOSMNode *> &osmNodes, const std::map< long long int, Edge *> &osmEdges, NBPTStopCont *nbptStopCont, const std::map< long long int, Edge *> &platfromShapes, NBPTLineCont *nbptLineCont, const OptionsCont &oc)
Constructor.
The representation of a single pt stop.
std::vector< long long int > myStops
bus stop references
void registerAdditionalEdge(std::string wayId, std::string edgeId)
NBParkingCont & getParkingCont()
SAX-handler base for SUMO-files.
void myEndElement(int element) override
Called when a closing tag occurs.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
void addSidewalk(double width)
add a pedestrian sidewalk of the given width and shift existing connctions
std::vector< long long int > myCurrentNodes
The list of nodes this edge is made of.
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge's geometry
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
static const double UNSPECIFIED_WIDTH
unspecified lane width
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
double getWidth(const std::string &type) const
Returns the lane width for the given type [m].
std::set< NIOSMNode *, CompareNodes > & myUniqueNodes
the set of unique nodes (used for duplicate detection/substitution)
NBNode * node
the NBNode that was instantiated
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
std::vector< long long int > myWays
ways in pt line references
const OptionsCont & myOptionsCont
the options cont
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given OSM file.
Functor which compares two Edges.
WayType myCyclewayType
Information about the kind of cycleway along this road.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
The representation of a single pt stop.
int myNoLanesForward
number of lanes in forward direction or 0 if unknown, negative if backwards lanes are meant ...
bool addEdge2EdgeConnection(NBEdge *dest)
Adds a connection to another edge.
const std::map< long long int, Edge * > & myPlatformShapes
The previously parsed platform shapes.
NBEdge * findEdgeRef(long long int wayRef, const std::vector< NBEdge *> &candidates) const
try to find the way segment among candidates
bool knows(const std::string &type) const
Returns whether the named type is in the container.
double getBikeLaneWidth(const std::string &type) const
Returns the lane width for a bike lane to be added [m].
void load(const OptionsCont &oc, NBNetBuilder &nb)
std::string myName
name of the relation
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
void setFileName(const std::string &name)
Sets the current file name.
void addWayNode(long long int way, long long int node)
void setMyNumOfStops(int numStops)
A class which extracts OSM-edges from a parsed OSM-file.
int insertEdge(Edge *e, int index, NBNode *from, NBNode *to, const std::vector< long long int > &passed, NBNetBuilder &nb)
Builds an NBEdge.
void insert(NBPTLine *pLine)
insert new line
double ele
The elevation of this node.
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
std::vector< int > myParentElements
The element stack.
double getSidewalkWidth(const std::string &type) const
Returns the lane width for a sidewalk to be added [m].
void updateParameter(const std::map< std::string, std::string > &mapArg)
Adds or updates all given parameters from the map.
bool ptStopPosition
Whether this is a public transport stop position.
Encapsulated SAX-Attributes.
void setRef(std::string basic_string)
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
A point in 2D or 3D with translation and scaling methods.
void myEndElement(int element) override
Called when a closing tag occurs.
NBEdgeCont & getEdgeCont()
T get(const std::string &str) const
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node) ...
Storage for edges, including some functionality operating on multiple edges.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
#define PROGRESS_BEGIN_MESSAGE(msg)
bool operator()(const Edge *e1, const Edge *e2) const
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
int myParkingType
Information about road-side parking.
long long int myLastNodeID
ID of the currently parsed node, for reporting mainly.
std::map< long long int, NIOSMNode * > & myToFill
The nodes container to fill.
bool myIsRestriction
whether the currently parsed relation is a restriction
~NIImporter_OpenStreetMap()
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
void setIsMultipleStopPositions(bool multipleStopPositions)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
bool railwayCrossing
Whether this is a railway crossing.
~NodesHandler() override
Destructor.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
double myMaxSpeed
maximum speed in km/h, or MAXSPEED_UNGIVEN
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
void myEndElement(int element) override
Called when a closing tag occurs.
bool myIsInValidNodeTag
Hierarchy helper for parsing a node's tags.
std::map< long long int, Edge * > myEdges
the map from OSM way ids to edge objects
std::vector< std::string > getVector()
const double lat
The latitude the node is located at.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
int myNoLanes
number of lanes, or -1 if unknown
static std::string to_lower_case(std::string str)
Transfers the content to lower case.
static int _2int(const E *const data)
converts a char-type array into the integer value described by it
bool tlsControlled
Whether this is a tls controlled junction.
EdgesHandler(const std::map< long long int, NIOSMNode *> &osmNodes, std::map< long long int, Edge *> &toFill, std::map< long long int, Edge *> &platformShapes)
Constructor.
void myStartElement(int element, const SUMOSAXAttributes &attrs) override
Called on the opening of a tag;.
std::map< std::string, std::string > myKnownCompoundTypes
The compound types that have already been mapped to other known types.
static std::string prune(const std::string &str)
Removes trailing and leading whitechars.
double length() const
Returns the length.
std::map< long long int, Edge * > & myEdgeMap
A map of built edges.
bool myCurrentIsPlatform
Information whether this is a pt platform.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
NBNodeCont & getNodeCont()
Returns a reference to the node container.
long long int myToWay
the destination way for the current restriction
bool myIsRoute
indicates whether current relation is a route
int myLayer
Information about the relative z-ordering of ways.
Instance responsible for building networks.
std::string myPTRouteType
indicates whether current relation is a pt route
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
const std::map< std::string, std::string > & getMap() const
Returns the inner key/value map.
static const std::string compoundTypeSeparator
The separator within newly created compound type names.
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
alternative definition for junction
A storage for options typed value containers)
long long int myViaNode
the via node/way for the current restriction
std::string joinToStringSorting(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
NBPTStop * get(std::string id)
Retrieve a previously inserted pt stop.
bool copyRestrictionsAndAttrs(const std::string &fromId, const std::string &toId)
Copy restrictions to a type.
static double _2double(const E *const data)
converts a char-type array into the double value described by it
SumoXMLNodeType getType() const
Returns the type of this node.
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
void addBikeLane(double width)
add a bicycle lane of the given width and shift existing connctions
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
void reconstructLayerElevation(double layerElevation, NBNetBuilder &nb)
reconstruct elevation from layer info
std::string name
The name of the node.
A class which extracts OSM-nodes from a parsed OSM-file.
const Position & getPosition() const
Represents a single node (junction) during network building.
void resetValues()
reset members to their defaults for parsing a new relation
NBNode * insertNodeChecking(long long int id, NBNodeCont &nc, NBTrafficLightLogicCont &tlsc)
Builds an NBNode.
int myHierarchyLevel
The current hierarchy level.
std::string myHighWayType
The type, stored in "highway" key.
NodesHandler(std::map< long long int, NIOSMNode *> &toFill, std::set< NIOSMNode *, CompareNodes > &uniqueNodes, const OptionsCont &cont)
Contructor.
const double lon
The longitude the node is located at.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
Importer for networks stored in OpenStreetMap format.
bool myIsStopArea
indicates whether current relation is a pt stop area
static const long long int INVALID_ID
bool myCurrentIsRoad
Information whether this is a road.
Edge * myCurrentEdge
The currently built edge.
std::map< long long int, Edge * > myPlatformShapes
the map from OSM way ids to platform shapes
std::set< std::string > myUnusableTypes
The compounds types that do not contain known types.
std::vector< NBPTStop * > getStops()
SVCPermissions permissions
type of pt stop
NBNode * getFromNode() const
Returns the origin node of the edge.
Container for nodes during the netbuilding process.
void myStartElement(int element, const SUMOSAXAttributes &attrs) override
Called on the opening of a tag;.
bool insert(NBPTStop *ptStop)
Inserts a node into the map.
#define PROGRESS_DONE_MESSAGE()
double ptStopLength
The length of the pt stop.
std::map< long long int, NIOSMNode * > myOSMNodes
the map from OSM node ids to actual nodes
A traffic light logics which must be computed (only nodes/edges are given)
std::vector< int > myParentElements
The element stack.
bool getIsOneWay(const std::string &type) const
Returns whether edges are one-way per default for the given type.
#define WRITE_MESSAGE(msg)
std::set< NIOSMNode *, CompareNodes > myUniqueNodes
the set of unique nodes used in NodesHandler, used when freeing memory
void addPlatformCand(NBPTPlatform platform)
static const double MAXSPEED_UNGIVEN
const OptionsCont & myOptionsCont
the options
NBNode * getToNode() const
Returns the destination node of the edge.
bool applyRestriction() const
try to apply the parsed restriction and return whether successful
A class which extracts relevant relation information from a parsed OSM-file.
std::string myIsOneWay
Information whether this is an one-way road.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::map< std::string, double > mySpeedMap
A map of non-numeric speed descriptions to their numeric values.
SVCPermissions getPermissions(const std::string &type) const
Returns allowed vehicle classes for the given type.
A storage for available types of edges.
NBPTStopCont * myNBPTStopCont
The previously filled pt stop container.