Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
AccessEdge.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// The AccessEdge is a special intermodal edge connecting different modes
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include "IntermodalEdge.h"
24
25
26// ===========================================================================
27// class definitions
28// ===========================================================================
30template<class E, class L, class N, class V>
31class AccessEdge : public IntermodalEdge<E, L, N, V> {
32private:
34
35public:
36 AccessEdge(int numericalID, const _IntermodalEdge* inEdge, const _IntermodalEdge* outEdge, const double length,
37 SVCPermissions modeRestriction = SVC_IGNORING,
38 SVCPermissions vehicleRestriction = SVC_IGNORING,
39 double traveltime = -1) :
40 _IntermodalEdge(inEdge->getID() + ":" + outEdge->getID() + (modeRestriction == SVC_TAXI ? ":taxi" : ""),
41 numericalID, outEdge->getEdge(), "!access", length > 0. ? length : NUMERICAL_EPS),
42 myTraveltime(traveltime),
43 myModeRestrictions(modeRestriction),
44 myVehicleRestriction(vehicleRestriction)
45 { }
46
47 AccessEdge(int numericalID, const std::string& id, const E* edge, const double length = 0,
48 SVCPermissions modeRestriction = SVC_IGNORING,
49 SVCPermissions vehicleRestriction = SVC_IGNORING) :
50 _IntermodalEdge(id, numericalID, edge, "!access", length > 0. ? length : NUMERICAL_EPS),
51 myTraveltime(-1),
52 myModeRestrictions(modeRestriction),
53 myVehicleRestriction(vehicleRestriction)
54 { }
55
56 double getTravelTime(const IntermodalTrip<E, N, V>* const trip, double /* time */) const {
57 return myTraveltime > 0 ? myTraveltime : this->getLength() / trip->speed;
58 }
59
60 bool prohibits(const IntermodalTrip<E, N, V>* const trip) const {
61 return ((myModeRestrictions != SVC_IGNORING && (trip->modeSet & myModeRestrictions) == 0)
63 ((trip->vehicle == nullptr ? SVC_PEDESTRIAN : trip->vehicle->getVClass()) & myVehicleRestriction) == 0));
64 }
65
66private:
68 const double myTraveltime;
73
74};
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_TAXI
vehicle is a taxi
@ SVC_PEDESTRIAN
pedestrian
the access edge connecting different modes that is given to the internal router (SUMOAbstractRouter)
Definition AccessEdge.h:31
AccessEdge(int numericalID, const std::string &id, const E *edge, const double length=0, SVCPermissions modeRestriction=SVC_IGNORING, SVCPermissions vehicleRestriction=SVC_IGNORING)
Definition AccessEdge.h:47
const SVCPermissions myVehicleRestriction
only allow using this edge if the vehicle class matches (i.e. exiting a taxi)
Definition AccessEdge.h:72
bool prohibits(const IntermodalTrip< E, N, V > *const trip) const
Definition AccessEdge.h:60
AccessEdge(int numericalID, const _IntermodalEdge *inEdge, const _IntermodalEdge *outEdge, const double length, SVCPermissions modeRestriction=SVC_IGNORING, SVCPermissions vehicleRestriction=SVC_IGNORING, double traveltime=-1)
Definition AccessEdge.h:36
IntermodalEdge< E, L, N, V > _IntermodalEdge
Definition AccessEdge.h:33
const double myTraveltime
travel time (alternative to length)
Definition AccessEdge.h:68
const SVCPermissions myModeRestrictions
only allow using this edge if the modeSet matches (i.e. entering a taxi)
Definition AccessEdge.h:70
double getTravelTime(const IntermodalTrip< E, N, V > *const trip, double) const
Definition AccessEdge.h:56
the base edge type that is given to the internal router (SUMOAbstractRouter)
const E * getEdge() const
double getLength() const
required by DijkstraRouter et al for external effort computation
the "vehicle" type that is given to the internal router (SUMOAbstractRouter)
const SVCPermissions modeSet
const V *const vehicle
const double speed
const std::string & getID() const
Returns the id.
Definition Named.h:74