Path: blob/main/src/guisim/GUITrafficLightLogicWrapper.h
193672 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 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 GUITrafficLightLogicWrapper.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Michael Behrisch17/// @date Oct/Nov 200318///19// A wrapper for tl-logics to allow their visualisation and interaction20/****************************************************************************/21#pragma once22#include <config.h>2324#include <gui/GUITLLogicPhasesTrackerWindow.h>25#include <utils/gui/globjects/GUIGlObject.h>26#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>272829// ===========================================================================30// class declarations31// ===========================================================================32class MSTrafficLightLogic;33class GUIMainWindow;343536// ===========================================================================37// class definition38// ===========================================================================39/**40* @class GUITrafficLightLogicWrapper41* This class is responsible for the visualisation of tl-logics and the42* interaction with them.43*/44class GUITrafficLightLogicWrapper : public GUIGlObject {45public:46/// Constructor47GUITrafficLightLogicWrapper(MSTLLogicControl& control, MSTrafficLightLogic& tll);4849/// Destructor50~GUITrafficLightLogicWrapper();51525354/// @name inherited from GUIGlObject55//@{5657/** @brief Returns an own popup-menu58*59* @param[in] app The application needed to build the popup-menu60* @param[in] parent The parent window needed to build the popup-menu61* @return The built popup-menu62* @see GUIGlObject::getPopUpMenu63*/64GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;6566/** @brief Returns an own parameter window67*68* @param[in] app The application needed to build the parameter window69* @param[in] parent The parent window needed to build the parameter window70* @return The built parameter window71* @see GUIGlObject::getParameterWindow72*/73GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;7475/** @brief Returns the boundary to which the view shall be centered in order to show the object76*77* @return The boundary the object is within78* @see GUIGlObject::getCenteringBoundary79*/80Boundary getCenteringBoundary() const override;8182/// @brief Returns the value for generic parameter 'name' or ''83const std::string getOptionalName() const override;8485/** @brief Draws the object86* @param[in] s The settings for the current view (may influence drawing)87* @see GUIGlObject::drawGL88*/89void drawGL(const GUIVisualizationSettings& s) const override;90//@}919293/// Builds a GUITLLogicPhasesTrackerWindow which will receive new phases94void begin2TrackPhases(GUIMainWindow* app = nullptr);9596/// Builds a GUITLLogicPhasesTrackerWindow which displays the phase diagram97void showPhases();9899/// Builds a GUITLLogicPhasesTrackerWindow which displays the phase diagram100void switchTLSLogic(int to);101102/// Returns the index of the given link within the according tls103int getLinkIndex(const MSLink* const link) const;104105MSTrafficLightLogic& getTLLogic() const {106return myTLLogic;107}108109MSTrafficLightLogic* getActiveTLLogic() const;110111int getCurrentPhase() const;112std::string getCurrentPhaseName() const;113int getCurrentDurationSeconds() const;114int getCurrentMinDurSeconds() const;115int getCurrentMaxDurSeconds() const;116int getCurrentEarliestEndSeconds() const;117int getCurrentLatestEndSeconds() const;118int getDefaultCycleTimeSeconds() const;119int getCurrentTimeInCycleSeconds() const;120int getRunningDurationSeconds() const;121122public:123/**124* @class GUITrafficLightLogicWrapperPopupMenu125* The popup-menu for a TLS-logic. Adds the functionality to open a126* view on the tls-logic and to start tracking of the tls-logic.127*/128class GUITrafficLightLogicWrapperPopupMenu : public GUIGLObjectPopupMenu {129FXDECLARE(GUITrafficLightLogicWrapperPopupMenu)130131public:132/// Constructor133GUITrafficLightLogicWrapperPopupMenu(GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject* o);134135/// Destructor136~GUITrafficLightLogicWrapperPopupMenu();137138/// Called if the phases shall be shown139long onCmdShowPhases(FXObject*, FXSelector, void*);140141/// Called if the phases shall be begun to track142long onCmdBegin2TrackPhases(FXObject*, FXSelector, void*);143long onCmdShowDetectors(FXObject*, FXSelector, void*);144145long onCmdSwitchTLS2Off(FXObject*, FXSelector, void*);146long onCmdSwitchTLSLogic(FXObject*, FXSelector, void*);147148protected:149/// protected constructor for FOX150GUITrafficLightLogicWrapperPopupMenu() { }151152};153154private:155/// Reference to the according tls156MSTLLogicControl& myTLLogicControl;157158/// The wrapped tl-logic159MSTrafficLightLogic& myTLLogic;160161/// The main application162GUIMainWindow* myApp;163};164165166