Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/libsumo/Lane.h
169666 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2012-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 Lane.h
15
/// @author Daniel Krajzewicz
16
/// @author Mario Krumnow
17
/// @author Michael Behrisch
18
/// @author Leonhard Luecken
19
/// @date 30.05.2012
20
///
21
// C++ TraCI client API implementation
22
/****************************************************************************/
23
#pragma once
24
#include <vector>
25
#include <libsumo/TraCIDefs.h>
26
27
28
// ===========================================================================
29
// class declarations
30
// ===========================================================================
31
#ifndef LIBTRACI
32
class MSLane;
33
class PositionVector;
34
#endif
35
36
37
// ===========================================================================
38
// class definitions
39
// ===========================================================================
40
/**
41
* @class Lane
42
* @brief C++ TraCI client API implementation
43
*/
44
namespace LIBSUMO_NAMESPACE {
45
class Lane {
46
public:
47
// Getter
48
static int getLinkNumber(const std::string& laneID);
49
static std::string getEdgeID(const std::string& laneID);
50
static double getLength(const std::string& laneID);
51
static double getMaxSpeed(const std::string& laneID);
52
static double getFriction(const std::string& laneID);
53
static std::vector<std::string> getAllowed(const std::string& laneID);
54
static std::vector<std::string> getDisallowed(const std::string& laneID);
55
static std::vector<std::string> getChangePermissions(const std::string& laneID, const int direction);
56
static std::vector<libsumo::TraCIConnection> getLinks(const std::string& laneID);
57
static libsumo::TraCIPositionVector getShape(const std::string& laneID);
58
static double getWidth(const std::string& laneID);
59
static double getCO2Emission(const std::string& laneID);
60
static double getCOEmission(const std::string& laneID);
61
static double getHCEmission(const std::string& laneID);
62
static double getPMxEmission(const std::string& laneID);
63
static double getNOxEmission(const std::string& laneID);
64
static double getFuelConsumption(const std::string& laneID);
65
static double getNoiseEmission(const std::string& laneID);
66
static double getElectricityConsumption(const std::string& laneID);
67
static double getLastStepMeanSpeed(const std::string& laneID);
68
static double getLastStepOccupancy(const std::string& laneID);
69
static double getLastStepLength(const std::string& laneID);
70
static double getWaitingTime(const std::string& laneID);
71
static double getTraveltime(const std::string& laneID);
72
static int getLastStepVehicleNumber(const std::string& laneID);
73
static int getLastStepHaltingNumber(const std::string& laneID);
74
static std::vector<std::string> getLastStepVehicleIDs(const std::string& laneID);
75
static std::vector<std::string> getFoes(const std::string& laneID, const std::string& toLaneID);
76
static std::vector<std::string> getInternalFoes(const std::string& laneID);
77
static const std::vector<std::string> getPendingVehicles(const std::string& laneID);
78
static double getAngle(const std::string& laneID, double relativePosition = libsumo::INVALID_DOUBLE_VALUE);
79
static std::string getBidiLane(const std::string& laneID);
80
81
LIBSUMO_ID_PARAMETER_API
82
LIBSUMO_SUBSCRIPTION_API
83
84
// Setter
85
static void setAllowed(const std::string& laneID, std::string allowedClasses);
86
static void setAllowed(const std::string& laneID, std::vector<std::string> allowedClasses);
87
static void setDisallowed(const std::string& laneID, std::string disallowedClasses);
88
static void setDisallowed(const std::string& laneID, std::vector<std::string> disallowedClasses);
89
static void setChangePermissions(const std::string& laneID, std::vector<std::string> allowedClasses, const int direction);
90
static void setMaxSpeed(const std::string& laneID, double speed);
91
static void setLength(const std::string& laneID, double length);
92
static void setFriction(const std::string& laneID, double friction);
93
94
// Generic parameter get/set
95
//static std::string getParameter(const std::string& laneID, const std::string& param);
96
//static void setParameter(const std::string& routeID, const std::string& key, const std::string& value); // not needed so far
97
98
#ifndef LIBTRACI
99
#ifndef SWIG
100
/** @brief Saves the shape of the requested object in the given container
101
* @param id The id of the lane to retrieve
102
* @param shape The container to fill
103
*/
104
static void storeShape(const std::string& id, PositionVector& shape);
105
106
static std::shared_ptr<VariableWrapper> makeWrapper();
107
108
static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
109
110
private:
111
static MSLane* getLane(const std::string& id);
112
113
private:
114
static SubscriptionResults mySubscriptionResults;
115
static ContextSubscriptionResults myContextSubscriptionResults;
116
#endif
117
#endif
118
private:
119
/// @brief invalidated standard constructor
120
Lane() = delete;
121
};
122
123
124
}
125
126