/****************************************************************************/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 GUILaneSpeedTrigger.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Michael Behrisch17/// @date Mon, 26.04.200418///19// Changes the speed allowed on a set of lanes (gui version)20/****************************************************************************/21#pragma once22#include <config.h>2324#include <vector>25#include <string>26#include <microsim/trigger/MSLaneSpeedTrigger.h>27#include <utils/foxtools/MFXComboBoxIcon.h>28#include <utils/gui/globjects/GUIGlObject_AbstractAdd.h>29#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>30#include <gui/GUIManipulator.h>313233// ===========================================================================34// class definitions35// ===========================================================================36/**37* @class GUILaneSpeedTrigger38* @brief Changes the speed allowed on a set of lanes (gui version)39*40* This is the gui-version of the MSLaneSpeedTrigger-object41*/42class GUILaneSpeedTrigger43: public MSLaneSpeedTrigger,44public GUIGlObject_AbstractAdd {45public:46/** @brief Constructor47* @param[in] idStorage The gl-id storage for giving this object an gl-id48* @param[in] id The id of the lane speed trigger49* @param[in] destLanes List of lanes affected by this speed trigger50* @param[in] file Name of the file to read the speeds to set from51*/52GUILaneSpeedTrigger(const std::string& id,53const std::vector<MSLane*>& destLanes,54const std::string& file);5556/** destructor */57~GUILaneSpeedTrigger();5859/// @name inherited from GUIGlObject60//@{6162/** @brief Returns an own popup-menu63*64* @param[in] app The application needed to build the popup-menu65* @param[in] parent The parent window needed to build the popup-menu66* @return The built popup-menu67* @see GUIGlObject::getPopUpMenu68*/69GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent);7071/** @brief Returns an own parameter window72*73* @param[in] app The application needed to build the parameter window74* @param[in] parent The parent window needed to build the parameter window75* @return The built parameter window76* @see GUIGlObject::getParameterWindow77*/78GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent);7980/// @brief return exaggeration associated with this GLObject81double getExaggeration(const GUIVisualizationSettings& s) const;8283/** @brief Returns the boundary to which the view shall be centered in order to show the object84*85* @return The boundary the object is within86* @see GUIGlObject::getCenteringBoundary87*/88Boundary getCenteringBoundary() const;8990/** @brief Draws the object91* @param[in] s The settings for the current view (may influence drawing)92* @see GUIGlObject::drawGL93*/94void drawGL(const GUIVisualizationSettings& s) const;95//@}9697GUIManipulator* openManipulator(GUIMainWindow& app, GUISUMOAbstractView& parent);9899public:100class GUILaneSpeedTriggerPopupMenu : public GUIGLObjectPopupMenu {101FXDECLARE(GUILaneSpeedTriggerPopupMenu)102public:103104GUILaneSpeedTriggerPopupMenu(GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject* o);105106~GUILaneSpeedTriggerPopupMenu();107108/** @brief Called if the object's manipulator shall be shown */109long onCmdOpenManip(FXObject*, FXSelector, void*);110111protected:112GUILaneSpeedTriggerPopupMenu() { }113114};115116class GUIManip_LaneSpeedTrigger : public GUIManipulator {117FXDECLARE(GUIManip_LaneSpeedTrigger)118public:119enum {120MID_USER_DEF = FXDialogBox::ID_LAST,121MID_PRE_DEF,122MID_OPTION,123MID_CLOSE,124ID_LAST125};126/// Constructor127GUIManip_LaneSpeedTrigger(GUIMainWindow& app,128const std::string& name, GUILaneSpeedTrigger& o,129int xpos, int ypos);130131/// Destructor132virtual ~GUIManip_LaneSpeedTrigger();133134long onCmdClose(FXObject*, FXSelector, void*);135long onCmdUserDef(FXObject*, FXSelector, void*);136long onUpdUserDef(FXObject*, FXSelector, void*);137long onCmdPreDef(FXObject*, FXSelector, void*);138long onUpdPreDef(FXObject*, FXSelector, void*);139long onCmdChangeOption(FXObject*, FXSelector, void*);140141private:142GUIMainWindow* myParent;143144FXint myChosenValue;145146FXDataTarget myChosenTarget;147148double mySpeed;149150FXDataTarget mySpeedTarget;151152FXRealSpinner* myUserDefinedSpeed;153154MFXComboBoxIcon* myPredefinedValues;155156GUILaneSpeedTrigger* myObject;157158protected:159FOX_CONSTRUCTOR(GUIManip_LaneSpeedTrigger)160};161162private:163/// Definition of a positions container164typedef std::vector<Position> PosCont;165166/// Definition of a rotation container167typedef std::vector<double> RotCont;168169private:170/// The positions in full-geometry mode171PosCont myFGPositions;172173/// The rotations in full-geometry mode174RotCont myFGRotations;175176/// The boundary of this rerouter177Boundary myBoundary;178179/// The information whether the speed shall be shown in m/s or km/h180bool myShowAsKMH;181182/// Storage for last value to avoid string recomputation183mutable double myLastValue;184185/// Storage for speed string to avoid recomputation186mutable std::string myLastValueString;187188};189190191