refactoring
This commit is contained in:
parent
7f0443243c
commit
5703eb47bd
5 changed files with 58 additions and 23 deletions
|
|
@ -5,10 +5,11 @@
|
|||
#ifndef PFAEDLE_NETGRAPH_EDGEPL_H_
|
||||
#define PFAEDLE_NETGRAPH_EDGEPL_H_
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "ad/cppgtfs/gtfs/Feed.h"
|
||||
#include "util/String.h"
|
||||
#include "util/geo/GeoGraph.h"
|
||||
|
||||
using util::geograph::GeoEdgePL;
|
||||
|
|
@ -25,15 +26,26 @@ class EdgePL : public GeoEdgePL<float> {
|
|||
public:
|
||||
EdgePL() {}
|
||||
EdgePL(const util::geo::FLine& l, const std::set<const Trip*>& trips)
|
||||
: _l(l), _trips(trips) {}
|
||||
: _l(l), _trips(trips) {
|
||||
for (const auto t : _trips) {
|
||||
_routeShortNames.insert(t->getRoute()->getShortName());
|
||||
_tripShortNames.insert(t->getShortname());
|
||||
}
|
||||
}
|
||||
const util::geo::FLine* getGeom() const { return &_l; }
|
||||
void getAttrs(std::map<std::string, std::string>* obj) const {
|
||||
(*obj)["numtrips"] = std::to_string(_trips.size());
|
||||
(*obj)["num_trips"] = std::to_string(_trips.size());
|
||||
(*obj)["route_short_names"] =
|
||||
util::implode(_routeShortNames.begin(), _routeShortNames.end(), ", ");
|
||||
(*obj)["trip_short_names"] =
|
||||
util::implode(_tripShortNames.begin(), _tripShortNames.end(), ", ");
|
||||
}
|
||||
|
||||
private:
|
||||
util::geo::FLine _l;
|
||||
std::set<const Trip*> _trips;
|
||||
std::set<std::string> _routeShortNames;
|
||||
std::set<std::string> _tripShortNames;
|
||||
};
|
||||
} // namespace netgraph
|
||||
} // namespace pfaedle
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue