112 importer.
load(oc, nb);
124 delete myEdge.second;
128 delete myPlatformShape.second;
135 if (!oc.
isSet(
"osm-files")) {
143 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
146 WRITE_ERROR(
"Could not open osm-file '" + *file +
"'.");
158 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
167 if (!oc.
getBool(
"osm.skip-duplicates-check")) {
170 std::set<const Edge*, CompareEdges> dupsFinder;
172 if (dupsFinder.count(it->second) > 0) {
177 dupsFinder.insert(it->second);
188 std::map<long long int, int> nodeUsage;
190 for (std::map<long long int, Edge*>::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
191 Edge* e = (*i).second;
193 for (std::vector<long long int>::const_iterator j = e->
myCurrentNodes.begin();
196 if (nodeUsage.find(*j) == nodeUsage.end()) {
199 nodeUsage[*j] = nodeUsage[*j] + 1;
203 for (std::map<long long int, NIOSMNode*>::const_iterator nodesIt =
myOSMNodes.begin();
206 if (nodesIt->second->tlsControlled ) {
209 nodeUsage[nodesIt->first] += 1;
219 Edge* e = myEdge.second;
232 std::vector<long long int> passed;
234 passed.push_back(*j);
237 running =
insertEdge(e, running, currentFrom, currentTo, passed, nb);
238 currentFrom = currentTo;
240 passed.push_back(*j);
246 insertEdge(e, running, currentFrom, last, passed, nb);
249 const double layerElevation = oc.
getFloat(
"osm.layer-elevation");
250 if (layerElevation > 0) {
263 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
298 if (!tlsc.
insert(tlDef)) {
310 const std::vector<long long int>& passed,
NBNetBuilder& nb) {
319 if (from == 0 || to == 0) {
320 WRITE_ERROR(
"Discarding edge '" +
id +
"' because the nodes could not be built.");
329 assert(passed.size() >= 2);
330 if (passed.size() == 2) {
331 WRITE_WARNING(
"Discarding edge '" +
id +
"' which connects two identical nodes without geometry.");
335 int intermediateIndex = (int) passed.size() / 2;
337 std::vector<long long int> part1(passed.begin(), passed.begin() + intermediateIndex + 1);
338 std::vector<long long int> part2(passed.begin() + intermediateIndex, passed.end());
339 index =
insertEdge(e, index, from, intermediate, part1, nb);
340 return insertEdge(e, index, intermediate, to, part2, nb);
342 const int newIndex = index + 1;
346 for (
long long i : passed) {
351 if (existingPtStop !=
nullptr) {
365 shape.push_back(pos);
368 WRITE_ERROR(
"Unable to project coordinates for edge '" +
id +
"'.");
373 if (!tc.
knows(type)) {
382 std::vector<std::string> types;
384 std::string t = tok.
next();
386 if (std::find(types.begin(), types.end(), t) == types.end()) {
389 }
else if (tok.
size() > 1) {
391 "Discarding unknown compound '" + t +
"' in type '" + type +
"' (first occurence for edge '" 397 WRITE_WARNING(
"Discarding unusable type '" + type +
"' (first occurence for edge '" +
id +
"').");
403 if (tc.
knows(newType)) {
416 bool defaultIsOneWay =
false;
419 for (
auto& type2 : types) {
437 "Discarding compound type '" + newType +
"' (first occurence for edge '" +
id +
"').");
442 WRITE_MESSAGE(
"Adding new type '" + type +
"' (first occurence for edge '" +
id +
"').");
443 tc.
insert(newType, numLanes, maxSpeed, prio, permissions, width, defaultIsOneWay, sidewalkWidth,
445 for (
auto& type3 : types) {
466 double forwardWidth = tc.
getWidth(type);
467 double backwardWidth = tc.
getWidth(type);
471 bool addForward =
true;
472 bool addBackward =
true;
475 e->
getParameter(
"railway:preferred_direction",
"") !=
"both")) {
489 if (addForward && !addBackward) {
491 }
else if (!addForward && addBackward) {
499 numLanesForward = (int) std::ceil(e->
myNoLanes / 2.0);
501 numLanesBackward = e->
myNoLanes - numLanesForward;
504 numLanesForward =
MAX2(1, numLanesForward);
505 numLanesBackward =
MAX2(1, numLanesBackward);
508 WRITE_WARNING(
"Skipping edge '" +
id +
"' because it has zero lanes.");
533 numLanesBackward = 1;
547 numLanesBackward = 1;
556 assert(numLanesForward > 0);
580 assert(numLanesBackward > 0);
600 throw ProcessError(
"Could not add edge '-" +
id +
"'.");
611 std::set<NIOSMNode*, CompareNodes>& uniqueNodes,
618 myIsInValidNodeTag(false),
621 myImportElevation(oc.getBool(
"osm.elevation")),
640 auto id = attrs.
get<
long 644 if (action ==
"delete") {
675 auto* toAdd =
new NIOSMNode(
id, tlon, tlat);
683 toAdd = *similarNode;
691 WRITE_ERROR(
"Tag element on wrong XML hierarchy level.");
697 if (key ==
"highway" || key ==
"ele" || key ==
"crossing" || key ==
"railway" || key ==
"public_transport" 698 || key ==
"name" || key ==
"train" || key ==
"bus" || key ==
"tram") {
700 if (key ==
"highway" && value.find(
"traffic_signal") != std::string::npos) {
702 }
else if (key ==
"crossing" && value.find(
"traffic_signals") != std::string::npos) {
704 }
else if (key ==
"railway" && value.find(
"crossing") != std::string::npos) {
706 }
else if (key ==
"public_transport" && value.find(
"stop_position") != std::string::npos) {
709 "osm.stop-output.length");
710 }
else if (key ==
"name") {
712 }
else if (key ==
"train") {
714 }
else if (key ==
"bus") {
716 }
else if (key ==
"tram") {
722 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in node '" +
743 const std::map<long long int, NIOSMNode*>& osmNodes,
744 std::map<long long int, Edge*>& toFill, std::map<long long int, Edge*>& platformShapes)
749 myPlatformShapesMap(platformShapes) {
769 auto id = attrs.
get<
long 773 if (action ==
"delete") {
786 auto ref = attrs.
get<
long 796 ref = node->second->id;
814 const std::string cyclewaySpec = key.substr(9);
816 if (cyclewaySpec ==
"right") {
818 }
else if (cyclewaySpec ==
"left") {
820 }
else if (cyclewaySpec ==
"both") {
831 const std::string buswaySpec = key.substr(7);
833 if (buswaySpec ==
"right") {
835 }
else if (buswaySpec ==
"left") {
837 }
else if (buswaySpec ==
"both") {
843 if (key ==
"bridge" || key ==
"tunnel") {
849 && key !=
"maxspeed" && key !=
"junction" && key !=
"name" && key !=
"tracks" && key !=
"layer" 851 && key !=
"postal_code" && key !=
"railway:preferred_direction" && key !=
"public_transport") {
856 if ((key ==
"highway" && value !=
"platform") || key ==
"railway" || key ==
"waterway" || key ==
"cycleway" 857 || key ==
"busway" || key ==
"route") {
860 if (key ==
"cycleway") {
864 if (value ==
"opposite_track") {
866 }
else if (value ==
"opposite_lane") {
871 if (key ==
"busway") {
875 if (value ==
"opposite_track") {
877 }
else if (value ==
"opposite_lane") {
884 const std::string singleTypeID = key +
"." + value;
890 types.push_back(singleTypeID);
895 }
else if (key ==
"lanes") {
901 std::vector<std::string> list = st.
getVector();
902 if (list.size() >= 2) {
905 for (
auto& i : list) {
907 minLanes =
MIN2(minLanes, numLanes);
911 "Using minimum lane number from list (" + value +
") for edge '" 915 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
920 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
923 }
else if (key ==
"lanes:forward") {
927 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
930 }
else if (key ==
"lanes:backward") {
935 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
938 }
else if (key ==
"maxspeed") {
942 double conversion = 1;
947 conversion = 1.609344;
952 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
956 }
else if (key ==
"junction") {
960 }
else if (key ==
"oneway") {
962 }
else if (key ==
"name") {
964 }
else if (key ==
"layer") {
968 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
971 }
else if (key ==
"tracks") {
979 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
982 }
else if (key ==
"postal_code") {
984 }
else if (key ==
"railway:preferred_direction") {
986 }
else if (key ==
"public_transport" && value ==
"platform") {
1015 const std::map<long long int, NIOSMNode*>& osmNodes,
1016 const std::map<long long int, Edge*>& osmEdges,
NBPTStopCont* nbptStopCont,
1017 const std::map<long long int, Edge*>& platformShapes,
1023 myOSMEdges(osmEdges),
1025 myNBPTStopCont(nbptStopCont),
1026 myNBPTLineCont(nbptLineCont),
1061 if (action ==
"delete" || !ok) {
1073 auto ref = attrs.
get<
long 1076 if (role ==
"via") {
1081 }
else if (memberType ==
"node") {
1086 "No node found for reference '" +
toString(ref) +
"' in relation '" 1095 }
else if (role ==
"stop") {
1097 }
else if (role ==
"platform") {
1099 if (memberType ==
"way") {
1100 const std::map<
long long int,
1105 platform.
isWay =
true;
1109 }
else if (memberType ==
"node") {
1111 platform.
isWay =
false;
1116 }
else if (role.empty()) {
1118 if (memberType ==
"way") {
1129 if (key ==
"type" || key ==
"restriction") {
1131 if (key ==
"type" && value ==
"restriction") {
1135 if (key ==
"type" && value ==
"route") {
1139 if (key ==
"restriction") {
1142 if (value.substr(0, 5) ==
"only_") {
1144 }
else if (value.substr(0, 3) ==
"no_") {
1153 }
else if (key ==
"public_transport") {
1155 if (value ==
"stop_area") {
1158 }
else if (key ==
"route") {
1160 if (value ==
"train" || value ==
"subway" || value ==
"monorail" || value ==
"tram" || value ==
"bus" 1161 || value ==
"trolleybus" || value ==
"arialway" || value ==
"ferry") {
1165 }
else if (key ==
"name") {
1168 }
else if (key ==
"ref") {
1216 for (
long long ref :
myStops) {
1220 +
"' does not exist. Probably OSM file is incomplete.");
1229 +
toString(n->
id) +
"'. Probably OSM file is incomplete.");
1233 if (myPlatform.isWay) {
1236 if (edge->myCurrentNodes[0] == *(edge->myCurrentNodes.end() - 1)) {
1238 +
"' is given as polygon, which currently is not supported.");
1243 for (
auto nodeRef : edge->myCurrentNodes) {
1247 +
"' does not exist. Probably OSM file is incomplete.");
1256 p.push_back(pNodePos);
1258 if (p.size() == 0) {
1261 +
"' is corrupt. Probably OSM file is incomplete.");
1270 +
"' does not exist. Probably OSM file is incomplete.");
1279 "osm.stop-output.length"));
1289 for (
long long ref :
myStops) {
1293 +
"' does not exist. Probably OSM file is incomplete.");
1307 +
"' refers to a non existing pt stop at node: '" +
toString(n->
id)
1308 +
"'. Probably OSM file is incomplete.");
1323 for (
long long& myWay :
myWays) {
1326 Edge* edge = entr->second;
1356 WRITE_WARNING(
"from-edge of restriction relation could not be determined");
1360 WRITE_WARNING(
"to-edge of restriction relation could not be determined");
1370 WRITE_WARNING(
"direction of restriction relation could not be determined");
1378 const std::vector<NBEdge*>& candidates)
const {
1379 const std::string prefix =
toString(wayRef);
1380 const std::string backPrefix =
"-" + prefix;
1383 for (
auto candidate : candidates) {
1384 if ((candidate->getID().substr(0, prefix.size()) == prefix) ||
1385 (candidate->getID().substr(0, backPrefix.size()) == backPrefix)) {
1391 WRITE_WARNING(
"Ambigous way reference '" + prefix +
"' in restriction relation");
1404 std::map<NBNode*, std::vector<std::pair<double, double> > > layerForces;
1407 std::set<NBNode*> knownElevation;
1408 for (
auto& myEdge :
myEdges) {
1409 Edge* e = myEdge.second;
1414 knownElevation.insert(node);
1420 #ifdef DEBUG_LAYER_ELEVATION 1421 std::cout <<
"known elevations:\n";
1422 for (std::set<NBNode*>::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1423 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[*it];
1424 std::cout <<
" node=" << (*it)->
getID() <<
" ele=";
1425 for (std::vector<std::pair<double, double> >::const_iterator it_ele = primaryLayers.begin(); it_ele != primaryLayers.end(); ++it_ele) {
1426 std::cout << it_ele->first <<
" ";
1434 std::map<NBNode*, double> knownEleMax;
1435 for (
auto it : knownElevation) {
1437 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[it];
1438 for (
const auto& primaryLayer : primaryLayers) {
1439 eleMax =
MAX2(eleMax, primaryLayer.first);
1441 knownEleMax[it] = eleMax;
1444 bool changed =
true;
1447 for (
auto it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1450 / gradeThreshold * 3,
1452 for (
auto& neighbor : neighbors) {
1453 if (knownElevation.count(neighbor.first) != 0) {
1454 const double grade = fabs(knownEleMax[*it] - knownEleMax[neighbor.first])
1456 #ifdef DEBUG_LAYER_ELEVATION 1457 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";
1459 if (grade > gradeThreshold * 50 / 3.6 / neighbor.second.second) {
1461 const double eleMax =
MAX2(knownEleMax[*it], knownEleMax[neighbor.first]);
1462 if (knownEleMax[*it] < eleMax) {
1463 knownEleMax[*it] = eleMax;
1465 knownEleMax[neighbor.first] = eleMax;
1475 std::set<NBNode*> unknownElevation;
1476 for (
auto it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1477 const double eleMax = knownEleMax[*it];
1478 const double maxDist = fabs(eleMax) * 100 / layerElevation;
1479 std::map<NBNode*, std::pair<double, double> > neighbors =
getNeighboringNodes(*it, maxDist, knownElevation);
1480 for (
auto& neighbor : neighbors) {
1481 if (knownElevation.count(neighbor.first) == 0) {
1482 unknownElevation.insert(neighbor.first);
1483 layerForces[neighbor.first].emplace_back(eleMax, neighbor.second.first);
1489 for (
auto it = unknownElevation.begin(); it != unknownElevation.end(); ++it) {
1491 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[*it];
1492 for (
const auto& primaryLayer : primaryLayers) {
1493 eleMax =
MAX2(eleMax, primaryLayer.first);
1495 const double maxDist = fabs(eleMax) * 100 / layerElevation;
1496 std::map<NBNode*, std::pair<double, double> > neighbors =
getNeighboringNodes(*it, maxDist, knownElevation);
1497 for (
auto& neighbor : neighbors) {
1498 if (knownElevation.count(neighbor.first) == 0 && unknownElevation.count(neighbor.first) == 0) {
1499 layerForces[*it].emplace_back(0, neighbor.second.first);
1504 #ifdef DEBUG_LAYER_ELEVATION 1505 std::cout <<
"summation of forces\n";
1507 std::map<NBNode*, double> nodeElevation;
1508 for (
auto& layerForce : layerForces) {
1509 const std::vector<std::pair<double, double> >& forces = layerForce.second;
1510 if (knownElevation.count(layerForce.first) != 0) {
1518 #ifdef DEBUG_LAYER_ELEVATION 1519 std::cout <<
" node=" << it->first->getID() <<
" knownElevation=" << knownEleMax[it->first] <<
"\n";
1521 nodeElevation[layerForce.first] = knownEleMax[layerForce.first];
1522 }
else if (forces.size() == 1) {
1523 nodeElevation[layerForce.first] = forces.front().first;
1527 for (
const auto& force : forces) {
1528 distSum += force.second;
1530 double weightSum = 0;
1531 double elevation = 0;
1532 #ifdef DEBUG_LAYER_ELEVATION 1533 std::cout <<
" node=" << it->first->getID() <<
" distSum=" << distSum <<
"\n";
1535 for (
const auto& force : forces) {
1536 const double weight = (distSum - force.second) / distSum;
1537 weightSum += weight;
1538 elevation += force.first * weight;
1540 #ifdef DEBUG_LAYER_ELEVATION 1541 std::cout <<
" force=" << it_force->first <<
" dist=" << it_force->second <<
" weight=" << weight <<
" ele=" << elevation <<
"\n";
1544 nodeElevation[layerForce.first] = elevation / weightSum;
1547 #ifdef DEBUG_LAYER_ELEVATION 1548 std::cout <<
"final elevations:\n";
1549 for (std::map<NBNode*, double>::iterator it = nodeElevation.begin(); it != nodeElevation.end(); ++it) {
1550 std::cout <<
" node=" << (it->first)->getID() <<
" ele=" << it->second <<
"\n";;
1554 for (
auto& it : nodeElevation) {
1561 for (
const auto& it : ec) {
1562 NBEdge* edge = it.second;
1564 const double length = geom.
length2D();
1565 const double zFrom = nodeElevation[edge->
getFromNode()];
1566 const double zTo = nodeElevation[edge->
getToNode()];
1571 for (
auto it_pos = geom.begin(); it_pos != geom.end(); ++it_pos) {
1572 if (it_pos != geom.begin()) {
1573 dist += (*it_pos).distanceTo2D(*(it_pos - 1));
1575 newGeom.push_back((*it_pos) +
Position(0, 0, zFrom + (zTo - zFrom) * dist / length));
1581 std::map<NBNode*, std::pair<double, double> >
1583 std::map<NBNode*, std::pair<double, double> > result;
1584 std::set<NBNode*> visited;
1585 std::vector<NBNode*> open;
1586 open.push_back(node);
1587 result[node] = std::make_pair(0, 0);
1588 while (!open.empty()) {
1591 if (visited.count(n) != 0) {
1596 for (
auto e : edges) {
1599 s = e->getFromNode();
1603 const double dist = result[n].first + e->getGeometry().length2D();
1604 const double speed =
MAX2(e->getSpeed(), result[n].second);
1605 if (result.count(s) == 0) {
1606 result[s] = std::make_pair(dist, speed);
1608 result[s] = std::make_pair(
MIN2(dist, result[s].first),
MAX2(speed, result[s].second));
1610 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.
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.
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) ...
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
const long long int id
The edge's id.
void reviseStops(NBEdgeCont &cont)
revise pt stops and remove stops on non existing (removed) edges
~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
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
double getWidth(const std::string &type) const
Returns the lane width for the given type [m].
bool applyRestriction() const
try to apply the parsed restriction and return whether successful
NIImporter_OpenStreetMap()
const double SUMO_const_laneWidth
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
The representation of a single edge during network building.
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)
bool getIsOneWay(const std::string &type) const
Returns whether edges are one-way per default for the given type.
long long int myCurrentRelation
The currently parsed relation.
void addPTStop(NBPTStop *pStop)
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
void setMyNumOfStops(unsigned long numStops)
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.
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
The representation of a single pt stop.
std::vector< long long int > myStops
bus stop references
void registerAdditionalEdge(std::string wayId, std::string edgeId)
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
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.
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
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
static const double UNSPECIFIED_WIDTH
unspecified lane width
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
std::set< NIOSMNode *, CompareNodes > & myUniqueNodes
the set of unique nodes (used for duplicate detection/substitution)
NBNode * node
the NBNode that was instantiated
PositionVector reverse() const
reverse position vector
std::vector< long long int > myWays
ways in pt line references
const OptionsCont & myOptionsCont
the options cont
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
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.
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
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.
const std::string & getID() const
Returns the id.
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.
const Position & getPosition() const
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)
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.
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
A point in 2D or 3D with translation and scaling methods.
int getNumLanes(const std::string &type) const
Returns the number of lanes for the given type.
void myEndElement(int element) override
Called when a closing tag occurs.
NBEdgeCont & getEdgeCont()
SumoXMLNodeType getType() const
Returns the type of this node.
int getPriority(const std::string &type) const
Returns the priority for the given type.
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node) ...
double length() const
Returns the length.
Storage for edges, including some functionality operating on multiple edges.
#define PROGRESS_BEGIN_MESSAGE(msg)
NodesHandler(std::map< long long int, NIOSMNode * > &toFill, std::set< NIOSMNode *, CompareNodes > &uniqueNodes, const OptionsCont &cont)
Contructor.
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
bool knows(const std::string &type) const
Returns whether the named type is in the container.
~NIImporter_OpenStreetMap()
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...
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
void setIsMultipleStopPositions(bool multipleStopPositions)
bool railwayCrossing
Whether this is a railway crossing.
~NodesHandler() override
Destructor.
double myMaxSpeed
maximum speed in km/h, or MAXSPEED_UNGIVEN
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
void myEndElement(int element) override
Called when a closing tag occurs.
bool checkEdgeRef(long long int ref) const
check whether a referenced way has a corresponding edge
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.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void addParameter(const std::string &key, const std::string &value)
Adds a parameter.
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.
NBNode * getToNode() const
Returns the destination node of the edge.
double getSidewalkWidth(const std::string &type) const
Returns the lane width for a sidewalk to be added [m].
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.
std::map< long long int, Edge * > & myEdgeMap
A map of built edges.
double length2D() const
Returns the length.
bool myCurrentIsPlatform
Information whether this is a pt platform.
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::vector< NBEdge * > EdgeVector
container for (sorted) edges
bool getShallBeDiscarded(const std::string &type) const
Returns the information whether edges of this type shall be discarded.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
static const std::string compoundTypeSeparator
The separator within newly created compound type names.
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
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...
NBEdge * findEdgeRef(long long int wayRef, const std::vector< NBEdge * > &candidates) const
try to find the way segment among candidates
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.
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.
T get(const std::string &str) const
int myHierarchyLevel
The current hierarchy level.
std::string myHighWayType
The type, stored in "highway" key.
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
double getSpeed(const std::string &type) const
Returns the maximal velocity for the given type [m/s].
bool myCurrentIsRoad
Information whether this is a road.
bool operator()(const Edge *e1, const Edge *e2) const
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
EdgesHandler(const std::map< long long int, NIOSMNode * > &osmNodes, std::map< long long int, Edge * > &toFill, std::map< long long int, Edge * > &platformShapes)
Constructor.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
SVCPermissions getPermissions(const std::string &type) const
Returns allowed vehicle classes for the given type.
Container for nodes during the netbuilding process.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
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.
#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
bool myIsPTRoute
indicates whether current relation is a pt route
const OptionsCont & myOptionsCont
the options
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.
A storage for available types of edges.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getBikeLaneWidth(const std::string &type) const
Returns the lane width for a bike lane to be added [m].
NBNode * getFromNode() const
Returns the origin node of the edge.
NBPTStopCont * myNBPTStopCont
The previously filled pt stop container.