37NBPTLine::NBPTLine(
const std::string&
id,
const std::string& name,
const std::string& type,
const std::string& ref,
int interval,
const std::string& nightService,
42 myRef(ref !=
"" ? ref : name),
45 myNightService(nightService),
48 myMissingStopsBefore(0),
49 myMissingStopsAfter(0)
55 if (!
myPTStops.empty() && pStop->getName() !=
"" &&
myPTStops.back()->getName() == pStop->getName()) {
57 if (
myPTStops.back()->isPlatform() && !pStop->isPlatform()) {
59 }
else if (pStop->isPlatform()) {
67const std::vector<std::shared_ptr<NBPTStop> >&
131const std::vector<long long int>*
148 if (permissions != 0 && (permissions & nVuln) == 0) {
153 for (
int i = 0; i < (int)e->getNumLanes(); i++) {
154 if ((e->getPermissions(i) & nVuln) != 0) {
173const std::vector<NBEdge*>&
179std::vector<std::pair<NBEdge*, std::string> >
181 std::vector<std::pair<NBEdge*, std::string> > result;
182 for (std::shared_ptr<NBPTStop> stop :
myPTStops) {
185 result.push_back({e, stop->
getID()});
194 std::vector<NBEdge*> validEdges;
198 validEdges.push_back(e);
201 if (validEdges.size() == 0) {
207 if (firstStopEdge ==
nullptr) {
212 auto it = std::find(validEdges.begin(), validEdges.end(), firstStopEdge);
213 if (it == validEdges.end()) {
218 return validEdges.front();
224 std::vector<NBEdge*> validEdges;
228 validEdges.push_back(e);
231 if (validEdges.size() == 0) {
237 if (lastStopEdge ==
nullptr) {
242 auto it = std::find(validEdges.begin(), validEdges.end(), lastStopEdge);
243 if (it == validEdges.end()) {
248 return validEdges.back();
254 if (
myRoute.empty() || stops.empty()) {
257 if (stops.size() > 1 && stops.front() == stops.back()) {
259 if (
myRoute.front() == stops.front()) {
261 }
else if (
myRoute.back() == stops.back()) {
262 stops.erase(stops.begin());
265 std::vector<NBEdge*>::const_iterator stopIt = stops.begin();
267 while (stopIt != stops.end() && e == *stopIt) {
270 if (stopIt == stops.end()) {
280 for (
int i = 0; i < (int)
myPTStops.size(); i++) {
292 for (
NBEdge* e : oldRoute) {
293 if (e->getID() == edgeID) {
294 for (
NBEdge* e2 : replacement) {
310 std::shared_ptr<NBPTStop> stop = *it;
311 if (sc.
get(stop->getID()) ==
nullptr ||
312 ec.
getByID(stop->getEdgeId()) ==
nullptr) {
326 long long int lastAreaID = -1;
327 std::string lastName =
"";
329 std::shared_ptr<NBPTStop> stop = *it;
330 if (lastAreaID != -1 && stop->getAreaID() == lastAreaID) {
333 }
else if (lastName !=
"" && stop->getName() == lastName) {
339 lastAreaID = stop->getAreaID();
340 lastName = stop->getName();
347 for (
int i = 0; i < (int)
myRoute.size();) {
349 if (
split !=
nullptr) {
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
#define WRITE_WARNINGF(...)
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_PEDESTRIAN
pedestrian
@ SUMO_TAG_PT_LINE
A pt line.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_COLOR
A color information.
const double SUMO_const_laneWidth
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Storage for edges, including some functionality operating on multiple edges.
NBEdge * getByID(const std::string &edgeID) const
Returns the edge with id if it exists.
const std::pair< NBEdge *, NBEdge * > * getSplit(const NBEdge *const origEdge) const
Returns the edge split if the edge has been split, nullptr otherwise.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
The representation of a single edge during network building.
const std::string & getID() const
void replaceStop(std::shared_ptr< NBPTStop > oldStop, std::shared_ptr< NBPTStop > newStop)
replace the given stop
void setNumOfStops(int numStops, int missingBefore, int missingAfter)
bool isConsistent(std::vector< NBEdge * > stops) const
return whether the mentioned edges appear in that order in the route
void deleteDuplicateStops()
const std::vector< long long int > * getWayNodes(std::string wayId)
SUMOVehicleClass myVClass
void replaceEdge(const std::string &edgeID, const std::vector< NBEdge * > &replacement)
replace the edge with the given edge list
NBPTLine(const std::string &id, const std::string &name, const std::string &type, const std::string &ref, int interval, const std::string &nightService, SUMOVehicleClass vClass, RGBColor color)
std::map< std::string, std::vector< long long int > > myWayNodes
std::vector< std::string > myWays
void deleteInvalidStops(const NBEdgeCont &ec, const NBPTStopCont &sc)
remove invalid stops from the line
void write(OutputDevice &device)
std::vector< NBEdge * > myRoute
void removeInvalidEdges(const NBEdgeCont &ec)
remove invalid edges from the line
std::vector< std::pair< NBEdge *, std::string > > getStopEdges(const NBEdgeCont &ec) const
get stop edges and stop ids
const std::string & getLineID() const
NBEdge * getRouteEnd(const NBEdgeCont &ec) const
return last valid edge of myRoute (if it doest not lie before the last stop)
const std::vector< NBEdge * > & getRoute() const
std::vector< std::shared_ptr< NBPTStop > > myPTStops
void addWayNode(long long int way, long long int node)
std::string myNightService
NBEdge * getRouteStart(const NBEdgeCont &ec) const
return first valid edge of myRoute (if it doest not lie after the first stop)
const std::vector< std::shared_ptr< NBPTStop > > & getStops()
void addPTStop(std::shared_ptr< NBPTStop > pStop)
void setEdges(const std::vector< NBEdge * > &edges)
Container for public transport stops during the net building process.
std::shared_ptr< NBPTStop > get(std::string id) const
Retrieve a previously inserted pt stop.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
bool isValid() const
check if RGBColor is valid
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.