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;
161 if (myNodeCont.size() == 0) {
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 +
".");
189 if (intermediate == 0) {
191 if (!myNodeCont.insert(n)) {
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] ==
'#') {
225 if (!myColumns.empty()) {
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);
238 throw ProcessError(
"Invalid version number '" +
toString(myVersion) +
"' in file '" + myFile +
"'.");
241 const size_t NUM_COLUMNS = 25;
242 const int MC = MISSING_COLUMN;
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);
246 }
else if (myVersion < 6) {
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 +
"'.");
258 if (myColumns.empty()) {
259 throw ProcessError(
"Missing version string in file '" + myFile +
"'.");
263 const std::string
id = getColumn(st, LINK_ID);
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 +
"').");
285 std::string streetName = getStreetNameFromIDs(
286 getColumn(st, NAME_ID1_REGIONAL),
287 getColumn(st, NAME_ID2_LOCAL));
289 const std::string fromID = getColumn(st, NODE_ID_FROM);
290 const std::string toID = getColumn(st, NODE_ID_TO);
291 NBNode* from = myNodeCont.retrieve(fromID);
292 NBNode* to = myNodeCont.retrieve(toID);
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 +
"'.");
314 numLanes =
TplConvert::_2int(getColumn(st, EXTENDED_NUMBER_OF_LANES,
"-1").c_str());
315 if (numLanes == -1) {
319 throw ProcessError(
"Non-numerical value for the number of lanes of link '" +
id +
"'.");
323 const std::string interID = getColumn(st, BETWEEN_NODE_ID);
324 if (interID ==
"-1") {
325 e =
new NBEdge(
id, from, to,
"", speed, numLanes, priority,
329 if (getColumn(st, CONNECTION,
"0") ==
"1") {
334 e =
new NBEdge(
id, from, to,
"", speed, numLanes, priority,
338 if (myVersion < 6.0) {
344 if (form_of_way == 14) {
349 if (!myEdgeCont.insert(e)) {
359 assert(!myColumns.empty());
360 if (myColumns[name] == MISSING_COLUMN) {
361 if (fallback ==
"") {
366 }
else if (myColumns[name] >= 0) {
367 return st.
get((
size_t)(myColumns[name]));
370 if ((
int) st.
size() <= -myColumns[name]) {
372 if (fallback ==
"") {
378 return st.
get((
size_t)(-myColumns[name]));
386 const std::string& regionalID,
const std::string& localID)
const {
387 std::string result =
"";
388 bool hadRegional =
false;
389 if (myStreetNames.count(regionalID) > 0) {
391 result += myStreetNames[regionalID];
393 if (myStreetNames.count(localID) > 0) {
397 result += myStreetNames[localID];
408 const std::string& file) :
423 if (result[0] ==
'#') {
427 const std::string edgeID = st.
get(5);
428 NBEdge* edge = myEdgeCont.retrieve(edgeID);
430 WRITE_WARNING(
"The traffic light edge '" + edgeID +
"' could not be found");
439 if (!myTLLogicCont.insert(tlDef)) {
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.
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...
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.
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.
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.
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.
void push_front(const Position &p)
Puts the given position at the front of the list.
SumoXMLNodeType getType() const
Returns the type of this node.
Storage for edges, including some functionality operating on multiple edges.
#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.
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
T get(const std::string &str)
static void addVehicleClassesV6(NBEdge &e, const std::string &classS)
same as addVehicleClasses but for version 6+
void push_back(const PositionVector &p)
Appends all positions from the given vector.
static int _2int(const E *const data)
NBNode * getToNode() const
Returns the destination node of the edge.
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)
NBTrafficLightLogicCont & getTLLogicCont()
Returns the traffic light logics container.
Represents a single node (junction) during network building.
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)...
void recheckLaneSpread()
Rechecks whether the lane spread is proper.
~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)
~NamesHandler()
Destructor.
~EdgesHandler()
Destructor.
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.