/****************************************************************************/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 MSJunction.h14/// @author Christian Roessel15/// @author Daniel Krajzewicz16/// @author Sascha Krieg17/// @author Michael Behrisch18/// @date Wed, 12 Dez 200119///20// The base class for an intersection21/****************************************************************************/22#pragma once23#include <config.h>2425#include <string>26#include <vector>27#include <map>28#include <utils/geom/Position.h>29#include <utils/geom/PositionVector.h>30#include <utils/common/Named.h>31#include <utils/common/Parameterised.h>32#include <utils/common/SUMOTime.h>33#include <utils/common/UtilExceptions.h>34#include <utils/xml/SUMOXMLDefinitions.h>353637// ===========================================================================38// class declarations39// ===========================================================================40class MSVehicle;41class MSLink;42class MSLane;43class MSEdge;44class MSJunctionLogic;4546typedef std::vector<MSEdge*> MSEdgeVector;47typedef std::vector<const MSEdge*> ConstMSEdgeVector;484950// ===========================================================================51// class definitions52// ===========================================================================53/**54* @class MSJunction55* @brief The base class for an intersection56*/57class MSJunction : public Named, public Parameterised {58public:59/** @brief Constructor60* @param[in] id The id of the junction61* @param[in] position The position of the junction62* @param[in] shape The shape of the junction63*/64MSJunction(const std::string& id,65SumoXMLNodeType type,66const Position& position,67const PositionVector& shape,68const std::string& name);697071/// @brief Destructor.72virtual ~MSJunction();737475/** performs some initialisation after the loading76(e.g., link map computation) */77virtual void postloadInit();7879/// used by the gui80void addSecondaryPosition(const Position& pos) {81myPosition2 = pos;82}8384/** returns the junction's position */85const Position& getPosition(bool secondaryShape = false) const;8687/** @brief Returns this junction's shape88* @return The shape of this junction89*/90const PositionVector& getShape() const {91return myShape;92}9394/// @brief return the junction name95const std::string& getName() const {96return myName;97}9899virtual const std::vector<MSLink*>& getFoeLinks(const MSLink* const /*srcLink*/) const {100return myEmptyLinks;101}102103virtual const std::vector<MSLane*>& getFoeInternalLanes(const MSLink* const /*srcLink*/) const {104return myEmptyLanes;105}106107inline const ConstMSEdgeVector& getIncoming() const {108return myIncoming;109}110111int getNrOfIncomingLanes() const;112113inline const ConstMSEdgeVector& getOutgoing() const {114return myOutgoing;115}116117/** @brief Returns all internal lanes on the junction118*/119virtual const std::vector<MSLane*> getInternalLanes() const {120return myEmptyLanes;121}122123void addIncoming(MSEdge* edge) {124myIncoming.push_back(edge);125}126127void addOutgoing(MSEdge* edge) {128myOutgoing.push_back(edge);129}130131/// @brief return the type of this Junction132SumoXMLNodeType getType() const {133return myType;134}135136/// @brief erase vehicle from myLinkLeaders137void passedJunction(const MSVehicle* vehicle);138139// @brief return the underlying right-of-way and conflict matrix140virtual const MSJunctionLogic* getLogic() const {141return nullptr;142}143144protected:145/// @brief Tye type of this junction146SumoXMLNodeType myType;147148/// @brief The position of the junction149Position myPosition;150151/// @brief The secondary position of the junction152Position myPosition2;153154/// @brief The shape of the junction155PositionVector myShape;156157/// @briefh The (optional) junction name158std::string myName;159160std::vector<MSLink*> myEmptyLinks;161std::vector<MSLane*> myEmptyLanes;162163164/// @brief incoming edges165ConstMSEdgeVector myIncoming;166/// @brief outgoing edges167ConstMSEdgeVector myOutgoing;168169private:170/// @brief Invalidated copy constructor.171MSJunction(const MSJunction&) = delete;172173/// @brief Invalidated assignment operator.174MSJunction& operator=(const MSJunction&) = delete;175176};177178179