diff --git a/src/cppgtfs b/src/cppgtfs index 192272f..69071e2 160000 --- a/src/cppgtfs +++ b/src/cppgtfs @@ -1 +1 @@ -Subproject commit 192272f4ab542e75ffad9b545be5cc68e5599828 +Subproject commit 69071e2fef12ceaea224a4d9c9aa980f7ab9cf05 diff --git a/src/pfaedle/PfaedleMain.cpp b/src/pfaedle/PfaedleMain.cpp index a8d1a41..c9305df 100644 --- a/src/pfaedle/PfaedleMain.cpp +++ b/src/pfaedle/PfaedleMain.cpp @@ -442,8 +442,25 @@ int main(int argc, char** argv) { // _____________________________________________________________________________ std::string getFileNameMotStr(const MOTs& mots) { + MOTs tmp = mots; std::string motStr; - for (const auto& mot : mots) { + + std::string names[11] = {"tram", "subway", "rail", "bus", + "ferry", "cablecar", "gondola", "funicular", + "coach", "trolleybus", "monorail"}; + + for (const auto& n : names) { + const auto& types = ad::cppgtfs::gtfs::flat::Route::getTypesFromString(n); + const auto& isect = pfaedle::router::motISect(tmp, types); + + if (isect.size() == types.size()) { + if (motStr.size()) motStr += "-"; + motStr += n; + for (const auto& mot : isect) tmp.erase(mot); + } + } + + for (const auto& mot : tmp) { if (motStr.size()) motStr += "-"; motStr += ad::cppgtfs::gtfs::flat::Route::getTypeString(mot); } diff --git a/src/pfaedle/router/Misc.h b/src/pfaedle/router/Misc.h index 34b1cfe..f6fc197 100644 --- a/src/pfaedle/router/Misc.h +++ b/src/pfaedle/router/Misc.h @@ -9,6 +9,7 @@ #include #include #include + #include "ad/cppgtfs/gtfs/Feed.h" #include "ad/cppgtfs/gtfs/Route.h" #include "pfaedle/gtfs/Feed.h" @@ -148,9 +149,27 @@ inline pfaedle::router::FeedStops writeMotStops(const pfaedle::gtfs::Feed* feed, // _____________________________________________________________________________ inline std::string getMotStr(const MOTs& mots) { + MOTs tmp = mots; bool first = false; std::string motStr; - for (const auto& mot : mots) { + + std::string names[11] = {"tram", "subway", "rail", "bus", + "ferry", "cablecar", "gondola", "funicular", + "coach", "trolleybus", "monorail"}; + + for (const auto& n : names) { + const auto& types = ad::cppgtfs::gtfs::flat::Route::getTypesFromString(n); + const auto& isect = motISect(tmp, types); + + if (isect.size() == types.size()) { + if (first) motStr += ", "; + motStr += "{" + n + "}"; + first = true; + for (const auto& mot : isect) tmp.erase(mot); + } + } + + for (const auto& mot : tmp) { if (first) motStr += ", "; motStr += "<" + ad::cppgtfs::gtfs::flat::Route::getTypeString(mot) + ">"; first = true;