use new cppgtfs version, adjust motToStr methods to handle sets of MOTs
This commit is contained in:
parent
16a8f3fcad
commit
43904f2346
3 changed files with 39 additions and 3 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 192272f4ab542e75ffad9b545be5cc68e5599828
|
Subproject commit 69071e2fef12ceaea224a4d9c9aa980f7ab9cf05
|
|
@ -442,8 +442,25 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
// _____________________________________________________________________________
|
// _____________________________________________________________________________
|
||||||
std::string getFileNameMotStr(const MOTs& mots) {
|
std::string getFileNameMotStr(const MOTs& mots) {
|
||||||
|
MOTs tmp = mots;
|
||||||
std::string motStr;
|
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 += "-";
|
if (motStr.size()) motStr += "-";
|
||||||
motStr += ad::cppgtfs::gtfs::flat::Route::getTypeString(mot);
|
motStr += ad::cppgtfs::gtfs::flat::Route::getTypeString(mot);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "ad/cppgtfs/gtfs/Feed.h"
|
#include "ad/cppgtfs/gtfs/Feed.h"
|
||||||
#include "ad/cppgtfs/gtfs/Route.h"
|
#include "ad/cppgtfs/gtfs/Route.h"
|
||||||
#include "pfaedle/gtfs/Feed.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) {
|
inline std::string getMotStr(const MOTs& mots) {
|
||||||
|
MOTs tmp = mots;
|
||||||
bool first = false;
|
bool first = false;
|
||||||
std::string motStr;
|
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 += ", ";
|
if (first) motStr += ", ";
|
||||||
motStr += "<" + ad::cppgtfs::gtfs::flat::Route::getTypeString(mot) + ">";
|
motStr += "<" + ad::cppgtfs::gtfs::flat::Route::getTypeString(mot) + ">";
|
||||||
first = true;
|
first = true;
|
||||||
|
|
Loading…
Reference in a new issue