117 importer.
load(oc, nb);
129 delete myEdge.second;
133 delete myPlatformShape.second;
139 if (!oc.
isSet(
"osm-files")) {
142 const std::vector<std::string> files = oc.
getStringVector(
"osm-files");
143 std::vector<SUMOSAXReader*> readers;
165 for (
const std::string& file : files) {
174 if (!readers.back()->parseFirst(file) || !readers.back()->parseSection(
SUMO_TAG_NODE) ||
187 for (
const std::string& file : files) {
189 readers[idx]->setHandler(edgesHandler);
194 readers[idx] =
nullptr;
201 if (!oc.
getBool(
"osm.skip-duplicates-check")) {
205 std::set<const Edge*, CompareEdges> dupsFinder;
207 if (dupsFinder.count(it->second) > 0) {
212 dupsFinder.insert(it->second);
217 if (numRemoved > 0) {
226 std::map<long long int, int> nodeUsage;
228 for (
const auto& edgeIt :
myEdges) {
229 assert(edgeIt.second->myCurrentIsRoad);
230 for (
const long long int node : edgeIt.second->myCurrentNodes) {
236 if (nodesIt.second->tlsControlled || nodesIt.second->railwaySignal || (nodesIt.second->pedestrianCrossing &&
myImportCrossings) ) {
239 nodeUsage[nodesIt.first]++;
248 for (
const auto& edgeIt :
myEdges) {
249 Edge*
const e = edgeIt.second;
263 NBNode* currentFrom = first;
265 std::vector<long long int> passed;
267 passed.push_back(*j);
270 running =
insertEdge(e, running, currentFrom, currentTo, passed, nb, first, last);
271 currentFrom = currentTo;
273 passed.push_back(*j);
279 insertEdge(e, running, currentFrom, last, passed, nb, first, last);
282 WRITE_MESSAGEF(
TL(
"Skipped applying OSM placement on % edge(s): % due to non-explicit one-way and % due to opposite-direction auxiliary edges."),
298 for (
auto item : nodeUsage) {
304 size_t incomingEdgesNo = incomingEdges.size();
305 size_t outgoingEdgesNo = outgoingEdges.size();
307 for (
size_t i = 0; i < incomingEdgesNo; i++) {
315 auto const iEdge = incomingEdges[i];
319 std::string
const& iEdgeId = iEdge->getID();
320 std::size_t
const m = iEdgeId.find_first_of(
"#");
321 std::string
const& iWayId = iEdgeId.substr(0, m);
322 for (
size_t j = 0; j < outgoingEdgesNo; j++) {
323 auto const oEdge = outgoingEdges[j];
326 if (oEdge->getID().find(iWayId) != std::string::npos
328 && oEdge->getID().rfind(iWayId, 0) != 0) {
331 edgeVector.push_back(oEdge);
341 for (
size_t i = 0; i < outgoingEdgesNo; i++) {
343 auto const oEdge = outgoingEdges[i];
347 std::string
const& oEdgeId = oEdge->getID();
348 std::size_t
const m = oEdgeId.find_first_of(
"#");
349 std::string
const& iWayId = oEdgeId.substr(0, m);
350 for (
size_t j = 0; j < incomingEdgesNo; j++) {
351 auto const iEdge = incomingEdges[j];
352 if (iEdge->getID().find(iWayId) != std::string::npos
354 && iEdge->getID().rfind(iWayId, 0) != 0) {
357 edgeVector.push_back(iEdge);
371 const double layerElevation = oc.
getFloat(
"osm.layer-elevation");
372 if (layerElevation > 0) {
384 for (
const std::string& file : files) {
385 if (readers[idx] !=
nullptr) {
387 readers[idx]->setHandler(relationHandler);
397 std::set<std::string> stopNames;
399 stopNames.insert(item.second->getName());
406 WRITE_ERRORF(
"Unable to project coordinates for node '%'.", n->
id);
422 if (node ==
nullptr) {
426 WRITE_ERRORF(
"Unable to project coordinates for junction '%'.",
id);
439 }
else if (n->
getParameter(
"crossing.light") ==
"yes") {
451 if (!tlsc.
insert(tlDef)) {
476 const std::vector<long long int>& passed,
NBNetBuilder& nb,
486 if (from ==
nullptr || to ==
nullptr) {
487 WRITE_ERRORF(
"Discarding edge '%' because the nodes could not be built.",
id);
496 assert(passed.size() >= 2);
497 if (passed.size() == 2) {
498 WRITE_WARNINGF(
TL(
"Discarding edge '%' which connects two identical nodes without geometry."),
id);
502 int intermediateIndex = (int) passed.size() / 2;
504 std::vector<long long int> part1(passed.begin(), passed.begin() + intermediateIndex + 1);
505 std::vector<long long int> part2(passed.begin() + intermediateIndex, passed.end());
506 index =
insertEdge(e, index, from, intermediate, part1, nb, first, last);
507 return insertEdge(e, index, intermediate, to, part2, nb, first, last);
509 const int newIndex = index + 1;
514 std::string routingType =
"";
522 std::vector<SumoXMLAttr> defaults;
525 extra = extra & ~SVC_BUS;
527 SVCPermissions permissions = (defaultPermissions & ~extraDis) | extra;
533 defaultsToOneWay =
true;
535 if (defaultPermissions ==
SVC_SHIP) {
537 permissions = defaultPermissions;
540 defaultsToOneWay =
false;
548 double distanceStart =
myOSMNodes[passed.front()]->positionMeters;
549 double distanceEnd =
myOSMNodes[passed.back()]->positionMeters;
550 const bool useDistance = distanceStart != std::numeric_limits<double>::max() && distanceEnd != std::numeric_limits<double>::max();
553 if (distanceStart < distanceEnd) {
566 if (
fn->railwaySignal) {
573 std::vector<std::shared_ptr<NBPTStop> > ptStops;
574 for (
long long i : passed) {
578 std::shared_ptr<NBPTStop> existingPtStop = sc.
get(
toString(n->
id));
579 if (existingPtStop !=
nullptr) {
580 existingPtStop->registerAdditionalEdge(
toString(e->
id), id);
584 WRITE_ERRORF(
"Unable to project coordinates for node '%'.", n->
id);
588 sc.
insert(ptStops.back());
595 shape.push_back(pos);
615 WRITE_ERRORF(
"Unable to project coordinates for edge '%'.",
id);
621 if (streetName == e->
ref) {
638 const std::string& onewayBike = e->
myExtraTags[
"oneway:bicycle"];
639 if (onewayBike ==
"false" || onewayBike ==
"no" || onewayBike ==
"0") {
650 bool addForward =
true;
651 bool addBackward =
true;
667 if (addBackward && (onewayBike ==
"true" || onewayBike ==
"yes" || onewayBike ==
"1")) {
670 if (addForward && (onewayBike ==
"reverse" || onewayBike ==
"-1")) {
673 if (!addBackward && (onewayBike ==
"false" || onewayBike ==
"no" || onewayBike ==
"0")) {
680 if (addForward && !addBackward) {
682 }
else if (!addForward && addBackward) {
690 numLanesForward = (int) std::ceil(e->
myNoLanes / 2.0);
692 numLanesBackward = e->
myNoLanes - numLanesForward;
695 numLanesForward =
MAX2(1, numLanesForward);
696 numLanesBackward =
MAX2(1, numLanesBackward);
707 numLanesForward =
MAX2(numLanesForward, 2);
713 numLanesBackward =
MAX2(numLanesForward, 2);
728 numLanesBackward = 1;
731 const int taggedLanes = (addForward ? numLanesForward : 0) + (addBackward ? numLanesBackward : 0);
735 forwardWidth = e->
myWidth / taggedLanes;
736 backwardWidth = forwardWidth;
745 double speedBackward = speed;
750 if (speed <= 0 || speedBackward <= 0) {
754 if (e->
myNoLanes == 1 && addForward && addBackward) {
767 routingType =
"narrow";
773 if (!addForward && (cyclewayType &
WAY_FORWARD) != 0) {
776 forwardWidth = bikeLaneWidth;
781 if (!addBackward && (cyclewayType &
WAY_BACKWARD) != 0) {
784 backwardWidth = bikeLaneWidth;
785 numLanesBackward = 1;
799 if (!addForward && (sidewalkType &
WAY_FORWARD) != 0) {
806 }
else if (addSidewalk && addForward && (sidewalkType &
WAY_BOTH) == 0
807 && numLanesForward == 1 && numLanesBackward <= 1
814 if (!addBackward && (sidewalkType &
WAY_BACKWARD) != 0) {
818 numLanesBackward = 1;
821 }
else if (addSidewalk && addBackward && (sidewalkType &
WAY_BOTH) == 0
822 && numLanesBackward == 1 && numLanesForward <= 1
831 bool applyPlacement =
false;
832 double placementOffset = 0;
834 if (!explicitOneWay) {
838 }
else if (!(addForward && !addBackward)) {
842 }
else if (numLanesForward <= 0) {
844 WRITE_WARNINGF(
TL(
"Ignoring placement for edge '%' because lane count is invalid."),
id);
849 std::vector<double> laneWidths((
size_t)numLanesForward, defaultPlacementWidth);
852 for (
int i = 0; i < numLanesForward; ++i) {
859 WRITE_WARNINGF(
TL(
"Ignoring placement for edge '%' because lane index '%' is out of range [1, %]."),
864 double leftOffset = 0;
865 for (
int i = 0; i < laneIndex; ++i) {
866 leftOffset += laneWidths[(size_t)i];
868 double placementRefOffset = leftOffset;
870 placementRefOffset += laneWidths[(size_t)laneIndex];
872 placementRefOffset += laneWidths[(size_t)laneIndex] / 2.;
874 double totalWidth = 0;
875 for (
double laneWidth : laneWidths) {
876 totalWidth += laneWidth;
878 placementOffset = totalWidth / 2. - placementRefOffset;
879 applyPlacement =
true;
883 if (applyPlacement && fabs(placementOffset) > POSITION_EPS) {
888 WRITE_WARNINGF(
TL(
"Ignoring placement for edge '%' because offset shape computation failed."),
id);
890 applyPlacement =
false;
898 const int offsetFactor = lefthand ? -1 : 1;
911 if (applyPlacement) {
915 if (defaults.size() > 0) {
920 const std::string reverseID =
"-" + id;
923 assert(numLanesForward > 0);
927 if (markOSMDirection) {
964 if ((
int)nbe->
getLanes().size() != numForwardLanesFromWidthKey) {
965 WRITE_WARNINGF(
TL(
"Forward lanes count for edge '%' ('%') is not matching the number of lanes defined in width:lanes:forward key ('%'). Using default width values."),
966 id, nbe->
getLanes().size(), numForwardLanesFromWidthKey);
968 for (
int i = 0; i < numForwardLanesFromWidthKey; i++) {
970 const int laneIndex = lefthand ? i : numForwardLanesFromWidthKey - i - 1;
987 assert(numLanesBackward > 0);
991 if (markOSMDirection) {
1022 if ((
int)nbe->
getLanes().size() != numBackwardLanesFromWidthKey) {
1023 WRITE_WARNINGF(
TL(
"Backward lanes count for edge '%' ('%') is not matching the number of lanes defined in width:lanes:backward key ('%'). Using default width values."),
1024 id, nbe->
getLanes().size(), numBackwardLanesFromWidthKey);
1026 for (
int i = 0; i < numBackwardLanesFromWidthKey; i++) {
1028 const int laneIndex = lefthand ? i : numBackwardLanesFromWidthKey - i - 1;
1080 std::map<NBNode*, std::vector<std::pair<double, double> > > layerForces;
1083 std::set<NBNode*> knownElevation;
1084 for (
auto& myEdge :
myEdges) {
1085 Edge* e = myEdge.second;
1089 if (node !=
nullptr) {
1090 knownElevation.insert(node);
1091 layerForces[node].emplace_back(e->
myLayer * layerElevation, POSITION_EPS);
1096#ifdef DEBUG_LAYER_ELEVATION
1097 std::cout <<
"known elevations:\n";
1098 for (std::set<NBNode*>::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1099 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[*it];
1100 std::cout <<
" node=" << (*it)->
getID() <<
" ele=";
1101 for (std::vector<std::pair<double, double> >::const_iterator it_ele = primaryLayers.begin(); it_ele != primaryLayers.end(); ++it_ele) {
1102 std::cout << it_ele->first <<
" ";
1110 std::map<NBNode*, double> knownEleMax;
1111 for (
auto it : knownElevation) {
1112 double eleMax = -std::numeric_limits<double>::max();
1113 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[it];
1114 for (
const auto& primaryLayer : primaryLayers) {
1115 eleMax =
MAX2(eleMax, primaryLayer.first);
1117 knownEleMax[it] = eleMax;
1120 bool changed =
true;
1123 for (
auto it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1126 / gradeThreshold * 3,
1128 for (
auto& neighbor : neighbors) {
1129 if (knownElevation.count(neighbor.first) != 0) {
1130 const double grade = fabs(knownEleMax[*it] - knownEleMax[neighbor.first])
1131 /
MAX2(POSITION_EPS, neighbor.second.first);
1132#ifdef DEBUG_LAYER_ELEVATION
1133 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";
1135 if (grade > gradeThreshold * 50 / 3.6 / neighbor.second.second) {
1137 const double eleMax =
MAX2(knownEleMax[*it], knownEleMax[neighbor.first]);
1138 if (knownEleMax[*it] < eleMax) {
1139 knownEleMax[*it] = eleMax;
1141 knownEleMax[neighbor.first] = eleMax;
1151 std::set<NBNode*> unknownElevation;
1152 for (
auto it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1153 const double eleMax = knownEleMax[*it];
1154 const double maxDist = fabs(eleMax) * 100 / layerElevation;
1155 std::map<NBNode*, std::pair<double, double> > neighbors =
getNeighboringNodes(*it, maxDist, knownElevation);
1156 for (
auto& neighbor : neighbors) {
1157 if (knownElevation.count(neighbor.first) == 0) {
1158 unknownElevation.insert(neighbor.first);
1159 layerForces[neighbor.first].emplace_back(eleMax, neighbor.second.first);
1165 for (
auto it = unknownElevation.begin(); it != unknownElevation.end(); ++it) {
1166 double eleMax = -std::numeric_limits<double>::max();
1167 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[*it];
1168 for (
const auto& primaryLayer : primaryLayers) {
1169 eleMax =
MAX2(eleMax, primaryLayer.first);
1171 const double maxDist = fabs(eleMax) * 100 / layerElevation;
1172 std::map<NBNode*, std::pair<double, double> > neighbors =
getNeighboringNodes(*it, maxDist, knownElevation);
1173 for (
auto& neighbor : neighbors) {
1174 if (knownElevation.count(neighbor.first) == 0 && unknownElevation.count(neighbor.first) == 0) {
1175 layerForces[*it].emplace_back(0, neighbor.second.first);
1180#ifdef DEBUG_LAYER_ELEVATION
1181 std::cout <<
"summation of forces\n";
1183 std::map<NBNode*, double> nodeElevation;
1184 for (
auto& layerForce : layerForces) {
1185 const std::vector<std::pair<double, double> >& forces = layerForce.second;
1186 if (knownElevation.count(layerForce.first) != 0) {
1194#ifdef DEBUG_LAYER_ELEVATION
1195 std::cout <<
" node=" << it->first->getID() <<
" knownElevation=" << knownEleMax[it->first] <<
"\n";
1197 nodeElevation[layerForce.first] = knownEleMax[layerForce.first];
1198 }
else if (forces.size() == 1) {
1199 nodeElevation[layerForce.first] = forces.front().first;
1203 for (
const auto& force : forces) {
1204 distSum += force.second;
1206 double weightSum = 0;
1207 double elevation = 0;
1208#ifdef DEBUG_LAYER_ELEVATION
1209 std::cout <<
" node=" << it->first->getID() <<
" distSum=" << distSum <<
"\n";
1211 for (
const auto& force : forces) {
1212 const double weight = (distSum - force.second) / distSum;
1213 weightSum += weight;
1214 elevation += force.first * weight;
1216#ifdef DEBUG_LAYER_ELEVATION
1217 std::cout <<
" force=" << it_force->first <<
" dist=" << it_force->second <<
" weight=" << weight <<
" ele=" << elevation <<
"\n";
1220 nodeElevation[layerForce.first] = elevation / weightSum;
1223#ifdef DEBUG_LAYER_ELEVATION
1224 std::cout <<
"final elevations:\n";
1225 for (std::map<NBNode*, double>::iterator it = nodeElevation.begin(); it != nodeElevation.end(); ++it) {
1226 std::cout <<
" node=" << (it->first)->getID() <<
" ele=" << it->second <<
"\n";
1230 for (
auto& it : nodeElevation) {
1236 for (
const auto& it : ec) {
1237 NBEdge* edge = it.second;
1239 const double length = geom.
length2D();
1240 const double zFrom = nodeElevation[edge->
getFromNode()];
1241 const double zTo = nodeElevation[edge->
getToNode()];
1246 for (
auto it_pos = geom.begin(); it_pos != geom.end(); ++it_pos) {
1247 if (it_pos != geom.begin()) {
1248 dist += (*it_pos).distanceTo2D(*(it_pos - 1));
1250 newGeom.push_back((*it_pos) +
Position(0, 0, zFrom + (zTo - zFrom) * dist / length));
1256std::map<NBNode*, std::pair<double, double> >
1258 std::map<NBNode*, std::pair<double, double> > result;
1259 std::set<NBNode*> visited;
1260 std::vector<NBNode*> open;
1261 open.push_back(node);
1262 result[node] = std::make_pair(0, 0);
1263 while (!open.empty()) {
1266 if (visited.count(n) != 0) {
1271 for (
auto e : edges) {
1274 s = e->getFromNode();
1278 const double dist = result[n].first + e->getGeometry().length2D();
1279 const double speed =
MAX2(e->getSpeed(), result[n].second);
1280 if (result.count(s) == 0) {
1281 result[s] = std::make_pair(dist, speed);
1283 result[s] = std::make_pair(
MIN2(dist, result[s].first),
MAX2(speed, result[s].second));
1285 if (dist < maxDist && knownElevation.count(s) == 0) {
1297 if (tc.
knows(type)) {
1308 std::vector<std::string> types;
1310 std::string t = tok.
next();
1312 if (std::find(types.begin(), types.end(), t) == types.end()) {
1315 }
else if (tok.
size() > 1) {
1317 WRITE_WARNINGF(
TL(
"Discarding unknown compound '%' in type '%' (first occurrence for edge '%')."), t, type,
id);
1321 if (types.empty()) {
1323 WRITE_WARNINGF(
TL(
"Discarding unusable type '%' (first occurrence for edge '%')."), type,
id);
1329 if (tc.
knows(newType)) {
1337 double maxSpeed = 0;
1342 bool defaultIsOneWay =
true;
1345 bool discard =
true;
1346 bool hadDiscard =
false;
1347 for (
auto& type2 : types) {
1364 if (hadDiscard && permissions == 0) {
1368 WRITE_WARNINGF(
TL(
"Discarding compound type '%' (first occurrence for edge '%')."), newType,
id);
1383 WRITE_MESSAGEF(
TL(
"Adding new type '%' (first occurrence for edge '%')."), type,
id);
1384 tc.
insertEdgeType(newType, numLanes, maxSpeed, prio, permissions, spreadType, width,
1385 defaultIsOneWay, sidewalkWidth, bikelaneWidth, 0, 0, 0);
1386 for (
auto& type3 : types) {
1401 std::vector<NIOSMNode*> nodes;
1402 std::vector<double> usablePositions;
1403 std::vector<int> usableIndex;
1407 if (node->
positionMeters != std::numeric_limits<double>::max()) {
1409 usableIndex.push_back((
int)nodes.size());
1411 nodes.push_back(node);
1413 if (usablePositions.size() == 0) {
1416 bool forward =
true;
1417 if (usablePositions.size() == 1) {
1418 WRITE_WARNINGF(
TL(
"Ambiguous railway kilometrage direction for way '%' (assuming forward)"),
id);
1420 forward = usablePositions.front() < usablePositions.back();
1423 for (
int i = 1; i < (int)usablePositions.size(); i++) {
1424 if ((usablePositions[i - 1] < usablePositions[i]) != forward) {
1425 WRITE_WARNINGF(
TL(
"Inconsistent railway kilometrage direction for way '%': % (skipping)"),
id,
toString(usablePositions));
1429 if (nodes.size() > usablePositions.size()) {
1433 shape.push_back(
Position(node->lon, node->lat, 0));
1438 double sign = forward ? 1 : -1;
1440 for (
int i = usableIndex.front() - 1; i >= 0; i--) {
1441 nodes[i]->positionMeters = nodes[i + 1]->positionMeters - sign * shape[i].distanceTo2D(shape[i + 1]);
1444 for (
int i = usableIndex.front() + 1; i < (int)nodes.size(); i++) {
1445 if (nodes[i]->positionMeters == std::numeric_limits<double>::max()) {
1446 nodes[i]->positionMeters = nodes[i - 1]->positionMeters + sign * shape[i].distanceTo2D(shape[i - 1]);
1473 return std::numeric_limits<double>::max();
1479 if (type ==
"train") {
1481 }
else if (type ==
"subway") {
1483 }
else if (type ==
"aerialway") {
1485 }
else if (type ==
"light_rail" || type ==
"monorail") {
1487 }
else if (type ==
"share_taxi") {
1489 }
else if (type ==
"minibus") {
1491 }
else if (type ==
"trolleybus") {
1496 std::string stop =
"";
1499 }
else if (result ==
SVC_BUS) {
1514 bool multiLane = changeProhibition > 3;
1516 for (
int lane = 0; changeProhibition > 0 && lane < e->
getNumLanes(); lane++) {
1517 int code = changeProhibition % 4;
1522 changeProhibition = changeProhibition >> 2;
1536 for (
int lane = 0; lane < numLanes; lane++) {
1538 const int i = lefthand ? lane : numLanes - 1 - lane;
1543 if (i < (
int)designated.size() && designated[i]) {
1555 if (signs.empty()) {
1556 signs.insert(signs.begin(), signs2.begin(), signs2.end());
1558 for (
int i = 0; i < (int)
MIN2(signs.size(), signs2.size()); i++) {
1559 signs[i] |= signs2[i];
1571 for (
int i = 0; i < (int)turnSigns.size(); i++) {
1588 std::set<NIOSMNode*, CompareNodes>& uniqueNodes,
const OptionsCont& oc) :
1591 myCurrentNode(nullptr),
1593 myHierarchyLevel(0),
1594 myUniqueNodes(uniqueNodes),
1595 myImportElevation(oc.getBool(
"osm.elevation")),
1596 myDuplicateNodes(0),
1600 if (kv ==
"DEFAULT") {
1603 }
else if (kv ==
"ALL") {
1620 if (myHierarchyLevel != 2) {
1621 WRITE_ERROR(
"Node element on wrong XML hierarchy level (id='" + myLastNodeID +
1622 "', level='" +
toString(myHierarchyLevel) +
"').");
1626 if (action ==
"delete" || !ok) {
1632 myCurrentNode =
nullptr;
1633 const auto insertionIt = myToFill.lower_bound(
id);
1634 if (insertionIt == myToFill.end() || insertionIt->first !=
id) {
1636 const double tlon = attrs.
get<
double>(
SUMO_ATTR_LON, myLastNodeID.c_str(), ok);
1637 const double tlat = attrs.
get<
double>(
SUMO_ATTR_LAT, myLastNodeID.c_str(), ok);
1641 myCurrentNode =
new NIOSMNode(
id, tlon, tlat);
1646 delete myCurrentNode;
1647 myCurrentNode = *similarNode;
1650 myToFill.emplace_hint(insertionIt,
id, myCurrentNode);
1653 WRITE_ERROR(
TL(
"Attribute 'id' in the definition of a node is not of type long long int."));
1657 if (element ==
SUMO_TAG_TAG && myCurrentNode !=
nullptr) {
1658 if (myHierarchyLevel != 3) {
1659 WRITE_ERROR(
TL(
"Tag element on wrong XML hierarchy level."));
1663 const std::string& key = attrs.
get<std::string>(
SUMO_ATTR_K, myLastNodeID.c_str(), ok,
false);
1665 if (key ==
"highway" || key ==
"ele" || key ==
"crossing" || key ==
"railway" || key ==
"public_transport"
1666 || key ==
"name" || key ==
"train" || key ==
"bus" || key ==
"tram" || key ==
"light_rail" || key ==
"subway" || key ==
"station" || key ==
"noexit"
1667 || key ==
"crossing:barrier"
1668 || key ==
"crossing:light"
1669 || key ==
"railway:ref"
1673 const std::string& value = attrs.
get<std::string>(
SUMO_ATTR_V, myLastNodeID.c_str(), ok,
false);
1674 if (key ==
"highway" && value.find(
"traffic_signal") != std::string::npos) {
1675 myCurrentNode->tlsControlled =
true;
1676 }
else if (key ==
"crossing" && value.find(
"traffic_signals") != std::string::npos) {
1677 myCurrentNode->tlsControlled =
true;
1678 }
else if (key ==
"highway" && value.find(
"crossing") != std::string::npos) {
1679 myCurrentNode->pedestrianCrossing =
true;
1680 }
else if ((key ==
"noexit" && value ==
"yes")
1681 || (key ==
"railway" && value ==
"buffer_stop")) {
1682 myCurrentNode->railwayBufferStop =
true;
1683 }
else if (key ==
"railway" && value.find(
"crossing") != std::string::npos) {
1684 myCurrentNode->railwayCrossing =
true;
1685 }
else if (key ==
"crossing:barrier") {
1686 myCurrentNode->setParameter(
"crossing:barrier", value);
1687 }
else if (key ==
"crossing:light") {
1688 myCurrentNode->setParameter(
"crossing:light", value);
1689 }
else if (key ==
"railway:signal:direction") {
1690 if (value ==
"both") {
1691 myCurrentNode->myRailDirection =
WAY_BOTH;
1692 }
else if (value ==
"backward") {
1694 }
else if (value ==
"forward") {
1698 std::string kv = key +
"=" + value;
1699 std::string kglob = key +
"=";
1700 if ((std::find(myRailSignalRules.begin(), myRailSignalRules.end(), kv) != myRailSignalRules.end())
1701 || (std::find(myRailSignalRules.begin(), myRailSignalRules.end(), kglob) != myRailSignalRules.end())) {
1702 myCurrentNode->railwaySignal =
true;
1704 }
else if (
StringUtils::startsWith(key,
"railway:position") && value.size() > myCurrentNode->position.size()) {
1706 myCurrentNode->position = value;
1707 }
else if ((key ==
"public_transport" && value ==
"stop_position") ||
1708 (key ==
"highway" && value ==
"bus_stop")) {
1709 myCurrentNode->ptStopPosition =
true;
1710 if (myCurrentNode->ptStopLength == 0) {
1712 myCurrentNode->ptStopLength = myOptionsCont.getFloat(
"osm.stop-output.length");
1714 }
else if (key ==
"name") {
1715 myCurrentNode->name = value;
1716 }
else if (myImportElevation && key ==
"ele") {
1719 if (std::isnan(elevation)) {
1720 WRITE_WARNINGF(
TL(
"Value of key '%' is invalid ('%') in node '%'."), key, value, myLastNodeID);
1722 myCurrentNode->ele = elevation;
1725 WRITE_WARNINGF(
TL(
"Value of key '%' is not numeric ('%') in node '%'."), key, value, myLastNodeID);
1727 }
else if (key ==
"station") {
1730 }
else if (key ==
"railway:ref") {
1731 myRailwayRef = value;
1738 const std::string info =
"node=" +
toString(myCurrentNode->id) +
", k=" + key;
1739 myCurrentNode->setParameter(key, attrs.
get<std::string>(
SUMO_ATTR_V, info.c_str(), ok,
false));
1748 if (myIsStation && myRailwayRef !=
"") {
1749 myCurrentNode->setParameter(
"railway:ref", myRailwayRef);
1751 myCurrentNode =
nullptr;
1752 myIsStation =
false;
1763 const std::map<long long int, NIOSMNode*>& osmNodes,
1764 std::map<long long int, Edge*>& toFill, std::map<long long int, Edge*>& platformShapes,
1769 myPlatformShapesMap(platformShapes),
1867 const long long int id = attrs.
get<
long long int>(
SUMO_ATTR_ID,
nullptr, ok);
1869 if (action ==
"delete" || !ok) {
1870 myCurrentEdge =
nullptr;
1873 myCurrentEdge =
new Edge(
id);
1876 if (element ==
SUMO_TAG_ND && myCurrentEdge !=
nullptr) {
1886 ref = node->second->id;
1887 if (myCurrentEdge->myCurrentNodes.empty() ||
1888 myCurrentEdge->myCurrentNodes.back() != ref) {
1889 myCurrentEdge->myCurrentNodes.push_back(ref);
1894 if (element ==
SUMO_TAG_TAG && myCurrentEdge !=
nullptr) {
1899 const std::string buswaySpec = key.substr(7);
1901 if (buswaySpec ==
"right") {
1903 }
else if (buswaySpec ==
"left") {
1905 }
else if (buswaySpec ==
"both") {
1906 myCurrentEdge->myBuswayType = (
WayType)(myCurrentEdge->myBuswayType |
WAY_BOTH);
1912 const std::string info =
"way=" +
toString(myCurrentEdge->id) +
", k=" + key;
1913 myCurrentEdge->setParameter(key, attrs.
get<std::string>(
SUMO_ATTR_V, info.c_str(), ok,
false));
1918 && key !=
"maxspeed" && key !=
"maxspeed:type"
1919 && key !=
"zone:maxspeed"
1920 && key !=
"maxspeed:forward" && key !=
"maxspeed:backward"
1921 && key !=
"junction" && key !=
"name" && key !=
"tracks" && key !=
"layer"
1926 && key !=
"highspeed"
1930 && key !=
"postal_code"
1931 && key !=
"railway:preferred_direction"
1932 && key !=
"railway:bidirectional"
1933 && key !=
"railway:track_ref"
1936 && key !=
"emergency"
1938 && key !=
"electrified"
1939 && key !=
"segregated"
1944 && key !=
"oneway:bicycle"
1945 && key !=
"oneway:bus"
1946 && key !=
"oneway:psv"
1947 && key !=
"placement"
1948 && key !=
"bus:lanes"
1949 && key !=
"bus:lanes:forward"
1950 && key !=
"bus:lanes:backward"
1951 && key !=
"psv:lanes"
1952 && key !=
"psv:lanes:forward"
1953 && key !=
"psv:lanes:backward"
1954 && key !=
"bicycle:lanes"
1955 && key !=
"bicycle:lanes:forward"
1956 && key !=
"bicycle:lanes:backward"
1959 && key !=
"public_transport") {
1962 const std::string value = attrs.
get<std::string>(
SUMO_ATTR_V,
toString(myCurrentEdge->id).c_str(), ok,
false);
1966 || key ==
"aeroway" || key ==
"aerialway" || key ==
"usage" || key ==
"service") {
1968 if (key !=
"highway" || myTypeCont.knows(key +
"." + value)) {
1969 myCurrentEdge->myCurrentIsRoad =
true;
1972 if (key ==
"cycleway") {
1973 if (value ==
"no" || value ==
"none" || value ==
"separate") {
1974 myCurrentEdge->myCyclewayType =
WAY_NONE;
1975 }
else if (value ==
"both") {
1976 myCurrentEdge->myCyclewayType =
WAY_BOTH;
1977 }
else if (value ==
"right") {
1979 }
else if (value ==
"left") {
1981 }
else if (value ==
"opposite_track") {
1983 }
else if (value ==
"opposite_lane") {
1985 }
else if (value ==
"opposite") {
1990 if (key ==
"cycleway:left") {
1991 if (myCurrentEdge->myCyclewayType ==
WAY_UNKNOWN) {
1992 myCurrentEdge->myCyclewayType =
WAY_NONE;
1994 if (value ==
"yes" || value ==
"lane" || value ==
"track") {
1999 if (key ==
"cycleway:right") {
2000 if (myCurrentEdge->myCyclewayType ==
WAY_UNKNOWN) {
2001 myCurrentEdge->myCyclewayType =
WAY_NONE;
2003 if (value ==
"yes" || value ==
"lane" || value ==
"track") {
2004 myCurrentEdge->myCyclewayType = (
WayType)(myCurrentEdge->myCyclewayType |
WAY_FORWARD);
2008 if (key ==
"cycleway:both") {
2009 if (myCurrentEdge->myCyclewayType ==
WAY_UNKNOWN) {
2010 if (value ==
"no" || value ==
"none" || value ==
"separate") {
2011 myCurrentEdge->myCyclewayType =
WAY_NONE;
2013 if (value ==
"yes" || value ==
"lane" || value ==
"track") {
2014 myCurrentEdge->myCyclewayType =
WAY_BOTH;
2019 if (key ==
"cycleway" && value !=
"lane" && value !=
"track" && value !=
"opposite_track" && value !=
"opposite_lane") {
2028 if (key ==
"sidewalk") {
2029 if (value ==
"no" || value ==
"none" || value ==
"separate") {
2030 myCurrentEdge->mySidewalkType =
WAY_NONE;
2031 if (value ==
"separate") {
2034 }
else if (value ==
"both" || value ==
"yes") {
2035 myCurrentEdge->mySidewalkType =
WAY_BOTH;
2036 }
else if (value ==
"right") {
2038 }
else if (value ==
"left") {
2042 if (key ==
"sidewalk:left") {
2043 if (myCurrentEdge->mySidewalkType ==
WAY_UNKNOWN) {
2044 myCurrentEdge->mySidewalkType =
WAY_NONE;
2046 if (value ==
"yes") {
2050 if (key ==
"sidewalk:right") {
2051 if (myCurrentEdge->mySidewalkType ==
WAY_UNKNOWN) {
2052 myCurrentEdge->mySidewalkType =
WAY_NONE;
2054 if (value ==
"yes") {
2055 myCurrentEdge->mySidewalkType = (
WayType)(myCurrentEdge->mySidewalkType |
WAY_FORWARD);
2057 if (value ==
"separate") {
2061 if (key ==
"sidewalk:both") {
2062 if (myCurrentEdge->mySidewalkType ==
WAY_UNKNOWN) {
2063 if (value ==
"no" || value ==
"none" || value ==
"separate") {
2064 myCurrentEdge->mySidewalkType =
WAY_NONE;
2065 if (value ==
"separate") {
2069 if (value ==
"yes") {
2070 myCurrentEdge->mySidewalkType =
WAY_BOTH;
2079 if (key ==
"busway") {
2080 if (value ==
"no") {
2083 if (value ==
"opposite_track") {
2085 }
else if (value ==
"opposite_lane") {
2091 std::string singleTypeID = key +
"." + value;
2092 if (key ==
"highspeed") {
2093 if (value ==
"no") {
2096 singleTypeID =
"railway.highspeed";
2098 addType(singleTypeID);
2100 }
else if (key ==
"bus" || key ==
"psv") {
2104 myCurrentEdge->myExtraAllowed |=
SVC_BUS;
2107 myCurrentEdge->myExtraDisallowed |=
SVC_BUS;
2110 myCurrentEdge->myExtraAllowed |=
SVC_BUS;
2113 }
else if (key ==
"emergency") {
2121 }
else if (key ==
"access") {
2122 if (value ==
"no") {
2128 std::vector<double> widthLanes;
2129 for (std::string width : values) {
2131 widthLanes.push_back(parsedWidth);
2134 if (key ==
"width:lanes" || key ==
"width:lanes:forward") {
2135 myCurrentEdge->myWidthLanesForward = widthLanes;
2136 }
else if (key ==
"width:lanes:backward") {
2137 myCurrentEdge->myWidthLanesBackward = widthLanes;
2139 WRITE_WARNINGF(
TL(
"Using default lane width for edge '%' as key '%' could not be parsed."),
toString(myCurrentEdge->id), key);
2142 WRITE_WARNINGF(
TL(
"Using default lane width for edge '%' as value '%' could not be parsed."),
toString(myCurrentEdge->id), value);
2144 }
else if (key ==
"width") {
2148 WRITE_WARNINGF(
TL(
"Using default width for edge '%' as value '%' could not be parsed."),
toString(myCurrentEdge->id), value);
2150 }
else if (key ==
"foot") {
2151 if (value ==
"use_sidepath" || value ==
"no") {
2153 }
else if (value ==
"yes" || value ==
"designated" || value ==
"permissive") {
2156 }
else if (key ==
"bicycle") {
2157 if (value ==
"use_sidepath" || value ==
"no") {
2159 }
else if (value ==
"yes" || value ==
"designated" || value ==
"permissive") {
2162 }
else if (key ==
"oneway:bicycle") {
2163 myCurrentEdge->myExtraTags[
"oneway:bicycle"] = value;
2164 }
else if (key ==
"oneway:bus" || key ==
"oneway:psv") {
2165 if (value ==
"no") {
2169 }
else if (key ==
"placement") {
2170 if (!interpretPlacement(value, myCurrentEdge->myPlacement, myCurrentEdge->myPlacementLane)) {
2171 WRITE_WARNINGF(
TL(
"Ignoring unsupported placement value '%' for edge '%'."), value, myCurrentEdge->id);
2173 }
else if (key ==
"lanes") {
2179 std::vector<std::string> list = st.
getVector();
2180 if (list.size() >= 2) {
2181 int minLanes = std::numeric_limits<int>::max();
2183 for (
auto& i : list) {
2185 minLanes =
MIN2(minLanes, numLanes);
2187 myCurrentEdge->myNoLanes = minLanes;
2190 WRITE_WARNINGF(
TL(
"Value of key '%' is not numeric ('%') in edge '%'."), key, value, myCurrentEdge->id);
2194 WRITE_WARNINGF(
TL(
"Value of key '%' is not numeric ('%') in edge '%'."), key, value, myCurrentEdge->id);
2196 }
else if (key ==
"lanes:forward") {
2199 if (myCurrentEdge->myNoLanesForward < 0 && myCurrentEdge->myNoLanes < 0) {
2201 myCurrentEdge->myNoLanes = numLanes - myCurrentEdge->myNoLanesForward;
2203 myCurrentEdge->myNoLanesForward = numLanes;
2205 WRITE_WARNINGF(
TL(
"Value of key '%' is not numeric ('%') in edge '%'."), key, value, myCurrentEdge->id);
2207 }
else if (key ==
"lanes:backward") {
2210 if (myCurrentEdge->myNoLanesForward > 0 && myCurrentEdge->myNoLanes < 0) {
2212 myCurrentEdge->myNoLanes = numLanes + myCurrentEdge->myNoLanesForward;
2215 myCurrentEdge->myNoLanesForward = -numLanes;
2217 WRITE_WARNINGF(
TL(
"Value of key '%' is not numeric ('%') in edge '%'."), key, value, myCurrentEdge->id);
2220 (key ==
"maxspeed" || key ==
"maxspeed:type" || key ==
"maxspeed:forward" || key ==
"zone:maxspeed")) {
2222 myCurrentEdge->myMaxSpeed = interpretSpeed(key, value);
2223 }
else if (key ==
"maxspeed:backward" && myCurrentEdge->myMaxSpeedBackward ==
MAXSPEED_UNGIVEN) {
2224 myCurrentEdge->myMaxSpeedBackward = interpretSpeed(key, value);
2225 }
else if (key ==
"junction") {
2226 if ((value ==
"roundabout" || value ==
"circular") && myCurrentEdge->myIsOneWay.empty()) {
2227 myCurrentEdge->myIsOneWay =
"yes";
2229 if (value ==
"roundabout") {
2230 myCurrentEdge->myAmInRoundabout =
true;
2232 }
else if (key ==
"oneway") {
2233 myCurrentEdge->myIsOneWay = value;
2234 }
else if (key ==
"name") {
2235 myCurrentEdge->streetName = value;
2236 }
else if (key ==
"ref") {
2237 myCurrentEdge->ref = value;
2238 myCurrentEdge->setParameter(
"ref", value);
2239 }
else if (key ==
"layer") {
2243 WRITE_WARNINGF(
TL(
"Value of key '%' is not numeric ('%') in edge '%'."), key, value, myCurrentEdge->id);
2245 }
else if (key ==
"tracks") {
2248 myCurrentEdge->myIsOneWay =
"true";
2250 WRITE_WARNINGF(
TL(
"Ignoring track count % for edge '%'."), value, myCurrentEdge->id);
2253 WRITE_WARNINGF(
TL(
"Value of key '%' is not numeric ('%') in edge '%'."), key, value, myCurrentEdge->id);
2255 }
else if (key ==
"railway:preferred_direction") {
2256 if (value ==
"both") {
2258 }
else if (value ==
"backward") {
2260 }
else if (value ==
"forward") {
2263 }
else if (key ==
"railway:bidirectional") {
2264 if (value ==
"regular") {
2265 myCurrentEdge->myRailDirection = (myCurrentEdge->myRailDirection |
WAY_BOTH) & ~
WAY_UNKNOWN;
2267 }
else if (key ==
"electrified" || key ==
"segregated") {
2268 if (value !=
"no") {
2269 myCurrentEdge->myExtraTags[key] = value;
2271 }
else if (key ==
"railway:track_ref") {
2272 myCurrentEdge->setParameter(key, value);
2273 }
else if (key ==
"public_transport" && value ==
"platform") {
2274 myCurrentEdge->myExtraTags[
"platform"] =
"yes";
2279 }
else if ((key ==
"parking:right" || key ==
"parking:lane:right") && !
StringUtils::startsWith(value,
"no")) {
2281 }
else if (key ==
"change" || key ==
"change:lanes") {
2282 myCurrentEdge->myChangeForward = myCurrentEdge->myChangeBackward = interpretChangeType(value);
2283 }
else if (key ==
"change:forward" || key ==
"change:lanes:forward") {
2284 myCurrentEdge->myChangeForward = interpretChangeType(value);
2285 }
else if (key ==
"change:backward" || key ==
"change:lanes:backward") {
2286 myCurrentEdge->myChangeBackward = interpretChangeType(value);
2287 }
else if (key ==
"vehicle:lanes" || key ==
"vehicle:lanes:forward") {
2290 }
else if (key ==
"vehicle:lanes:backward") {
2293 }
else if (key ==
"bus:lanes" || key ==
"bus:lanes:forward") {
2294 interpretLaneUse(value,
SVC_BUS,
true);
2295 }
else if (key ==
"bus:lanes:backward") {
2296 interpretLaneUse(value,
SVC_BUS,
false);
2297 }
else if (key ==
"psv:lanes" || key ==
"psv:lanes:forward") {
2298 interpretLaneUse(value,
SVC_BUS,
true);
2299 interpretLaneUse(value,
SVC_TAXI,
true);
2300 }
else if (key ==
"psv:lanes:backward") {
2301 interpretLaneUse(value,
SVC_BUS,
false);
2302 interpretLaneUse(value,
SVC_TAXI,
false);
2303 }
else if (key ==
"bicycle:lanes" || key ==
"bicycle:lanes:forward") {
2305 }
else if (key ==
"bicycle:lanes:backward") {
2319 std::vector<int> turnCodes;
2320 for (std::string codeList : values) {
2323 if (codes.size() == 0) {
2326 for (std::string code : codes) {
2327 if (code ==
"" || code ==
"none" || code ==
"through") {
2329 }
else if (code ==
"left" || code ==
"sharp_left") {
2331 }
else if (code ==
"right" || code ==
"sharp_right") {
2333 }
else if (code ==
"slight_left") {
2335 }
else if (code ==
"slight_right") {
2337 }
else if (code ==
"reverse") {
2339 }
else if (code ==
"merge_to_left" || code ==
"merge_to_right") {
2343 turnCodes.push_back(turnCode);
2361 if (!myCurrentEdge->myHighWayType.empty() && singleTypeID !=
"railway.highspeed") {
2362 if (myCurrentEdge->myHighWayType ==
"railway.highspeed") {
2367 std::vector<std::string> types =
StringTokenizer(myCurrentEdge->myHighWayType,
2369 types.push_back(singleTypeID);
2372 myCurrentEdge->myHighWayType = singleTypeID;
2379 if (mySpeedMap.find(value) != mySpeedMap.end()) {
2380 return mySpeedMap[value];
2383 if (value.size() > 3 && value[2] ==
':') {
2384 if (value.substr(3, 4) ==
"zone") {
2385 value = value.substr(7);
2387 value = value.substr(3);
2393 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
2394 toString(myCurrentEdge->id) +
"'.");
2405 for (
const std::string& val : values) {
2408 }
else if (val ==
"not_left") {
2410 }
else if (val ==
"not_right") {
2413 result = result << 2;
2416 result = result >> 2;
2418 if (values.size() > 1) {
2431 if (tokens.size() != 2) {
2435 if (where ==
"left_of") {
2437 }
else if (where ==
"right_of") {
2439 }
else if (where ==
"middle_of") {
2451 if (laneIndex <= 0) {
2463 std::vector<bool>& designated = forward ? myCurrentEdge->myDesignatedLaneForward : myCurrentEdge->myDesignatedLaneBackward;
2464 std::vector<SVCPermissions>& allowed = forward ? myCurrentEdge->myAllowedLaneForward : myCurrentEdge->myAllowedLaneBackward;
2465 std::vector<SVCPermissions>& disallowed = forward ? myCurrentEdge->myDisallowedLaneForward : myCurrentEdge->myDisallowedLaneBackward;
2466 designated.resize(
MAX2(designated.size(), values.size()),
false);
2470 for (
const std::string& val : values) {
2471 if (val ==
"yes" || val ==
"permissive") {
2473 }
else if (val ==
"lane" || val ==
"designated") {
2475 designated[i] =
true;
2476 }
else if (val ==
"no") {
2477 disallowed[i] |= svc;
2479 WRITE_WARNINGF(
TL(
"Unknown lane use specifier '%' ignored for way '%'"), val, myCurrentEdge->id);
2488 if (element ==
SUMO_TAG_WAY && myCurrentEdge !=
nullptr) {
2489 if (myCurrentEdge->myCurrentIsRoad) {
2490 const auto insertionIt = myEdgeMap.lower_bound(myCurrentEdge->id);
2491 if (insertionIt == myEdgeMap.end() || insertionIt->first != myCurrentEdge->id) {
2493 myEdgeMap.emplace_hint(insertionIt, myCurrentEdge->id, myCurrentEdge);
2495 delete myCurrentEdge;
2497 }
else if (myCurrentEdge->myExtraTags.count(
"platform") != 0) {
2498 const auto insertionIt = myPlatformShapesMap.lower_bound(myCurrentEdge->id);
2499 if (insertionIt == myPlatformShapesMap.end() || insertionIt->first != myCurrentEdge->id) {
2501 myPlatformShapesMap.emplace_hint(insertionIt, myCurrentEdge->id, myCurrentEdge);
2503 delete myCurrentEdge;
2506 delete myCurrentEdge;
2508 myCurrentEdge =
nullptr;
2517 const std::map<long long int, NIOSMNode*>& osmNodes,
2518 const std::map<long long int, Edge*>& osmEdges,
NBPTStopCont* nbptStopCont,
2519 const std::map<long long int, Edge*>& platformShapes,
2524 myOSMEdges(osmEdges),
2526 myNBPTStopCont(nbptStopCont),
2527 myNBPTLineCont(nbptLineCont),
2539 myIsRestriction =
false;
2546 myRestrictionType = RestrictionType::UNKNOWN;
2547 myPlatforms.clear();
2549 myPlatformStops.clear();
2551 myIsStopArea =
false;
2554 myRouteColor.setValid(
false);
2562 myCurrentRelation = attrs.
get<
long long int>(
SUMO_ATTR_ID,
nullptr, ok);
2564 if (action ==
"delete" || !ok) {
2570 myNightService =
"";
2579 const long long int ref = attrs.
get<
long long int>(
SUMO_ATTR_REF,
nullptr, ok);
2580 if (role ==
"via") {
2583 if (memberType ==
"way" && checkEdgeRef(ref)) {
2585 }
else if (memberType ==
"node") {
2592 }
else if (role ==
"from" && checkEdgeRef(ref)) {
2594 }
else if (role ==
"to" && checkEdgeRef(ref)) {
2598 myStops.push_back(ref);
2602 if (memberType ==
"way") {
2603 const std::map<long long int, NIImporter_OpenStreetMap::Edge*>::const_iterator& wayIt =
myPlatformShapes.find(ref);
2606 platform.
isWay =
true;
2608 myPlatforms.push_back(platform);
2610 }
else if (memberType ==
"node") {
2612 myStops.push_back(ref);
2613 myPlatformStops.insert(ref);
2615 platform.
isWay =
false;
2617 myPlatforms.push_back(platform);
2620 }
else if (role ==
"station") {
2622 }
else if (role.empty()) {
2624 if (memberType ==
"way") {
2625 myWays.push_back(ref);
2626 }
else if (memberType ==
"node") {
2628 if (it !=
myOSMNodes.end() && it->second->hasParameter(
"railway:ref")) {
2631 myStops.push_back(ref);
2642 if (key ==
"type" || key ==
"restriction") {
2644 if (key ==
"type" && value ==
"restriction") {
2645 myIsRestriction =
true;
2648 if (key ==
"type" && value ==
"route") {
2652 if (key ==
"restriction") {
2655 if (value.substr(0, 5) ==
"only_") {
2656 myRestrictionType = RestrictionType::ONLY;
2657 }
else if (value.substr(0, 3) ==
"no_") {
2658 myRestrictionType = RestrictionType::NO;
2664 }
else if (key ==
"except") {
2668 myRestrictionException |=
SVC_BUS;
2669 }
else if (v ==
"bicycle") {
2671 }
else if (v ==
"hgv") {
2673 }
else if (v ==
"motorcar") {
2675 }
else if (v ==
"emergency") {
2679 }
else if (key ==
"public_transport") {
2681 if (value ==
"stop_area") {
2682 myIsStopArea =
true;
2684 }
else if (key ==
"route") {
2686 if (value ==
"train" || value ==
"subway" || value ==
"light_rail" || value ==
"monorail" || value ==
"tram" || value ==
"bus"
2687 || value ==
"trolleybus" || value ==
"aerialway" || value ==
"ferry" || value ==
"share_taxi" || value ==
"minibus") {
2688 myPTRouteType = value;
2691 }
else if (key ==
"name") {
2693 }
else if (key ==
"colour") {
2698 WRITE_WARNINGF(
TL(
"Invalid color value '%' in relation %"), value, myCurrentRelation);
2700 }
else if (key ==
"ref") {
2702 }
else if (key ==
"interval" || key ==
"headway") {
2704 }
else if (key ==
"by_night") {
2713 if (myOSMEdges.find(ref) != myOSMEdges.end()) {
2724 if (myIsRestriction) {
2727 if (myRestrictionType == RestrictionType::UNKNOWN) {
2743 if (ok && !applyRestriction()) {
2746 }
else if (myIsStopArea) {
2747 for (
long long ref : myStops) {
2748 myStopAreas[ref] = myCurrentRelation;
2757 std::shared_ptr<NBPTStop> ptStop = myNBPTStopCont->get(
toString(n->
id));
2758 if (ptStop ==
nullptr) {
2765 if (myPlatform.isWay) {
2769 WRITE_WARNINGF(
TL(
"Platform '%' in relation: '%' is given as polygon, which currently is not supported."), myPlatform.ref, myCurrentRelation);
2784 WRITE_ERRORF(
"Unable to project coordinates for node '%'.", pNode->
id);
2787 p.push_back(pNodePos);
2789 if (p.size() == 0) {
2790 WRITE_WARNINGF(
TL(
"Referenced platform: '%' in relation: '%' is corrupt. Probably OSM file is incomplete."),
2795 ptStop->addPlatformCand(platform);
2806 WRITE_ERRORF(
"Unable to project coordinates for node '%'.", pNode->
id);
2808 NBPTPlatform platform(platformPos, myOptionsCont.getFloat(
"osm.stop-output.length"));
2809 ptStop->addPlatformCand(platform);
2813 ptStop->setIsMultipleStopPositions(myStops.size() > 1, myCurrentRelation);
2815 const auto& nodeIt =
myOSMNodes.find(myStation);
2818 if (station !=
nullptr) {
2826 }
else if (myPTRouteType !=
"" && myIsRoute) {
2827 NBPTLine* ptLine =
new NBPTLine(
toString(myCurrentRelation), myName, myPTRouteType, myRef, myInterval, myNightService,
2829 int consecutiveGap =
false;
2830 int missingBefore = 0;
2831 int missingAfter = 0;
2832 for (
long long ref : myStops) {
2844 if (consecutiveGap > 1) {
2845 WRITE_WARNINGF(
TL(
"PT line '%' in relation % has a gap of % stops, only keeping first part."), myName, myCurrentRelation, consecutiveGap);
2846 missingAfter = (int)myStops.size() - missingBefore - (int)ptLine->
getStops().size();
2852 const NIOSMNode*
const n = nodeIt->second;
2853 std::shared_ptr<NBPTStop> ptStop = myNBPTStopCont->get(
toString(n->
id));
2854 if (ptStop ==
nullptr) {
2858 WRITE_ERRORF(
"Unable to project coordinates for node '%'.", n->
id);
2862 myNBPTStopCont->insert(ptStop);
2863 if (myStopAreas.count(n->
id)) {
2864 ptStop->setIsMultipleStopPositions(
false, myStopAreas[n->
id]);
2866 if (myPlatformStops.count(n->
id) > 0) {
2867 ptStop->setIsPlatform();
2872 for (
long long& myWay : myWays) {
2873 auto entr = myOSMEdges.find(myWay);
2874 if (entr != myOSMEdges.end()) {
2875 Edge* edge = entr->second;
2881 ptLine->
setNumOfStops((
int)myStops.size(), missingBefore, missingAfter);
2883 WRITE_WARNINGF(
TL(
"PT line in relation % with no stops ignored. Probably OSM file is incomplete."), myCurrentRelation);
2888 if (!myNBPTLineCont->insert(ptLine)) {
2903 if (viaNode ==
nullptr) {
2909 if (from ==
nullptr) {
2913 if (to ==
nullptr) {
2917 if (myRestrictionType == RestrictionType::ONLY) {
2944 WRITE_WARNINGF(
TL(
"direction of restriction relation could not be determined%"),
"");
2952 const std::vector<NBEdge*>& candidates)
const {
2953 const std::string prefix =
toString(wayRef);
2954 const std::string backPrefix =
"-" + prefix;
2955 NBEdge* result =
nullptr;
2957 for (
auto candidate : candidates) {
2958 if ((candidate->getID().substr(0, prefix.size()) == prefix) ||
2959 (candidate->getID().substr(0, backPrefix.size()) == backPrefix)) {
2965 WRITE_WARNINGF(
TL(
"Ambiguous way reference '%' in restriction relation"), prefix);
#define WRITE_WARNINGF(...)
#define WRITE_MESSAGEF(...)
#define WRITE_ERRORF(...)
#define WRITE_WARNING(msg)
#define PROGRESS_BEGIN_TIME_MESSAGE(msg)
#define PROGRESS_TIME_MESSAGE(before)
#define PROGRESS_DONE_MESSAGE()
#define PROGRESS_BEGIN_MESSAGE(msg)
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
SVCPermissions extraDisallowed(SVCPermissions disallowed, const MMVersion &networkVersion)
Interprets disallowed vehicles depending on network version.
const SVCPermissions SVCAll
all VClasses are allowed
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a (exclusive) railway edge.
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_SHIP
is an arbitrary ship
@ SVC_PRIVATE
private vehicles
@ SVC_TRUCK
vehicle is a large transport vehicle
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_RAIL_CLASSES
classes which drive on tracks
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_RAIL_FAST
vehicle that is allowed to drive on high-speed rail tracks
@ SVC_TRAILER
vehicle is a large transport vehicle
@ SVC_RAIL_ELECTRIC
rail vehicle that requires electrified tracks
@ SVC_RAIL_URBAN
vehicle is a city rail
@ SVC_EMERGENCY
public emergency vehicles
@ SVC_AUTHORITY
authorities vehicles
@ SVC_TRAM
vehicle is a light rail
@ SVC_PUBLIC_CLASSES
public transport
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_NODE
alternative definition for junction
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
@ PARTLEFT
The link is a partial left direction.
@ RIGHT
The link is a (hard) right direction.
@ TURN
The link is a 180 degree turn.
@ LEFT
The link is a (hard) left direction.
@ STRAIGHT
The link is a straight direction.
@ PARTRIGHT
The link is a partial right direction.
@ NODIR
The link has no direction (is a dead end link)
const double SUMO_const_laneWidth
std::string joinToStringSorting(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static bool isReadable(std::string path)
Checks whether the given file is readable.
void setFileName(const std::string &name)
Sets the current file name.
bool wasInformed() const
Returns the information whether any messages were added.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
Storage for edges, including some functionality operating on multiple edges.
int extractRoundabouts()
Determines which edges have been marked as roundabouts and stores them internally.
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
The representation of a single edge during network building.
static const int TURN_SIGN_SHIFT_BUS
shift values for decoding turn signs
static const int TURN_SIGN_SHIFT_BICYCLE
void setPermittedChanging(int lane, SVCPermissions changeLeft, SVCPermissions changeRight)
set allowed classes for changing to the left and right from the given lane
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given
void addBikeLane(double width)
add a bicycle lane of the given width and shift existing connctions
NBNode * getToNode() const
Returns the destination node of the edge.
static const double UNSPECIFIED_FRICTION
unspecified lane friction
Lane & getLaneStruct(int lane)
const PositionVector & getGeometry() const
Returns the geometry of the edge.
bool addEdge2EdgeConnection(NBEdge *dest, bool overrideRemoval=false, SVCPermissions permission=SVC_UNSPECIFIED)
Adds a connection to another edge.
void setTurnSignTarget(const std::string &target)
void setDistance(double distance)
set kilometrage at start of edge (negative value implies couting down along the edge)
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
const std::string & getID() const
void setLaneWidth(int lane, double width)
set lane specific width (negative lane implies set for all lanes)
void addSidewalk(double width)
add a pedestrian sidewalk of the given width and shift existing connctions
int getNumLanes() const
Returns the number of lanes.
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false, const bool keepPossibleTurns=false)
Removes the specified connection(s)
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)
static const int TURN_SIGN_SHIFT_TAXI
void preferVehicleClass(int lane, SVCPermissions vclasses)
prefer certain vehicle classes for the given lane or for all lanes if -1 is given (ensures also permi...
NBNode * getFromNode() const
Returns the origin node of the edge.
static const double UNSPECIFIED_WIDTH
unspecified lane width
void setRoutingType(const std::string &routingType)
set the routingType for this edge
static const double UNSPECIFIED_OFFSET
unspecified lane offset
void setJunctionPriority(const NBNode *const node, int prio)
Sets the junction priority of the edge.
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge's geometry
Instance responsible for building networks.
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=nullptr)
NBPTLineCont & getPTLineCont()
Returns a reference to the pt line container.
NBParkingCont & getParkingCont()
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
NBEdgeCont & getEdgeCont()
NBTypeCont & getTypeCont()
Returns a reference to the type container.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=nullptr)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
Container for nodes during the netbuilding process.
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
Represents a single node (junction) during network building.
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
NBNode::Crossing * addCrossing(EdgeVector edges, double width, bool priority, int tlIndex=-1, int tlIndex2=-1, const PositionVector &customShape=PositionVector::EMPTY, bool fromSumoNet=false, const Parameterised *params=nullptr)
add a pedestrian crossing to this node
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
SumoXMLNodeType getType() const
Returns the type of this node.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
bool checkCrossingDuplicated(EdgeVector edges)
return true if there already exist a crossing with the same edges as the input
const Position & getPosition() const
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node)
static const int FORWARD
edge directions (for pedestrian related stuff)
void setFringeType(FringeType fringeType)
set fringe type
A traffic light logics which must be computed (only nodes/edges are given)
void setNumOfStops(int numStops, int missingBefore, int missingAfter)
void addWayNode(long long int way, long long int node)
const std::vector< std::shared_ptr< NBPTStop > > & getStops()
void addPTStop(std::shared_ptr< NBPTStop > pStop)
Container for public transport stops during the net building process.
int cleanupDeleted(NBEdgeCont &cont)
remove stops on non existing (removed) edges
const std::map< std::string, std::shared_ptr< NBPTStop > > & getStops() const
Returns an unmodifiable reference to the stored pt stops.
std::shared_ptr< NBPTStop > get(std::string id) const
Retrieve a previously inserted pt stop.
bool insert(std::shared_ptr< NBPTStop > ptStop, bool floating=false)
Inserts a node into the map.
The representation of an imported parking area.
static const std::string OSM_DIRECTION
processing parameter for rail signal edges and nodes
static const std::string OSM_SIGNAL_DIRECTION
A container for traffic light definitions and built programs.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
A storage for available edgeTypes of edges.
bool getEdgeTypeShallBeDiscarded(const std::string &edgeType) const
Returns the information whether edges of this edgeType shall be discarded.
void insertEdgeType(const std::string &id, int numLanes, double maxSpeed, int prio, SVCPermissions permissions, LaneSpreadFunction spreadType, double width, bool oneWayIsDefault, double sidewalkWidth, double bikeLaneWidth, double widthResolution, double maxWidth, double minWidth)
Adds a edgeType into the list.
bool copyEdgeTypeRestrictionsAndAttrs(const std::string &fromId, const std::string &toId)
Copy restrictions to a edgeType.
double getEdgeTypeSpeed(const std::string &edgeType) const
Returns the maximal velocity for the given edgeType [m/s].
int getEdgeTypePriority(const std::string &edgeType) const
Returns the priority for the given edgeType.
int getEdgeTypeNumLanes(const std::string &edgeType) const
Returns the number of lanes for the given edgeType.
double getEdgeTypeWidth(const std::string &edgeType) const
Returns the lane width for the given edgeType [m].
SVCPermissions getEdgeTypePermissions(const std::string &edgeType) const
Returns allowed vehicle classes for the given edgeType.
bool knows(const std::string &edgeType) const
Returns whether the named edgeType is in the container.
double getEdgeTypeSidewalkWidth(const std::string &edgeType) const
Returns the lane width for a sidewalk to be added [m].
LaneSpreadFunction getEdgeTypeSpreadType(const std::string &edgeType) const
Returns spreadType for the given edgeType.
double getEdgeTypeBikeLaneWidth(const std::string &edgeType) const
Returns the lane width for a bike lane to be added [m].
bool getEdgeTypeIsOneWay(const std::string &edgeType) const
Returns whether edges are one-way per default for the given edgeType.
Functor which compares two Edges.
bool operator()(const Edge *e1, const Edge *e2) const
An internal definition of a loaded edge.
int myPlacementLane
1-based lane index for placement specification
std::vector< SVCPermissions > myDisallowedLaneBackward
(optional) information about additional disallowed SVCs on backward lane(s)
std::map< std::string, std::string > myExtraTags
Additionally tagged information.
std::vector< double > myWidthLanesForward
Information on lane width.
WayType mySidewalkType
Information about the kind of sidwalk along this road.
std::vector< double > myWidthLanesBackward
std::vector< SVCPermissions > myDisallowedLaneForward
(optional) information about additional disallowed SVCs on forward lane(s)
bool myCurrentIsRoad
Information whether this is a road.
WayType myCyclewayType
Information about the kind of cycleway along this road.
std::vector< int > myTurnSignsBackward
int myNoLanesForward
number of lanes in forward direction or 0 if unknown, negative if backwards lanes are meant
double myMaxSpeed
maximum speed in km/h, or MAXSPEED_UNGIVEN
std::string ref
The edge's track name.
std::vector< SVCPermissions > myAllowedLaneForward
(optional) information about additional allowed SVCs on forward lane(s)
std::string myHighWayType
The type, stored in "highway" key.
const long long int id
The edge's id.
bool myAmInRoundabout
Information whether this road is part of a roundabout.
int myLayer
Information about the relative z-ordering of ways.
int myRailDirection
Information about the direction(s) of railway usage.
std::vector< bool > myDesignatedLaneBackward
(optional) information about whether the backward lanes are designated to some SVCs
SVCPermissions myExtraDisallowed
Extra permissions prohibited from tags instead of highway type.
std::vector< SVCPermissions > myAllowedLaneBackward
(optional) information about additional allowed SVCs on backward lane(s)
int myNoLanes
number of lanes, or -1 if unknown
std::vector< int > myTurnSignsForward
turning direction (arrows printed on the road)
std::vector< long long int > myCurrentNodes
The list of nodes this edge is made of.
int myParkingType
Information about road-side parking.
double myMaxSpeedBackward
maximum speed in km/h, or MAXSPEED_UNGIVEN
WayType myBuswayType
Information about the kind of busway along this road.
int myChangeForward
Information about change prohibitions (forward direction.
SVCPermissions myExtraAllowed
Extra permissions added from tags instead of highway type.
int myChangeBackward
Information about change prohibitions (backward direction.
std::string streetName
The edge's street name.
PlacementType myPlacement
placement of the OSM way geometry relative to lanes
std::vector< bool > myDesignatedLaneForward
(optional) information about whether the forward lanes are designated to some SVCs
std::string myIsOneWay
Information whether this is an one-way road.
A class which extracts OSM-edges from a parsed OSM-file.
void addType(const std::string &singleTypeID)
void interpretLaneUse(const std::string &value, SUMOVehicleClass svc, const bool forward) const
int interpretChangeType(const std::string &value) const
EdgesHandler(const std::map< long long int, NIOSMNode * > &osmNodes, std::map< long long int, Edge * > &toFill, std::map< long long int, Edge * > &platformShapes, const NBTypeCont &tc)
Constructor.
~EdgesHandler() override
Destructor.
void myEndElement(int element) override
Called when a closing tag occurs.
bool interpretPlacement(const std::string &value, NIImporter_OpenStreetMap::PlacementType &placement, int &laneIndex) const
double interpretSpeed(const std::string &key, std::string value)
std::map< std::string, double > mySpeedMap
A map of non-numeric speed descriptions to their numeric values.
void myStartElement(int element, const SUMOSAXAttributes &attrs) override
Called on the opening of a tag;.
A class which extracts OSM-nodes from a parsed OSM-file.
~NodesHandler() override
Destructor.
int getDuplicateNodes() const
void myStartElement(int element, const SUMOSAXAttributes &attrs) override
Called on the opening of a tag;.
NodesHandler(std::map< long long int, NIOSMNode * > &toFill, std::set< NIOSMNode *, CompareNodes > &uniqueNodes, const OptionsCont &cont)
Constructor.
void myEndElement(int element) override
Called when a closing tag occurs.
StringVector myRailSignalRules
custom requirements for rail signal tagging
A class which extracts relevant relation information from a parsed OSM-file.
void myEndElement(int element) override
Called when a closing tag occurs.
void resetValues()
reset members to their defaults for parsing a new relation
void myStartElement(int element, const SUMOSAXAttributes &attrs) override
Called on the opening of a tag;.
~RelationHandler() override
Destructor.
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.
bool checkEdgeRef(long long int ref) const
check whether a referenced way has a corresponding edge
bool applyRestriction() const
try to apply the parsed restriction and return whether successful
NBEdge * findEdgeRef(long long int wayRef, const std::vector< NBEdge * > &candidates) const
try to find the way segment among candidates
Importer for networks stored in OpenStreetMap format.
int insertEdge(Edge *e, int index, NBNode *from, NBNode *to, const std::vector< long long int > &passed, NBNetBuilder &nb, const NBNode *first, const NBNode *last)
Builds an NBEdge.
std::map< long long int, Edge * > myEdges
the map from OSM way ids to edge objects
bool myImportCrossings
import crossings
std::map< long long int, NIOSMNode * > myOSMNodes
the map from OSM node ids to actual nodes
NIImporter_OpenStreetMap()
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given OSM file.
static const long long int INVALID_ID
WayType
details on the kind of sidewalk, cycleway, busway along this road
void applyLaneUse(NBEdge *e, NIImporter_OpenStreetMap::Edge *nie, const bool forward)
Applies lane use information from nie to e.
static const double MAXSPEED_UNGIVEN
bool myOnewayDualSidewalk
import sidewalks
~NIImporter_OpenStreetMap()
std::map< long long int, Edge * > myPlatformShapes
the map from OSM way ids to platform shapes
void load(const OptionsCont &oc, NBNetBuilder &nb)
void applyTurnSigns(NBEdge *e, const std::vector< int > &turnSigns)
bool myImportSidewalks
import sidewalks
std::set< NIOSMNode *, CompareNodes > myUniqueNodes
the set of unique nodes used in NodesHandler, used when freeing memory
static bool myAllAttributes
whether additional way and node attributes shall be imported
void reconstructLayerElevation(double layerElevation, NBNetBuilder &nb)
reconstruct elevation from layer info
static SUMOVehicleClass interpretTransportType(const std::string &type, NIOSMNode *toSet=nullptr)
translate osm transport designations into sumo vehicle class
int myPlacementSkippedNonExplicitOneWay
number of placement skips due to non-explicit oneway
bool myImportLaneAccess
import lane specific access restrictions
bool myImportTurnSigns
import turning signals (turn:lanes) to guide connection building
std::map< std::string, std::string > myKnownCompoundTypes
The compound types that have already been mapped to other known types.
static const std::string compoundTypeSeparator
The separator within newly created compound type names.
std::set< std::string > myUnusableTypes
The compounds types that do not contain known types.
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::set< std::string > myExtraAttributes
extra attributes to import
bool myImportBikeAccess
import bike path specific permissions and directions
bool myAnnotateDefaults
whether edges should carry information on the use of typemap defaults
static double interpretDistance(NIOSMNode *node)
read distance value from node and return value in m
NBNode * insertNodeChecking(long long int id, NBNodeCont &nc, NBTrafficLightLogicCont &tlsc)
Builds an NBNode.
static void mergeTurnSigns(std::vector< int > &signs, std::vector< int > signs2)
void extendRailwayDistances(Edge *e, NBTypeCont &tc)
extend kilometrage data for all nodes along railway
int myPlacementSkippedAuxOppositeDirection
number of placement skips due to generated opposite-direction auxiliary edges
std::string usableType(const std::string &type, const std::string &id, NBTypeCont &tc)
check whether the type is known or consists of known type compounds. return empty string otherwise
static void applyChangeProhibition(NBEdge *e, int changeProhibition)
const std::string & getID() const
Returns the id.
A storage for options typed value containers)
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
void unsetParameter(const std::string &key)
Removes a parameter.
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.
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
void updateParameters(const Parameterised::Map &mapArg)
Adds or updates all given parameters from the map.
A point in 2D or 3D with translation and scaling methods.
double length2D() const
Returns the length.
double length() const
Returns the length.
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
PositionVector reverse() const
reverse position vector
static RGBColor parseColor(std::string coldef)
Parses a color information.
Encapsulated SAX-Attributes.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue=T(), bool report=true) const
Tries to read given attribute assuming it is an int.
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
SAX-handler base for SUMO-files.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
T get(const std::string &str) const
get key
int size() const
returns the number of existing substrings
std::vector< std::string > getVector()
return vector of strings
bool hasNext()
returns the information whether further substrings exist
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
static bool isBool(const std::string &sData)
check if the given value can be converted to bool
static long long int toLong(const std::string &sData)
converts a string into the long value described by it by calling the char-type converter,...
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
static std::string prune(const std::string &str)
Removes trailing and leading whitechars.
static double parseDist(const std::string &sData)
parse a distance, length or width value with a unit
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
static double parseSpeed(const std::string &sData, const bool defaultKmph=true)
parse a speed value with a unit
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
static SUMOSAXReader * getSAXReader(SUMOSAXHandler &handler, const bool isNet=false, const bool isRoute=false)
Builds a reader and assigns the handler to it.
An (internal) definition of a single lane of an edge.
int turnSigns
turning signs printed on the road, bitset of LinkDirection (imported from OSM)
An internal representation of an OSM-node.
SVCPermissions permissions
type of pt stop
NBNode * node
the NBNode that was instantiated
double positionMeters
position converted to m (using highest precision available)
std::string position
kilometrage/mileage
const long long int id
The node's id.
bool pedestrianCrossing
Whether this is a pedestrian crossing.
bool tlsControlled
Whether this is a tls controlled junction.
double ptStopLength
The length of the pt stop.
bool ptStopPosition
Whether this is a public transport stop position.
std::string name
The name of the node.
bool railwayCrossing
Whether this is a railway crossing.
double ele
The elevation of this node.
bool railwayBufferStop
Whether this is a railway buffer stop.
const double lon
The longitude the node is located at.
const double lat
The latitude the node is located at.
bool railwaySignal
Whether this is a railway (main) signal.
WayType myRailDirection
Information about the direction(s) of railway usage.