31 NBPTLine::NBPTLine(
const std::string&
id,
const std::string& name,
const std::string& type,
const std::string& ref,
int interval,
const std::string& nightService,
36 myRef(ref !=
"" ? ref : name),
38 myNightService(nightService),
70 std::vector<std::string> validEdgeIDs;
75 validEdgeIDs.push_back(e->getID());
121 if (permissions != 0 && (permissions & nVuln) == 0) {
126 for (
int i = 0; i < (int)e->getNumLanes(); i++) {
127 if ((e->getPermissions(i) & nVuln) != 0) {
146 std::vector<NBEdge*> result;
158 std::vector<NBEdge*> validEdges;
162 validEdges.push_back(e);
165 if (validEdges.size() == 0) {
171 if (firstStopEdge ==
nullptr) {
176 auto it = std::find(validEdges.begin(), validEdges.end(), firstStopEdge);
177 if (it == validEdges.end()) {
182 return validEdges.front();
187 std::vector<NBEdge*> validEdges;
191 validEdges.push_back(e);
194 if (validEdges.size() == 0) {
200 if (lastStopEdge ==
nullptr) {
205 auto it = std::find(validEdges.begin(), validEdges.end(), lastStopEdge);
206 if (it == validEdges.end()) {
211 return validEdges.back();
216 for (
int i = 0; i < (int)
myPTStops.size(); i++) {
228 std::vector<NBPTStop*> unassigned;
229 for (
NBEdge* e : oldRoute) {
230 if (e->getID() == edgeID) {
231 myRoute.insert(
myRoute.end(), replacement.begin(), replacement.end());
235 while (stopIndex < (
int)
myPTStops.size() &&
myPTStops[stopIndex]->getEdgeId() == e->getID()) {
236 if (e->getID() == edgeID) {
239 double bestDist = std::numeric_limits<double>::max();
240 NBEdge* bestEdge =
nullptr;
241 for (
NBEdge* cand : replacement) {
243 if (dist < bestDist) {
248 if (bestDist != std::numeric_limits<double>::max()) {
255 WRITE_WARNING(
"Could not re-assign ptstop '" + stop->
getID() +
"' after replacing edge '" + edgeID +
"'");
256 unassigned.push_back(stop);
#define WRITE_WARNING(msg)
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
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 * 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.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
const std::string & getID() const
const PositionVector & getGeometry() const
Returns the geometry of the edge.
std::vector< NBPTStop * > myPTStops
SUMOVehicleClass myVClass
void addPTStop(NBPTStop *pStop)
std::vector< std::string > myWays
std::vector< NBEdge * > myRoute
const std::vector< std::string > & getMyWays() const
void write(OutputDevice &device, NBEdgeCont &ec)
std::vector< long long int > * getWaysNodes(std::string wayId)
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
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)
std::map< std::string, std::vector< long long int > > myWaysNodes
std::vector< NBEdge * > getStopEdges(const NBEdgeCont &ec) const
get stop edges
void setMyNumOfStops(int numStops)
void replaceStop(NBPTStop *oldStop, NBPTStop *newStop)
replace the given stop
void replaceEdge(const std::string &edgeID, const EdgeVector &replacement)
replace the edge with the given edge list
std::vector< NBPTStop * > getStops()
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)
void setEdges(const std::vector< NBEdge * > &edges)
The representation of a single pt stop.
bool findLaneAndComputeBusStopExtent(const NBEdgeCont &ec)
void clearAccess()
remove all access definitions
std::string getID() const
const Position & getPosition() const
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.