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());
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 (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();