52 myCurrentStop(nullptr),
53 myCurrentLine(nullptr),
54 myCurrentCompletion(0),
55 myCurrentStopWasIgnored(false)
98 if (key ==
"completeness") {
100 }
else if (key ==
"name") {
140 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID,
"busStop", ok);
142 const std::string laneID = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok);
151 if (edge ==
nullptr) {
171 myCurrentStop = std::make_shared<NBPTStop>(
id, pos, edgeID, edgeID, endPos - startPos, name, permissions, parkingLength, color, startPos);
173 WRITE_ERRORF(
TL(
"Could not add public transport stop '%' (already exists)"),
id);
184 throw InvalidArgument(
"Could not add access outside a stopping place.");
207 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID,
"ptLine", ok);
217 const std::string nightService = attrs.
getStringSecure(
"nightService",
"");
232 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID,
"flow", ok);
242 for (std::shared_ptr<NBPTStop> stop :
myRouteStops[route]) {
257 const std::vector<std::string>& edgeIDs = attrs.
get<std::vector<std::string> >(
SUMO_ATTR_EDGES,
nullptr, ok);
259 for (
const std::string& edgeID : edgeIDs) {
261 if (edge ==
nullptr) {
266 edges.push_back(edge);
279 for (
const std::string& edgeID : edgeIDs) {
281 if (edge ==
nullptr) {
286 edges.push_back(edge);
300 if (stop ==
nullptr) {
317 if (stop ==
nullptr) {
#define WRITE_WARNINGF(...)
#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 permission is a railway edge.
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
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ 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)
bool insert(NBPTLine *ptLine)
insert new line
void setName(const std::string &name)
const std::string & getName() const
const std::string & getLineID() const
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.
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