/****************************************************************************/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 MSLogicJunction.cpp14/// @author Christian Roessel15/// @author Daniel Krajzewicz16/// @author Michael Behrisch17/// @author Jakob Erdmann18/// @date Wed, 12 Dez 200119///20// with one ore more logics.21/****************************************************************************/22#include <config.h>2324#include "MSLogicJunction.h"25#include "MSLane.h"262728// ===========================================================================29// member method definitions30// ===========================================================================31/* -------------------------------------------------------------------------32* methods from MSLogicJunction33* ----------------------------------------------------------------------- */34MSLogicJunction::MSLogicJunction(const std::string& id,35SumoXMLNodeType type,36const Position& position,37const PositionVector& shape,38const std::string& name,39std::vector<MSLane*> incoming,40std::vector<MSLane*> internal):41MSJunction(id, type, position, shape, name),42myIncomingLanes(incoming),43myInternalLanes(internal) {44}454647MSLogicJunction::~MSLogicJunction() {}484950void51MSLogicJunction::postloadInit() {52/*53if(getID()=="1565") {54int bla = 0;55}56// inform links where they have to report approaching vehicles to57int requestPos = 0;58std::vector<MSLane*>::iterator i;59// going through the incoming lanes...60for(i=myIncomingLanes.begin(); i!=myIncomingLanes.end(); ++i) {61const MSLinkCont &links = (*i)->getLinkCont();62// ... set information for every link63for(MSLinkCont::const_iterator j=links.begin(); j!=links.end(); j++) {64(*j)->setRequestInformation(&myRequest, requestPos,65&myRespond, requestPos/, clearInfo/);66requestPos++;67}68}69// set information for the internal lanes70requestPos = 0;71for(i=myInternalLanes.begin(); i!=myInternalLanes.end(); ++i) {72// ... set information about participation73static_cast<MSInternalLane*>(*i)->setParentJunctionInformation(74&myInnerState, requestPos++);75}76*/77}7879const std::vector<MSLane*>80MSLogicJunction::getInternalLanes() const {81// Besides the lanes im myInternal lanes, which are only the last parts of the connections,82// this collects all lanes on the junction83std::vector<MSLane*> allInternalLanes;84for (std::vector<MSLane*>::const_iterator i = myInternalLanes.begin(); i != myInternalLanes.end(); ++i) {85MSLane* l = *i;86while (l != nullptr) {87allInternalLanes.push_back(l);88const std::vector<MSLane::IncomingLaneInfo> incoming = l->getIncomingLanes();89if (incoming.size() == 0) {90break;91}92assert(l->getIncomingLanes().size() == 1);93l = l->getIncomingLanes()[0].lane;94if (!l->isInternal()) {95break;96}97}98}99return allInternalLanes;100}101102103/****************************************************************************/104105106