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.dev/sumo
3 // Copyright (C) 2001-2024 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>
29 #include <utils/common/RGBColor.h>
31 #include "GUISUMOViewParent.h"
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class GUINet;
39 class GUISUMOViewParent;
40 class GUIVehicle;
41 class GUIVideoEncoder;
42 class MSRoute;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
53 public:
55  GUIViewTraffic(FXComposite* p, GUIMainWindow& app,
56  GUISUMOViewParent* parent, GUINet& net, FXGLVisual* glVis,
57  FXGLCanvas* share);
59  virtual ~GUIViewTraffic();
60 
62  virtual void buildViewToolBars(GUIGlChildWindow*) override;
63 
67  void startTrack(int id) override;
68 
71  void stopTrack() override;
72 
76  GUIGlID getTrackedID() const override;
77 
78  bool setColorScheme(const std::string& name) override;
79 
81  void buildColorRainbow(const GUIVisualizationSettings& s, GUIColorScheme& scheme, int active, GUIGlObjectType objectType,
82  const GUIVisualizationRainbowSettings& rs) override;
83 
85  std::vector<std::string> getEdgeDataAttrs() const override;
86 
88  std::vector<std::string> getMeanDataIDs() const override;
89 
91  std::vector<std::string> getMeanDataAttrs(const std::string& meanDataID) const override;
92 
94  std::vector<std::string> getEdgeLaneParamKeys(bool edgeKeys) const override;
95 
97  std::vector<std::string> getVehicleParamKeys(bool vTypeKeys) const override;
98 
100  std::vector<std::string> getPOIParamKeys() const override;
101 
103  void onGamingClick(Position pos) override;
104  void onGamingRightClick(Position pos) override;
105 
107  SUMOTime getCurrentTimeStep() const override;
108 
110  long onCmdCloseLane(FXObject*, FXSelector, void*) override;
111  long onCmdCloseEdge(FXObject*, FXSelector, void*) override;
112  long onCmdAddRerouter(FXObject*, FXSelector, void*) override;
113 
115  long onCmdShowReachability(FXObject*, FXSelector, void*) override;
116  static long showLaneReachability(GUILane* lane, FXObject*, FXSelector);
117 
118  long onDoubleClicked(FXObject*, FXSelector, void*) override;
119 
122  void saveFrame(const std::string& destFile, FXColor* buf) override;
123 
126  void endSnapshot() override;
127 
130  void checkSnapshots() override;
131 
133  const std::vector<SUMOTime> retrieveBreakpoints() const override;
134 
137  void drawPedestrianNetwork(const GUIVisualizationSettings& s) const override;
138 
141  void changePedestrianNetworkColor(const GUIVisualizationSettings& s) const override;
142 
143 protected:
144  int doPaintGL(int mode, const Boundary& bound) override;
145 
146  GUILane* getLaneUnderCursor() override;
147 
148 private:
150 
152  bool myTLSGame;
153 
154 #ifdef HAVE_FFMPEG
155  GUIVideoEncoder* myCurrentVideo;
156 #endif
157 
158 protected:
160 
161 };
long long int SUMOTime
Definition: GUI.h:35
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.
void saveFrame(const std::string &destFile, FXColor *buf) override
Adds a frame to a video snapshot which will be initialized if necessary.
SUMOTime getCurrentTimeStep() const override
get the current simulation time
std::vector< std::string > getVehicleParamKeys(bool vTypeKeys) const override
return list of available vehicle parameters
virtual void buildViewToolBars(GUIGlChildWindow *) override
builds the view toolbars
std::vector< std::string > getMeanDataIDs() const override
return list of loaded edgeData ids (being computed in the current simulation)
virtual ~GUIViewTraffic()
destructor
long onCmdCloseLane(FXObject *, FXSelector, void *) override
interaction with the simulation
std::vector< std::string > getMeanDataAttrs(const std::string &meanDataID) const override
return list of available attributes for the given meanData id
void stopTrack() override
Stops vehicle tracking.
int doPaintGL(int mode, const Boundary &bound) override
paint GL
GUIGlID getTrackedID() const override
Returns the id of the tracked vehicle (-1 if none)
std::vector< std::string > getPOIParamKeys() const override
return list of available POI parameters
long onCmdCloseEdge(FXObject *, FXSelector, void *) override
void onGamingClick(Position pos) override
handle mouse click in gaming mode
void endSnapshot() override
Ends a video snapshot.
long onCmdShowReachability(FXObject *, FXSelector, void *) override
highlight edges according to reachability
void drawPedestrianNetwork(const GUIVisualizationSettings &s) const override
Draw (or not) the JuPedSim pedestrian network.
void checkSnapshots() override
Checks whether it is time for a snapshot.
bool setColorScheme(const std::string &name) override
set color scheme
const std::vector< SUMOTime > retrieveBreakpoints() const override
retrieve breakpoints from the current runThread
GUILane * getLaneUnderCursor() override
returns the GUILane at cursor position (implementation depends on view)
void buildColorRainbow(const GUIVisualizationSettings &s, GUIColorScheme &scheme, int active, GUIGlObjectType objectType, const GUIVisualizationRainbowSettings &rs) override
recalibrate color scheme according to the current value range
void startTrack(int id) override
Starts vehicle tracking.
long onDoubleClicked(FXObject *, FXSelector, void *) override
std::vector< std::string > getEdgeDataAttrs() const override
return list of loaded edgeData attributes
static long showLaneReachability(GUILane *lane, FXObject *, FXSelector)
long onCmdAddRerouter(FXObject *, FXSelector, void *) override
std::vector< std::string > getEdgeLaneParamKeys(bool edgeKeys) const override
return list of available edge parameters
void changePedestrianNetworkColor(const GUIVisualizationSettings &s) const override
Change the color of the JuPedSim pedestrian network.
bool myTLSGame
whether game mode was set to 'tls'
void onGamingRightClick(Position pos) override
Stores the information about how to visualize structures.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37