Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/jtrrouter/ROJTRTurnDefLoader.h
169666 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file ROJTRTurnDefLoader.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Michael Behrisch
18
/// @date Tue, 20 Jan 2004
19
///
20
// Loader for the of turning percentages and source/sink definitions
21
/****************************************************************************/
22
#pragma once
23
#include <config.h>
24
25
#include <set>
26
#include <string>
27
#include <utils/xml/SUMOSAXHandler.h>
28
#include <utils/importio/NamedColumnsParser.h>
29
#include <utils/importio/LineHandler.h>
30
31
32
// ===========================================================================
33
// class declarations
34
// ===========================================================================
35
class ROJTREdge;
36
class RONet;
37
38
39
// ===========================================================================
40
// class definitions
41
// ===========================================================================
42
/**
43
* @class ROJTRTurnDefLoader
44
* @brief Loader for the of turning percentages and source/sink definitions
45
*
46
* This handler parses XML-descriptions of jtrrouter-definitions, including
47
* percentage ratios at junctions and definitions of sink/source edges.
48
*
49
* All read values are stored directly into the given network's structures
50
* (edges).
51
*/
52
class ROJTRTurnDefLoader : public SUMOSAXHandler {
53
public:
54
/** @brief Constructor
55
*
56
* @param[in] net The net to add loaded turning percentages into
57
*/
58
ROJTRTurnDefLoader(RONet& net);
59
60
61
/// @brief Destructor
62
~ROJTRTurnDefLoader();
63
64
65
protected:
66
/// @name inherited from GenericSAXHandler
67
//@{
68
69
/** @brief Called on the opening of a tag;
70
*
71
* @param[in] element ID of the currently opened element
72
* @param[in] attrs Attributes within the currently opened element
73
* @exception ProcessError If something fails
74
* @see GenericSAXHandler::myStartElement
75
*/
76
void myStartElement(int element, const SUMOSAXAttributes& attrs);
77
//@}
78
79
80
private:
81
/** @brief Begins the processing of a incoming edge definition
82
*
83
* Tries to retrieve the currently described incoming edge. If the
84
* edge id is not given in the attributes or the edge is not known,
85
* an error is reported.
86
*
87
* If everything is ok, the edge's address is stored in myEdge.
88
*
89
* @param[in] attrs The SAX-attributes to parse incoming edge from
90
*/
91
void beginFromEdge(const SUMOSAXAttributes& attrs);
92
93
94
/** @brief Parses the probability to use a certain outgoing edge
95
*
96
* Tries to retreive the outgoing edge and then the probability to
97
* use it. If one of both operations could not be accomplished,
98
* an error is generated.
99
*
100
* If everything is ok, this means the destination edge is defined
101
* and known and the probability is valid, too, this probability
102
* is added to "myEdge", the last parsed incoming edge. As time,
103
* the previously parsed interval begin/end is used.
104
*
105
* @param[in] attrs The SAX-attributes to parse the destination edge and the probability to use it from
106
*/
107
void addToEdge(const SUMOSAXAttributes& attrs);
108
109
/** @brief Parses the probability to use a certain incoming-outgoing edge relation
110
* @param[in] attrs The SAX-attributes to parse the destination edge and the probability to use it from
111
*/
112
void addEdgeRel(const SUMOSAXAttributes& attrs);
113
114
private:
115
/// @brief The network to set the information into
116
RONet& myNet;
117
118
/// @brief The begin and the end of the current interval
119
double myIntervalBegin, myIntervalEnd;
120
121
/// @brief The current incoming edge the turning probabilities are set into
122
ROJTREdge* myEdge;
123
124
/// @brief whether all sources are sinks
125
bool mySourcesAreSinks;
126
127
/// @brief whether upstream flows should be discounted from source flows
128
bool myDiscountSources;
129
130
/// @brief whether the warning for the deprecated format has been issued
131
bool myHaveWarnedAboutDeprecatedFormat;
132
133
};
134
135