84 GUINet& net, FXGLVisual* glVis,
103 for (std::vector<std::string>::const_iterator i = names.begin(); i != names.end(); ++i) {
113 "\tLocate Junction\tLocate a junction within the network.",
115 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
118 "\tLocate Street\tLocate a street within the network.",
120 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
124 "\tLocate Vehicle\tLocate a vehicle within the network.",
126 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
131 "\tLocate Vehicle\tLocate a person within the network.",
133 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
138 "\tLocate TLS\tLocate a tls within the network.",
140 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
143 "\tLocate Additional\tLocate an additional structure within the network.",
145 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
148 "\tLocate PoI\tLocate a PoI within the network.",
150 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
153 "\tLocate Polygon\tLocate a Polygon within the network.",
155 ICON_ABOVE_TEXT | FRAME_THICK | FRAME_RAISED);
179 double minValue = std::numeric_limits<double>::infinity();
180 double maxValue = -std::numeric_limits<double>::infinity();
186 }
else if (active == 24) {
190 for (MSEdgeVector::const_iterator it = edges.begin(); it != edges.end(); ++it) {
193 minValue =
MIN2(minValue, val);
194 maxValue =
MAX2(maxValue, val);
196 const std::vector<MSLane*>& lanes = (*it)->getLanes();
197 for (std::vector<MSLane*>::const_iterator it_l = lanes.begin(); it_l != lanes.end(); it_l++) {
199 minValue =
MIN2(minValue, val);
200 maxValue =
MAX2(maxValue, val);
206 std::set<const MSJunction*> junctions;
208 junctions.insert(edge->getFromJunction());
209 junctions.insert(edge->getToJunction());
211 for (
const MSJunction* junction : junctions) {
212 minValue =
MIN2(minValue, junction->getPosition().z());
213 maxValue =
MAX2(maxValue, junction->getPosition().z());
217 if (minValue != std::numeric_limits<double>::infinity()) {
220 double range = maxValue - minValue;
238 glMatrixMode(GL_MODELVIEW);
240 glDisable(GL_TEXTURE_2D);
241 glDisable(GL_ALPHA_TEST);
243 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
244 glEnable(GL_DEPTH_TEST);
255 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
256 const float minB[2] = { (float)bound.
xmin(), (float)bound.
ymin() };
257 const float maxB[2] = { (float)bound.
xmax(), (float)bound.
ymax() };
259 glEnable(GL_POLYGON_OFFSET_FILL);
260 glEnable(GL_POLYGON_OFFSET_LINE);
264 glTranslated(0, 0, -.01);
270 glTranslated(0, 0, .01);
307 const std::vector<MSTrafficLightLogic*>& logics = tlsControl.
getAllLogics();
309 double minDist = std::numeric_limits<double>::infinity();
310 for (std::vector<MSTrafficLightLogic*>::const_iterator i = logics.begin(); i != logics.end(); ++i) {
316 if (lanes.size() > 0) {
317 const Position& endPos = lanes[0]->getShape().back();
327 const std::vector<MSTrafficLightLogic*> logics = vars.
getAllLogics();
328 if (logics.size() > 1) {
330 for (
int i = 0; i < (int)logics.size() - 1; ++i) {
331 if (minTll->
getProgramID() == logics[i]->getProgramID()) {
336 if (l == logics[0]) {
359 return dynamic_cast<GUILane*
>(o);
419 if (myCurrentVideo == 0) {
433 if (myCurrentVideo != 0) {
434 delete myCurrentVideo;
445 if (myCurrentVideo != 0) {
447 if (error !=
"" && error !=
"video") {
455 const std::vector<SUMOTime>
Locate junction - button.
void paintGLGrid()
paints a grid
static const RGBColor BLUE
double ymin() const
Returns minimum y-coordinate.
virtual void buildViewToolBars(GUIGlChildWindow &)
builds the view toolbars
double xmax() const
Returns maximum x-coordinate.
GUICompleteSchemeStorage gSchemeStorage
MSEdge & getEdge() const
Returns the lane's edge.
long onCmdCloseLane(FXObject *, FXSelector, void *)
interaction with the simulation
double scale
information about a lane's width (temporary, used for a single view)
Storage for all programs of a single tls.
bool setColorScheme(const std::string &name)
set color scheme
void unlock()
release exclusive access to the simulation state
SUMORTree * myGrid
The visualization speed-up.
void switchTo(const std::string &id, const std::string &programID)
Switches the named (id) tls to the named (programID) program.
const std::vector< std::string > & getNames() const
Returns a list of stored settings names.
void closeTraffic(bool rebuildAllowed=true)
close this lane for traffic
bool gaming
whether the application is in gaming mode or not
Locate addtional structure - button.
The base class for an intersection.
void changeStepAndDuration(MSTLLogicControl &tlcontrol, SUMOTime simStep, int step, SUMOTime stepDuration)
Changes the current phase and her duration.
const double SUMO_const_laneWidth
GUIMainWindow * myApp
The application.
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
void writeFrame(uint8_t *buffer)
bool isActive(const MSTrafficLightLogic *tl) const
Returns whether the given tls program is the currently active for his tls.
static const RGBColor ORANGE
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
void lock()
grant exclusive access to the simulation state
const std::string & getID() const
Returns the id.
GUIDialog_ViewSettings * myVisualizationChanger
Visualization changer.
#define UNUSED_PARAMETER(x)
A class that stores a 2D geometrical boundary.
#define WRITE_WARNING(msg)
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
A fixed traffic light logic.
const LaneVector & getLanesAt(int i) const
Returns the list of lanes that are controlled by the signals at the given position.
std::map< const GUIGlObject *, int > myAdditionallyDrawn
List of objects for which GUIGlObject::drawGLAdditional is called.
Representation of a lane in the micro simulation (gui-version)
A class that stores and controls tls and switching of their programs.
A road/street connecting two junctions (gui-version)
A road/street connecting two junctions.
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
SUMOTime duration
The duration of the phase.
std::vector< MSTrafficLightLogic * > getAllLogics() const
static const RGBColor GREEN
Locate polygons - button.
int addColor(const T &color, const double threshold, const std::string &name="")
std::string name
The name of this setting.
void setCurrentScheme(const std::string &)
Sets the named scheme as the current.
const std::string & getProgramID() const
Returns this tl-logic's id.
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
A point in 2D or 3D with translation and scaling methods.
long onCmdAddRerouter(FXObject *, FXSelector, void *)
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
std::string makeSnapshot(const std::string &destFile, const int width=-1, const int height=-1)
Takes a snapshots and writes it into the given file.
long onCmdCloseEdge(FXObject *, FXSelector, void *)
FXComboBox & getColoringSchemesCombo()
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
GUIVisualizationSettings & get(const std::string &name)
Returns the named scheme.
bool isGaming() const
return whether the gui is in gaming mode
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static const RGBColor MAGENTA
double xmin() const
Returns minimum x-coordinate.
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.
virtual void checkSnapshots()
Checks whether it is time for a snapshot.
FXDEFMAP(GUIViewTraffic) GUIViewTrafficMap[]
long onDoubleClicked(FXObject *, FXSelector, void *)
bool myUseToolTips
use tool tips
void checkSnapshots()
Checks whether it is time for a snapshot.
void buildColorRainbow(GUIColorScheme &scheme, int active, GUIGlObjectType objectType)
recalibrate color scheme according to the current value range
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.
FXbool makeCurrent()
A reimplementation due to some internal reasons.
static const RGBColor YELLOW
std::vector< MSLane * > LaneVector
Definition of the list of arrival lanes subjected to this tls.
static const RGBColor RED
named colors
double m2p(double meter) const
meter-to-pixels conversion method
static const RGBColor CYAN
GUIVisualizationSettings * myVisualizationSettings
visualization settings
A MSNet extended by some values for usage within the gui.
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
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
bool contains(const std::string &name) const
Returns the information whether a setting with the given name is stored.
static const GUIGlID INVALID_ID
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints from the current runThread
std::string getCurrentScheme() const
Returns the name of the currently chosen scheme.
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
bool showGrid
Information whether a grid shall be shown.
void drawDecals()
Draws the stored decals.
GUIGlID getGlID() const
Returns the numerical id of the object.
The parent class for traffic light logics.
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
void unblockObject(GUIGlID id)
Marks an object as unblocked.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
std::vector< MSEdge * > MSEdgeVector
GUIGlID getObjectUnderCursor()
returns the id of the object under the cursor using GL_SELECT
GUIGlID getTrackedID() const
Returns the id of the tracked vehicle (-1 if none)
double ymax() const
Returns maximum y-coordinate.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
virtual int Search(const float a_min[2], const float a_max[2], const GUIVisualizationSettings &c) const
Find all within search rectangle.
std::vector< MSTrafficLightLogic * > getAllLogics() const
Returns a vector which contains all logics.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
const MSPhaseDefinition & getPhase(int givenstep) const
Returns the definition of the phase from the given position within the plan.
void stopTrack()
Stops vehicle tracking.
GUILane * getLaneUnderCursor()
FXPopup * getLocatorPopup()