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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // A view on the simulation; this view is a microscopic one
19 /****************************************************************************/
20 #ifndef GUIViewTraffic_h
21 #define GUIViewTraffic_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <string>
30 #include <utils/geom/Boundary.h>
31 #include <utils/geom/Position.h>
32 #include <utils/common/RGBColor.h>
34 #include "GUISUMOViewParent.h"
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class GUINet;
42 class GUISUMOViewParent;
43 class GUIVehicle;
44 class GUIVideoEncoder;
45 class MSRoute;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
56  FXDECLARE(GUIViewTraffic)
57 public:
59  GUIViewTraffic(FXComposite* p, GUIMainWindow& app,
60  GUISUMOViewParent* parent, GUINet& net, FXGLVisual* glVis,
61  FXGLCanvas* share);
63  virtual ~GUIViewTraffic();
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  void onGamingClick(Position pos);
99  void onGamingRightClick(Position pos);
100 
103 
105  long onCmdCloseLane(FXObject*, FXSelector, void*);
106  long onCmdCloseEdge(FXObject*, FXSelector, void*);
107  long onCmdAddRerouter(FXObject*, FXSelector, void*);
108 
109  long onDoubleClicked(FXObject*, FXSelector, void*);
110 
113  void saveFrame(const std::string& destFile, FXColor* buf);
114 
117  void endSnapshot();
118 
121  void checkSnapshots();
122 
124  const std::vector<SUMOTime> retrieveBreakpoints() const;
125 
126 protected:
127  int doPaintGL(int mode, const Boundary& bound);
128 
130 
131 private:
133 
135  bool myTLSGame;
136 
137 #ifdef HAVE_FFMPEG
138  GUIVideoEncoder* myCurrentVideo;
139 #endif
140 
141 protected:
143 
144 };
145 
146 
147 #endif
148 
149 /****************************************************************************/
150 
virtual void buildViewToolBars(GUIGlChildWindow &)
builds the view toolbars
long onCmdCloseLane(FXObject *, FXSelector, void *)
interaction with the simulation
long long int SUMOTime
Definition: SUMOTime.h:35
bool setColorScheme(const std::string &name)
set color scheme
GUIGlObjectType
void onGamingRightClick(Position pos)
Stores the information about how to visualize structures.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:62
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
long onCmdAddRerouter(FXObject *, FXSelector, void *)
long onCmdCloseEdge(FXObject *, FXSelector, void *)
bool myTLSGame
whether game mode was set to &#39;tls&#39;
void onGamingClick(Position pos)
handle mouse click in gaming mode
A simple video encoder from RGBA pics to anything ffmpeg can handle.
void startTrack(int id)
Starts vehicle tracking.
std::vector< std::string > getEdgeLaneParamKeys(bool edgeKeys) const
return list of available edge parameters
long onDoubleClicked(FXObject *, FXSelector, void *)
void checkSnapshots()
Checks whether it is time for a snapshot.
SUMOTime getCurrentTimeStep() const
get the current simulation time
A single child window which contains a view of the simulation area.
void endSnapshot()
Ends a video snapshot.
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
unsigned int GUIGlID
Definition: GUIGlObject.h:43
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:83
void saveFrame(const std::string &destFile, FXColor *buf)
Adds a frame to a video snapshot which will be initialized if neccessary.
virtual ~GUIViewTraffic()
destructor
int doPaintGL(int mode, const Boundary &bound)
paint GL
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints from the current runThread
GUIGlID getTrackedID() const
Returns the id of the tracked vehicle (-1 if none)
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
void stopTrack()
Stops vehicle tracking.
GUILane * getLaneUnderCursor()
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:54