52 myCurrentStop(nullptr),
53 myCurrentLine(nullptr),
54 myCurrentCompletion(0),
55 myCurrentStopWasIgnored(false)
98 if (key ==
"completeness") {
100 }
else if (key ==
"name") {
102 }
else if (key ==
"missingBefore") {
104 }
else if (key ==
"missingAfter") {
146 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID,
"busStop", ok);
148 const std::string laneID = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok);
157 if (edge ==
nullptr) {
177 myCurrentStop = std::make_shared<NBPTStop>(
id, pos, edgeID, edgeID, endPos - startPos, name, permissions, parkingLength, color, startPos);
179 WRITE_ERRORF(
TL(
"Could not add public transport stop '%' (already exists)"),
id);
190 throw InvalidArgument(
"Could not add access outside a stopping place.");
213 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID,
"ptLine", ok);
223 const std::string nightService = attrs.
getStringSecure(
"nightService",
"");
234 WRITE_MESSAGEF(
TL(
"Duplicate ptLine id occurred ('%'); assuming overwriting is wished."),
id);
241 if (intervalS != -1) {
254 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID,
"flow", ok);
264 for (std::shared_ptr<NBPTStop> stop :
myRouteStops[route]) {
279 const std::vector<std::string>& edgeIDs = attrs.
get<std::vector<std::string> >(
SUMO_ATTR_EDGES,
nullptr, ok);
281 for (
const std::string& edgeID : edgeIDs) {
283 if (edge ==
nullptr) {
288 edges.push_back(edge);
301 for (
const std::string& edgeID : edgeIDs) {
303 if (edge ==
nullptr) {
308 edges.push_back(edge);
322 if (stop ==
nullptr) {
339 if (stop ==
nullptr) {
#define WRITE_MESSAGEF(...)
#define WRITE_ERRORF(...)
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permissions is a railway edge.
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_SHIP
is an arbitrary ship
@ SVC_TAXI
vehicle is a taxi
@ SVC_BUS
vehicle is a bus
@ SUMO_TAG_ACCESS
An access point for a train stop.
@ SUMO_TAG_PT_LINE
A pt line.
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_STOP
stop for vehicles
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_ATTR_PARKING_LENGTH
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_COLOR
A color information.
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.
bool wasIgnored(std::string id) const
Returns whether the edge with the id was ignored during parsing.
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
int getNumLanes() const
Returns the number of lanes.
Position geometryPositionAtOffset(double offset) const
return position taking into account loaded length
static int getLaneIndexFromLaneID(const std::string laneID)
NBPTLine * retrieve(const std::string &lineID)
bool insert(NBPTLine *ptLine)
insert new line
void setNumOfStops(int numStops, int missingBefore, int missingAfter)
void setName(const std::string &name)
void setRef(const std::string &line)
const std::string & getName() const
const std::string & getLineID() const
void setPeriod(int intervalS)
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.
static void addIgnored(const std::string &stopID)
std::shared_ptr< NBPTStop > get(std::string id) const
Retrieve a previously inserted pt stop.
static bool wasIgnored(const std::string &stopID)
bool insert(std::shared_ptr< NBPTStop > ptStop, bool floating=false)
Inserts a node into the map.
static SUMOVehicleClass interpretTransportType(const std::string &type, NIOSMNode *toSet=nullptr)
translate osm transport designations into sumo vehicle class
NIXMLPTHandler(NBEdgeCont &ec, NBPTStopCont &sc, NBPTLineCont &lc)
Constructor.
void addPTLine(const SUMOSAXAttributes &attrs)
Parses a public transport line.
std::shared_ptr< NBPTStop > myCurrentStop
The currently processed stop.
~NIXMLPTHandler()
Destructor.
std::map< std::string, std::vector< std::shared_ptr< NBPTStop > > > myRouteStops
stand-alone route information
std::string myCurrentRouteID
The currently processed stand-alone route.
void addPTLineStop(const SUMOSAXAttributes &attrs)
Parses an public transport stop reference within a line element.
void addPTLineFromFlow(const SUMOSAXAttributes &attrs)
Parses a public transport line.
NBPTStopCont & myStopCont
The stop container (for loading of stops)
void myEndElement(int element)
Called when a closing tag occurs.
NBEdgeCont & myEdgeCont
The edges container (for retrieving referenced stop edge)
std::map< std::string, EdgeVector > myRouteEdges
NBPTLineCont & myLineCont
The line container (for loading of lines)
bool myCurrentStopWasIgnored
whether the current stop should be discarded
void addPTLineRoute(const SUMOSAXAttributes &attrs)
Parses a route as port of a public transport line.
void addPTStop(const SUMOSAXAttributes &attrs)
Parses an public transport stop.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
double myCurrentCompletion
the completion level of the current line
void addRoute(const SUMOSAXAttributes &attrs)
Parses a stand-alone route when parsing implicit ptlines from routes and flows.
void addRouteStop(const SUMOSAXAttributes &attrs)
Parses an public transport stop reference within a route element.
void addAccess(const SUMOSAXAttributes &attrs)
Parses an stop access definition.
NBPTLine * myCurrentLine
The currently processed line.
A point in 2D or 3D with translation and scaling methods.
Encapsulated SAX-Attributes.
virtual std::string getString(int id, bool *isPresent=nullptr) const =0
Returns the string-value of the named (by its enum-value) attribute.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue=T(), bool report=true) const
Tries to read given attribute assuming it is an int.
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
SAX-handler base for SUMO-files.
static std::string getEdgeIDFromLane(const std::string laneID)
return edge id when given the lane ID
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
static int toInt(const std::string &sData)
converts a string into the integer value described by it by calling the char-type converter,...