73 if (!oc.
isSet(
"dlr-navteq-prefix")) {
81 std::map<std::string, PositionVector> myGeoms;
83 std::string file = oc.
getString(
"dlr-navteq-prefix") +
"_nodes_unsplitted.txt";
86 throw ProcessError(
"The file '" + file +
"' could not be opened.");
92 std::map<std::string, std::string> streetNames;
93 if (oc.
getBool(
"output.street-names")) {
94 file = oc.
getString(
"dlr-navteq-prefix") +
"_names.txt";
101 WRITE_WARNING(
"Output will not contain street names because the file '" + file +
"' was not found");
107 file = oc.
getString(
"dlr-navteq-prefix") +
"_links_unsplitted.txt";
111 throw ProcessError(
"The file '" + file +
"' could not be opened.");
118 file = oc.
getString(
"dlr-navteq-prefix") +
"_traffic_signals.txt";
127 file = oc.
getString(
"dlr-navteq-prefix") +
"_prohibited_manoeuvres.txt";
136 file = oc.
getString(
"dlr-navteq-prefix") +
"_connected_lanes.txt";
145 file = oc.
getString(
"dlr-navteq-prefix") +
"_links_timerestrictions.txt";
148 if (!oc.
isDefault(
"construction-date")) {
153 handler5.printSummary();
160 assert(line[0] ==
'#');
161 const std::string marker =
"extraction version: v";
163 if (lowerCase.find(marker) == std::string::npos) {
166 const int vStart = (int)(lowerCase.find(marker) + marker.size());
167 const int vEnd = (int)line.find(
" ", vStart);
171 throw ProcessError(
"Invalid version number '" +
toString(version) +
"' in file '" + file +
"'.");
175 throw ProcessError(
"Non-numerical value '" + line.substr(vStart, vEnd - vStart) +
"' for version string in file '" + file +
"'.");
184 const std::string& file,
185 std::map<std::string, PositionVector>& geoms)
186 : myNodeCont(nc), myGeoms(geoms) {
196 if (result[0] ==
'#') {
201 int no_geoms, intermediate;
203 std::istringstream stream(result);
207 throw ProcessError(
"Something is wrong with the following data line\n" + result);
210 stream >> intermediate;
215 throw ProcessError(
"Non-numerical value for intermediate status in node " +
id +
".");
220 throw ProcessError(
"Non-numerical value for number of geometries in node " +
id +
".");
224 for (
int i = 0; i < no_geoms; i++) {
227 throw ProcessError(
"Non-numerical value for x-position in node " +
id +
".");
231 throw ProcessError(
"Non-numerical value for y-position in node " +
id +
".");
235 throw ProcessError(
"Unable to project coordinates for node " +
id +
".");
237 geoms.push_back(pos);
240 if (intermediate == 0) {
258 std::map<std::string, PositionVector>& geoms,
259 std::map<std::string, std::string>& streetNames):
264 myStreetNames(streetNames),
276 if (result[0] ==
'#') {
284 const int NUM_COLUMNS = 25;
287 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};
288 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
290 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};
291 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
293 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};
294 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
310 throw ProcessError(
"Non-numerical value for form_of_way of link '" +
id +
"'.");
317 throw ProcessError(
"Non-numerical value for brunnel_type of link '" +
id +
"'.");
324 if (form_of_way == 11) {
326 }
else if (form_of_way > 11) {
330 throw ProcessError(
"Non-numerical value for street_type of link '" +
id +
"').");
342 throw ProcessError(
"The from-node '" + fromID +
"' of link '" +
id +
"' could not be found");
345 throw ProcessError(
"The to-node '" + toID +
"' of link '" +
id +
"' could not be found");
352 throw ProcessError(
"Non-numerical value for the SPEED_RESTRICTION of link '" +
id +
"'.");
363 if (numLanes == -1) {
367 throw ProcessError(
"Non-numerical value for the number of lanes of link '" +
id +
"'.");
372 if (interID ==
"-1") {
373 e =
new NBEdge(
id, from, to,
"", speed, numLanes, priority,
383 e =
new NBEdge(
id, from, to,
"", speed, numLanes, priority,
403 if (form_of_way == 14) {
408 if (brunnel_type == 10) {
426 if (fallback ==
"") {
437 if (fallback ==
"") {
451 const std::string& regionalID,
const std::string& localID)
const {
452 std::string result =
"";
453 bool hadRegional =
false;
473 const std::string& file) :
488 if (result[0] ==
'#') {
492 const std::string edgeID = st.
get(5);
495 WRITE_WARNING(
"The traffic light edge '" + edgeID +
"' could not be found");
519 const std::string& file, std::map<std::string, std::string>& streetNames) :
520 myStreetNames(streetNames) {
531 if (result[0] ==
'#') {
535 if (st.
size() == 1) {
538 assert(st.
size() >= 2);
539 const std::string
id = st.
next();
541 const std::string permanent_id_info = st.
next();
554 myConstructionTime(constructionTime),
555 myCS_min(std::numeric_limits<time_t>::max()),
556 myCS_max(std::numeric_limits<time_t>::min()),
557 myConstructionEntries(0),
559 myUnderConstruction(0),
571 if (result[0] ==
'#') {
575 const std::string
id = st.
next();
576 const std::string type = st.
next();
577 const std::string directionOfFlow = st.
next();
578 const std::string throughTraffic = st.
next();
579 const std::string vehicleType = st.
next();
580 const std::string validityPeriod = st.
next();
581 const std::string warning =
"Unrecognized TIME_REC '" + validityPeriod +
"'";
584 if (validityPeriod.size() > 1024) {
593 matched = sscanf(validityPeriod.c_str(),
"[(%[^)]){%[^}]}]", start, duration);
627 std::ostringstream msg;
628 strftime(buff, 1024,
"%Y-%m-%d", localtime(&
myCS_min));
630 strftime(buff, 1024,
"%Y-%m-%d", localtime(&
myCS_max));
631 msg <<
" and " << buff <<
".\n";
633 msg <<
"Removed " <<
myRemovedEdges <<
" edges not yet constructed at " << buff <<
".\n";
644 int result = fallBack;
645 size_t pos = s.find(prefix);
646 if (pos != std::string::npos) {
647 sscanf(s.substr(pos).c_str(), (prefix +
"%i").c_str(), &result);
656 timeinfo.tm_hour = 0;
659 timeinfo.tm_year = 0;
661 timeinfo.tm_mday = 1;
662 timeinfo.tm_wday = 0;
663 timeinfo.tm_yday = 0;
664 timeinfo.tm_isdst = 0;
671 time_t result = mktime(&timeinfo);
679 timeinfo.tm_hour = 0;
682 timeinfo.tm_wday = 0;
683 timeinfo.tm_yday = 0;
684 timeinfo.tm_isdst = 0;
686 if (yyyymmdd.size() == 10
687 && yyyymmdd[4] ==
'-' 688 && yyyymmdd[7] ==
'-') {
693 return mktime(&timeinfo);
697 WRITE_ERROR(
"Could not parse YYYY-MM-DD date '" + yyyymmdd +
"'");
707 NBEdgeCont& ec,
const std::string& file, time_t constructionTime) :
721 if (result[0] ==
'#') {
731 if (st.
size() == 1) {
735 assert(st.
size() >= 7);
736 const std::string
id = st.
next();
737 const std::string permanent = st.
next();
738 const std::string validityPeriod = st.
next();
739 const std::string throughTraffic = st.
next();
740 const std::string vehicleType = st.
next();
742 WRITE_WARNING(
"Ignoring temporary prohibited manoeuvre (" + validityPeriod +
")");
746 const std::string startEdge = st.
next();
747 const std::string endEdge = st.
get(st.
size() - 1);
751 WRITE_WARNING(
"Ignoring prohibition from unknown start edge '" + startEdge +
"'");
756 WRITE_WARNING(
"Ignoring prohibition from unknown end edge '" + endEdge +
"'");
778 if (result[0] ==
'#') {
782 if (st.
size() == 1) {
785 assert(st.
size() >= 7);
786 const std::string nodeID = st.
next();
787 const std::string vehicleType = st.
next();
788 const std::string fromLaneS = st.
next();
789 const std::string toLaneS = st.
next();
790 const std::string throughTraffic = st.
next();
791 const std::string startEdge = st.
next();
792 const std::string endEdge = st.
get(st.
size() - 1);
796 WRITE_WARNING(
"Ignoring prohibition from unknown start edge '" + startEdge +
"'");
801 WRITE_WARNING(
"Ignoring prohibition from unknown end edge '" + endEdge +
"'");
805 if (fromLane < 0 || fromLane >= from->
getNumLanes()) {
806 WRITE_WARNING(
"Ignoring invalid lane index '" + fromLaneS +
"' in connection from edge '" + startEdge +
"' with " +
toString(from->
getNumLanes()) +
" lanes");
820 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.
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::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
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.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
The representation of a single edge during network building.
static const 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.
static const double UNSPECIFIED_OFFSET
unspecified lane offset
void removeFromConnections(NBEdge *toEdge, int fromLane=-1, int toLane=-1, bool tryLater=false, const bool adaptToLaneRemoval=false)
Removes the specified connection(s)
bool 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)
Imports prohibitions regarding connectivity.
bool connectionsDone
Whether connection information for this lane is already completed.
Importer of street names in DLRNavteq's (aka elmar) format.
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.
PositionVector reverse() const
reverse position vector
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) ...
Importer of edges stored in unsplit elmar format.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
const std::string & getID() const
Returns the id.
static double readVersion(const std::string &line, const std::string &file)
const Position & getPosition() const
void readAll(LineHandler &lh)
Reads the whole file linewise, reporting every line to the given LineHandler.
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.
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
void extract(NBDistrictCont &dc, NBEdge *edge, bool remember=false)
Removes the given edge from the container like erase but does not delete it.
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
static int _str2int(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter...
SumoXMLNodeType getType() const
Returns the type of this node.
static time_t readTimeRec(const std::string &start, const std::string &duration)
int getNumLanes() const
Returns the number of lanes.
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)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
bool knows(const std::string &type) const
Returns whether the named type is in the container.
The connection was given by the user.
vehicle is a passenger car (a "normal" car)
double myVersion
version number of current file
std::string getStreetNameFromIDs(const std::string ®ionalID, const std::string &localID) const
build the street name for the given ids
NBEdgeCont & myEdgeCont
The edge container to get the referenced edges from.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
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.
static int _2int(const E *const data)
converts a char-type array into the integer value described by it
NBNode * getToNode() const
Returns the destination node of the edge.
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)
Adds a connection between the specified this edge's lane and an approached one.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
NBNodeCont & getNodeCont()
Returns a reference to the node container.
Instance responsible for building networks.
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 warnOnly=false)
Adds a connection which could not be set during loading.
ConnectedLanesHandler(NBEdgeCont &ne)
Constructor.
std::string get(int pos) const
A storage for options typed value containers)
static double _2double(const E *const data)
converts a char-type array into the double value described by it
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.
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 ...
Represents a single node (junction) during network building.
T get(const std::string &str) const
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.
int size() const
Returns the number of nodes stored in this container.
std::string getLaneID(int lane) const
get Lane ID (Secure)
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
SVCPermissions getPermissions(const std::string &type) const
Returns allowed vehicle classes for the given type.
Container for nodes during the netbuilding process.
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
void disallowVehicleClass(int lane, SUMOVehicleClass vclass)
set disallowed class for the given lane or for all lanes if -1 is given
~ProhibitionHandler()
Destructor.
A storage for available types of edges.
std::string getColumn(const StringTokenizer &st, ColumnName name, const std::string fallback="")
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
bool report(const std::string &result)
Parsing method.