/****************************************************************************/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 AccessEdge.h14/// @author Michael Behrisch15/// @date Mon, 03 March 201416///17// The AccessEdge is a special intermodal edge connecting different modes18/****************************************************************************/19#pragma once20#include <config.h>2122#include "IntermodalEdge.h"232425// ===========================================================================26// class definitions27// ===========================================================================28/// @brief the access edge connecting different modes that is given to the internal router (SUMOAbstractRouter)29template<class E, class L, class N, class V>30class AccessEdge : public IntermodalEdge<E, L, N, V> {31private:32typedef IntermodalEdge<E, L, N, V> _IntermodalEdge;3334public:35AccessEdge(int numericalID, const _IntermodalEdge* inEdge, const _IntermodalEdge* outEdge, const double length,36SVCPermissions modeRestriction = SVC_IGNORING,37SVCPermissions vehicleRestriction = SVC_IGNORING,38double traveltime = -1) :39_IntermodalEdge(inEdge->getID() + ":" + outEdge->getID() + (modeRestriction == SVC_TAXI ? ":taxi" : ""),40numericalID, outEdge->getEdge(), "!access", length > 0. ? length : NUMERICAL_EPS),41myTraveltime(traveltime),42myModeRestrictions(modeRestriction),43myVehicleRestriction(vehicleRestriction)44{ }4546AccessEdge(int numericalID, const std::string& id, const E* edge, const double length = 0,47SVCPermissions modeRestriction = SVC_IGNORING,48SVCPermissions vehicleRestriction = SVC_IGNORING) :49_IntermodalEdge(id, numericalID, edge, "!access", length > 0. ? length : NUMERICAL_EPS),50myTraveltime(-1),51myModeRestrictions(modeRestriction),52myVehicleRestriction(vehicleRestriction)53{ }5455double getTravelTime(const IntermodalTrip<E, N, V>* const trip, double /* time */) const {56return myTraveltime > 0 ? myTraveltime : this->getLength() / trip->speed;57}5859bool prohibits(const IntermodalTrip<E, N, V>* const trip) const {60return ((myModeRestrictions != SVC_IGNORING && (trip->modeSet & myModeRestrictions) == 0)61|| (myVehicleRestriction != SVC_IGNORING &&62((trip->vehicle == nullptr ? SVC_PEDESTRIAN : trip->vehicle->getVClass()) & myVehicleRestriction) == 0));63}6465private:66/// @brief travel time (alternative to length)67const double myTraveltime;68/// @brief only allow using this edge if the modeSet matches (i.e. entering a taxi)69const SVCPermissions myModeRestrictions;70/// @brief only allow using this edge if the vehicle class matches (i.e. exiting a taxi)71const SVCPermissions myVehicleRestriction;7273};747576