Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/libsumo/Edge.h
169666 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2017-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 Edge.h
15
/// @author Gregor Laemmel
16
/// @date 15.09.2017
17
///
18
// C++ TraCI client API implementation
19
/****************************************************************************/
20
21
#pragma once
22
#include <string>
23
#include <vector>
24
#include <memory>
25
#include <libsumo/TraCIDefs.h>
26
#include <libsumo/TraCIConstants.h>
27
28
29
// ===========================================================================
30
// class declarations
31
// ===========================================================================
32
#ifndef LIBTRACI
33
class MSEdge;
34
class PositionVector;
35
#endif
36
37
38
// ===========================================================================
39
// class definitions
40
// ===========================================================================
41
/**
42
* @class Edge
43
* @brief C++ TraCI client API implementation
44
*/
45
namespace LIBSUMO_NAMESPACE {
46
class Edge {
47
public:
48
static double getAdaptedTraveltime(const std::string& edgeID, double time);
49
static double getEffort(const std::string& edgeID, double time);
50
static double getTraveltime(const std::string& edgeID);
51
static double getWaitingTime(const std::string& edgeID);
52
static const std::vector<std::string> getLastStepPersonIDs(const std::string& edgeID);
53
static const std::vector<std::string> getLastStepVehicleIDs(const std::string& edgeID);
54
static double getCO2Emission(const std::string& edgeID);
55
static double getCOEmission(const std::string& edgeID);
56
static double getHCEmission(const std::string& edgeID);
57
static double getPMxEmission(const std::string& edgeID);
58
static double getNOxEmission(const std::string& edgeID);
59
static double getFuelConsumption(const std::string& edgeID);
60
static double getNoiseEmission(const std::string& edgeID);
61
static double getElectricityConsumption(const std::string& edgeID);
62
static int getLastStepVehicleNumber(const std::string& edgeID);
63
static double getLastStepMeanSpeed(const std::string& edgeID);
64
static double getMeanFriction(const std::string& edgeID);
65
static double getLastStepOccupancy(const std::string& edgeID);
66
static int getLastStepHaltingNumber(const std::string& edgeID);
67
static double getLastStepLength(const std::string& edgeID);
68
static int getLaneNumber(const std::string& edgeID);
69
static std::string getStreetName(const std::string& edgeID);
70
static const std::vector<std::string> getPendingVehicles(const std::string& edgeID);
71
static double getAngle(const std::string& edgeID, double relativePosition = libsumo::INVALID_DOUBLE_VALUE);
72
static std::string getFromJunction(const std::string& edgeID);
73
static std::string getToJunction(const std::string& edgeID);
74
static std::string getBidiEdge(const std::string& edgeID);
75
76
LIBSUMO_ID_PARAMETER_API
77
LIBSUMO_SUBSCRIPTION_API
78
79
static void setAllowed(const std::string& edgeID, std::string allowedClasses);
80
static void setAllowed(const std::string& edgeID, std::vector<std::string> allowedClasses);
81
static void setDisallowed(const std::string& edgeID, std::string disallowedClasses);
82
static void setDisallowed(const std::string& edgeID, std::vector<std::string> disallowedClasses);
83
static void adaptTraveltime(const std::string& edgeID, double time, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max());
84
static void setEffort(const std::string& edgeID, double effort, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max());
85
static void setMaxSpeed(const std::string& edgeID, double speed);
86
static void setFriction(const std::string& edgeID, double friction);
87
88
#ifndef LIBTRACI
89
#ifndef SWIG
90
/** @brief Saves the shape of the requested object in the given container
91
* @param id The id of the edge to retrieve
92
* @param shape The container to fill
93
*/
94
static void storeShape(const std::string& edgeID, PositionVector& shape);
95
96
static std::shared_ptr<VariableWrapper> makeWrapper();
97
98
static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
99
100
private:
101
static void setAllowedSVCPermissions(const std::string& edgeID, long long int permissions);
102
103
static MSEdge* getEdge(const std::string& edgeID);
104
105
private:
106
static SubscriptionResults mySubscriptionResults;
107
static ContextSubscriptionResults myContextSubscriptionResults;
108
#endif
109
#endif
110
private:
111
/// @brief invalidated standard constructor
112
Edge() = delete;
113
114
};
115
116
}
117
118