/****************************************************************************/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 GUIJunctionWrapper.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @author Michael Behrisch17/// @date Mon, 1 Jul 200318///19// Holds geometrical values for a junction20/****************************************************************************/21#pragma once22#include <config.h>2324#include <string>25#include <utility>26#include <utils/geom/PositionVector.h>27#include <utils/gui/globjects/GUIGLObjectPopupMenu.h>28#include <utils/gui/globjects/GUIGlObject.h>29#include <utils/gui/globjects/GUIPolygon.h>303132// ===========================================================================33// class declarations34// ===========================================================================35class MSNet;36class MSJunction;37#ifdef HAVE_OSG38namespace osg {39class Geometry;40}41#endif424344// ===========================================================================45// class definitions46// ===========================================================================47/**48* @class GUIJunctionWrapper49*50* As MSJunctions do not have a graphical representation but a complex51* inheritance tree, this class is used to encapsulate the geometry of an52* abstract junction and to be used as a gl-object.53*54* In the case the represented junction's shape is empty, the boundary55* is computed using the junction's position to which an offset of 1m to each56* side is added.57*/58class GUIJunctionWrapper : public GUIGlObject {59public:60/** @brief Constructor61* @param[in] junction The represented junction62*/63GUIJunctionWrapper(MSJunction& junction, const std::string& tllID);646566/// @brief Destructor67virtual ~GUIJunctionWrapper();68697071/// @name inherited from GUIGlObject72//@{7374/** @brief Returns an own popup-menu75*76* @param[in] app The application needed to build the popup-menu77* @param[in] parent The parent window needed to build the popup-menu78* @return The built popup-menu79* @see GUIGlObject::getPopUpMenu80*/81GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app,82GUISUMOAbstractView& parent);8384/** @brief Returns an own parameter window85*86* @param[in] app The application needed to build the parameter window87* @param[in] parent The parent window needed to build the parameter window88* @return The built parameter window89* @see GUIGlObject::getParameterWindow90*/91GUIParameterTableWindow* getParameterWindow(92GUIMainWindow& app, GUISUMOAbstractView& parent);9394/// @brief return exaggeration associated with this GLObject95double getExaggeration(const GUIVisualizationSettings& s) const;9697/** @brief Returns the boundary to which the view shall be centered in order to show the object98*99* @return The boundary the object is within100* @see GUIGlObject::getCenteringBoundary101*/102Boundary getCenteringBoundary() const;103104/// @brief Returns the value for generic parameter 'name' or ''105const std::string getOptionalName() const;106107/** @brief Draws the object108* @param[in] s The settings for the current view (may influence drawing)109* @see GUIGlObject::drawGL110*/111void drawGL(const GUIVisualizationSettings& s) const;112//@}113114/** @brief Returns the boundary of the junction115* @return This junction's boundary116*/117Boundary getBoundary() const {118return myBoundary;119}120121/// @brief whether this is an inner junction (a waiting spot for crossing a "real" junction)122bool isInternal() const {123return myIsInternal;124}125126/** @brief Returns the represented junction127* @return The junction itself128*/129const MSJunction& getJunction() const {130return myJunction;131}132133134#ifdef HAVE_OSG135void setGeometry(osg::Geometry* geom) {136myGeom = geom;137}138139void updateColor(const GUIVisualizationSettings& s);140#endif141142private:143double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;144145private:146/// @brief A reference to the represented junction147MSJunction& myJunction;148149/// @brief An object that stores the shape and its tesselation150mutable TesselatedPolygon myTesselation;151mutable double myExaggeration;152153/// @brief The maximum size (in either x-, or y-dimension) for determining whether to draw or not154double myMaxSize;155156/// @brief The represented junction's boundary157Boundary myBoundary;158159/// @brief whether this wraps an instance of MSInternalJunction160bool myIsInternal;161162/// @brief whether this junction has only waterways as incoming and outgoing edges163bool myAmWaterway;164/// @brief whether this junction has only railways as incoming and outgoing edges165bool myAmRailway;166/// @brief whether this junction has only airways as incoming and outgoing edges167bool myAmAirway;168169/// @brief the associated traffic light or ""170const std::string myTLLID;171172#ifdef HAVE_OSG173osg::Geometry* myGeom;174#endif175176177private:178/// @brief Invalidated copy constructor.179GUIJunctionWrapper(const GUIJunctionWrapper&);180181/// @brief Invalidated assignment operator.182GUIJunctionWrapper& operator=(const GUIJunctionWrapper&);183184};185186187