chore: fixes and code cleanup

This commit is contained in:
Vlad Vesa 2020-08-19 09:17:34 +03:00
parent c96bd24cca
commit f1aa563d41
3 changed files with 1955 additions and 1933 deletions

View file

@ -1,12 +1,12 @@
// Copyright 2018, University of Freiburg, // Copyright 2018, University of Freiburg,
// Chair of Algorithms and Data Structures. // Chair of Algorithms and Data Structures.
// Authors: Patrick Brosi <brosi@informatik.uni-freiburg.de> // Authors: Patrick Brosi <brosi@informatik.uni-freiburg.de>
#include <climits>
#include <pwd.h> #include <pwd.h>
#include <csignal>
#include <cstdio>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <climits>
#include <csignal>
#include <cstdio>
#include <fstream> #include <fstream>
#include <map> #include <map>
#include <string> #include <string>
@ -163,14 +163,12 @@ int main(int argc, char** argv) {
LOG(INFO) << "Writing filtered XML to " << cfg.writeOsm << " ..."; LOG(INFO) << "Writing filtered XML to " << cfg.writeOsm << " ...";
BBoxIdx box(BOX_PADDING); BBoxIdx box(BOX_PADDING);
for (size_t i = 0; i < cfg.feedPaths.size(); i++) { for (size_t i = 0; i < cfg.feedPaths.size(); i++) {
ShapeBuilder::getGtfsBox(&gtfs[i], cmdCfgMots, cfg.shapeTripId, true, ShapeBuilder::getGtfsBox(&gtfs[i], cmdCfgMots, cfg.shapeTripId, true, &box);
&box);
} }
OsmBuilder osmBuilder; OsmBuilder osmBuilder;
std::vector<pfaedle::osm::OsmReadOpts> opts; std::vector<pfaedle::osm::OsmReadOpts> opts;
for (const auto& o : motCfgReader.getConfigs()) { for (const auto& o : motCfgReader.getConfigs()) {
if (std::find_first_of(o.mots.begin(), o.mots.end(), cmdCfgMots.begin(), if (std::find_first_of(o.mots.begin(), o.mots.end(), cmdCfgMots.begin(), cmdCfgMots.end()) != o.mots.end()) {
cmdCfgMots.end()) != o.mots.end()) {
opts.push_back(o.osmBuildOpts); opts.push_back(o.osmBuildOpts);
} }
} }
@ -185,14 +183,12 @@ int main(int argc, char** argv) {
} else if (cfg.writeOverpass) { } else if (cfg.writeOverpass) {
BBoxIdx box(BOX_PADDING); BBoxIdx box(BOX_PADDING);
for (size_t i = 0; i < cfg.feedPaths.size(); i++) { for (size_t i = 0; i < cfg.feedPaths.size(); i++) {
ShapeBuilder::getGtfsBox(&gtfs[i], cmdCfgMots, cfg.shapeTripId, true, ShapeBuilder::getGtfsBox(&gtfs[i], cmdCfgMots, cfg.shapeTripId, true, &box);
&box);
} }
OsmBuilder osmBuilder; OsmBuilder osmBuilder;
std::vector<pfaedle::osm::OsmReadOpts> opts; std::vector<pfaedle::osm::OsmReadOpts> opts;
for (const auto& o : motCfgReader.getConfigs()) { for (const auto& o : motCfgReader.getConfigs()) {
if (std::find_first_of(o.mots.begin(), o.mots.end(), cmdCfgMots.begin(), if (std::find_first_of(o.mots.begin(), o.mots.end(), cmdCfgMots.begin(), cmdCfgMots.end()) != o.mots.end()) {
cmdCfgMots.end()) != o.mots.end()) {
opts.push_back(o.osmBuildOpts); opts.push_back(o.osmBuildOpts);
} }
} }
@ -251,8 +247,7 @@ int main(int argc, char** argv) {
} }
} }
ShapeBuilder shapeBuilder(&gtfs[0], &evalFeed, cmdCfgMots, motCfg, &ecoll, ShapeBuilder shapeBuilder(&gtfs[0], &evalFeed, cmdCfgMots, motCfg, &ecoll, &graph, &fStops, &restr, cfg);
&graph, &fStops, &restr, cfg);
if (cfg.writeGraph) { if (cfg.writeGraph) {
LOG(INFO) << "Outputting graph.json..."; LOG(INFO) << "Outputting graph.json...";

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,7 @@ namespace osm {
class OsmFilter { class OsmFilter {
public: public:
enum Type : uint64_t { NODE = 16, WAY = 8, REL = 4, ALL = 0 }; enum Type : uint64_t { NODE = 16, WAY = 8, REL = 4, ALL = 0 };
OsmFilter() {} OsmFilter() = default;
OsmFilter(const MultAttrMap& keep, const MultAttrMap& drop); OsmFilter(const MultAttrMap& keep, const MultAttrMap& drop);
explicit OsmFilter(const OsmReadOpts& o); explicit OsmFilter(const OsmReadOpts& o);
uint64_t keep(const AttrMap& attrs, Type t) const; uint64_t keep(const AttrMap& attrs, Type t) const;