/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file ROJTRTurnDefLoader.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Michael Behrisch17/// @date Tue, 20 Jan 200418///19// Loader for the of turning percentages and source/sink definitions20/****************************************************************************/21#pragma once22#include <config.h>2324#include <set>25#include <string>26#include <utils/xml/SUMOSAXHandler.h>27#include <utils/importio/NamedColumnsParser.h>28#include <utils/importio/LineHandler.h>293031// ===========================================================================32// class declarations33// ===========================================================================34class ROJTREdge;35class RONet;363738// ===========================================================================39// class definitions40// ===========================================================================41/**42* @class ROJTRTurnDefLoader43* @brief Loader for the of turning percentages and source/sink definitions44*45* This handler parses XML-descriptions of jtrrouter-definitions, including46* percentage ratios at junctions and definitions of sink/source edges.47*48* All read values are stored directly into the given network's structures49* (edges).50*/51class ROJTRTurnDefLoader : public SUMOSAXHandler {52public:53/** @brief Constructor54*55* @param[in] net The net to add loaded turning percentages into56*/57ROJTRTurnDefLoader(RONet& net);585960/// @brief Destructor61~ROJTRTurnDefLoader();626364protected:65/// @name inherited from GenericSAXHandler66//@{6768/** @brief Called on the opening of a tag;69*70* @param[in] element ID of the currently opened element71* @param[in] attrs Attributes within the currently opened element72* @exception ProcessError If something fails73* @see GenericSAXHandler::myStartElement74*/75void myStartElement(int element, const SUMOSAXAttributes& attrs);76//@}777879private:80/** @brief Begins the processing of a incoming edge definition81*82* Tries to retrieve the currently described incoming edge. If the83* edge id is not given in the attributes or the edge is not known,84* an error is reported.85*86* If everything is ok, the edge's address is stored in myEdge.87*88* @param[in] attrs The SAX-attributes to parse incoming edge from89*/90void beginFromEdge(const SUMOSAXAttributes& attrs);919293/** @brief Parses the probability to use a certain outgoing edge94*95* Tries to retreive the outgoing edge and then the probability to96* use it. If one of both operations could not be accomplished,97* an error is generated.98*99* If everything is ok, this means the destination edge is defined100* and known and the probability is valid, too, this probability101* is added to "myEdge", the last parsed incoming edge. As time,102* the previously parsed interval begin/end is used.103*104* @param[in] attrs The SAX-attributes to parse the destination edge and the probability to use it from105*/106void addToEdge(const SUMOSAXAttributes& attrs);107108/** @brief Parses the probability to use a certain incoming-outgoing edge relation109* @param[in] attrs The SAX-attributes to parse the destination edge and the probability to use it from110*/111void addEdgeRel(const SUMOSAXAttributes& attrs);112113private:114/// @brief The network to set the information into115RONet& myNet;116117/// @brief The begin and the end of the current interval118double myIntervalBegin, myIntervalEnd;119120/// @brief The current incoming edge the turning probabilities are set into121ROJTREdge* myEdge;122123/// @brief whether all sources are sinks124bool mySourcesAreSinks;125126/// @brief whether upstream flows should be discounted from source flows127bool myDiscountSources;128129/// @brief whether the warning for the deprecated format has been issued130bool myHaveWarnedAboutDeprecatedFormat;131132};133134135