Path: blob/main/src/guisim/GUITrafficLightLogicWrapper.h
169667 views
/****************************************************************************/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 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,65GUISUMOAbstractView& parent);6667/** @brief Returns an own parameter window68*69* @param[in] app The application needed to build the parameter window70* @param[in] parent The parent window needed to build the parameter window71* @return The built parameter window72* @see GUIGlObject::getParameterWindow73*/74GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app,75GUISUMOAbstractView& parent);7677/** @brief Returns the boundary to which the view shall be centered in order to show the object78*79* @return The boundary the object is within80* @see GUIGlObject::getCenteringBoundary81*/82Boundary getCenteringBoundary() const;8384/// @brief Returns the value for generic parameter 'name' or ''85const std::string getOptionalName() const;8687/** @brief Draws the object88* @param[in] s The settings for the current view (may influence drawing)89* @see GUIGlObject::drawGL90*/91void drawGL(const GUIVisualizationSettings& s) const;92//@}939495/// Builds a GUITLLogicPhasesTrackerWindow which will receive new phases96void begin2TrackPhases();9798/// Builds a GUITLLogicPhasesTrackerWindow which displays the phase diagram99void showPhases();100101/// Builds a GUITLLogicPhasesTrackerWindow which displays the phase diagram102void switchTLSLogic(int to);103104/// Returns the index of the given link within the according tls105int getLinkIndex(const MSLink* const link) const;106107MSTrafficLightLogic& getTLLogic() const {108return myTLLogic;109}110111MSTrafficLightLogic* getActiveTLLogic() const;112113int getCurrentPhase() const;114std::string getCurrentPhaseName() const;115int getCurrentDurationSeconds() const;116int getCurrentMinDurSeconds() const;117int getCurrentMaxDurSeconds() const;118int getCurrentEarliestEndSeconds() const;119int getCurrentLatestEndSeconds() const;120int getDefaultCycleTimeSeconds() const;121int getCurrentTimeInCycleSeconds() const;122int getRunningDurationSeconds() const;123124public:125/**126* @class GUITrafficLightLogicWrapperPopupMenu127* The popup-menu for a TLS-logic. Adds the functionality to open a128* view on the tls-logic and to start tracking of the tls-logic.129*/130class GUITrafficLightLogicWrapperPopupMenu : public GUIGLObjectPopupMenu {131FXDECLARE(GUITrafficLightLogicWrapperPopupMenu)132133public:134/// Constructor135GUITrafficLightLogicWrapperPopupMenu(GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject* o);136137/// Destructor138~GUITrafficLightLogicWrapperPopupMenu();139140/// Called if the phases shall be shown141long onCmdShowPhases(FXObject*, FXSelector, void*);142143/// Called if the phases shall be begun to track144long onCmdBegin2TrackPhases(FXObject*, FXSelector, void*);145long onCmdShowDetectors(FXObject*, FXSelector, void*);146147long onCmdSwitchTLS2Off(FXObject*, FXSelector, void*);148long onCmdSwitchTLSLogic(FXObject*, FXSelector, void*);149150protected:151/// protected constructor for FOX152GUITrafficLightLogicWrapperPopupMenu() { }153154};155156private:157/// Reference to the according tls158MSTLLogicControl& myTLLogicControl;159160/// The wrapped tl-logic161MSTrafficLightLogic& myTLLogic;162163/// The main application164GUIMainWindow* myApp;165};166167168