39 myAttributeName(attributeName),
40 myAmEdgeBased(edgeBased),
41 myDestination(destination),
123 if (definition->myAmEdgeBased) {
125 definition->myAggValue = attrs.
getFloat(definition->myAttributeName);
126 definition->myNoLanes = 1;
127 definition->myHadAttribute =
true;
129 definition->myHadAttribute =
false;
132 definition->myAggValue = 0;
133 definition->myNoLanes = 0;
139 if (!definition->myAmEdgeBased) {
141 definition->myAggValue += attrs.
getFloat(definition->myAttributeName);
142 definition->myNoLanes++;
143 definition->myHadAttribute =
true;
161 const std::string to = attrs.
get<std::string>(
SUMO_ATTR_TO,
nullptr, ok);
164 ret->myDestination.addEdgeRelWeight(from, to,
165 attrs.
getFloat(ret->myAttributeName),
177 const std::string to = attrs.
get<std::string>(
SUMO_ATTR_TO,
nullptr, ok);
180 ret->myDestination.addTazRelWeight(
myCurrentID, from, to,
181 attrs.
getFloat(ret->myAttributeName),
193 if (definition->myHadAttribute) {
195 definition->myAggValue / (
double)definition->myNoLanes,
#define WRITE_ERRORF(...)
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ SUMO_TAG_TAZREL
a relation between two TAZs
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_END
weights: time range end
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Interface for a class which obtains read weights for named edges.
Complete definition about what shall be retrieved and where to store it.
ToRetrieveDefinition(const std::string &attributeName, bool edgeBased, EdgeFloatTimeLineRetriever &destination)
Constructor.
~ToRetrieveDefinition()
Destructor.
double myCurrentTimeEnd
the end of the time period that is currently processed
double myCurrentTimeBeg
the begin of the time period that is currently processed
void myEndElement(int elemente)
Called when a closing tag occurs.
void tryParseTazRel(const SUMOSAXAttributes &attrs)
Parses the data of an tazRelation for the previously read times.
~SAXWeightsHandler()
Destructor.
void tryParseEdgeRel(const SUMOSAXAttributes &attrs)
Parses the data of an edgeRelation for the previously read times.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
void tryParse(const SUMOSAXAttributes &attrs, bool isEdge)
Parses the data of an edge or lane for the previously read times.
SAXWeightsHandler(const std::vector< ToRetrieveDefinition * > &defs, const std::string &file)
Constructor.
std::string myCurrentEdgeID
the edge which is currently being processed
std::string myCurrentID
the id of the interval being parsed
std::vector< ToRetrieveDefinition * > myDefinitions
List of definitions what shall be read and whereto stored while parsing the file.
Encapsulated SAX-Attributes.
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.
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.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
double getFloat(int id) const
Returns the double-value of the named (by its enum-value) attribute.
SAX-handler base for SUMO-files.