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 /****************************************************************************/
17 // A view on the simulation; this view is a microscopic one
18 /****************************************************************************/
19 #ifndef GUIViewTraffic_h
20 #define GUIViewTraffic_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <string>
29 #include <utils/geom/Boundary.h>
30 #include <utils/geom/Position.h>
31 #include <utils/common/RGBColor.h>
33 #include "GUISUMOViewParent.h"
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class GUINet;
41 class GUISUMOViewParent;
42 class GUIVehicle;
43 class GUIVideoEncoder;
44 class MSRoute;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
55  FXDECLARE(GUIViewTraffic)
56 public:
58  GUIViewTraffic(FXComposite* p, GUIMainWindow& app,
59  GUISUMOViewParent* parent, GUINet& net, FXGLVisual* glVis,
60  FXGLCanvas* share);
62  virtual ~GUIViewTraffic();
63 
65  virtual void buildViewToolBars(GUIGlChildWindow&);
66 
67 
71  void startTrack(int id);
72 
73 
76  void stopTrack();
77 
78 
82  GUIGlID getTrackedID() const;
83 
84  bool setColorScheme(const std::string& name);
85 
87  void buildColorRainbow(const GUIVisualizationSettings& s, GUIColorScheme& scheme, int active, GUIGlObjectType objectType,
88  bool hide = false, double hideThreshold = 0);
89 
91  std::vector<std::string> getEdgeDataAttrs() const;
92 
94  std::vector<std::string> getEdgeLaneParamKeys(bool edgeKeys) const;
95 
97  std::vector<std::string> getVehicleParamKeys(bool vTypeKeys) const;
98 
100  void onGamingClick(Position pos);
101  void onGamingRightClick(Position pos);
102 
105 
107  long onCmdCloseLane(FXObject*, FXSelector, void*);
108  long onCmdCloseEdge(FXObject*, FXSelector, void*);
109  long onCmdAddRerouter(FXObject*, FXSelector, void*);
110 
112  long onCmdShowReachability(FXObject*, FXSelector, void*);
113 
114  long onDoubleClicked(FXObject*, FXSelector, void*);
115 
118  void saveFrame(const std::string& destFile, FXColor* buf);
119 
122  void endSnapshot();
123 
126  void checkSnapshots();
127 
129  const std::vector<SUMOTime> retrieveBreakpoints() const;
130 
131 protected:
132  int doPaintGL(int mode, const Boundary& bound);
133 
135 
136 private:
138 
140  bool myTLSGame;
141 
142 #ifdef HAVE_FFMPEG
143  GUIVideoEncoder* myCurrentVideo;
144 #endif
145 
146 protected:
148 
149 };
150 
151 
152 #endif
153 
154 /****************************************************************************/
155 
Boundary.h
GUIViewTraffic::endSnapshot
void endSnapshot()
Ends a video snapshot.
Definition: GUIViewTraffic.cpp:621
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GUISUMOViewParent
A single child window which contains a view of the simulation area.
Definition: GUISUMOViewParent.h:58
GUIViewTraffic
Definition: GUIViewTraffic.h:54
GUIViewTraffic::GUIViewTraffic
GUIViewTraffic()
Definition: GUIViewTraffic.h:147
GUIViewTraffic::stopTrack
void stopTrack()
Stops vehicle tracking.
Definition: GUIViewTraffic.cpp:364
GUIVideoEncoder
A simple video encoder from RGBA pics to anything ffmpeg can handle.
Definition: GUIVideoEncoder.h:70
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
GUIViewTraffic::getEdgeDataAttrs
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
Definition: GUIViewTraffic.cpp:260
GUIViewTraffic::onCmdCloseLane
long onCmdCloseLane(FXObject *, FXSelector, void *)
interaction with the simulation
Definition: GUIViewTraffic.cpp:505
GUIViewTraffic::getLaneUnderCursor
GUILane * getLaneUnderCursor()
Definition: GUIViewTraffic.cpp:490
MSRoute
Definition: MSRoute.h:66
GUIViewTraffic::onGamingClick
void onGamingClick(Position pos)
handle mouse click in gaming mode
Definition: GUIViewTraffic.cpp:376
RGBColor.h
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:39
GUISUMOAbstractView.h
GUIViewTraffic::getTrackedID
GUIGlID getTrackedID() const
Returns the id of the tracked vehicle (-1 if none)
Definition: GUIViewTraffic.cpp:370
GUIViewTraffic::onCmdShowReachability
long onCmdShowReachability(FXObject *, FXSelector, void *)
highlight edges according to reachability
Definition: GUIViewTraffic.cpp:541
GUIVehicle
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:53
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GUISUMOViewParent.h
GUIViewTraffic::onDoubleClicked
long onDoubleClicked(FXObject *, FXSelector, void *)
Definition: GUIViewTraffic.cpp:594
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GUIViewTraffic::retrieveBreakpoints
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints from the current runThread
Definition: GUIViewTraffic.cpp:643
GUIViewTraffic::buildColorRainbow
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
Definition: GUIViewTraffic.cpp:181
GUIViewTraffic::setColorScheme
bool setColorScheme(const std::string &name)
set color scheme
Definition: GUIViewTraffic.cpp:164
GUIViewTraffic::~GUIViewTraffic
virtual ~GUIViewTraffic()
destructor
Definition: GUIViewTraffic.cpp:97
GUIViewTraffic::getEdgeLaneParamKeys
std::vector< std::string > getEdgeLaneParamKeys(bool edgeKeys) const
return list of available edge parameters
Definition: GUIViewTraffic.cpp:269
GUIViewTraffic::checkSnapshots
void checkSnapshots()
Checks whether it is time for a snapshot.
Definition: GUIViewTraffic.cpp:632
Position.h
GUILane
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:61
GUIMainWindow
Definition: GUIMainWindow.h:46
GUIViewTraffic::onCmdCloseEdge
long onCmdCloseEdge(FXObject *, FXSelector, void *)
Definition: GUIViewTraffic.cpp:517
GUIGlID
unsigned int GUIGlID
Definition: GUIGlObject.h:42
GUIViewTraffic::myTrackedID
GUIGlID myTrackedID
Definition: GUIViewTraffic.h:137
GUIViewTraffic::doPaintGL
int doPaintGL(int mode, const Boundary &bound)
paint GL
Definition: GUIViewTraffic.cpp:304
GUIViewTraffic::buildViewToolBars
virtual void buildViewToolBars(GUIGlChildWindow &)
builds the view toolbars
Definition: GUIViewTraffic.cpp:103
GUIViewTraffic::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
get the current simulation time
Definition: GUIViewTraffic.cpp:484
config.h
GUIViewTraffic::saveFrame
void saveFrame(const std::string &destFile, FXColor *buf)
Adds a frame to a video snapshot which will be initialized if neccessary.
Definition: GUIViewTraffic.cpp:607
GUIGlChildWindow
Definition: GUIGlChildWindow.h:40
GUIViewTraffic::myTLSGame
bool myTLSGame
whether game mode was set to 'tls'
Definition: GUIViewTraffic.h:140
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GUIViewTraffic::getVehicleParamKeys
std::vector< std::string > getVehicleParamKeys(bool vTypeKeys) const
return list of available vehicle parameters
Definition: GUIViewTraffic.cpp:289
GUINet
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:82
GUIViewTraffic::startTrack
void startTrack(int id)
Starts vehicle tracking.
Definition: GUIViewTraffic.cpp:358
GUIViewTraffic::onCmdAddRerouter
long onCmdAddRerouter(FXObject *, FXSelector, void *)
Definition: GUIViewTraffic.cpp:529
PositionVector.h
GUIPropertyScheme
Definition: GUIPropertyScheme.h:45
GUIViewTraffic::onGamingRightClick
void onGamingRightClick(Position pos)
Definition: GUIViewTraffic.cpp:469