/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2002-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 MSNoLogicJunction.cpp14/// @author Daniel Krajzewicz15/// @author Michael Behrisch16/// @author Jakob Erdmann17/// @date Thu, 06 Jun 200218///19// -------------------20/****************************************************************************/21#include <config.h>2223#include <algorithm>24#include <cassert>25#include <cmath>26#include "MSLane.h"27#include "MSLink.h"28#include "MSNoLogicJunction.h"293031// ===========================================================================32// static member definitions33// ===========================================================================3435// ===========================================================================36// method definitions37// ===========================================================================38MSNoLogicJunction::MSNoLogicJunction(const std::string& id,39SumoXMLNodeType type,40const Position& position,41const PositionVector& shape,42const std::string& name,43std::vector<MSLane*> incoming, std::vector<MSLane*> internal):44MSJunction(id, type, position, shape, name),45myIncomingLanes(incoming),46myInternalLanes(internal) {47}484950MSNoLogicJunction::~MSNoLogicJunction() {}515253void54MSNoLogicJunction::postloadInit() {55// inform links where they have to report approaching vehicles to56for (const MSLane* const l : myIncomingLanes) {57for (MSLink* const link : l->getLinkCont()) {58link->setRequestInformation(-1, false, false, std::vector<MSLink*>(), std::vector<MSLane*>());59}60}61}626364const std::vector<MSLane*>65MSNoLogicJunction::getInternalLanes() const {66// Besides the lanes im myInternal lanes, which are only the last parts of the connections,67// this collects all lanes on the junction68std::vector<MSLane*> allInternalLanes;69for (std::vector<MSLane*>::const_iterator i = myInternalLanes.begin(); i != myInternalLanes.end(); ++i) {70MSLane* l = *i;71while (l != nullptr) {72allInternalLanes.push_back(l);73const std::vector<MSLane::IncomingLaneInfo> incoming = l->getIncomingLanes();74if (incoming.size() == 0) {75break;76}77assert(l->getIncomingLanes().size() == 1);78l = l->getIncomingLanes()[0].lane;79if (!l->isInternal()) {80break;81}82}83}84return allInternalLanes;85}868788/****************************************************************************/899091