47 mySourcesAreSinks(
OptionsCont::getOptions().getBool(
"sources-are-sinks")),
48 myDiscountSources(
OptionsCont::getOptions().getBool(
"discount-sources")),
49 myHaveWarnedAboutDeprecatedFormat(false)
68 WRITE_WARNINGF(
TL(
"The turn-file format with elements %, % is deprecated, please use % instead."),
83 while (st.hasNext()) {
84 std::string
id = st.next();
86 if (edge ==
nullptr) {
87 throw ProcessError(
TLF(
"The edge '%' declared as a sink is not known.",
id));
94 const std::string flowID = attrs.
get<std::string>(
SUMO_ATTR_ID,
nullptr, ok);
98 if (edge ==
nullptr) {
99 throw ProcessError(
"The from-edge '" + edgeID +
"' in flow '" + flowID +
"' is not known.");
113 static_cast<ROJTREdge*
>(edge)->changeSourceFlow(numVehs);
124 while (st.hasNext()) {
125 std::string
id = st.next();
127 if (edge ==
nullptr) {
128 throw ProcessError(
TLF(
"The edge '%' declared as a source is not known.",
id));
152 WRITE_ERRORF(
TL(
"The edge '%' is not known within the network (within a 'from-edge' tag)."),
id);
171 if (edge ==
nullptr) {
172 WRITE_ERRORF(
TL(
"The edge '%' is not known within the network (within a 'to-edge' tag)."),
id);
177 if (probability < 0) {
178 WRITE_ERRORF(
TL(
"'probability' must be positive (in definition of to-edge '%')."),
id);
192 double probability = attrs.
get<
double>(
194 (fromID +
"->" + toID).c_str(), ok);
200 if (from ==
nullptr) {
209 if (probability < 0) {
210 WRITE_ERRORF(
TL(
"'probability' must be positive (in edgeRelation from '%' to '%'."), fromID, toID);
#define WRITE_WARNINGF(...)
#define WRITE_ERRORF(...)
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_TAG_TOEDGE
Outgoing edge specification (jtrrouter)
@ SUMO_TAG_FLOW
a flow definition using from and to edges or a route
@ SUMO_TAG_FROMEDGE
Incoming edge specification (jtrrouter)
@ SUMO_TAG_SINK
Sink(s) specification.
@ SUMO_TAG_SOURCE
a source
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_END
weights: time range end
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A storage for options typed value containers)
A basic edge for routing applications.
void setSource(const bool isSource=true)
Sets whether the edge is a source.
void setSink(const bool isSink=true)
Sets whether the edge is a sink.
An edge the jtr-router may route through.
void addFollowerProbability(ROJTREdge *follower, double begTime, double endTime, double probability)
adds the information about the percentage of using a certain follower
~ROJTRTurnDefLoader()
Destructor.
ROJTRTurnDefLoader(RONet &net)
Constructor.
void addEdgeRel(const SUMOSAXAttributes &attrs)
Parses the probability to use a certain incoming-outgoing edge relation.
void addToEdge(const SUMOSAXAttributes &attrs)
Parses the probability to use a certain outgoing edge.
bool myHaveWarnedAboutDeprecatedFormat
whether the warning for the deprecated format has been issued
ROJTREdge * myEdge
The current incoming edge the turning probabilities are set into.
double myIntervalBegin
The begin and the end of the current interval.
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
RONet & myNet
The network to set the information into.
bool mySourcesAreSinks
whether all sources are sinks
void beginFromEdge(const SUMOSAXAttributes &attrs)
Begins the processing of a incoming edge definition.
bool myDiscountSources
whether upstream flows should be discounted from source flows
The router's network representation.
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
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.
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.
Structure representing possible vehicle parameter.
double repetitionProbability
The probability for emitting a vehicle per second.
SUMOTime repetitionEnd
The time at which the flow ends (only needed when using repetitionProbability)
static SUMOVehicleParameter * parseFlowAttributes(SumoXMLTag tag, const SUMOSAXAttributes &attrs, const bool hardFail, const bool needID, const SUMOTime beginDefault, const SUMOTime endDefault, const bool allowInternalRoutes=false)
Parses a flow's attributes.
static const int WHITECHARS
identifier for splitting the given string at all whitespace characters