Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/marouter/ROMAEdge.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 ROMAEdge.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Christian Roessel
18
/// @author Laura Bieker
19
/// @author Michael Behrisch
20
/// @date Sept 2002
21
///
22
// A basic edge for routing applications
23
/****************************************************************************/
24
#pragma once
25
#include <config.h>
26
27
#include <string>
28
#include <map>
29
#include <vector>
30
#include <algorithm>
31
#include <utils/common/ValueTimeLine.h>
32
#include <utils/common/SUMOVehicleClass.h>
33
#include <router/ROEdge.h>
34
35
36
// ===========================================================================
37
// class declarations
38
// ===========================================================================
39
class ROLane;
40
class ROVehicle;
41
42
43
// ===========================================================================
44
// class definitions
45
// ===========================================================================
46
/**
47
* @class ROMAEdge
48
* @brief A basic edge for routing applications
49
*
50
* The edge contains two time lines, one for the travel time and one for a second
51
* measure which may be used for computing the costs of a route. After loading
52
* the weights, it is needed to call "buildTimeLines" in order to initialise
53
* these time lines.
54
*/
55
class ROMAEdge : public ROEdge {
56
public:
57
/** @brief Constructor
58
*
59
* @param[in] id The id of the edge
60
* @param[in] from The node the edge begins at
61
* @param[in] to The node the edge ends at
62
* @param[in] index The numeric id of the edge
63
*/
64
ROMAEdge(const std::string& id, RONode* from, RONode* to, int index, const int priority, const std::string& type);
65
66
67
/// Destructor
68
virtual ~ROMAEdge();
69
70
/** @brief Adds information about a connected edge.
71
*
72
* In addition to ROEdge::addSuccessor it keeps track of left turns.
73
*
74
* @param[in] s The edge to add
75
* @todo What about vehicle-type aware connections?
76
*/
77
virtual void addSuccessor(ROEdge* s, ROEdge* via = nullptr, std::string dir = "");
78
79
void setFlow(const double begin, const double end, const double flow) {
80
myFlow.add(begin, end, flow);
81
}
82
83
double getFlow(const double time) const {
84
return myFlow.getValue(time);
85
}
86
87
void setHelpFlow(const double begin, const double end, const double flow) {
88
myHelpFlow.add(begin, end, flow);
89
}
90
91
double getHelpFlow(const double time) const {
92
return myHelpFlow.getValue(time);
93
}
94
95
private:
96
std::set<ROMAEdge*> myLeftTurns;
97
ValueTimeLine<double> myFlow;
98
ValueTimeLine<double> myHelpFlow;
99
100
private:
101
/// @brief Invalidated copy constructor
102
ROMAEdge(const ROMAEdge& src);
103
104
/// @brief Invalidated assignment operator
105
ROMAEdge& operator=(const ROMAEdge& src);
106
107
};
108
109