Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/router/IntermodalTrip.h
194300 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2026 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 IntermodalTrip.h
15
/// @author Jakob Erdmann
16
/// @author Michael Behrisch
17
/// @author Robert Hilbrich
18
/// @date Mon, 03 March 2014
19
///
20
// The "vehicle" definition for the Intermodal Router
21
/****************************************************************************/
22
#pragma once
23
#include <config.h>
24
25
#include <string>
26
#include <vector>
27
28
#include "EffortCalculator.h"
29
30
class SUMOVTypeParameter;
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
35
/// @brief the "vehicle" type that is given to the internal router (SUMOAbstractRouter)
36
template<class E, class N, class V>
37
class IntermodalTrip {
38
public:
39
IntermodalTrip(const E* _from, const E* _to, double _departPos, double _arrivalPos,
40
double _speed, SUMOTime _departTime, const N* _node,
41
const SUMOVTypeParameter& _pars,
42
const V* _vehicle = 0, const SVCPermissions _modeSet = SVC_PEDESTRIAN,
43
const EffortCalculator* const _calc = nullptr, const double _externalFactor = 0.) :
44
from(_from),
45
to(_to),
46
departPos(_departPos < 0 ? _from->getLength() + _departPos : _departPos),
47
arrivalPos(_arrivalPos < 0 ? _to->getLength() + _arrivalPos : _arrivalPos),
48
speed(_speed),
49
departTime(_departTime),
50
node(_node),
51
pars(_pars),
52
vehicle(_vehicle),
53
modeSet(_modeSet),
54
calc(_calc),
55
externalFactor(_externalFactor) {
56
}
57
58
// exists just for debugging purposes
59
std::string getID() const {
60
return from->getID() + ":" + to->getID() + ":" + time2string(departTime);
61
}
62
63
64
inline SUMOVehicleClass getVClass() const {
65
return vehicle != 0 ? vehicle->getVClass() : SVC_PEDESTRIAN;
66
}
67
68
inline const SUMOVTypeParameter& getVTypeParameter() const {
69
return vehicle != 0 ? vehicle->getVTypeParameter() : pars;
70
}
71
72
/** @brief Returns whether this object is ignoring transient permission
73
* changes (during routing)
74
*/
75
bool ignoreTransientPermissions() const {
76
return vehicle != 0 ? vehicle->ignoreTransientPermissions() : false;
77
};
78
79
inline double getLength() const {
80
// person length is arbitrary (only used in the context of rail-reversal validity
81
return vehicle != 0 ? vehicle->getVehicleType().getLength() : 1;
82
}
83
84
// only used by AStar
85
inline double getMaxSpeed() const {
86
return vehicle != nullptr ? vehicle->getMaxSpeed() : speed;
87
}
88
89
// only used by AStar
90
inline double getChosenSpeedFactor() const {
91
return vehicle != nullptr ? vehicle->getChosenSpeedFactor() : 1.0;
92
}
93
94
const E* const from;
95
const E* const to;
96
const double departPos;
97
const double arrivalPos;
98
const double speed;
99
const SUMOTime departTime;
100
const N* const node; // indicates whether only routing across this node shall be performed
101
const SUMOVTypeParameter& pars;
102
const V* const vehicle; // indicates which vehicle may be used
103
const SVCPermissions modeSet;
104
const EffortCalculator* const calc;
105
const double externalFactor;
106
107
private:
108
/// @brief Invalidated assignment operator.
109
IntermodalTrip& operator=(const IntermodalTrip&);
110
};
111
112