diff --git a/src/cppgtfs b/src/cppgtfs index d79469f..35ab19c 160000 --- a/src/cppgtfs +++ b/src/cppgtfs @@ -1 +1 @@ -Subproject commit d79469fa692d52cae56f5e797561451edcf3016a +Subproject commit 35ab19c313f96fec649fd0cb31c42d281f2c3b6e diff --git a/src/pfaedle/gtfs/Feed.h b/src/pfaedle/gtfs/Feed.h index f640760..b6a04b9 100644 --- a/src/pfaedle/gtfs/Feed.h +++ b/src/pfaedle/gtfs/Feed.h @@ -23,10 +23,12 @@ namespace gtfs { typedef ad::cppgtfs::gtfs::FeedB< ad::cppgtfs::gtfs::Agency, ad::cppgtfs::gtfs::Route, ad::cppgtfs::gtfs::Stop, Service, StopTime, Shape, ad::cppgtfs::gtfs::Fare, - ad::cppgtfs::gtfs::Level, ad::cppgtfs::gtfs::Container, - ad::cppgtfs::gtfs::Container, ad::cppgtfs::gtfs::NullContainer, - ad::cppgtfs::gtfs::ContContainer, ad::cppgtfs::gtfs::ContContainer, - ShapeContainer, ad::cppgtfs::gtfs::Container, ad::cppgtfs::gtfs::Container> + ad::cppgtfs::gtfs::Level, ad::cppgtfs::gtfs::Pathway, + ad::cppgtfs::gtfs::Container, ad::cppgtfs::gtfs::Container, + ad::cppgtfs::gtfs::NullContainer, ad::cppgtfs::gtfs::ContContainer, + ad::cppgtfs::gtfs::ContContainer, ShapeContainer, + ad::cppgtfs::gtfs::Container, ad::cppgtfs::gtfs::Container, + ad::cppgtfs::gtfs::Container> Feed; typedef ad::cppgtfs::gtfs::TripB, Service, ad::cppgtfs::gtfs::Route, Shape> diff --git a/src/pfaedle/gtfs/StopTime.h b/src/pfaedle/gtfs/StopTime.h index b8a45b1..db03334 100644 --- a/src/pfaedle/gtfs/StopTime.h +++ b/src/pfaedle/gtfs/StopTime.h @@ -26,12 +26,15 @@ class StopTime { typename StopT::Ref s, uint32_t seq, const std::string& hs, ad::cppgtfs::gtfs::flat::StopTime::PU_DO_TYPE put, ad::cppgtfs::gtfs::flat::StopTime::PU_DO_TYPE dot, float distTrav, - bool isTp) + bool isTp, uint8_t continuousDropOff, + uint8_t continuousPickup) : _s(s), _sequence(seq), _dist(distTrav), _at(at), _dt(dt), _isTp(isTp) { UNUSED(hs); UNUSED(put); UNUSED(dot); UNUSED(distTrav); + UNUSED(continuousDropOff); + UNUSED(continuousPickup); } const typename StopT::Ref getStop() const { return _s; } diff --git a/src/pfaedle/gtfs/Writer.cpp b/src/pfaedle/gtfs/Writer.cpp index 8f51fa4..d07a566 100644 --- a/src/pfaedle/gtfs/Writer.cpp +++ b/src/pfaedle/gtfs/Writer.cpp @@ -194,6 +194,23 @@ void Writer::write(gtfs::Feed* sourceFeed, const std::string& path) const { } } + csvp = ip.getCsvParser("pathways.txt"); + if (csvp->isGood()) { + curFile = getTmpFName(gtfsPath, ".pfaedle-tmp", "pathways.txt"); + curFileTg = gtfsPath + "/pathways.txt"; + fs.open(curFile.c_str()); + if (!fs.good()) cannotWrite(curFile, curFileTg); + writePathways(sourceFeed, &fs); + fs.close(); + + if (toZip) { + moveIntoZip(za, curFile, "pathways.txt"); + } else { + if (std::rename(curFile.c_str(), curFileTg.c_str())) + cannotWrite(curFileTg); + } + } + csvp = ip.getCsvParser("levels.txt"); if (csvp->isGood()) { curFile = getTmpFName(gtfsPath, ".pfaedle-tmp", "levels.txt"); @@ -320,6 +337,23 @@ void Writer::writeFeedInfo(gtfs::Feed* f, std::ostream* os) const { csvw->flushLine(); } +// ____________________________________________________________________________ +void Writer::writePathways(gtfs::Feed* sourceFeed, std::ostream* os) const { + Parser p(sourceFeed->getPath()); + auto csvp = p.getCsvParser("pathways.txt"); + ad::cppgtfs::Writer w; + + auto csvw = ad::cppgtfs::Writer::getPathwayCsvw(os); + csvw->flushLine(); + + ad::cppgtfs::gtfs::flat::Pathway fa; + auto flds = Parser::getPathwayFlds(csvp.get()); + + while (p.nextPathway(csvp.get(), &fa, flds)) { + w.writePathway(fa, csvw.get()); + } +} + // ____________________________________________________________________________ void Writer::writeLevels(gtfs::Feed* sourceFeed, std::ostream* os) const { Parser p(sourceFeed->getPath()); diff --git a/src/pfaedle/gtfs/Writer.h b/src/pfaedle/gtfs/Writer.h index d3ef995..41e169d 100644 --- a/src/pfaedle/gtfs/Writer.h +++ b/src/pfaedle/gtfs/Writer.h @@ -36,6 +36,7 @@ class Writer { bool writeTrips(Feed* f, std::ostream* os) const; void writeStopTimes(Feed* f, std::ostream* os) const; void writeLevels(Feed* f, std::ostream* os) const; + void writePathways(Feed* f, std::ostream* os) const; static void cannotWrite(const std::string& file, const std::string& file2); static void cannotWrite(const std::string& file);