58 #ifdef CHECK_MEMORY_LEAKS 60 #endif // CHECK_MEMORY_LEAKS 77 if (!oc.
isSet(
"dlr-navteq-prefix")) {
83 std::map<std::string, PositionVector> myGeoms;
85 std::string file = oc.
getString(
"dlr-navteq-prefix") +
"_nodes_unsplitted.txt";
88 throw ProcessError(
"The file '" + file +
"' could not be opened.");
94 std::map<std::string, std::string> streetNames;
95 if (oc.
getBool(
"output.street-names")) {
96 file = oc.
getString(
"dlr-navteq-prefix") +
"_names.txt";
103 WRITE_WARNING(
"Output will not contain street names because the file '" + file +
"' was not found");
109 file = oc.
getString(
"dlr-navteq-prefix") +
"_links_unsplitted.txt";
113 throw ProcessError(
"The file '" + file +
"' could not be opened.");
120 file = oc.
getString(
"dlr-navteq-prefix") +
"_traffic_signals.txt";
129 file = oc.
getString(
"dlr-navteq-prefix") +
"_links_timerestrictions.txt";
134 if (!oc.
isDefault(
"construction-date")) {
139 handler5.printSummary();
149 const std::string& file,
150 std::map<std::string, PositionVector>& geoms)
151 : myNodeCont(nc), myGeoms(geoms) {
161 if (result[0] ==
'#') {
166 int no_geoms, intermediate;
168 std::istringstream stream(result);
172 throw ProcessError(
"Something is wrong with the following data line\n" + result);
175 stream >> intermediate;
180 throw ProcessError(
"Non-numerical value for intermediate status in node " +
id +
".");
185 throw ProcessError(
"Non-numerical value for number of geometries in node " +
id +
".");
189 for (
int i = 0; i < no_geoms; i++) {
192 throw ProcessError(
"Non-numerical value for x-position in node " +
id +
".");
196 throw ProcessError(
"Non-numerical value for y-position in node " +
id +
".");
200 throw ProcessError(
"Unable to project coordinates for node " +
id +
".");
202 geoms.push_back(pos);
205 if (intermediate == 0) {
223 std::map<std::string, PositionVector>& geoms,
224 std::map<std::string, std::string>& streetNames):
229 myStreetNames(streetNames),
241 if (result[0] ==
'#') {
245 const std::string marker =
"extraction version: v";
247 if (lowerCase.find(marker) == std::string::npos) {
250 const int vStart = (int)(lowerCase.find(marker) + marker.size());
251 const int vEnd = (int)result.find(
" ", vStart);
258 const int NUM_COLUMNS = 25;
261 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};
262 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
264 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};
265 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
267 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};
268 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
271 throw ProcessError(
"Non-numerical value '" + result.substr(vStart, vEnd - vStart) +
"' for version string in file '" +
myFile +
"'.");
286 throw ProcessError(
"Non-numerical value for form_of_way of link '" +
id +
"'.");
293 throw ProcessError(
"Non-numerical value for brunnel_type of link '" +
id +
"'.");
300 if (form_of_way == 11) {
302 }
else if (form_of_way > 11) {
306 throw ProcessError(
"Non-numerical value for street_type of link '" +
id +
"').");
318 throw ProcessError(
"The from-node '" + fromID +
"' of link '" +
id +
"' could not be found");
321 throw ProcessError(
"The to-node '" + toID +
"' of link '" +
id +
"' could not be found");
328 throw ProcessError(
"Non-numerical value for the SPEED_RESTRICTION of link '" +
id +
"'.");
339 if (numLanes == -1) {
343 throw ProcessError(
"Non-numerical value for the number of lanes of link '" +
id +
"'.");
348 if (interID ==
"-1") {
349 e =
new NBEdge(
id, from, to,
"", speed, numLanes, priority,
358 e =
new NBEdge(
id, from, to,
"", speed, numLanes, priority,
378 if (form_of_way == 14) {
383 if (brunnel_type == 10) {
401 if (fallback ==
"") {
412 if (fallback ==
"") {
426 const std::string& regionalID,
const std::string& localID)
const {
427 std::string result =
"";
428 bool hadRegional =
false;
448 const std::string& file) :
463 if (result[0] ==
'#') {
467 const std::string edgeID = st.
get(5);
470 WRITE_WARNING(
"The traffic light edge '" + edgeID +
"' could not be found");
494 const std::string& file, std::map<std::string, std::string>& streetNames) :
495 myStreetNames(streetNames) {
506 if (result[0] ==
'#') {
510 if (st.
size() == 1) {
513 assert(st.
size() >= 2);
514 const std::string
id = st.
next();
516 const std::string permanent_id_info = st.
next();
529 myConstructionTime(constructionTime),
530 myCS_min(std::numeric_limits<time_t>::
max()),
531 myCS_max(std::numeric_limits<time_t>::
min()),
532 myConstructionEntries(0),
534 myUnderConstruction(0),
546 if (result[0] ==
'#') {
550 const std::string
id = st.
next();
551 const std::string type = st.
next();
552 const std::string directionOfFlow = st.
next();
553 const std::string throughTraffic = st.
next();
554 const std::string vehicleType = st.
next();
555 const std::string validityPeriod = st.
next();
556 const std::string warning =
"Unrecognized TIME_REC '" + validityPeriod +
"'";
559 if (validityPeriod.size() > 1024) {
568 matched = sscanf(validityPeriod.c_str(),
"[(%[^)]){%[^}]}]", start, duration);
602 std::ostringstream msg;
603 strftime(buff, 1024,
"%Y-%m-%d", localtime(&
myCS_min));
605 strftime(buff, 1024,
"%Y-%m-%d", localtime(&
myCS_max));
606 msg <<
" and " << buff <<
".\n";
608 msg <<
"Removed " <<
myRemovedEdges <<
" edges not yet constructed at " << buff <<
".\n";
619 int result = fallBack;
620 size_t pos = s.find(prefix);
621 if (pos != std::string::npos) {
622 sscanf(s.substr(pos).c_str(), (prefix +
"%i").c_str(), &result);
631 timeinfo.tm_hour = 0;
634 timeinfo.tm_year = 0;
636 timeinfo.tm_mday = 1;
637 timeinfo.tm_wday = 0;
638 timeinfo.tm_yday = 0;
639 timeinfo.tm_isdst = 0;
646 time_t result = mktime(&timeinfo);
654 timeinfo.tm_hour = 0;
657 timeinfo.tm_wday = 0;
658 timeinfo.tm_yday = 0;
659 timeinfo.tm_isdst = 0;
661 if (yyyymmdd.size() == 10
662 && yyyymmdd[4] ==
'-' 663 && yyyymmdd[7] ==
'-') {
668 return mktime(&timeinfo);
672 WRITE_ERROR(
"Could not parse YYYY-MM-DD date '" + yyyymmdd +
"'");
bool report(const std::string &result)
Parsing method.
NBNodeCont & myNodeCont
The node container to get the referenced nodes from.
static const SUMOReal UNSPECIFIED_WIDTH
unspecified lane width
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 SUMOReal _2SUMOReal(const E *const data)
converts a char-type array into the SUMOReal value described by it
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 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.
bool setFile(const std::string &file)
Reinitialises the reader for reading from the given file.
void setPermissions(SVCPermissions permissions, int lane=-1)
set allowed/disallowed classes for the given lane or for all lanes if -1 is given ...
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)
Importer of street names in DLRNavteq's (aka elmar) format.
const SVCPermissions SVCAll
NBTypeCont & myTypeCont
The type container to retrieve type info from.
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
Importer of traffic lights stored in DLRNavteq's (aka elmar) format.
static const int MISSING_COLUMN
#define UNUSED_PARAMETER(x)
#define WRITE_WARNING(msg)
static OptionsCont & getOptions()
Retrieves the options.
PositionVector reverse() const
reverse position vector
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.
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)
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 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)
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.
vehicle is a passenger car (a "normal" car)
static SUMOReal getSpeed(const std::string &id, const std::string &speedClassS)
Returns the speed evaluating the given Navteq-description.
SUMOReal 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.
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.
std::string get(int pos) const
A storage for options typed value containers)
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.
Represents a single node (junction) during network building.
T get(const std::string &str) const
static const int GEO_SCALE
scaling factor for geo coordinates (DLRNavteq format uses this to increase floating point precisions)...
bool insert(NBTrafficLightDefinition *logic, bool forceInsert=false)
Adds a logic definition to the dictionary.
void recheckLaneSpread()
Rechecks whether the lane spread is proper.
~TrafficlightsHandler()
Destructor.
int size() const
Returns the number of nodes stored in this container.
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 time_t readDate(const std::string &yyyymmdd)
#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
A storage for available types of edges.
static int getLaneNumber(const std::string &id, const std::string &laneNoS, SUMOReal speed)
Returns the lane number evaluating the given Navteq-description.
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.