39 myAttributeName(attributeName),
40 myAmEdgeBased(edgeBased),
41 myDestination(destination),
67 myCurrentTimeEnd(-1) {
113 if (definition->myAmEdgeBased) {
115 definition->myAggValue = attrs.
getFloat(definition->myAttributeName);
116 definition->myNoLanes = 1;
117 definition->myHadAttribute =
true;
119 definition->myHadAttribute =
false;
122 definition->myAggValue = 0;
123 definition->myNoLanes = 0;
129 if (!definition->myAmEdgeBased) {
131 definition->myAggValue += attrs.
getFloat(definition->myAttributeName);
132 definition->myNoLanes++;
133 definition->myHadAttribute =
true;
151 const std::string to = attrs.
get<std::string>(
SUMO_ATTR_TO,
nullptr, ok);
154 ret->myDestination.addEdgeRelWeight(from, to,
155 attrs.
getFloat(ret->myAttributeName),
167 if (definition->myHadAttribute) {
169 definition->myAggValue / (
double)definition->myNoLanes,
@ 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_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.
~SAXWeightsHandler()
Destructor.
void tryParseEdgeRel(const SUMOSAXAttributes &attrs)
Parses the data of an edgeRel 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::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, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual double getFloat(int id) const =0
Returns the double-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.
SUMOTime getSUMOTimeReporting(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is a SUMOTime.
SAX-handler base for SUMO-files.