2018-06-09 17:14:08 +02:00
|
|
|
// Copyright 2018, University of Freiburg,
|
|
|
|
|
// Chair of Algorithms and Data Structures.
|
|
|
|
|
// Authors: Patrick Brosi <brosi@informatik.uni-freiburg.de>
|
|
|
|
|
|
|
|
|
|
#ifndef PFAEDLE_NETGRAPH_EDGEPL_H_
|
|
|
|
|
#define PFAEDLE_NETGRAPH_EDGEPL_H_
|
|
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
|
#include <string>
|
2018-08-01 14:25:54 +02:00
|
|
|
#include <vector>
|
2018-06-09 17:14:08 +02:00
|
|
|
#include "ad/cppgtfs/gtfs/Feed.h"
|
2019-01-10 16:52:59 +01:00
|
|
|
#include "pfaedle/gtfs/Feed.h"
|
2018-07-25 20:14:46 +02:00
|
|
|
#include "util/String.h"
|
2018-06-09 17:14:08 +02:00
|
|
|
#include "util/geo/GeoGraph.h"
|
|
|
|
|
|
|
|
|
|
using util::geograph::GeoEdgePL;
|
2019-01-10 16:52:59 +01:00
|
|
|
using pfaedle::gtfs::Trip;
|
2018-06-09 17:14:08 +02:00
|
|
|
|
|
|
|
|
namespace pfaedle {
|
|
|
|
|
namespace netgraph {
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* A payload class for edges on a network graph - that is a graph
|
|
|
|
|
* that exactly represents a physical public transit network
|
|
|
|
|
*/
|
2019-01-10 16:52:59 +01:00
|
|
|
class EdgePL {
|
2018-06-09 17:14:08 +02:00
|
|
|
public:
|
|
|
|
|
EdgePL() {}
|
2022-01-03 22:27:59 +01:00
|
|
|
EdgePL(const LINE& l, const std::vector<const Trip*>& trips)
|
2018-07-25 20:14:46 +02:00
|
|
|
: _l(l), _trips(trips) {
|
|
|
|
|
for (const auto t : _trips) {
|
|
|
|
|
_routeShortNames.insert(t->getRoute()->getShortName());
|
|
|
|
|
_tripShortNames.insert(t->getShortname());
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-08-10 16:42:38 +02:00
|
|
|
const LINE* getGeom() const { return &_l; }
|
2018-08-01 14:25:54 +02:00
|
|
|
util::json::Dict getAttrs() const {
|
|
|
|
|
util::json::Dict obj;
|
|
|
|
|
obj["num_trips"] = static_cast<int>(_trips.size());
|
2019-01-10 16:52:59 +01:00
|
|
|
obj["route_short_names"] =
|
|
|
|
|
util::json::Array(_routeShortNames.begin(), _routeShortNames.end());
|
|
|
|
|
obj["trip_short_names"] =
|
|
|
|
|
util::json::Array(_tripShortNames.begin(), _tripShortNames.end());
|
2018-08-01 14:25:54 +02:00
|
|
|
return obj;
|
2018-06-09 17:14:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
2018-08-10 16:42:38 +02:00
|
|
|
LINE _l;
|
2022-01-03 22:27:59 +01:00
|
|
|
std::vector<const Trip*> _trips;
|
2018-07-25 20:14:46 +02:00
|
|
|
std::set<std::string> _routeShortNames;
|
|
|
|
|
std::set<std::string> _tripShortNames;
|
2018-06-09 17:14:08 +02:00
|
|
|
};
|
|
|
|
|
} // namespace netgraph
|
|
|
|
|
} // namespace pfaedle
|
|
|
|
|
|
|
|
|
|
#endif // PFAEDLE_NETGRAPH_EDGEPL_H_
|