57 #ifdef CHECK_MEMORY_LEAKS 59 #endif // CHECK_MEMORY_LEAKS 76 if (!oc.
isSet(
"dlr-navteq-prefix")) {
82 std::map<std::string, PositionVector> myGeoms;
84 std::string file = oc.
getString(
"dlr-navteq-prefix") +
"_nodes_unsplitted.txt";
87 throw ProcessError(
"The file '" + file +
"' could not be opened.");
93 std::map<std::string, std::string> streetNames;
94 if (oc.
getBool(
"output.street-names")) {
95 file = oc.
getString(
"dlr-navteq-prefix") +
"_names.txt";
102 WRITE_WARNING(
"Output will not contain street names because the file '" + file +
"' was not found");
108 file = oc.
getString(
"dlr-navteq-prefix") +
"_links_unsplitted.txt";
112 throw ProcessError(
"The file '" + file +
"' could not be opened.");
119 file = oc.
getString(
"dlr-navteq-prefix") +
"_traffic_signals.txt";
133 const std::string& file,
134 std::map<std::string, PositionVector>& geoms)
135 : myNodeCont(nc), myGeoms(geoms) {
145 if (result[0] ==
'#') {
150 int no_geoms, intermediate;
152 std::istringstream stream(result);
156 throw ProcessError(
"Something is wrong with the following data line\n" + result);
159 stream >> intermediate;
164 throw ProcessError(
"Non-numerical value for intermediate status in node " +
id +
".");
169 throw ProcessError(
"Non-numerical value for number of geometries in node " +
id +
".");
173 for (
int i = 0; i < no_geoms; i++) {
176 throw ProcessError(
"Non-numerical value for x-position in node " +
id +
".");
180 throw ProcessError(
"Non-numerical value for y-position in node " +
id +
".");
184 throw ProcessError(
"Unable to project coordinates for node " +
id +
".");
186 geoms.push_back(pos);
189 if (intermediate == 0) {
206 const std::string& file,
207 std::map<std::string, PositionVector>& geoms,
208 std::map<std::string, std::string>& streetNames):
212 myStreetNames(streetNames),
224 if (result[0] ==
'#') {
228 const std::string marker =
"Extraction version: V";
229 size_t vStart = result.find(marker);
230 if (vStart == std::string::npos) {
233 vStart += marker.size();
234 const size_t vEnd = result.find(
" ", vStart);
241 const size_t NUM_COLUMNS = 25;
244 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};
245 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
247 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};
248 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
250 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};
251 myColumns = std::vector<int>(columns, columns + NUM_COLUMNS);
254 throw ProcessError(
"Non-numerical value for version string in file '" +
myFile +
"'.");
269 throw ProcessError(
"Non-numerical value for form_of_way of link '" +
id +
"'.");
276 if (form_of_way == 11) {
278 }
else if (form_of_way > 11) {
282 throw ProcessError(
"Non-numerical value for street_type of link '" +
id +
"').");
294 throw ProcessError(
"The from-node '" + fromID +
"' of link '" +
id +
"' could not be found");
297 throw ProcessError(
"The to-node '" + toID +
"' of link '" +
id +
"' could not be found");
304 throw ProcessError(
"Non-numerical value for the SPEED_RESTRICTION of link '" +
id +
"'.");
315 if (numLanes == -1) {
319 throw ProcessError(
"Non-numerical value for the number of lanes of link '" +
id +
"'.");
324 if (interID ==
"-1") {
325 e =
new NBEdge(
id, from, to,
"", speed, numLanes, priority,
334 e =
new NBEdge(
id, from, to,
"", speed, numLanes, priority,
344 if (form_of_way == 14) {
361 if (fallback ==
"") {
372 if (fallback ==
"") {
386 const std::string& regionalID,
const std::string& localID)
const {
387 std::string result =
"";
388 bool hadRegional =
false;
408 const std::string& file) :
423 if (result[0] ==
'#') {
427 const std::string edgeID = st.
get(5);
430 WRITE_WARNING(
"The traffic light edge '" + edgeID +
"' could not be found");
454 const std::string& file, std::map<std::string, std::string>& streetNames) :
455 myStreetNames(streetNames) {
466 if (result[0] ==
'#') {
470 if (st.
size() == 1) {
473 assert(st.
size() >= 2);
474 const std::string
id = st.
next();
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
bool report(const std::string &result)
Parsing method.
static bool transformCoordinates(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)
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.
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 setFile(const std::string &file)
Reinitialises the reader for reading from the given file.
NBEdgeCont & myEdgeCont
The edge container to store loaded edges into.
std::map< std::string, PositionVector > & myGeoms
Previously read edge geometries (manipulated during use)
static const SUMOReal UNSPECIFIED_OFFSET
unspecified lane offset
std::string get(size_t pos) const
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
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.
unsigned int size() const
Returns the number of known nodes.
const Position & getPosition() const
Returns the position of this node.
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.
NamesHandler(const std::string &file, std::map< std::string, std::string > &streetNames)
Constructor.
static StringBijection< TrafficLightType > TrafficLightTypes
A point in 2D or 3D with translation and scaling methods.
NBEdgeCont & getEdgeCont()
Returns the edge container.
SumoXMLNodeType getType() const
Returns the type of this node.
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.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
vehicle is a passenger car (a "normal" car)
static unsigned int getLaneNumber(const std::string &id, const std::string &laneNoS, SUMOReal speed)
Returns the lane number evaluating the given Navteq-description.
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::vector< std::string > getVector()
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.
static void addVehicleClassesV6(NBEdge &e, const std::string &classS)
same as addVehicleClasses but for version 6+
static int _2int(const E *const data)
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.
EdgesHandler(NBNodeCont &nc, NBEdgeCont &ec, const std::string &file, std::map< std::string, PositionVector > &geoms, std::map< std::string, std::string > &streetNames)
Constructor.
NBNodeCont & getNodeCont()
Returns the node container.
Instance responsible for building networks.
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 the traffic light logics container.
std::map< std::string, std::string > & myStreetNames
The container for storing read names.
NBTrafficLightLogicCont & myTLLogicCont
The traffic lights container to add built tls to.
Represents a single node (junction) during network building.
T get(const std::string &str) const
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
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.
NBNode * retrieve(const std::string &id) const
Returns the node with the given name.
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)
~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
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.