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  bool hide = false, double hideThreshold = 0,
83  bool hide2 = false, double hideThreshold2 = 0) override;
84 
86  std::vector<std::string> getEdgeDataAttrs() const override;
87 
89  std::vector<std::string> getMeanDataIDs() const override;
90 
92  std::vector<std::string> getMeanDataAttrs(const std::string& meanDataID) const override;
93 
95  std::vector<std::string> getEdgeLaneParamKeys(bool edgeKeys) const override;
96 
98  std::vector<std::string> getVehicleParamKeys(bool vTypeKeys) const override;
99 
101  std::vector<std::string> getPOIParamKeys() const override;
102 
104  void onGamingClick(Position pos) override;
105  void onGamingRightClick(Position pos) override;
106 
108  SUMOTime getCurrentTimeStep() const override;
109 
111  long onCmdCloseLane(FXObject*, FXSelector, void*) override;
112  long onCmdCloseEdge(FXObject*, FXSelector, void*) override;
113  long onCmdAddRerouter(FXObject*, FXSelector, void*) override;
114 
116  long onCmdShowReachability(FXObject*, FXSelector, void*) override;
117  static long showLaneReachability(GUILane* lane, FXObject*, FXSelector);
118 
119  long onDoubleClicked(FXObject*, FXSelector, void*) override;
120 
123  void saveFrame(const std::string& destFile, FXColor* buf) override;
124 
127  void endSnapshot() override;
128 
131  void checkSnapshots() override;
132 
134  const std::vector<SUMOTime> retrieveBreakpoints() const override;
135 
138  void drawPedestrianNetwork(const GUIVisualizationSettings& s) const override;
139 
142  void changePedestrianNetworkColor(const GUIVisualizationSettings& s) const override;
143 
144 protected:
145  int doPaintGL(int mode, const Boundary& bound) override;
146 
147  GUILane* getLaneUnderCursor() override;
148 
149 private:
151 
153  bool myTLSGame;
154 
155 #ifdef HAVE_FFMPEG
156  GUIVideoEncoder* myCurrentVideo;
157 #endif
158 
159 protected:
161 
162 };
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 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 buildColorRainbow(const GUIVisualizationSettings &s, GUIColorScheme &scheme, int active, GUIGlObjectType objectType, bool hide=false, double hideThreshold=0, bool hide2=false, double hideThreshold2=0) override
recalibrate color scheme according to the current value range
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