/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GUIViewTraffic.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Michael Behrisch17/// @author Andreas Gaubatz18/// @date Sept 200219///20// A view on the simulation; this view is a microscopic one21/****************************************************************************/22#pragma once23#include <config.h>2425#include <string>26#include <utils/geom/Boundary.h>27#include <utils/geom/Position.h>28#include <utils/common/RGBColor.h>29#include <utils/geom/PositionVector.h>30#include "GUISUMOViewParent.h"31#include <utils/gui/windows/GUISUMOAbstractView.h>323334// ===========================================================================35// class declarations36// ===========================================================================37class GUINet;38class GUISUMOViewParent;39class GUIVehicle;40class GUIVideoEncoder;41class MSRoute;424344// ===========================================================================45// class definitions46// ===========================================================================47/**48* @class GUIViewTraffic49* Microsocopic view at the simulation50*/51class GUIViewTraffic : public GUISUMOAbstractView {52public:53/// @brief constructor54GUIViewTraffic(FXComposite* p, GUIMainWindow& app,55GUISUMOViewParent* parent, GUINet& net, FXGLVisual* glVis,56FXGLCanvas* share);57/// @brief destructor58virtual ~GUIViewTraffic();5960/// @brief builds the view toolbars61virtual void buildViewToolBars(GUIGlChildWindow*) override;6263/** @brief Starts vehicle tracking64* @param[in] id The glID of the vehicle to track65*/66void startTrack(int id) override;6768/** @brief Stops vehicle tracking69*/70void stopTrack() override;7172/** @brief Returns the id of the tracked vehicle (-1 if none)73* @return The glID of the vehicle to track74*/75GUIGlID getTrackedID() const override;7677bool setColorScheme(const std::string& name) override;7879/// @brief recalibrate color scheme according to the current value range80void buildColorRainbow(const GUIVisualizationSettings& s, GUIColorScheme& scheme, int active, GUIGlObjectType objectType,81const GUIVisualizationRainbowSettings& rs) override;8283/// @brief return list of loaded edgeData attributes84std::vector<std::string> getEdgeDataAttrs() const override;8586/// @brief return list of loaded edgeData ids (being computed in the current simulation)87std::vector<std::string> getMeanDataIDs() const override;8889/// @brief return list of available attributes for the given meanData id90std::vector<std::string> getMeanDataAttrs(const std::string& meanDataID) const override;9192/// @brief return list of available edge parameters93std::vector<std::string> getEdgeLaneParamKeys(bool edgeKeys) const override;9495/// @brief return list of available vehicle parameters96std::vector<std::string> getVehicleParamKeys(bool vTypeKeys) const override;9798/// @brief return list of available POI parameters99std::vector<std::string> getPOIParamKeys() const override;100101/// @brief handle mouse click in gaming mode102void onGamingClick(Position pos) override;103void onGamingRightClick(Position pos) override;104105/// @brief get the current simulation time106SUMOTime getCurrentTimeStep() const override;107108/// @brief interaction with the simulation109long onCmdCloseLane(FXObject*, FXSelector, void*) override;110long onCmdCloseEdge(FXObject*, FXSelector, void*) override;111long onCmdAddRerouter(FXObject*, FXSelector, void*) override;112113/// @brief highlight edges according to reachability114long onCmdShowReachability(FXObject*, FXSelector, void*) override;115static long showLaneReachability(GUILane* lane, FXObject*, FXSelector);116117long onDoubleClicked(FXObject*, FXSelector, void*) override;118119/** @brief Adds a frame to a video snapshot which will be initialized if necessary120*/121void saveFrame(const std::string& destFile, FXColor* buf) override;122123/** @brief Ends a video snapshot124*/125void endSnapshot() override;126127/** @brief Checks whether it is time for a snapshot128*/129void checkSnapshots() override;130131/// @brief retrieve breakpoints from the current runThread132const std::vector<SUMOTime> retrieveBreakpoints() const override;133134/// @brief Draw (or not) the JuPedSim pedestrian network135/// @param s The visualization settings136void drawPedestrianNetwork(const GUIVisualizationSettings& s) const override;137138/// @brief Change the color of the JuPedSim pedestrian network139/// @param s The visualization settings140void changePedestrianNetworkColor(const GUIVisualizationSettings& s) const override;141142/** @brief centers to the chosen artifact143* @param[in] id The id of the artifact to center to144* @param[in] applyZoom Whether to zoom in145* @param[in] zoomDist The distance in m to use for the zoom, values < 0 means: use the centeringBoundary146* @note caller is responsible for calling update147*/148void centerTo(GUIGlID id, bool applyZoom, double zoomDist = 20) override;149150protected:151int doPaintGL(int mode, const Boundary& bound) override;152153GUILane* getLaneUnderCursor() override;154155private:156GUIGlID myTrackedID;157158/// @brief whether game mode was set to 'tls'159bool myTLSGame;160161#ifdef HAVE_FFMPEG162GUIVideoEncoder* myCurrentVideo;163#endif164165protected:166GUIViewTraffic() { }167168};169170171