update cppgtfs, support pathways, parse continuous_pickup and drop_off
This commit is contained in:
parent
c68cde67dc
commit
0699fccb1e
5 changed files with 46 additions and 6 deletions
|
@ -1 +1 @@
|
|||
Subproject commit d79469fa692d52cae56f5e797561451edcf3016a
|
||||
Subproject commit 35ab19c313f96fec649fd0cb31c42d281f2c3b6e
|
|
@ -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<StopTime<ad::cppgtfs::gtfs::Stop>, Service,
|
||||
ad::cppgtfs::gtfs::Route, Shape>
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue