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),
52 if (!
myPTStops.empty() && pStop->getName() !=
"" &&
myPTStops.back()->getName() == pStop->getName()) {
54 if (
myPTStops.back()->isPlatform() && !pStop->isPlatform()) {
56 }
else if (pStop->isPlatform()) {
64const std::vector<std::shared_ptr<NBPTStop> >&
122const std::vector<long long int>*
139 if (permissions != 0 && (permissions & nVuln) == 0) {
144 for (
int i = 0; i < (int)e->getNumLanes(); i++) {
145 if ((e->getPermissions(i) & nVuln) != 0) {
162const std::vector<NBEdge*>&
168std::vector<std::pair<NBEdge*, std::string> >
170 std::vector<std::pair<NBEdge*, std::string> > result;
171 for (std::shared_ptr<NBPTStop> stop :
myPTStops) {
174 result.push_back({e, stop->
getID()});
183 std::vector<NBEdge*> validEdges;
187 validEdges.push_back(e);
190 if (validEdges.size() == 0) {
196 if (firstStopEdge ==
nullptr) {
201 auto it = std::find(validEdges.begin(), validEdges.end(), firstStopEdge);
202 if (it == validEdges.end()) {
207 return validEdges.front();
213 std::vector<NBEdge*> validEdges;
217 validEdges.push_back(e);
220 if (validEdges.size() == 0) {
226 if (lastStopEdge ==
nullptr) {
231 auto it = std::find(validEdges.begin(), validEdges.end(), lastStopEdge);
232 if (it == validEdges.end()) {
237 return validEdges.back();
243 if (
myRoute.empty() || stops.empty()) {
246 std::vector<NBEdge*>::const_iterator stopIt = stops.begin();
248 while (stopIt != stops.end() && e == *stopIt) {
251 if (stopIt == stops.end()) {
261 for (
int i = 0; i < (int)
myPTStops.size(); i++) {
273 for (
NBEdge* e : oldRoute) {
274 if (e->getID() == edgeID) {
275 for (
NBEdge* e2 : replacement) {
291 std::shared_ptr<NBPTStop> stop = *it;
292 if (sc.
get(stop->getID()) ==
nullptr ||
293 ec.
getByID(stop->getEdgeId()) ==
nullptr) {
307 long long int lastAreaID = -1;
308 std::string lastName =
"";
310 std::shared_ptr<NBPTStop> stop = *it;
311 if (lastAreaID != -1 && stop->getAreaID() == lastAreaID) {
314 }
else if (lastName !=
"" && stop->getName() == lastName) {
320 lastAreaID = stop->getAreaID();
321 lastName = stop->getName();
328 for (
int i = 0; i < (int)
myRoute.size();) {
330 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
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_PEDESTRIAN
pedestrian
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ 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 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
bool isConsistent(const std::vector< NBEdge * > &stops) const
return whether the mentioned edges appear in that order in the route
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 setMyNumOfStops(int numStops)
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.