Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/libsumo/GUI.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 GUI.h
15
/// @author Michael Behrisch
16
/// @date 07.04.2021
17
///
18
// C++ libsumo / TraCI client API implementation
19
/****************************************************************************/
20
#pragma once
21
#include <vector>
22
#include <libsumo/TraCIDefs.h>
23
24
#define DEFAULT_VIEW "View #0"
25
26
27
// ===========================================================================
28
// class declarations
29
// ===========================================================================
30
#ifndef LIBTRACI
31
namespace FX {
32
class FXApp;
33
}
34
class GUISUMOAbstractView;
35
class GUIApplicationWindow;
36
typedef long long int SUMOTime;
37
#endif
38
39
40
// ===========================================================================
41
// class definitions
42
// ===========================================================================
43
/**
44
* @class GUI
45
* @brief C++ TraCI client API implementation
46
*/
47
namespace LIBSUMO_NAMESPACE {
48
class GUI {
49
public:
50
#if defined(HAVE_LIBSUMOGUI) || defined(HAVE_FOX) || defined(LIBTRACI)
51
static double getZoom(const std::string& viewID = DEFAULT_VIEW);
52
static double getAngle(const std::string& viewID = DEFAULT_VIEW);
53
static libsumo::TraCIPosition getOffset(const std::string& viewID = DEFAULT_VIEW);
54
static std::string getSchema(const std::string& viewID = DEFAULT_VIEW);
55
static libsumo::TraCIPositionVector getBoundary(const std::string& viewID = DEFAULT_VIEW);
56
static bool hasView(const std::string& viewID = DEFAULT_VIEW);
57
static std::string getTrackedVehicle(const std::string& viewID = DEFAULT_VIEW);
58
static bool isSelected(const std::string& objID, const std::string& objType = "vehicle");
59
60
static void setZoom(const std::string& viewID, double zoom);
61
static void setAngle(const std::string& viewID, double angle);
62
static void setOffset(const std::string& viewID, double x, double y);
63
static void setSchema(const std::string& viewID, const std::string& schemeName);
64
static void setBoundary(const std::string& viewID, double xmin, double ymin, double xmax, double ymax);
65
static void trackVehicle(const std::string& viewID, const std::string& vehID);
66
static void screenshot(const std::string& viewID, const std::string& filename, const int width = -1, const int height = -1);
67
static void track(const std::string& objID, const std::string& viewID = DEFAULT_VIEW);
68
static void toggleSelection(const std::string& objID, const std::string& objType = "vehicle");
69
static void addView(const std::string& viewID, const std::string& schemeName = "", bool in3D = false);
70
static void removeView(const std::string& viewID);
71
72
LIBSUMO_ID_PARAMETER_API
73
LIBSUMO_SUBSCRIPTION_API
74
75
#ifndef LIBTRACI
76
#ifndef SWIG
77
static bool start(const std::vector<std::string>& cmd);
78
79
static bool load(const std::vector<std::string>& cmd);
80
81
static bool hasInstance();
82
83
static bool step(SUMOTime t);
84
85
static bool close(const std::string& reason);
86
87
static std::shared_ptr<VariableWrapper> makeWrapper();
88
89
static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
90
91
private:
92
static SubscriptionResults mySubscriptionResults;
93
static ContextSubscriptionResults myContextSubscriptionResults;
94
static GUISUMOAbstractView* getView(const std::string& id);
95
96
static GUIApplicationWindow* myWindow;
97
98
static FX::FXApp* myApp;
99
100
#endif
101
#endif
102
#endif
103
104
/// @brief invalidated standard constructor
105
GUI() = delete;
106
};
107
108
109
}
110
111