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 
Boundary.h
GUIViewTraffic::endSnapshot
void endSnapshot()
Ends a video snapshot.
Definition: GUIViewTraffic.cpp:555
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GUISUMOViewParent
A single child window which contains a view of the simulation area.
Definition: GUISUMOViewParent.h:59
GUIViewTraffic
Definition: GUIViewTraffic.h:55
GUIViewTraffic::GUIViewTraffic
GUIViewTraffic()
Definition: GUIViewTraffic.h:142
GUIViewTraffic::stopTrack
void stopTrack()
Stops vehicle tracking.
Definition: GUIViewTraffic.cpp:348
GUIVideoEncoder
A simple video encoder from RGBA pics to anything ffmpeg can handle.
Definition: GUIVideoEncoder.h:71
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
GUIViewTraffic::getEdgeDataAttrs
std::vector< std::string > getEdgeDataAttrs() const
return list of loaded edgeData attributes
Definition: GUIViewTraffic.cpp:259
GUIViewTraffic::onCmdCloseLane
long onCmdCloseLane(FXObject *, FXSelector, void *)
interaction with the simulation
Definition: GUIViewTraffic.cpp:492
GUIViewTraffic::getLaneUnderCursor
GUILane * getLaneUnderCursor()
Definition: GUIViewTraffic.cpp:477
MSRoute
Definition: MSRoute.h:67
GUIViewTraffic::onGamingClick
void onGamingClick(Position pos)
handle mouse click in gaming mode
Definition: GUIViewTraffic.cpp:360
RGBColor.h
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:40
GUISUMOAbstractView.h
GUIViewTraffic::getTrackedID
GUIGlID getTrackedID() const
Returns the id of the tracked vehicle (-1 if none)
Definition: GUIViewTraffic.cpp:354
GUIVehicle
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:54
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GUISUMOViewParent.h
GUIViewTraffic::onDoubleClicked
long onDoubleClicked(FXObject *, FXSelector, void *)
Definition: GUIViewTraffic.cpp:528
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GUIViewTraffic::retrieveBreakpoints
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints from the current runThread
Definition: GUIViewTraffic.cpp:577
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:180
GUIViewTraffic::setColorScheme
bool setColorScheme(const std::string &name)
set color scheme
Definition: GUIViewTraffic.cpp:163
GUIViewTraffic::~GUIViewTraffic
virtual ~GUIViewTraffic()
destructor
Definition: GUIViewTraffic.cpp:96
GUIViewTraffic::getEdgeLaneParamKeys
std::vector< std::string > getEdgeLaneParamKeys(bool edgeKeys) const
return list of available edge parameters
Definition: GUIViewTraffic.cpp:268
GUIViewTraffic::checkSnapshots
void checkSnapshots()
Checks whether it is time for a snapshot.
Definition: GUIViewTraffic.cpp:566
Position.h
GUILane
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:62
GUIMainWindow
Definition: GUIMainWindow.h:47
GUIViewTraffic::onCmdCloseEdge
long onCmdCloseEdge(FXObject *, FXSelector, void *)
Definition: GUIViewTraffic.cpp:504
GUIGlID
unsigned int GUIGlID
Definition: GUIGlObject.h:43
GUIViewTraffic::myTrackedID
GUIGlID myTrackedID
Definition: GUIViewTraffic.h:132
GUIViewTraffic::doPaintGL
int doPaintGL(int mode, const Boundary &bound)
paint GL
Definition: GUIViewTraffic.cpp:288
GUIViewTraffic::buildViewToolBars
virtual void buildViewToolBars(GUIGlChildWindow &)
builds the view toolbars
Definition: GUIViewTraffic.cpp:102
GUIViewTraffic::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
get the current simulation time
Definition: GUIViewTraffic.cpp:471
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:541
GUIGlChildWindow
Definition: GUIGlChildWindow.h:41
GUIViewTraffic::myTLSGame
bool myTLSGame
whether game mode was set to 'tls'
Definition: GUIViewTraffic.h:135
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GUINet
A MSNet extended by some values for usage within the gui.
Definition: GUINet.h:83
GUIViewTraffic::startTrack
void startTrack(int id)
Starts vehicle tracking.
Definition: GUIViewTraffic.cpp:342
GUIViewTraffic::onCmdAddRerouter
long onCmdAddRerouter(FXObject *, FXSelector, void *)
Definition: GUIViewTraffic.cpp:516
PositionVector.h
GUIPropertyScheme
Definition: GUIPropertyScheme.h:46
GUIViewTraffic::onGamingRightClick
void onGamingRightClick(Position pos)
Definition: GUIViewTraffic.cpp:456