41 const std::string& file)
42 :
SUMOSAXHandler(file), myContainer(cont), myCurrentDistrict(nullptr) {}
86 const std::vector<std::string>& desc = attrs.
get<std::vector<std::string> >(
SUMO_ATTR_EDGES,
id.c_str(), ok);
87 for (
const std::string& eID : desc) {
97 std::pair<std::string, double> vals =
parseTAZ(attrs);
98 if (vals.second >= 0) {
106 std::pair<std::string, double> vals =
parseTAZ(attrs);
107 if (vals.second >= 0) {
114std::pair<std::string, double>
118 return std::pair<std::string, double>(
"", -1);
124 return std::pair<std::string, double>(
"", -1);
132 return std::pair<std::string, double>(
id, weight);
135 return std::pair<std::string, double>(
"", -1);
#define WRITE_ERRORF(...)
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ SUMO_ATTR_EDGES
the edges of a route
const std::string & getID() const
Returns the id.
bool add(const std::string &id, T item)
Adds an item.
A container for districts.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called when an opening-tag occurs.
void openDistrict(const SUMOSAXAttributes &attrs)
Begins the parsing of a district.
std::pair< std::string, double > parseTAZ(const SUMOSAXAttributes &attrs)
Returns the id and weight for a taz/tazSink/tazSource.
ODDistrictHandler(ODDistrictCont &cont, const std::string &file)
Constructor.
void addSource(const SUMOSAXAttributes &attrs)
Adds a read source to the current district.
ODDistrict * myCurrentDistrict
The currently parsed district.
~ODDistrictHandler()
Destructor.
void closeDistrict()
Closes the processing of the current district.
void addSink(const SUMOSAXAttributes &attrs)
Adds a read sink to the current district.
void myEndElement(int element)
Called when a closing tag occurs.
ODDistrictCont & myContainer
The container to add read districts to.
A district (origin/destination)
void addSource(const std::string &id, double weight)
Adds a source connection.
void addSink(const std::string &id, double weight)
Adds a sink connection.
Encapsulated SAX-Attributes.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
const std::string & getObjectType() const
return the objecttype to which these attributes belong
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.