67 if (!oc.
isSet(
"dlr-navteq-prefix")) {
75 std::map<std::string, PositionVector> myGeoms;
77 std::string file = oc.
getString(
"dlr-navteq-prefix") +
"_nodes_unsplitted.txt";
80 throw ProcessError(
"The file '" + file +
"' could not be opened.");
86 std::map<std::string, std::string> streetNames;
87 if (oc.
getBool(
"output.street-names")) {
88 file = oc.
getString(
"dlr-navteq-prefix") +
"_names.txt";
95 WRITE_WARNING(
"Output will not contain street names because the file '" + file +
"' was not found");
101 file = oc.
getString(
"dlr-navteq-prefix") +
"_links_unsplitted.txt";
105 throw ProcessError(
"The file '" + file +
"' could not be opened.");
112 file = oc.
getString(
"dlr-navteq-prefix") +
"_traffic_signals.txt";
121 file = oc.
getString(
"dlr-navteq-prefix") +
"_prohibited_manoeuvres.txt";
130 file = oc.
getString(
"dlr-navteq-prefix") +
"_connected_lanes.txt";
139 file = oc.
getString(
"dlr-navteq-prefix") +
"_links_timerestrictions.txt";
142 if (!oc.
isDefault(
"construction-date")) {
147 handler5.printSummary();
154 assert(line[0] ==
'#');
155 const std::string marker =
"extraction version: v";
157 if (lowerCase.find(marker) == std::string::npos) {
160 const int vStart = (int)(lowerCase.find(marker) + marker.size());
161 const int vEnd = (int)line.find(
" ", vStart);
165 throw ProcessError(
"Invalid version number '" +
toString(version) +
"' in file '" + file +
"'.");
169 throw ProcessError(
"Non-numerical value '" + line.substr(vStart, vEnd - vStart) +
"' for version string in file '" + file +
"'.");
178 const std::string& file,
179 std::map<std::string, PositionVector>& geoms)
180 : myNodeCont(nc), myGeoms(geoms) {
190 if (result[0] ==
'#') {
195 int no_geoms, intermediate;
197 std::istringstream stream(result);
201 throw ProcessError(
"Something is wrong with the following data line\n" + result);
204 stream >> intermediate;
209 throw ProcessError(
"Non-numerical value for intermediate status in node " +
id +
".");
214 throw ProcessError(
"Non-numerical value for number of geometries in node " +
id +
".");
218 for (
int i = 0; i < no_geoms; i++) {
221 throw ProcessError(
"Non-numerical value for x-position in node " +
id +
".");
225 throw ProcessError(
"Non-numerical value for y-position in node " +
id +
".");
229 throw ProcessError(
"Unable to project coordinates for node " +
id +
".");
231 geoms.push_back(pos);
234 if (intermediate == 0) {
252 std::map<std::string, PositionVector>& geoms,
253 std::map<std::string, std::string>& streetNames):
258 myStreetNames(streetNames),
270 if (result[0] ==
'#') {
278 const int NUM_COLUMNS = 25;
281 const int columns[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, MC, 12, 13, 14, 15, 16, 17, 18, 19, 20, MC, MC, -21};
282 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
284 const int columns[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, MC, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -23};
285 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
287 const int columns[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24};
288 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
304 throw ProcessError(
"Non-numerical value for form_of_way of link '" +
id +
"'.");
311 throw ProcessError(
"Non-numerical value for brunnel_type of link '" +
id +
"'.");
318 if (form_of_way == 11) {
320 }
else if (form_of_way > 11) {
324 throw ProcessError(
"Non-numerical value for street_type of link '" +
id +
"').");
335 if (from ==
nullptr) {
336 throw ProcessError(
"The from-node '" + fromID +
"' of link '" +
id +
"' could not be found");
339 throw ProcessError(
"The to-node '" + toID +
"' of link '" +
id +
"' could not be found");
346 throw ProcessError(
"Non-numerical value for the SPEED_RESTRICTION of link '" +
id +
"'.");
357 if (numLanes == -1) {
361 throw ProcessError(
"Non-numerical value for the number of lanes of link '" +
id +
"'.");
368 if (interID ==
"-1") {
369 e =
new NBEdge(
id, from, to,
myTypeCont.
knows(navTeqTypeId) ? navTeqTypeId :
"", speed, numLanes, priority,
379 e =
new NBEdge(
id, from, to,
myTypeCont.
knows(navTeqTypeId) ? navTeqTypeId :
"", speed, numLanes, priority,
397 if (form_of_way == 14) {
402 if (brunnel_type == 10) {
420 if (fallback ==
"") {
431 if (fallback ==
"") {
445 const std::string& regionalID,
const std::string& localID)
const {
446 std::string result =
"";
447 bool hadRegional =
false;
467 const std::string& file) :
482 if (result[0] ==
'#') {
486 const std::string edgeID = st.
get(5);
488 if (edge ==
nullptr) {
489 WRITE_WARNING(
"The traffic light edge '" + edgeID +
"' could not be found");
513 const std::string& file, std::map<std::string, std::string>& streetNames) :
514 myStreetNames(streetNames) {
525 if (result[0] ==
'#') {
529 if (st.
size() == 1) {
532 assert(st.
size() >= 2);
533 const std::string
id = st.
next();
535 const std::string permanent_id_info = st.
next();
548 myConstructionTime(constructionTime),
549 myCS_min(std::numeric_limits<time_t>::max()),
550 myCS_max(std::numeric_limits<time_t>::min()),
551 myConstructionEntries(0),
553 myUnderConstruction(0),
565 if (result[0] ==
'#') {
569 const std::string
id = st.
next();
570 const std::string type = st.
next();
571 const std::string directionOfFlow = st.
next();
572 const std::string throughTraffic = st.
next();
573 const std::string vehicleType = st.
next();
574 const std::string validityPeriod = st.
next();
575 const std::string warning =
"Unrecognized TIME_REC '" + validityPeriod +
"'";
578 if (validityPeriod.size() > 1024) {
587 matched = sscanf(validityPeriod.c_str(),
"[(%[^)]){%[^}]}]", start, duration);
597 if (edge !=
nullptr) {
621 std::ostringstream msg;
622 strftime(buff, 1024,
"%Y-%m-%d", localtime(&
myCS_min));
624 strftime(buff, 1024,
"%Y-%m-%d", localtime(&
myCS_max));
625 msg <<
" and " << buff <<
".\n";
627 msg <<
"Removed " <<
myRemovedEdges <<
" edges not yet constructed at " << buff <<
".\n";
638 int result = fallBack;
639 size_t pos = s.find(prefix);
640 if (pos != std::string::npos) {
641 sscanf(s.substr(pos).c_str(), (prefix +
"%i").c_str(), &result);
650 timeinfo.tm_hour = 0;
653 timeinfo.tm_year = 0;
655 timeinfo.tm_mday = 1;
656 timeinfo.tm_wday = 0;
657 timeinfo.tm_yday = 0;
658 timeinfo.tm_isdst = 0;
665 time_t result = mktime(&timeinfo);
673 timeinfo.tm_hour = 0;
676 timeinfo.tm_wday = 0;
677 timeinfo.tm_yday = 0;
678 timeinfo.tm_isdst = 0;
680 if (yyyymmdd.size() == 10
681 && yyyymmdd[4] ==
'-' 682 && yyyymmdd[7] ==
'-') {
687 return mktime(&timeinfo);
691 WRITE_ERROR(
"Could not parse YYYY-MM-DD date '" + yyyymmdd +
"'");
701 NBEdgeCont& ec,
const std::string& file, time_t constructionTime) :
715 if (result[0] ==
'#') {
725 if (st.
size() == 1) {
729 assert(st.
size() >= 7);
730 const std::string
id = st.
next();
731 const std::string permanent = st.
next();
732 const std::string validityPeriod = st.
next();
733 const std::string throughTraffic = st.
next();
734 const std::string vehicleType = st.
next();
736 WRITE_WARNING(
"Ignoring temporary prohibited manoeuvre (" + validityPeriod +
")");
740 const std::string startEdge = st.
next();
741 const std::string endEdge = st.
get(st.
size() - 1);
744 if (from ==
nullptr) {
745 WRITE_WARNING(
"Ignoring prohibition from unknown start edge '" + startEdge +
"'");
750 WRITE_WARNING(
"Ignoring prohibition from unknown end edge '" + endEdge +
"'");
772 if (result[0] ==
'#') {
776 if (st.
size() == 1) {
779 assert(st.
size() >= 7);
780 const std::string nodeID = st.
next();
781 const std::string vehicleType = st.
next();
782 const std::string fromLaneS = st.
next();
783 const std::string toLaneS = st.
next();
784 const std::string throughTraffic = st.
next();
785 const std::string startEdge = st.
next();
786 const std::string endEdge = st.
get(st.
size() - 1);
789 if (from ==
nullptr) {
790 WRITE_WARNING(
"Ignoring prohibition from unknown start edge '" + startEdge +
"'");
795 WRITE_WARNING(
"Ignoring prohibition from unknown end edge '" + endEdge +
"'");
799 if (fromLane < 0 || fromLane >= from->
getNumLanes()) {
800 WRITE_WARNING(
"Ignoring invalid lane index '" + fromLaneS +
"' in connection from edge '" + startEdge +
"' with " +
toString(from->
getNumLanes()) +
" lanes");
814 const bool warnOnly = st.
size() > 7;
bool report(const std::string &result)
Parsing method.
static const PositionVector EMPTY
empty Vector
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
NBNodeCont & myNodeCont
The node container to get the referenced nodes from.
NBTypeCont & getTypeCont()
Returns a reference to the type container.
bool report(const std::string &result)
Parsing method.
static bool transformCoordinate(Position &from, bool includeInBoundary=true, GeoConvHelper *from_srs=0)
transforms loaded coordinates handles projections, offsets (using GeoConvHelper) and import of height...
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
std::map< std::string, std::string > & myStreetNames
Previously read streat names (non-const because operate[] is more convenient)
static const double UNSPECIFIED_VISIBILITY_DISTANCE
unspecified foe visibility for connections
static double getSpeed(const std::string &id, const std::string &speedClassS)
Returns the speed evaluating the given Navteq-description.
static const int WHITECHARS
identifier for splitting the given string at all whitespace characters
Importer of street names in DLRNavteq's (aka elmar) format.
Importer of nodes stored in unsplit elmar format.
A container for traffic light definitions and built programs.
Retrieves a file linewise and reports the lines to a handler.
void reinit(const Position &position, SumoXMLNodeType type, bool updateEdgeGeometries=false)
Resets initial values.
bool report(const std::string &result)
Parsing method.
NodesHandler(NBNodeCont &nc, const std::string &file, std::map< std::string, PositionVector > &geoms)
Constructor.
The representation of a single edge during network building.
static const std::string UNDEFINED
magic value for undefined stuff
static void loadNetwork(const OptionsCont &oc, NBNetBuilder &nb)
Loads content of the optionally given dlr-navteq (aka Elmar-fomat) folder.
A container for districts.
The base class for traffic light logic definitions.
static void addVehicleClasses(NBEdge &e, const std::string &classS)
Adds vehicle classes parsing the given list of allowed vehicles.
bool report(const std::string &result)
Parsing method.
std::string get(int pos) const
returns the item at the given position
static const double UNSPECIFIED_OFFSET
unspecified lane offset
bool setFile(const std::string &file)
Reinitialises the reader for reading from the given file.
bool report(const std::string &result)
Parsing method.
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
ProhibitionHandler(NBEdgeCont &ne, const std::string &file, time_t constructionTime)
Constructor.
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
NBDistrictCont & myDistrictCont
std::map< std::string, PositionVector > & myGeoms
Previously read edge geometries (manipulated during use)
PositionVector reverse() const
reverse position vector
Imports prohibitions regarding connectivity.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
bool connectionsDone
Whether connection information for this lane is already completed.
const std::string & getID() const
Returns the id.
Importer of street names in DLRNavteq's (aka elmar) format.
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
const SVCPermissions SVCAll
all VClasses are allowed
NBTypeCont & myTypeCont
The type container to retrieve type info from.
Lane & getLaneStruct(int lane)
Importer of traffic lights stored in DLRNavteq's (aka elmar) format.
static const int MISSING_COLUMN
bool report(const std::string &result)
Parsing method.
#define UNUSED_PARAMETER(x)
static const double UNSPECIFIED_WIDTH
unspecified lane width
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
~ConnectedLanesHandler()
Destructor.
The edge has been loaded, nothing is computed yet.
static const double UNSPECIFIED_SPEED
unspecified lane speed
time_t myConstructionTime
The date for which to build the network (in case some edges are still under construction) ...
bool addLane2LaneConnection(int fromLane, NBEdge *dest, int toLane, Lane2LaneInfoType type, bool mayUseSameDestination=false, bool mayDefinitelyPass=false, bool keepClear=true, double contPos=UNSPECIFIED_CONTPOS, double visibility=UNSPECIFIED_VISIBILITY_DISTANCE, double speed=UNSPECIFIED_SPEED, const PositionVector &customShape=PositionVector::EMPTY, const bool uncontrolled=UNSPECIFIED_CONNECTION_UNCONTROLLED)
Adds a connection between the specified this edge's lane and an approached one.
Importer of edges stored in unsplit elmar format.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
static double readVersion(const std::string &line, const std::string &file)
void readAll(LineHandler &lh)
Reads the whole file linewise, reporting every line to the given LineHandler.
bool knows(const std::string &type) const
Returns whether the named type is in the container.
int size() const
returns the number of existing substrings
bool insert(NBEdge *edge, bool ignorePrunning=false)
Adds an edge to the dictionary.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
NamesHandler(const std::string &file, std::map< std::string, std::string > &streetNames)
Constructor.
int size() const
Returns the number of nodes stored in this container.
void addPostProcessConnection(const std::string &from, int fromLane, const std::string &to, int toLane, bool mayDefinitelyPass, bool keepClear, double contPos, double visibility, double speed, const PositionVector &customShape, bool uncontrolled, bool warnOnly)
Adds a connection which could not be set during loading.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter ...
std::string getLaneID(int lane) const
get lane ID
void extract(NBDistrictCont &dc, NBEdge *edge, bool remember=false)
Removes the given edge from the container like erase but does not delete it.
int getNumLanes() const
Returns the number of lanes.
A point in 2D or 3D with translation and scaling methods.
TimeRestrictionsHandler(NBEdgeCont &ec, NBDistrictCont &dc, time_t constructionTime)
Constructor.
int myConstructionEntries
NBEdgeCont & getEdgeCont()
static const double UNSPECIFIED_CONTPOS
unspecified internal junction position
T get(const std::string &str) const
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static time_t readTimeRec(const std::string &start, const std::string &duration)
const std::string & getID() const
std::map< std::string, PositionVector > & myGeoms
A container for parsed geometries.
Storage for edges, including some functionality operating on multiple edges.
const std::string myFile
the file being parsed
#define PROGRESS_BEGIN_MESSAGE(msg)
~NodesHandler()
Destructor.
~TimeRestrictionsHandler()
Destructor.
static int readPrefixedInt(const std::string &s, const std::string &prefix, int fallBack=0)
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
The connection was given by the user.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
vehicle is a passenger car (a "normal" car)
static const int TAB
the ascii index of the tab character
double myVersion
version number of current file
NBEdgeCont & myEdgeCont
The edge container to get the referenced edges from.
static void addVehicleClassesV6(NBEdge &e, const std::string &classS)
same as addVehicleClasses but for version 6+
static std::string to_lower_case(std::string str)
Transfers the content to lower case.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Instance responsible for building networks.
std::string getStreetNameFromIDs(const std::string ®ionalID, const std::string &localID) const
build the street name for the given ids
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
ConnectedLanesHandler(NBEdgeCont &ne)
Constructor.
A storage for options typed value containers)
SumoXMLNodeType getType() const
Returns the type of this node.
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.
std::map< std::string, std::string > & myStreetNames
The container for storing read names.
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)
NBEdgeCont & myEdgeCont
The edge container.
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to.
EdgesHandler(NBNodeCont &nc, NBEdgeCont &ec, NBTypeCont &tc, const std::string &file, std::map< std::string, PositionVector > &geoms, std::map< std::string, std::string > &streetNames)
Constructor.
void declareConnectionsAsLoaded(EdgeBuildingStep step=LANES2LANES_USER)
declares connections as fully loaded. This is needed to avoid recomputing connections if an edge has ...
const Position & getPosition() const
Represents a single node (junction) during network building.
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
void recheckLaneSpread()
Rechecks whether the lane spread is proper.
static int getLaneNumber(const std::string &id, const std::string &laneNoS, double speed)
Returns the lane number evaluating the given Navteq-description.
~TrafficlightsHandler()
Destructor.
Container for nodes during the netbuilding process.
TrafficlightsHandler(NBNodeCont &nc, NBTrafficLightLogicCont &tlc, NBEdgeCont &ne, const std::string &file)
Constructor.
#define PROGRESS_DONE_MESSAGE()
A traffic light logics which must be computed (only nodes/edges are given)
static const std::string GEO_SCALE
scaling factor for geo coordinates (DLRNavteq format uses this to increase floating point precisions)...
static time_t readDate(const std::string &yyyymmdd)
Imports prohibitions regarding connectivity.
#define WRITE_MESSAGE(msg)
NBDistrictCont & getDistrictCont()
Returns a reference the districts container.
~NamesHandler()
Destructor.
~EdgesHandler()
Destructor.
std::vector< int > myColumns
the version number of the edge file being parsed
NBNode * getToNode() const
Returns the destination node of the edge.
void disallowVehicleClass(int lane, SUMOVehicleClass vclass)
set disallowed class for the given lane or for all lanes if -1 is given
~ProhibitionHandler()
Destructor.
SVCPermissions getPermissions(const std::string &type) const
Returns allowed vehicle classes for the given type.
A storage for available types of edges.
std::string getColumn(const StringTokenizer &st, ColumnName name, const std::string fallback="")
bool report(const std::string &result)
Parsing method.