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-2020 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  virtual void buildViewToolBars(GUIGlChildWindow*);
64 
65 
69  void startTrack(int id);
70 
71 
74  void stopTrack();
75 
76 
80  GUIGlID getTrackedID() const;
81 
82  bool setColorScheme(const std::string& name);
83 
85  void buildColorRainbow(const GUIVisualizationSettings& s, GUIColorScheme& scheme, int active, GUIGlObjectType objectType,
86  bool hide = false, double hideThreshold = 0);
87 
89  std::vector<std::string> getEdgeDataAttrs() const;
90 
92  std::vector<std::string> getEdgeLaneParamKeys(bool edgeKeys) const;
93 
95  std::vector<std::string> getVehicleParamKeys(bool vTypeKeys) const;
96 
98  std::vector<std::string> getPOIParamKeys() const;
99 
101  void onGamingClick(Position pos);
102  void onGamingRightClick(Position pos);
103 
106 
108  long onCmdCloseLane(FXObject*, FXSelector, void*);
109  long onCmdCloseEdge(FXObject*, FXSelector, void*);
110  long onCmdAddRerouter(FXObject*, FXSelector, void*);
111 
113  long onCmdShowReachability(FXObject*, FXSelector, void*);
114 
115  long onDoubleClicked(FXObject*, FXSelector, void*);
116 
119  void saveFrame(const std::string& destFile, FXColor* buf);
120 
123  void endSnapshot();
124 
127  void checkSnapshots();
128 
130  const std::vector<SUMOTime> retrieveBreakpoints() const;
131 
132 protected:
133  int doPaintGL(int mode, const Boundary& bound);
134 
136 
137 private:
139 
141  bool myTLSGame;
142 
143 #ifdef HAVE_FFMPEG
144  GUIVideoEncoder* myCurrentVideo;
145 #endif
146 
147 protected:
149 
150 };
unsigned int GUIGlID
Definition: GUIGlObject.h:40
GUIGlObjectType
long long int SUMOTime
Definition: SUMOTime.h:31
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
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:36