Eclipse SUMO - Simulation of Urban MObility
GUI.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2022 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 /****************************************************************************/
18 // C++ 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
32 #endif
33 
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
42 namespace LIBSUMO_NAMESPACE {
43 class GUI {
44 public:
45  static double getZoom(const std::string& viewID = DEFAULT_VIEW);
46  static libsumo::TraCIPosition getOffset(const std::string& viewID = DEFAULT_VIEW);
47  static std::string getSchema(const std::string& viewID = DEFAULT_VIEW);
48  static libsumo::TraCIPositionVector getBoundary(const std::string& viewID = DEFAULT_VIEW);
49  static void setZoom(const std::string& viewID, double zoom);
50  static void setOffset(const std::string& viewID, double x, double y);
51  static void setSchema(const std::string& viewID, const std::string& schemeName);
52  static void setBoundary(const std::string& viewID, double xmin, double ymin, double xmax, double ymax);
53  static void screenshot(const std::string& viewID, const std::string& filename, const int width = -1, const int height = -1);
54  static void trackVehicle(const std::string& viewID, const std::string& vehID);
55  static bool hasView(const std::string& viewID = DEFAULT_VIEW);
56  static std::string getTrackedVehicle(const std::string& viewID = DEFAULT_VIEW);
57  static void track(const std::string& objID, const std::string& viewID = DEFAULT_VIEW);
58  static bool isSelected(const std::string& objID, const std::string& objType = "vehicle");
59  static void toggleSelection(const std::string& objID, const std::string& objType = "vehicle");
60 
63 
64 #ifndef LIBTRACI
65 #ifndef SWIG
66  static std::shared_ptr<VariableWrapper> makeWrapper();
67 
68  static bool handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper, tcpip::Storage* paramData);
69 
70 private:
71  static GUISUMOAbstractView* getView(const std::string& id);
72 #endif
73 #endif
74 
76  GUI() = delete;
77 };
78 
79 
80 }
#define DEFAULT_VIEW
Definition: GUI.h:24
#define LIBSUMO_ID_PARAMETER_API
Definition: TraCIDefs.h:108
#define LIBSUMO_SUBSCRIPTION_API
Definition: TraCIDefs.h:56
static libsumo::TraCIPositionVector getBoundary(const std::string &viewID=DEFAULT_VIEW)
Definition: GUI.cpp:65
static libsumo::TraCIPosition getOffset(const std::string &viewID=DEFAULT_VIEW)
Definition: GUI.cpp:53
static void track(const std::string &objID, const std::string &viewID=DEFAULT_VIEW)
Definition: GUI.cpp:138
LIBSUMO_ID_PARAMETER_API static LIBSUMO_SUBSCRIPTION_API std::shared_ptr< VariableWrapper > makeWrapper()
static void setSchema(const std::string &viewID, const std::string &schemeName)
Definition: GUI.cpp:90
static void toggleSelection(const std::string &objID, const std::string &objType="vehicle")
Definition: GUI.cpp:152
GUI()=delete
invalidated standard constructor
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper, tcpip::Storage *paramData)
static void screenshot(const std::string &viewID, const std::string &filename, const int width=-1, const int height=-1)
Definition: GUI.cpp:109
static void setOffset(const std::string &viewID, double x, double y)
Definition: GUI.cpp:80
static GUISUMOAbstractView * getView(const std::string &id)
static bool hasView(const std::string &viewID=DEFAULT_VIEW)
Definition: GUI.cpp:126
static std::string getTrackedVehicle(const std::string &viewID=DEFAULT_VIEW)
Definition: GUI.cpp:132
static double getZoom(const std::string &viewID=DEFAULT_VIEW)
Definition: GUI.cpp:47
static std::string getSchema(const std::string &viewID=DEFAULT_VIEW)
Definition: GUI.cpp:59
static void trackVehicle(const std::string &viewID, const std::string &vehID)
Definition: GUI.cpp:120
static void setBoundary(const std::string &viewID, double xmin, double ymin, double xmax, double ymax)
Definition: GUI.cpp:96
static void setZoom(const std::string &viewID, double zoom)
Definition: GUI.cpp:74
static bool isSelected(const std::string &objID, const std::string &objType="vehicle")
Definition: GUI.cpp:144
A 3D-position.
Definition: TraCIDefs.h:164
A list of positions.
Definition: TraCIDefs.h:207