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-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 /****************************************************************************/
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  FXDECLARE(GUIViewTraffic)
54 public:
56  GUIViewTraffic(FXComposite* p, GUIMainWindow& app,
57  GUISUMOViewParent* parent, GUINet& net, FXGLVisual* glVis,
58  FXGLCanvas* share);
60  virtual ~GUIViewTraffic();
61 
63  void recalculateBoundaries();
64 
66  virtual void buildViewToolBars(GUIGlChildWindow*);
67 
68 
72  void startTrack(int id);
73 
74 
77  void stopTrack();
78 
79 
83  GUIGlID getTrackedID() const;
84 
85  bool setColorScheme(const std::string& name);
86 
88  void buildColorRainbow(const GUIVisualizationSettings& s, GUIColorScheme& scheme, int active, GUIGlObjectType objectType,
89  bool hide = false, double hideThreshold = 0);
90 
92  std::vector<std::string> getEdgeDataAttrs() const;
93 
95  std::vector<std::string> getEdgeLaneParamKeys(bool edgeKeys) const;
96 
98  std::vector<std::string> getVehicleParamKeys(bool vTypeKeys) const;
99 
101  std::vector<std::string> getPOIParamKeys() const;
102 
104  void onGamingClick(Position pos);
105  void onGamingRightClick(Position pos);
106 
109 
111  long onCmdCloseLane(FXObject*, FXSelector, void*);
112  long onCmdCloseEdge(FXObject*, FXSelector, void*);
113  long onCmdAddRerouter(FXObject*, FXSelector, void*);
114 
116  long onCmdShowReachability(FXObject*, FXSelector, void*);
117 
118  long onDoubleClicked(FXObject*, FXSelector, void*);
119 
122  void saveFrame(const std::string& destFile, FXColor* buf);
123 
126  void endSnapshot();
127 
130  void checkSnapshots();
131 
133  const std::vector<SUMOTime> retrieveBreakpoints() const;
134 
135 protected:
136  int doPaintGL(int mode, const Boundary& bound);
137 
139 
140 private:
142 
144  bool myTLSGame;
145 
146 #ifdef HAVE_FFMPEG
147  GUIVideoEncoder* myCurrentVideo;
148 #endif
149 
150 protected:
152 
153 };
unsigned int GUIGlID
Definition: GUIGlObject.h:40
GUIGlObjectType
long long int SUMOTime
Definition: SUMOTime.h:32
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:59
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:81
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 *)
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()
void buildColorRainbow(const GUIVisualizationSettings &s, GUIColorScheme &scheme, int active, GUIGlObjectType objectType, bool hide=false, double hideThreshold=0)
recalibrate color scheme according to the current value range
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.
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 *)
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 > 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