Eclipse SUMO - Simulation of Urban MObility
GUIViewTraffic.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2023 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/****************************************************************************/
21// A view on the simulation; this view is a microscopic one
22/****************************************************************************/
23#pragma once
24#include <config.h>
25
26#include <string>
27#include <utils/geom/Boundary.h>
28#include <utils/geom/Position.h>
31#include "GUISUMOViewParent.h"
33
34
35// ===========================================================================
36// class declarations
37// ===========================================================================
38class GUINet;
40class GUIVehicle;
41class GUIVideoEncoder;
42class MSRoute;
43
44
45// ===========================================================================
46// class definitions
47// ===========================================================================
53public:
55 GUIViewTraffic(FXComposite* p, GUIMainWindow& app,
56 GUISUMOViewParent* parent, GUINet& net, FXGLVisual* glVis,
57 FXGLCanvas* share);
59 virtual ~GUIViewTraffic();
60
63
66
67
71 void startTrack(int id);
72
73
76 void stopTrack();
77
78
82 GUIGlID getTrackedID() const;
83
84 bool setColorScheme(const std::string& name);
85
87 void buildColorRainbow(const GUIVisualizationSettings& s, GUIColorScheme& scheme, int active, GUIGlObjectType objectType,
88 bool hide = false, double hideThreshold = 0,
89 bool hide2 = false, double hideThreshold2 = 0);
90
92 std::vector<std::string> getEdgeDataAttrs() const;
93
95 std::vector<std::string> getMeanDataIDs() const;
96
98 std::vector<std::string> getMeanDataAttrs(const std::string& meanDataID) const;
99
101 std::vector<std::string> getEdgeLaneParamKeys(bool edgeKeys) const;
102
104 std::vector<std::string> getVehicleParamKeys(bool vTypeKeys) const;
105
107 std::vector<std::string> getPOIParamKeys() const;
108
110 void onGamingClick(Position pos);
112
115
117 long onCmdCloseLane(FXObject*, FXSelector, void*);
118 long onCmdCloseEdge(FXObject*, FXSelector, void*);
119 long onCmdAddRerouter(FXObject*, FXSelector, void*);
120
122 long onCmdShowReachability(FXObject*, FXSelector, void*);
123 static long showLaneReachability(GUILane* lane, FXObject*, FXSelector);
124
125 long onDoubleClicked(FXObject*, FXSelector, void*);
126
129 void saveFrame(const std::string& destFile, FXColor* buf);
130
133 void endSnapshot();
134
137 void checkSnapshots();
138
140 const std::vector<SUMOTime> retrieveBreakpoints() const;
141
142protected:
143 int doPaintGL(int mode, const Boundary& bound);
144
146
147private:
149
152
153#ifdef HAVE_FFMPEG
154 GUIVideoEncoder* myCurrentVideo;
155#endif
156
157protected:
159
160};
long long int SUMOTime
Definition: GUI.h:36
unsigned int GUIGlID
Definition: GUIGlObject.h:43
GUIGlObjectType
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:60
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:82
A single child window which contains a view of the simulation area.
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:51
A simple video encoder from RGBA pics to anything ffmpeg can handle.
long onCmdCloseEdge(FXObject *, FXSelector, void *)
void buildColorRainbow(const GUIVisualizationSettings &s, GUIColorScheme &scheme, int active, GUIGlObjectType objectType, bool hide=false, double hideThreshold=0, bool hide2=false, double hideThreshold2=0)
recalibrate color scheme according to the current value range
long onCmdCloseLane(FXObject *, FXSelector, void *)
interaction with the simulation
void recalculateBoundaries()
recalculate boundaries
virtual ~GUIViewTraffic()
destructor
std::vector< std::string > getEdgeLaneParamKeys(bool edgeKeys) const
return list of available edge parameters
void onGamingRightClick(Position pos)
int doPaintGL(int mode, const Boundary &bound)
paint GL
SUMOTime getCurrentTimeStep() const
get the current simulation time
GUILane * getLaneUnderCursor()
returns the GUILane at cursor position (implementation depends on view)
void stopTrack()
Stops vehicle tracking.
void startTrack(int id)
Starts vehicle tracking.
void saveFrame(const std::string &destFile, FXColor *buf)
Adds a frame to a video snapshot which will be initialized if neccessary.
std::vector< std::string > getMeanDataIDs() const
return list of loaded edgeData ids (being computed in the current simulation)
void endSnapshot()
Ends a video snapshot.
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints from the current runThread
std::vector< std::string > getVehicleParamKeys(bool vTypeKeys) const
return list of available vehicle parameters
std::vector< std::string > getPOIParamKeys() const
return list of available POI parameters
long onCmdAddRerouter(FXObject *, FXSelector, void *)
static long showLaneReachability(GUILane *lane, FXObject *, FXSelector)
void onGamingClick(Position pos)
handle mouse click in gaming mode
long onCmdShowReachability(FXObject *, FXSelector, void *)
highlight edges according to reachability
bool setColorScheme(const std::string &name)
set color scheme
long onDoubleClicked(FXObject *, FXSelector, void *)
std::vector< std::string > getMeanDataAttrs(const std::string &meanDataID) const
return list of available attributes for the given meanData id
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
virtual void buildViewToolBars(GUIGlChildWindow *)
builds the view toolbars
bool myTLSGame
whether game mode was set to 'tls'
void checkSnapshots()
Checks whether it is time for a snapshot.
GUIGlID getTrackedID() const
Returns the id of the tracked vehicle (-1 if none)
Stores the information about how to visualize structures.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37