Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/utils/router/IntermodalTrip.h
169678 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 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
31
// ===========================================================================
32
// class definitions
33
// ===========================================================================
34
/// @brief the "vehicle" type that is given to the internal router (SUMOAbstractRouter)
35
template<class E, class N, class V>
36
class IntermodalTrip {
37
public:
38
IntermodalTrip(const E* _from, const E* _to, double _departPos, double _arrivalPos,
39
double _speed, SUMOTime _departTime, const N* _node,
40
const V* _vehicle = 0, const SVCPermissions _modeSet = SVC_PEDESTRIAN,
41
const EffortCalculator* const _calc = nullptr, const double _externalFactor = 0.) :
42
from(_from),
43
to(_to),
44
departPos(_departPos < 0 ? _from->getLength() + _departPos : _departPos),
45
arrivalPos(_arrivalPos < 0 ? _to->getLength() + _arrivalPos : _arrivalPos),
46
speed(_speed),
47
departTime(_departTime),
48
node(_node),
49
vehicle(_vehicle),
50
modeSet(_modeSet),
51
calc(_calc),
52
externalFactor(_externalFactor) {
53
}
54
55
// exists just for debugging purposes
56
std::string getID() const {
57
return from->getID() + ":" + to->getID() + ":" + time2string(departTime);
58
}
59
60
61
inline SUMOVehicleClass getVClass() const {
62
return vehicle != 0 ? vehicle->getVClass() : SVC_PEDESTRIAN;
63
}
64
65
/** @brief Returns whether this object is ignoring transient permission
66
* changes (during routing)
67
*/
68
bool ignoreTransientPermissions() const {
69
return vehicle != 0 ? vehicle->ignoreTransientPermissions() : false;
70
};
71
72
inline double getLength() const {
73
// person length is arbitrary (only used in the context of rail-reversal validity
74
return vehicle != 0 ? vehicle->getVehicleType().getLength() : 1;
75
}
76
77
// only used by AStar
78
inline double getMaxSpeed() const {
79
return vehicle != nullptr ? vehicle->getMaxSpeed() : speed;
80
}
81
82
// only used by AStar
83
inline double getChosenSpeedFactor() const {
84
return vehicle != nullptr ? vehicle->getChosenSpeedFactor() : 1.0;
85
}
86
87
const E* const from;
88
const E* const to;
89
const double departPos;
90
const double arrivalPos;
91
const double speed;
92
const SUMOTime departTime;
93
const N* const node; // indicates whether only routing across this node shall be performed
94
const V* const vehicle; // indicates which vehicle may be used
95
const SVCPermissions modeSet;
96
const EffortCalculator* const calc;
97
const double externalFactor;
98
99
private:
100
/// @brief Invalidated assignment operator.
101
IntermodalTrip& operator=(const IntermodalTrip&);
102
};
103
104