some minor changes
This commit is contained in:
parent
ea79e3ac52
commit
39fb167cbf
7 changed files with 49 additions and 19 deletions
|
|
@ -188,7 +188,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
for (size_t i = 0; i < cfg.feedPaths.size(); i++) {
|
||||
ShapeBuilder::getGtfsBox(>fs[i], cmdCfgMots, cfg.shapeTripId, true,
|
||||
&box, maxSpeed);
|
||||
&box, maxSpeed, 0);
|
||||
}
|
||||
OsmBuilder osmBuilder;
|
||||
std::vector<pfaedle::osm::OsmReadOpts> opts;
|
||||
|
|
@ -210,7 +210,7 @@ int main(int argc, char** argv) {
|
|||
BBoxIdx box(BOX_PADDING);
|
||||
for (size_t i = 0; i < cfg.feedPaths.size(); i++) {
|
||||
ShapeBuilder::getGtfsBox(>fs[i], cmdCfgMots, cfg.shapeTripId, true,
|
||||
&box, maxSpeed);
|
||||
&box, maxSpeed, 0);
|
||||
}
|
||||
OsmBuilder osmBuilder;
|
||||
std::vector<pfaedle::osm::OsmReadOpts> opts;
|
||||
|
|
@ -242,6 +242,7 @@ int main(int argc, char** argv) {
|
|||
Stats stats;
|
||||
double tOsmBuild = 0;
|
||||
std::map<std::string, std::pair<size_t, size_t>> graphDimensions;
|
||||
std::vector<double> hopDists;
|
||||
|
||||
for (const auto& motCfg : motCfgReader.getConfigs()) {
|
||||
std::string filePost;
|
||||
|
|
@ -266,7 +267,7 @@ int main(int argc, char** argv) {
|
|||
pfaedle::osm::BBoxIdx box(BOX_PADDING);
|
||||
ShapeBuilder::getGtfsBox(>fs[0], usedMots, cfg.shapeTripId,
|
||||
cfg.dropShapes, &box,
|
||||
motCfg.osmBuildOpts.maxSpeed);
|
||||
motCfg.osmBuildOpts.maxSpeed, &hopDists);
|
||||
|
||||
T_START(osmBuild);
|
||||
|
||||
|
|
@ -389,11 +390,15 @@ int main(int argc, char** argv) {
|
|||
graphSizes[gd.first] = a;
|
||||
}
|
||||
|
||||
double hopDistSum = 0;
|
||||
for (auto d : hopDists) hopDistSum += d;
|
||||
|
||||
util::json::Dict jsonStats = {
|
||||
{"statistics",
|
||||
util::json::Dict{
|
||||
{"gtfs_num_stations", gtfs[0].getStops().size()},
|
||||
{"gtfs_num_trips", gtfs[0].getTrips().size()},
|
||||
{"gtfs_avg_hop_dist", hopDistSum / (hopDists.size() * 1.0)},
|
||||
{"graph_dimension", graphSizes},
|
||||
{"num_nodes_tot", numNodesTot},
|
||||
{"num_edges_tot", numEdgesTot},
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ ShapeBuilder::ShapeBuilder(
|
|||
_router(router) {
|
||||
pfaedle::osm::BBoxIdx box(BOX_PADDING);
|
||||
ShapeBuilder::getGtfsBox(feed, mots, cfg.shapeTripId, cfg.dropShapes, &box,
|
||||
_motCfg.osmBuildOpts.maxSpeed);
|
||||
_motCfg.osmBuildOpts.maxSpeed, 0);
|
||||
|
||||
_eGrid = EdgeGrid(cfg.gridSize, cfg.gridSize, box.getFullBox(), false);
|
||||
_nGrid = NodeGrid(cfg.gridSize, cfg.gridSize, box.getFullBox(), false);
|
||||
|
|
@ -647,7 +647,8 @@ const RoutingAttrs& ShapeBuilder::getRAttrs(const Trip* trip) const {
|
|||
// _____________________________________________________________________________
|
||||
void ShapeBuilder::getGtfsBox(const Feed* feed, const MOTs& mots,
|
||||
const std::string& tid, bool dropShapes,
|
||||
osm::BBoxIdx* box, double maxSpeed) {
|
||||
osm::BBoxIdx* box, double maxSpeed,
|
||||
std::vector<double>* hopDists) {
|
||||
for (const auto& t : feed->getTrips()) {
|
||||
if (!tid.empty() && t.getId() != tid) continue;
|
||||
if (tid.empty() && !t.getShape().empty() && !dropShapes) continue;
|
||||
|
|
@ -671,6 +672,7 @@ void ShapeBuilder::getGtfsBox(const Feed* feed, const MOTs& mots,
|
|||
toD = util::geo::haversine(
|
||||
st.getStop()->getLat(), st.getStop()->getLng(),
|
||||
stPrev.getStop()->getLat(), stPrev.getStop()->getLng());
|
||||
if (hopDists) hopDists->push_back(toD);
|
||||
}
|
||||
|
||||
if (i < t.getStopTimes().size() - 1) {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@
|
|||
#ifndef PFAEDLE_ROUTER_SHAPEBUILDER_H_
|
||||
#define PFAEDLE_ROUTER_SHAPEBUILDER_H_
|
||||
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "ad/cppgtfs/gtfs/Feed.h"
|
||||
|
|
@ -72,7 +72,8 @@ class ShapeBuilder {
|
|||
|
||||
static void getGtfsBox(const pfaedle::gtfs::Feed* feed, const MOTs& mots,
|
||||
const std::string& tid, bool dropShapes,
|
||||
osm::BBoxIdx* box, double maxSpeed);
|
||||
osm::BBoxIdx* box, double maxSpeed,
|
||||
std::vector<double>* hopDists);
|
||||
|
||||
private:
|
||||
pfaedle::gtfs::Feed* _feed;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue