 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
27 #include <xercesc/sax/HandlerBase.hpp>
28 #include <xercesc/sax/AttributeList.hpp>
29 #include <xercesc/sax/SAXParseException.hpp>
30 #include <xercesc/sax/SAXException.hpp>
56 myCurrentLine(nullptr) {
118 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID,
"busStop", ok);
120 const std::string laneID = attrs.
get<std::string>(
SUMO_ATTR_LANE,
id.c_str(), ok);
127 if (edge ==
nullptr) {
128 WRITE_ERROR(
"Edge '" + edgeID +
"' for stop '" +
id +
"' not found");
132 WRITE_ERROR(
"Lane '" + laneID +
"' for stop '" +
id +
"' not found");
140 WRITE_ERROR(
"Could not add public transport stop '" +
id +
"' (already exists)");
148 throw InvalidArgument(
"Could not add access outside a stopping place.");
161 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID,
"ptLine", ok);
170 const std::string nightService = attrs.
getStringSecure(
"nightService",
"");
181 WRITE_ERROR(
"Found route outside line definition");
186 for (
const std::string& edgeID : edgeIDs) {
188 if (edge ==
nullptr) {
191 edges.push_back(edge);
201 const std::string
id = attrs.
get<std::string>(
SUMO_ATTR_ID,
"ptLine", ok);
203 if (stop ==
nullptr) {
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
const std::string & getName() const
const std::vector< std::string > getStringVector(int attr) const
Tries to read given attribute assuming it is a string vector.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
NBEdge * retrieve(const std::string &id, bool retrieveExtracted=false) const
Returns the edge that has the given id.
void addPTLine(const SUMOSAXAttributes &attrs)
Parses a public transport line.
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
NBPTLineCont & myLineCont
The line container (for loading of lines)
Storage for edges, including some functionality operating on multiple edges.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SAX-handler base for SUMO-files.
~NIXMLPTHandler()
Destructor.
void insert(NBPTLine *ptLine)
insert new line
@ SUMO_TAG_PARAM
parameter associated to a certain key
void addPTLineStop(const SUMOSAXAttributes &attrs)
Parses an public transport stop reference within a line element.
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter
Position geometryPositionAtOffset(double offset) const
return position taking into account loaded length
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
std::vector< NBPTStop * > getStops()
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
NBPTStop * myCurrentStop
The currently processed stop.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
SVCPermissions getPermissions(int lane=-1) const
get the union of allowed classes over all lanes or for a specific lane
void setMyNumOfStops(int numStops)
const std::string & getLineID() const
The representation of a single edge during network building.
static SUMOVehicleClass interpretTransportType(const std::string &type, NIOSMNode *toSet=nullptr)
translate osm transport designations into sumo vehicle class
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
NBEdgeCont & myEdgeCont
The edges container (for retrieving referenced stop edge)
static int getLaneIndexFromLaneID(const std::string laneID)
@ SUMO_ATTR_EDGES
the edges of a route
NIXMLPTHandler(NBEdgeCont &ec, NBPTStopCont &sc, NBPTLineCont &lc)
Constructor.
int getNumLanes() const
Returns the number of lanes.
void addAccess(const SUMOSAXAttributes &attrs)
Parses an stop access definition.
void addPTStop(NBPTStop *pStop)
A point in 2D or 3D with translation and scaling methods.
void addPTStop(const SUMOSAXAttributes &attrs)
Parses an public transport stop.
T getOpt(int attr, const char *objectid, bool &ok, T defaultValue, bool report=true) const
Tries to read given attribute assuming it is an int.
void myEndElement(int element)
Called when a closing tag occurs.
void addAccess(std::string laneID, double offset, double length)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_PT_LINE
A pt line.
void addRoute(const SUMOSAXAttributes &attrs)
Parses a route as port of a public transport line.
void setEdges(const std::vector< NBEdge * > &edges)
NBPTStop * get(std::string id)
Retrieve a previously inserted pt stop.
static std::string getEdgeIDFromLane(const std::string laneID)
return edge id when given the lane ID
NBPTStopCont & myStopCont
The stop container (for loading of stops)
NBPTLine * myCurrentLine
The currently processed line.
@ SUMO_TAG_ROUTE
begin/end of the description of a route
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
bool insert(NBPTStop *ptStop)
Inserts a node into the map.
@ SUMO_TAG_ACCESS
An access point for a train stop.
The representation of a single pt stop.
Encapsulated SAX-Attributes.
double myCurrentCompletion
the completion level of the current line
std::vector< Parameterised * > myLastParameterised
element to receive parameters