/****************************************************************************/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 GUIContainer.h14/// @author Melanie Weber15/// @author Andreas Kendziorra16/// @date Wed, 01.08.201417///18// A MSVehicle extended by some values for usage within the gui19/****************************************************************************/20#pragma once21#include <config.h>2223#include <vector>24#include <set>25#include <string>26#include <utils/foxtools/fxheader.h>27#include <utils/gui/globjects/GUIGlObject.h>28#include <utils/common/RGBColor.h>29#include <microsim/transportables/MSTransportable.h>30#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>31#include <utils/gui/settings/GUIPropertySchemeStorage.h>32#include "GUIBaseVehicle.h"333435// ===========================================================================36// class declarations37// ===========================================================================38class GUISUMOAbstractView;39class GUIGLObjectPopupMenu;40class MSDevice_Vehroutes;414243// ===========================================================================44// class definitions45// ===========================================================================46/**47* @class GUIContainer48*/49class GUIContainer : public MSTransportable, public GUIGlObject {50public:51/** @brief Constructor52*/53GUIContainer(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan);5455/// @brief destructor56~GUIContainer();5758/// @name inherited from GUIGlObject59//@{6061/** @brief Returns an own popup-menu62*63* @param[in] app The application needed to build the popup-menu64* @param[in] parent The parent window needed to build the popup-menu65* @return The built popup-menu66* @see GUIGlObject::getPopUpMenu67*/68GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;6970/** @brief Returns an own parameter window71*72* @param[in] app The application needed to build the parameter window73* @param[in] parent The parent window needed to build the parameter window74* @return The built parameter window75* @see GUIGlObject::getParameterWindow76*/77GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;7879/** @brief Returns an own type parameter window80*81* @param[in] app The application needed to build the parameter window82* @param[in] parent The parent window needed to build the parameter window83* @return The built parameter window84*/85GUIParameterTableWindow* getTypeParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;8687/// @brief return exaggeration associated with this GLObject88double getExaggeration(const GUIVisualizationSettings& s) const override;8990/** @brief Returns the boundary to which the view shall be centered in order to show the object91*92* @return The boundary the object is within93* @see GUIGlObject::getCenteringBoundary94*/95Boundary getCenteringBoundary() const override;9697/** @brief Draws the object98* @param[in] s The settings for the current view (may influence drawing)99* @see GUIGlObject::drawGL100*/101void drawGL(const GUIVisualizationSettings& s) const override;102103/** @brief Draws additionally triggered visualisations104* @param[in] parent The view105* @param[in] s The settings for the current view (may influence drawing)106*/107virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const override;108//@}109110/* @brief set the position of a container while being transported by a vehicle111* @note This must be called by the vehicle before the call to drawGl */112void setPositionInVehicle(const GUIBaseVehicle::Seat& pos) {113myPositionInVehicle = pos;114}115116/// @name inherited from MSContainer with added locking117//@{118119/// @brief return the offset from the start of the current edge120double getEdgePos() const override;121122/// @brief Return the movement directon on the edge123int getDirection() const override;124125/// @brief return the Network coordinate of the container126// @note overrides the base method and returns myPositionInVehicle while in driving stage127Position getPosition() const override;128129/// @brief return the current angle of the container130double getAngle() const override;131132/// @brief the time this container spent waiting in seconds133double getWaitingSeconds() const override;134135/// @brief the current speed of the container136double getSpeed() const override;137138//@}139140/// @brief whether this container is selected in the GUI141bool isSelected() const override;142143double getScaleVisual() const override {144return getVehicleType().getParameter().scaleVisual;145}146/**147* @class GUIContainerPopupMenu148*149* A popup-menu for vehicles. In comparison to the normal popup-menu, this one150* also allows to trigger further visualisations and to track the vehicle.151*/152class GUIContainerPopupMenu : public GUIGLObjectPopupMenu {153FXDECLARE(GUIContainerPopupMenu)154public:155/** @brief Constructor156* @param[in] app The main window for instantiation of other windows157* @param[in] parent The parent view for changing it158* @param[in] o The object of interest159*/160GUIContainerPopupMenu(GUIMainWindow& app, GUISUMOAbstractView& parent, GUIGlObject* o);161162/// @brief Destructor163~GUIContainerPopupMenu();164165/// @brief Called if the plan shall be shown166long onCmdShowPlan(FXObject*, FXSelector, void*);167168/// @brief Called if the person shall be tracked169long onCmdStartTrack(FXObject*, FXSelector, void*);170171/// @brief Called if the person shall not be tracked any longer172long onCmdStopTrack(FXObject*, FXSelector, void*);173174protected:175/// @brief default constructor needed by FOX176FOX_CONSTRUCTOR(GUIContainerPopupMenu)177178};179180181182/// @brief Enabled visualisations, per view183std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;184185186187188private:189/// The mutex used to avoid concurrent updates of the vehicle buffer190mutable FXMutex myLock;191192/// The position of a container while riding a vehicle193GUIBaseVehicle::Seat myPositionInVehicle;194195/// @brief sets the color according to the currente settings196void setColor(const GUIVisualizationSettings& s) const;197198/// @brief gets the color value according to the current scheme index199double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const override;200201/// @brief sets the color according to the current scheme index and some vehicle function202bool setFunctionalColor(int activeScheme) const;203204/// @name drawing helper methods205/// @{206void drawAction_drawAsPoly(const GUIVisualizationSettings& s) const;207void drawAction_drawAsImage(const GUIVisualizationSettings& s) const;208/// @}209};210211212