/****************************************************************************/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 ROLane.h14/// @author Daniel Krajzewicz15/// @author Jakob Erdmann16/// @date Sept 200217///18// A single lane the router may use19/****************************************************************************/20#pragma once21#include <config.h>2223#include <vector>24#include <utils/geom/PositionVector.h>25#include <utils/common/Named.h>26#include <utils/common/SUMOVehicleClass.h>272829// ===========================================================================30// class declarations31// ===========================================================================32class ROEdge;333435// ===========================================================================36// class definitions37// ===========================================================================38/**39* @class ROLane40* @brief A single lane the router may use41*42* Currently, the lane has no other purpose then storing the allowed vehicle43* classes. They are even only stored herein and used by computing the vehicle44* classes allowed on the according edge.45* @see ROEdge46*/47class ROLane : public Named {48public:49/** @brief Constructor50*51* @param[in] id The id of the lane52* @param[in] length The length of the lane53* @param[in] maxSpeed The maximum speed allowed on the lane54* @param[in] permissions Vehicle classes that may pass this lane55*/56ROLane(const std::string& id, ROEdge* edge, double length, double maxSpeed, SVCPermissions permissions, const PositionVector& shape) :57Named(id), myEdge(edge), myLength(length), myMaxSpeed(maxSpeed), myPermissions(permissions), myShape(shape),58myLengthGeometryFactor(MAX2(NUMERICAL_EPS, myShape.length() / myLength)) // factor should not be 059{ }606162/// @brief Destructor63~ROLane() { }646566/** @brief Returns the length of the lane67* @return The length of this lane68*/69double getLength() const {70return myLength;71}727374/** @brief Returns the maximum speed allowed on this lane75* @return The maximum speed allowed on this lane76*/77double getSpeed() const {78return myMaxSpeed;79}808182/** @brief Returns the list of allowed vehicle classes83* @return The list of vehicle classes allowed on this lane84*/85inline SVCPermissions getPermissions() const {86return myPermissions;87}8889/** @brief Returns the lane's edge90* @return This lane's edge91*/92ROEdge& getEdge() const {93return *myEdge;94}9596/// @brief get the map of outgoing lanes to via edges97const std::vector<std::pair<const ROLane*, const ROEdge*> >& getOutgoingViaLanes() const {98return myOutgoingLanes;99}100101void addOutgoingLane(ROLane* lane, ROEdge* via = nullptr) {102myOutgoingLanes.push_back(std::make_pair(lane, via));103}104105/// @brief get the state of the link from the logical predecessor to this lane (ignored for routing)106inline LinkState getIncomingLinkState() const {107return LINKSTATE_MAJOR;108}109110inline bool allowsVehicleClass(SUMOVehicleClass vclass) const {111return (myPermissions & vclass) == vclass;112}113114const PositionVector& getShape() const {115return myShape;116}117118/* @brief fit the given lane position to a visibly suitable geometry position119* (lane length might differ from geometry length) */120inline double interpolateLanePosToGeometryPos(double lanePos) const {121return lanePos * myLengthGeometryFactor;122}123124/* @brief fit the given lane position to a visibly suitable geometry position125* and return the coordinates */126inline const Position geometryPositionAtOffset(double offset, double lateralOffset = 0) const {127return myShape.positionAtOffset(interpolateLanePosToGeometryPos(offset), lateralOffset);128}129130private:131/// @brief The parent edge of this lane132ROEdge* myEdge;133134/// @brief The length of the lane135double myLength;136137/// @brief The maximum speed allowed on the lane138double myMaxSpeed;139140/// @brief The encoding of allowed vehicle classes141SVCPermissions myPermissions;142143std::vector<std::pair<const ROLane*, const ROEdge*> > myOutgoingLanes;144145/// @brief shape for this lane146const PositionVector myShape;147148/// @brief precomputed myShape.length / myLength149const double myLengthGeometryFactor;150151152private:153/// @brief Invalidated copy constructor154ROLane(const ROLane& src);155156/// @brief Invalidated assignment operator157ROLane& operator=(const ROLane& src);158159};160161162