/****************************************************************************/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 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, GUISUMOAbstractView& parent) override;8283/** @brief Returns an own parameter window84*85* @param[in] app The application needed to build the parameter window86* @param[in] parent The parent window needed to build the parameter window87* @return The built parameter window88* @see GUIGlObject::getParameterWindow89*/90GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;9192/// @brief return exaggeration associated with this GLObject93double getExaggeration(const GUIVisualizationSettings& s) const override;9495/** @brief Returns the boundary to which the view shall be centered in order to show the object96*97* @return The boundary the object is within98* @see GUIGlObject::getCenteringBoundary99*/100Boundary getCenteringBoundary() const override;101102/// @brief Returns the value for generic parameter 'name' or ''103const std::string getOptionalName() const override;104105/** @brief Draws the object106* @param[in] s The settings for the current view (may influence drawing)107* @see GUIGlObject::drawGL108*/109void drawGL(const GUIVisualizationSettings& s) const override;110//@}111112/** @brief Returns the boundary of the junction113* @return This junction's boundary114*/115Boundary getBoundary() const {116return myBoundary;117}118119/// @brief whether this is an inner junction (a waiting spot for crossing a "real" junction)120bool isInternal() const {121return myIsInternal;122}123124/** @brief Returns the represented junction125* @return The junction itself126*/127const MSJunction& getJunction() const {128return myJunction;129}130131132#ifdef HAVE_OSG133void setGeometry(osg::Geometry* geom) {134myGeom = geom;135}136137void updateColor(const GUIVisualizationSettings& s);138#endif139140private:141double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const override;142143private:144/// @brief A reference to the represented junction145MSJunction& myJunction;146147/// @brief An object that stores the shape and its tesselation148mutable TesselatedPolygon myTesselation;149mutable double myExaggeration;150151/// @brief The maximum size (in either x-, or y-dimension) for determining whether to draw or not152double myMaxSize;153154/// @brief The represented junction's boundary155Boundary myBoundary;156157/// @brief whether this wraps an instance of MSInternalJunction158bool myIsInternal;159160/// @brief whether this junction has only waterways as incoming and outgoing edges161bool myAmWaterway;162/// @brief whether this junction has only railways as incoming and outgoing edges163bool myAmRailway;164/// @brief whether this junction has only airways as incoming and outgoing edges165bool myAmAirway;166167/// @brief the associated traffic light or ""168const std::string myTLLID;169170#ifdef HAVE_OSG171osg::Geometry* myGeom;172#endif173174175private:176/// @brief Invalidated copy constructor.177GUIJunctionWrapper(const GUIJunctionWrapper&);178179/// @brief Invalidated assignment operator.180GUIJunctionWrapper& operator=(const GUIJunctionWrapper&);181182};183184185