109 importer.
load(oc, nb);
120 for (std::map<long long int, Edge*>::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
128 if (!oc.
isSet(
"osm-files")) {
136 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
139 WRITE_ERROR(
"Could not open osm-file '" + *file +
"'.");
151 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
160 if (!oc.
getBool(
"osm.skip-duplicates-check")) {
163 std::set<const Edge*, CompareEdges> dupsFinder;
164 for (std::map<long long int, Edge*>::iterator it =
myEdges.begin(); it !=
myEdges.end();) {
165 if (dupsFinder.count(it->second) > 0) {
170 dupsFinder.insert(it->second);
181 std::map<long long int, int> nodeUsage;
183 for (std::map<long long int, Edge*>::const_iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
184 Edge* e = (*i).second;
186 for (std::vector<long long int>::const_iterator j = e->
myCurrentNodes.begin();
189 if (nodeUsage.find(*j) == nodeUsage.end()) {
192 nodeUsage[*j] = nodeUsage[*j] + 1;
196 for (std::map<long long int, NIOSMNode*>::const_iterator nodesIt =
myOSMNodes.begin();
199 if (nodesIt->second->tlsControlled ) {
202 nodeUsage[nodesIt->first] += 1;
211 for (std::map<long long int, Edge*>::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
212 Edge* e = (*i).second;
225 std::vector<long long int> passed;
227 passed.push_back(*j);
230 running =
insertEdge(e, running, currentFrom, currentTo, passed, nb);
231 currentFrom = currentTo;
233 passed.push_back(*j);
239 insertEdge(e, running, currentFrom, last, passed, nb);
242 const double layerElevation = oc.
getFloat(
"osm.layer-elevation");
243 if (layerElevation > 0) {
250 for (std::vector<std::string>::const_iterator file = files.begin(); file != files.end(); ++file) {
285 if (!tlsc.
insert(tlDef)) {
297 const std::vector<long long int>& passed,
NBNetBuilder& nb) {
306 if (from == 0 || to == 0) {
307 WRITE_ERROR(
"Discarding edge '" +
id +
"' because the nodes could not be built.");
316 assert(passed.size() >= 2);
317 if (passed.size() == 2) {
318 WRITE_WARNING(
"Discarding edge '" +
id +
"' which connects two identical nodes without geometry.");
322 int intermediateIndex = (int) passed.size() / 2;
324 std::vector<long long int> part1(passed.begin(), passed.begin() + intermediateIndex + 1);
325 std::vector<long long int> part2(passed.begin() + intermediateIndex, passed.end());
326 index =
insertEdge(e, index, from, intermediate, part1, nb);
327 return insertEdge(e, index, intermediate, to, part2, nb);
329 const int newIndex = index + 1;
333 for (std::vector<long long int>::const_iterator i = passed.begin(); i != passed.end(); ++i) {
346 shape.push_back(pos);
349 WRITE_ERROR(
"Unable to project coordinates for edge '" +
id +
"'.");
354 if (!tc.
knows(type)) {
362 std::vector<std::string> types;
364 std::string t = tok.
next();
366 if (std::find(types.begin(), types.end(), t) == types.end()) {
369 }
else if (tok.
size() > 1) {
371 "Discarding unknown compound '" + t +
"' in type '" + type +
"' (first occurence for edge '" +
id 375 if (types.size() == 0) {
376 WRITE_WARNING(
"Discarding unusable type '" + type +
"' (first occurence for edge '" +
id +
"').");
381 if (tc.
knows(newType)) {
394 bool defaultIsOneWay =
false;
397 for (std::vector<std::string>::iterator it = types.begin(); it != types.end(); it++) {
414 WRITE_WARNING(
"Discarding compound type '" + newType +
"' (first occurence for edge '" +
id +
"').");
418 WRITE_MESSAGE(
"Adding new type '" + type +
"' (first occurence for edge '" +
id +
"').");
419 tc.
insert(newType, numLanes, maxSpeed, prio, permissions, width, defaultIsOneWay, sidewalkWidth,
421 for (std::vector<std::string>::iterator it = types.begin(); it != types.end(); it++) {
442 double forwardWidth = tc.
getWidth(type);
443 double backwardWidth = tc.
getWidth(type);
447 bool addForward =
true;
448 bool addBackward =
true;
451 e->
getParameter(
"railway:preferred_direction",
"") !=
"both")) {
465 if (addForward && !addBackward) {
467 }
else if (!addForward && addBackward) {
475 numLanesForward = (int) std::ceil(e->
myNoLanes / 2.0);
477 numLanesBackward = e->
myNoLanes - numLanesForward;
480 numLanesForward =
MAX2(1, numLanesForward);
481 numLanesBackward =
MAX2(1, numLanesBackward);
484 WRITE_WARNING(
"Skipping edge '" +
id +
"' because it has zero lanes.");
509 numLanesBackward = 1;
523 numLanesBackward = 1;
532 assert(numLanesForward > 0);
556 assert(numLanesBackward > 0);
576 throw ProcessError(
"Could not add edge '-" +
id +
"'.");
587 std::set<NIOSMNode*, CompareNodes>& uniqueNodes,
const OptionsCont& oc)
593 myIsInValidNodeTag(false),
596 myImportElevation(oc.getBool(
"osm.elevation")),
613 long long int id = attrs.
get<
long 617 if (action ==
"delete") {
651 std::set<NIOSMNode*, CompareNodes>::iterator similarNode =
myUniqueNodes.find(toAdd);
656 toAdd = *similarNode;
664 WRITE_ERROR(
"Tag element on wrong XML hierarchy level.");
670 if (key ==
"highway" || key ==
"ele" || key ==
"crossing" || key ==
"railway" || key ==
"public_transport" || key ==
"name") {
672 if (key ==
"highway" && value.find(
"traffic_signal") != std::string::npos) {
674 }
else if (key ==
"crossing" && value.find(
"traffic_signals") != std::string::npos) {
676 }
else if (key ==
"railway" && value.find(
"crossing") != std::string::npos) {
678 }
else if (key ==
"public_transport" && value.find(
"stop_position") != std::string::npos) {
681 "osm.stop-output.length");
682 }
else if (key ==
"name") {
688 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in node '" +
709 const std::map<long long int, NIOSMNode*>& osmNodes,
710 std::map<long long int, Edge*>& toFill)
735 long long int id = attrs.
get<
long 739 if (action ==
"delete") {
752 long long int ref = attrs.
get<
long 756 std::map<long long int, NIOSMNode*>::const_iterator node =
myOSMNodes.find(ref);
761 ref = node->second->id;
779 const std::string cyclewaySpec = key.substr(9);
781 if (cyclewaySpec ==
"right") {
783 }
else if (cyclewaySpec ==
"left") {
785 }
else if (cyclewaySpec ==
"both") {
796 const std::string buswaySpec = key.substr(7);
798 if (buswaySpec ==
"right") {
800 }
else if (buswaySpec ==
"left") {
802 }
else if (buswaySpec ==
"both") {
808 if (key ==
"bridge" || key ==
"tunnel") {
814 && key !=
"maxspeed" && key !=
"junction" && key !=
"name" && key !=
"tracks" && key !=
"layer" && key !=
"route" 815 && key !=
"postal_code" && key !=
"railway:preferred_direction") {
820 if (key ==
"highway" || key ==
"railway" || key ==
"waterway" || key ==
"cycleway" || key ==
"busway" || key ==
"route") {
823 if (key ==
"cycleway") {
826 }
else if (value ==
"opposite_track") {
828 }
else if (value ==
"opposite_lane") {
833 if (key ==
"busway") {
836 }
else if (value ==
"opposite_track") {
838 }
else if (value ==
"opposite_lane") {
845 const std::string singleTypeID = key +
"." + value;
851 types.push_back(singleTypeID);
856 }
else if (key ==
"lanes") {
862 std::vector<std::string> list = st.
getVector();
863 if (list.size() >= 2) {
866 for (std::vector<std::string>::iterator i = list.begin(); i != list.end(); ++i) {
868 minLanes =
MIN2(minLanes, numLanes);
875 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
880 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
883 }
else if (key ==
"lanes:forward") {
887 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
890 }
else if (key ==
"lanes:backward") {
895 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
898 }
else if (key ==
"maxspeed") {
902 double conversion = 1;
907 conversion = 1.609344;
912 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
916 }
else if (key ==
"junction") {
920 }
else if (key ==
"oneway") {
922 }
else if (key ==
"name") {
924 }
else if (key ==
"layer") {
928 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
931 }
else if (key ==
"tracks") {
939 WRITE_WARNING(
"Value of key '" + key +
"' is not numeric ('" + value +
"') in edge '" +
942 }
else if (key ==
"postal_code") {
944 }
else if (key ==
"railway:preferred_direction") {
967 const std::map<long long int, NIOSMNode*>& osmNodes,
968 const std::map<long long int, Edge*>& osmEdges)
972 myOSMEdges(osmEdges) {
1001 if (action ==
"delete" || !ok) {
1012 long long int ref = attrs.
get<
long 1015 if (role ==
"via") {
1020 }
else if (memberType ==
"node") {
1041 if (key ==
"type" || key ==
"restriction") {
1043 if (key ==
"type" && value ==
"restriction") {
1047 if (key ==
"restriction") {
1050 if (value.substr(0, 5) ==
"only_") {
1052 }
else if (value.substr(0, 3) ==
"no_") {
1118 WRITE_WARNING(
"from-edge of restriction relation could not be determined");
1122 WRITE_WARNING(
"to-edge of restriction relation could not be determined");
1132 WRITE_WARNING(
"direction of restriction relation could not be determined");
1140 const std::vector<NBEdge*>& candidates)
const {
1141 const std::string prefix =
toString(wayRef);
1142 const std::string backPrefix =
"-" + prefix;
1145 for (EdgeVector::const_iterator it = candidates.begin(); it != candidates.end(); ++it) {
1146 if (((*it)->getID().substr(0, prefix.size()) == prefix) ||
1147 ((*it)->getID().substr(0, backPrefix.size()) == backPrefix)) {
1153 WRITE_WARNING(
"Ambigous way reference '" + prefix +
"' in restriction relation");
1166 std::map<NBNode*, std::vector<std::pair<double, double> > > layerForces;
1169 std::set<NBNode*> knownElevation;
1170 for (std::map<long long int, Edge*>::iterator i =
myEdges.begin(); i !=
myEdges.end(); ++i) {
1171 Edge* e = (*i).second;
1176 knownElevation.insert(node);
1182 #ifdef DEBUG_LAYER_ELEVATION 1183 std::cout <<
"known elevations:\n";
1184 for (std::set<NBNode*>::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1185 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[*it];
1186 std::cout <<
" node=" << (*it)->
getID() <<
" ele=";
1187 for (std::vector<std::pair<double, double> >::const_iterator it_ele = primaryLayers.begin(); it_ele != primaryLayers.end(); ++it_ele) {
1188 std::cout << it_ele->first <<
" ";
1196 std::map<NBNode*, double> knownEleMax;
1197 for (std::set<NBNode*>::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1199 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[*it];
1200 for (std::vector<std::pair<double, double> >::const_iterator it_ele = primaryLayers.begin();
1201 it_ele != primaryLayers.end();
1203 eleMax =
MAX2(eleMax, it_ele->first);
1205 knownEleMax[*it] = eleMax;
1208 bool changed =
true;
1211 for (std::set<NBNode*>::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1213 knownEleMax[*it] / gradeThreshold * 3, knownElevation);
1214 for (std::map<
NBNode*, std::pair<double, double> >::iterator it_neigh = neighbors.begin();
1215 it_neigh != neighbors.end();
1217 if (knownElevation.count(it_neigh->first) != 0) {
1218 const double grade = fabs(knownEleMax[*it] - knownEleMax[it_neigh->first])
1220 #ifdef DEBUG_LAYER_ELEVATION 1221 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";
1223 if (grade > gradeThreshold * 50 / 3.6 / it_neigh->second.second) {
1225 const double eleMax =
MAX2(knownEleMax[*it], knownEleMax[it_neigh->first]);
1226 if (knownEleMax[*it] < eleMax) {
1227 knownEleMax[*it] = eleMax;
1229 knownEleMax[it_neigh->first] = eleMax;
1239 std::set<NBNode*> unknownElevation;
1240 for (std::set<NBNode*>::iterator it = knownElevation.begin(); it != knownElevation.end(); ++it) {
1241 const double eleMax = knownEleMax[*it];
1242 const double maxDist = fabs(eleMax) * 100 / layerElevation;
1243 std::map<NBNode*, std::pair<double, double> > neighbors =
getNeighboringNodes(*it, maxDist, knownElevation);
1244 for (std::map<
NBNode*, std::pair<double, double> >::iterator it_neigh = neighbors.begin();
1245 it_neigh != neighbors.end();
1247 if (knownElevation.count(it_neigh->first) == 0) {
1248 unknownElevation.insert(it_neigh->first);
1249 layerForces[it_neigh->first].push_back(std::make_pair(eleMax, it_neigh->second.first));
1255 for (std::set<NBNode*>::iterator it = unknownElevation.begin(); it != unknownElevation.end(); ++it) {
1257 const std::vector<std::pair<double, double> >& primaryLayers = layerForces[*it];
1258 for (std::vector<std::pair<double, double> >::const_iterator it_ele = primaryLayers.begin();
1259 it_ele != primaryLayers.end();
1261 eleMax =
MAX2(eleMax, it_ele->first);
1263 const double maxDist = fabs(eleMax) * 100 / layerElevation;
1264 std::map<NBNode*, std::pair<double, double> > neighbors =
getNeighboringNodes(*it, maxDist, knownElevation);
1265 for (std::map<
NBNode*, std::pair<double, double> >::iterator it_neigh = neighbors.begin();
1266 it_neigh != neighbors.end();
1268 if (knownElevation.count(it_neigh->first) == 0 && unknownElevation.count(it_neigh->first) == 0) {
1269 layerForces[*it].push_back(std::make_pair(0, it_neigh->second.first));
1274 #ifdef DEBUG_LAYER_ELEVATION 1275 std::cout <<
"summation of forces\n";
1277 std::map<NBNode*, double> nodeElevation;
1278 for (std::map<
NBNode*, std::vector<std::pair<double, double> > >::iterator it = layerForces.begin();
1279 it != layerForces.end();
1281 const std::vector<std::pair<double, double> >& forces = it->second;
1282 if (knownElevation.count(it->first) != 0) {
1290 #ifdef DEBUG_LAYER_ELEVATION 1291 std::cout <<
" node=" << it->first->getID() <<
" knownElevation=" << knownEleMax[it->first] <<
"\n";
1293 nodeElevation[it->first] = knownEleMax[it->first];
1294 }
else if (forces.size() == 1) {
1295 nodeElevation[it->first] = forces.front().first;
1299 for (std::vector<std::pair<double, double> >::const_iterator it_force = forces.begin();
1300 it_force != forces.end();
1302 distSum += it_force->second;
1304 double weightSum = 0;
1305 double elevation = 0;
1306 #ifdef DEBUG_LAYER_ELEVATION 1307 std::cout <<
" node=" << it->first->getID() <<
" distSum=" << distSum <<
"\n";
1309 for (std::vector<std::pair<double, double> >::const_iterator it_force = forces.begin();
1310 it_force != forces.end();
1312 const double weight = (distSum - it_force->second) / distSum;
1313 weightSum += weight;
1314 elevation += it_force->first * weight;
1316 #ifdef DEBUG_LAYER_ELEVATION 1317 std::cout <<
" force=" << it_force->first <<
" dist=" << it_force->second <<
" weight=" << weight <<
" ele=" << elevation <<
"\n";
1320 nodeElevation[it->first] = elevation / weightSum;
1323 #ifdef DEBUG_LAYER_ELEVATION 1324 std::cout <<
"final elevations:\n";
1325 for (std::map<NBNode*, double>::iterator it = nodeElevation.begin(); it != nodeElevation.end(); ++it) {
1326 std::cout <<
" node=" << (it->first)->getID() <<
" ele=" << it->second <<
"\n";;
1330 for (std::map<NBNode*, double>::iterator it = nodeElevation.begin(); it != nodeElevation.end(); ++it) {
1337 for (std::map<std::string, NBEdge*>::const_iterator it = ec.
begin(); it != ec.
end(); ++it) {
1338 NBEdge* edge = it->second;
1340 const double length = geom.
length2D();
1341 const double zFrom = nodeElevation[edge->
getFromNode()];
1342 const double zTo = nodeElevation[edge->
getToNode()];
1347 for (PositionVector::const_iterator it_pos = geom.begin(); it_pos != geom.end(); ++it_pos) {
1348 if (it_pos != geom.begin()) {
1349 dist += (*it_pos).distanceTo2D(*(it_pos - 1));
1351 newGeom.push_back((*it_pos) +
Position(0, 0, zFrom + (zTo - zFrom)*dist / length));
1357 std::map<NBNode*, std::pair<double, double> >
1359 std::map<NBNode*, std::pair<double, double> > result;
1360 std::set<NBNode*> visited;
1361 std::vector<NBNode*> open;
1362 open.push_back(node);
1363 while (open.size() > 0) {
1366 if (visited.count(n) != 0) {
1371 for (EdgeVector::const_iterator j = edges.begin(); j != edges.end(); ++j) {
1380 const double speed =
MAX2(e->
getSpeed(), result[n].second);
1381 if (result.count(s) == 0) {
1382 result[s] = std::make_pair(dist, speed);
1384 result[s] = std::make_pair(
MIN2(dist, result[s].first),
MAX2(speed, result[s].second));
1386 if (dist < maxDist && knownElevation.count(s) == 0) {
const std::map< long long int, NIOSMNode * > & myOSMNodes
The previously parsed nodes.
An internal definition of a loaded edge.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
void insert(const std::string &id, int numLanes, double maxSpeed, int prio, SVCPermissions permissions, double width, bool oneWayIsDefault, double sidewalkWidth, double bikeLaneWidth)
Adds a type into the list.
const bool myImportElevation
whether elevation data should be imported
const std::map< long long int, Edge * > & myOSMEdges
The previously parsed edges.
The only invalid connection is declared.
An internal representation of an OSM-node.
const long long int id
The edge's id.
double length2D() const
Returns the length.
double getSpeed(const std::string &type) const
Returns the maximal velocity for the given type [m/s].
std::string streetName
The edge's street name.
NBTypeCont & getTypeCont()
Returns a reference to the type container.
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.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
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
A container for traffic light definitions and built programs.
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
~RelationHandler()
Destructor.
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...
bool ptStopPostion
Whether this is a public transport stop position.
EdgesHandler(const std::map< long long int, NIOSMNode *> &osmNodes, std::map< long long int, Edge *> &toFill)
Constructor.
NIImporter_OpenStreetMap()
const double SUMO_const_laneWidth
void myEndElement(int element)
Called when a closing tag occurs.
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
The representation of a single edge during network building.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
int getPriority(const std::string &type) const
Returns the priority for the given type.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false)
Removes the specified connection(s)
long long int myCurrentRelation
The currently parsed relation.
bool checkEdgeRef(long long int ref) const
check whether a referenced way has a corresponding edge
NBPTStopCont & getPTStopCont()
Returns a reference to the pt stop container.
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
PositionVector reverse() const
reverse position vector
static bool transformCoordinates(PositionVector &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
int getNumLanes(const std::string &type) const
Returns the number of lanes for the given type.
bool getShallBeDiscarded(const std::string &type) const
Returns the information whether edges of this type shall be discarded.
std::map< std::string, NBEdge * >::const_iterator end() const
Returns the pointer to the end of the stored edges.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
void myEndElement(int element)
Called when a closing tag occurs.
const std::string & getID() const
Returns the id.
The representation of a single pt stop.
SAX-handler base for SUMO-files.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
void addSidewalk(double width)
add a pedestrian sidewalk of the given width and shift existing connctions
std::vector< long long int > myCurrentNodes
The list of nodes this edge is made of.
void setGeometry(const PositionVector &g, bool inner=false)
(Re)sets the edge's geometry
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
static const double UNSPECIFIED_WIDTH
unspecified lane width
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
double getWidth(const std::string &type) const
Returns the lane width for the given type [m].
std::set< NIOSMNode *, CompareNodes > & myUniqueNodes
the set of unique nodes (used for duplicate detection/substitution)
NBNode * node
the NBNode that was instantiated
const EdgeVector & getOutgoingEdges() const
Returns this node's outgoing edges (The edges which start at this node)
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given OSM file.
Functor which compares two Edges.
WayType myCyclewayType
Information about the kind of cycleway along this road.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
int myNoLanesForward
number of lanes in forward direction or 0 if unknown, negative if backwards lanes are meant ...
~EdgesHandler()
Destructor.
bool addEdge2EdgeConnection(NBEdge *dest)
Adds a connection to another edge.
NBEdge * findEdgeRef(long long int wayRef, const std::vector< NBEdge *> &candidates) const
try to find the way segment among candidates
bool knows(const std::string &type) const
Returns whether the named type is in the container.
double getBikeLaneWidth(const std::string &type) const
Returns the lane width for a bike lane to be added [m].
void load(const OptionsCont &oc, NBNetBuilder &nb)
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.
std::map< std::string, NBEdge * >::const_iterator begin() const
Returns the pointer to the begin of the stored edges.
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.
double ele
The elevation of this node.
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
std::vector< int > myParentElements
The element stack.
double getSidewalkWidth(const std::string &type) const
Returns the lane width for a sidewalk to be added [m].
Encapsulated SAX-Attributes.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
A point in 2D or 3D with translation and scaling methods.
NBEdgeCont & getEdgeCont()
T get(const std::string &str) const
RelationHandler(const std::map< long long int, NIOSMNode *> &osmNodes, const std::map< long long int, Edge *> &osmEdges)
Constructor.
const EdgeVector & getEdges() const
Returns all edges which participate in this node (Edges that start or end at this node) ...
void myEndElement(int element)
Called when a closing tag occurs.
Storage for edges, including some functionality operating on multiple edges.
std::vector< std::string > getStringVector(const std::string &name) const
Returns the list of string-vector-value of the named option (only for Option_String) ...
#define PROGRESS_BEGIN_MESSAGE(msg)
bool operator()(const Edge *e1, const Edge *e2) const
long long int myLastNodeID
ID of the currently parsed node, for reporting mainly.
std::map< long long int, NIOSMNode * > & myToFill
The nodes container to fill.
bool myIsRestriction
whether the currently parsed relation is a restriction
~NIImporter_OpenStreetMap()
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
bool railwayCrossing
Whether this is a railway crossing.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
double myMaxSpeed
maximum speed in km/h, or MAXSPEED_UNGIVEN
bool hasIncoming(const NBEdge *const e) const
Returns whether the given edge ends at this node.
double getSpeed() const
Returns the speed allowed on this 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.
const PositionVector & getGeometry() const
Returns the geometry of the edge.
void addParameter(const std::string &key, const std::string &value)
Adds a parameter.
int myNoLanes
number of lanes, or -1 if unknown
const std::string & getParameter(const std::string &key, const std::string &defaultValue) const
Returns the value for a given key.
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.
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.
const EdgeVector & getIncomingEdges() const
Returns this node's incoming edges (The edges which yield in this node)
NBNodeCont & getNodeCont()
Returns a reference to the node container.
long long int myToWay
the destination way for the current restriction
int myLayer
Information about the relative z-ordering of ways.
Instance responsible for building networks.
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
static const std::string compoundTypeSeparator
The separator within newly created compound type names.
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
alternative definition for junction
A storage for options typed value containers)
long long int myViaNode
the via node/way for the current restriction
std::string joinToStringSorting(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
bool copyRestrictionsAndAttrs(const std::string &fromId, const std::string &toId)
Copy restrictions to a type.
static double _2double(const E *const data)
converts a char-type array into the double value described by it
SumoXMLNodeType getType() const
Returns the type of this node.
void addBikeLane(double width)
add a bicycle lane of the given width and shift existing connctions
bool insert(const std::string &id, const Position &position, NBDistrict *district=0)
Inserts a node into the map.
NBTrafficLightLogicCont & getTLLogicCont()
Returns a reference to the traffic light logics container.
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
void reconstructLayerElevation(double layerElevation, NBNetBuilder &nb)
reconstruct elevation from layer info
std::string name
The name of the node.
A class which extracts OSM-nodes from a parsed OSM-file.
const Position & getPosition() const
Represents a single node (junction) during network building.
void resetValues()
reset members to their defaults for parsing a new relation
NBNode * insertNodeChecking(long long int id, NBNodeCont &nc, NBTrafficLightLogicCont &tlsc)
Builds an NBNode.
int myHierarchyLevel
The current hierarchy level.
std::string myHighWayType
The type, stored in "highway" key.
NodesHandler(std::map< long long int, NIOSMNode *> &toFill, std::set< NIOSMNode *, CompareNodes > &uniqueNodes, const OptionsCont &cont)
Contructor.
const double lon
The longitude the node is located at.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
Importer for networks stored in OpenStreetMap format.
static const long long int INVALID_ID
bool myCurrentIsRoad
Information whether this is a road.
Edge * myCurrentEdge
The currently built edge.
std::set< std::string > myUnusableTypes
The compounds types that do not contain known types.
~NodesHandler()
Destructor.
NBNode * getFromNode() const
Returns the origin node of the edge.
Container for nodes during the netbuilding process.
bool insert(NBPTStop *ptStop)
Inserts a node into the map.
#define PROGRESS_DONE_MESSAGE()
double ptStopLength
The length of the pt stop.
std::map< long long int, NIOSMNode * > myOSMNodes
the map from OSM node ids to actual nodes
A traffic light logics which must be computed (only nodes/edges are given)
std::vector< int > myParentElements
The element stack.
bool getIsOneWay(const std::string &type) const
Returns whether edges are one-way per default for the given type.
#define WRITE_MESSAGE(msg)
std::set< NIOSMNode *, CompareNodes > myUniqueNodes
the set of unique nodes used in NodesHandler, used when freeing memory
static const double MAXSPEED_UNGIVEN
const OptionsCont & myOptionsCont
the options
NBNode * getToNode() const
Returns the destination node of the edge.
bool applyRestriction() const
try to apply the parsed restriction and return whether successful
A class which extracts relevant relation information from a parsed OSM-file.
std::string myIsOneWay
Information whether this is an one-way road.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::map< std::string, double > mySpeedMap
A map of non-numeric speed descriptions to their numeric values.
SVCPermissions getPermissions(const std::string &type) const
Returns allowed vehicle classes for the given type.
A storage for available types of edges.