LCOV - code coverage report
Current view: top level - src/router - ROEdge.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 92.2 % 90 83
Test Date: 2026-03-02 16:00:03 Functions: 85.7 % 21 18

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2002-2026 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              : /****************************************************************************/
      14              : /// @file    ROEdge.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Jakob Erdmann
      17              : /// @author  Christian Roessel
      18              : /// @author  Michael Behrisch
      19              : /// @author  Melanie Knocke
      20              : /// @author  Yun-Pang Floetteroed
      21              : /// @author  Ruediger Ebendt
      22              : /// @date    Sept 2002
      23              : ///
      24              : // A basic edge for routing applications
      25              : /****************************************************************************/
      26              : #pragma once
      27              : #include <config.h>
      28              : 
      29              : #include <string>
      30              : #include <map>
      31              : #include <vector>
      32              : #include <algorithm>
      33              : #include <utils/common/Named.h>
      34              : #include <utils/common/StdDefs.h>
      35              : #include <utils/common/ValueTimeLine.h>
      36              : #include <utils/common/SUMOVehicleClass.h>
      37              : #include <utils/common/RandHelper.h>
      38              : #include <utils/emissions/PollutantsInterface.h>
      39              : #include <utils/geom/Boundary.h>
      40              : #include <utils/router/FlippedEdge.h>
      41              : #ifdef HAVE_FOX
      42              : #include <utils/foxtools/fxheader.h>
      43              : #endif
      44              : #include <utils/vehicle/SUMOVTypeParameter.h>
      45              : #include "RONet.h"
      46              : #include "RONode.h"
      47              : #include "ROVehicle.h"
      48              : 
      49              : 
      50              : // ===========================================================================
      51              : // class declarations
      52              : // ===========================================================================
      53              : class ROLane;
      54              : class ROEdge;
      55              : 
      56              : typedef std::vector<ROEdge*> ROEdgeVector;
      57              : typedef std::vector<const ROEdge*> ConstROEdgeVector;
      58              : typedef std::vector<std::pair<const ROEdge*, const ROEdge*> > ROConstEdgePairVector;
      59              : 
      60              : 
      61              : // ===========================================================================
      62              : // class definitions
      63              : // ===========================================================================
      64              : /**
      65              :  * @class ROEdge
      66              :  * @brief A basic edge for routing applications
      67              :  *
      68              :  * The edge contains two time lines, one for the travel time and one for a second
      69              :  *  measure which may be used for computing the costs of a route. After loading
      70              :  *  the weights, it is needed to call "buildTimeLines" in order to initialise
      71              :  *  these time lines.
      72              :  */
      73              : class ROEdge : public Named, public Parameterised {
      74              : public:
      75              :     /** @brief Constructor
      76              :      *
      77              :      * @param[in] id The id of the edge
      78              :      * @param[in] from The node the edge begins at
      79              :      * @param[in] to The node the edge ends at
      80              :      * @param[in] index The numeric id of the edge
      81              :      */
      82              :     ROEdge(const std::string& id, RONode* from, RONode* to, int index, const int priority, const std::string& type, const std::string& routingType);
      83              : 
      84              :     /** @brief Constructor for dummy edge, only used when building the connectivity graph **/
      85              :     ROEdge(const std::string& id, const RONode* from, const RONode* to, SVCPermissions p);
      86              : 
      87              : 
      88              :     /// Destructor
      89              :     virtual ~ROEdge();
      90              : 
      91              : 
      92              :     /// @name Set-up methods
      93              :     //@{
      94              : 
      95              :     /** @brief Adds a lane to the edge while loading
      96              :      *
      97              :      * The lane's length is adapted. Additionally, the information about allowed/disallowed
      98              :      *  vehicle classes is patched using the information stored in the lane.
      99              :      *
     100              :      * @param[in] lane The lane to add
     101              :      * @todo What about vehicle-type aware connections?
     102              :      */
     103              :     virtual void addLane(ROLane* lane);
     104              : 
     105              : 
     106              :     /** @brief Adds information about a connected edge
     107              :      *
     108              :      * The edge s is added to "myFollowingEdges" and this edge is added as predecessor to s.
     109              :      * @param[in] s The edge to add
     110              :      * @todo What about vehicle-type aware connections?
     111              :      */
     112              :     virtual void addSuccessor(ROEdge* s, ROEdge* via = nullptr, std::string dir = "");
     113              : 
     114              : 
     115              :     /** @brief Sets the function of the edge
     116              :     * @param[in] func The new function for the edge
     117              :     */
     118              :     inline void setFunction(SumoXMLEdgeFunc func) {
     119       329244 :         myFunction = func;
     120              :     }
     121              : 
     122              : 
     123              :     /** @brief Sets whether the edge is a source
     124              :     * @param[in] func The new source functionality for the edge
     125              :     */
     126              :     inline void setSource(const bool isSource = true) {
     127            0 :         myAmSource = isSource;
     128              :     }
     129              : 
     130              : 
     131              :     /** @brief Sets whether the edge is a sink
     132              :     * @param[in] func The new sink functionality for the edge
     133              :     */
     134              :     inline void setSink(const bool isSink = true) {
     135           64 :         myAmSink = isSink;
     136          348 :     }
     137              : 
     138              : 
     139              :     /** @brief Sets the vehicle class specific speed limits of the edge
     140              :      * @param[in] restrictions The restrictions for the edge
     141              :      */
     142              :     inline void setSpeedRestrictions(const std::map<SUMOVehicleClass, double>* restrictions) {
     143           66 :         mySpeedRestrictions = restrictions;
     144              :     }
     145              : 
     146              :     inline void setTimePenalty(double value) {
     147       158098 :         myTimePenalty = value;
     148       158098 :     }
     149              : 
     150              :     inline double getTimePenalty() const {
     151       495609 :         return myTimePenalty;
     152              :     }
     153              : 
     154              :     /// @brief return whether this edge is a normal edge
     155              :     inline bool isNormal() const {
     156        10750 :         return myFunction == SumoXMLEdgeFunc::NORMAL;
     157              :     }
     158              : 
     159              :     /// @brief return whether this edge is an internal edge
     160              :     inline bool isInternal() const {
     161     12769460 :         return myFunction == SumoXMLEdgeFunc::INTERNAL;
     162              :     }
     163              : 
     164              :     /// @brief return whether this edge is a pedestrian crossing
     165              :     inline bool isCrossing() const {
     166      4638220 :         return myFunction == SumoXMLEdgeFunc::CROSSING;
     167              :     }
     168              : 
     169              :     /// @brief return whether this edge is walking area
     170              :     inline bool isWalkingArea() const {
     171      1476370 :         return myFunction == SumoXMLEdgeFunc::WALKINGAREA;
     172              :     }
     173              : 
     174              :     inline bool isTazConnector() const {
     175      4168075 :         return myFunction == SumoXMLEdgeFunc::CONNECTOR;
     176              :     }
     177              : 
     178              :     void setOtherTazConnector(const ROEdge* edge) {
     179         3253 :         myOtherTazConnector = edge;
     180              :     }
     181              : 
     182              :     const ROEdge* getOtherTazConnector() const {
     183         4706 :         return myOtherTazConnector;
     184              :     }
     185              : 
     186              :     /** @brief Builds the internal representation of the travel time/effort
     187              :      *
     188              :      * Should be called after weights / travel times have been loaded.
     189              :      *
     190              :      * In the case "weight-attribute" is one of "CO", "CO2", "HC", "NOx", "PMx", "fuel", or "electricity"
     191              :      *  the proper value (departs/s) is computed and multiplied with the travel time.
     192              :      *
     193              :      * @param[in] measure The name of the measure to use.
     194              :      */
     195              :     void buildTimeLines(const std::string& measure, const bool boundariesOverride);
     196              : 
     197              :     void cacheParamRestrictions(const std::vector<std::string>& restrictionKeys);
     198              :     //@}
     199              : 
     200              : 
     201              : 
     202              :     /// @name Getter methods
     203              :     //@{
     204              : 
     205              :     /** @brief Returns the function of the edge
     206              :     * @return This edge's basic function
     207              :     * @see SumoXMLEdgeFunc
     208              :     */
     209              :     inline SumoXMLEdgeFunc getFunction() const {
     210       380079 :         return myFunction;
     211              :     }
     212              : 
     213              : 
     214              :     /** @brief Returns whether the edge acts as a sink
     215              :     * @return whether the edge is a sink
     216              :     */
     217              :     inline bool isSink() const {
     218       331300 :         return myAmSink;
     219              :     }
     220              : 
     221              : 
     222              :     /** @brief Returns the length of the edge
     223              :      * @return This edge's length
     224              :      */
     225              :     double getLength() const {
     226      6422498 :         return myLength;
     227              :     }
     228              : 
     229              :     /** @brief Returns the index (numeric id) of the edge
     230              :      * @return This edge's numerical id
     231              :      */
     232              :     int getNumericalID() const {
     233     15872601 :         return myIndex;
     234              :     }
     235              : 
     236              : 
     237              :     /** @brief Returns the speed allowed on this edge
     238              :      * @return The speed allowed on this edge
     239              :      */
     240              :     double getSpeedLimit() const {
     241       340311 :         return mySpeed;
     242              :     }
     243              : 
     244              :     /// @brief return a lower bound on shape.length() / myLength that is
     245              :     // sufficient for the astar air-distance heuristic
     246              :     double getLengthGeometryFactor() const;
     247              : 
     248              :     /** @brief Returns the number of lanes this edge has
     249              :      * @return This edge's number of lanes
     250              :      */
     251              :     int getNumLanes() const {
     252       326901 :         return (int) myLanes.size();
     253              :     }
     254              : 
     255              : 
     256              :     /** @brief returns the information whether this edge is directly connected to the given
     257              :      *
     258              :      * @param[in] e The edge which may be connected
     259              :      * @param[in] vClass The vehicle class for which the connectivity is checked
     260              :      * @return Whether the given edge is a direct successor to this one
     261              :      */
     262              :     bool isConnectedTo(const ROEdge& e, const SUMOVehicleClass vClass, bool ignoreTransientPermissions = false) const;
     263              : 
     264              : 
     265              :     /** @brief Returns whether this edge prohibits the given vehicle to pass it
     266              :      * @param[in] vehicle The vehicle for which the information has to be returned
     267              :      * @return Whether the vehicle must not enter this edge
     268              :      */
     269      5709365 :     inline bool prohibits(const ROVehicle* const vehicle, bool checkRestrictions = false) const {
     270              :         const SUMOVehicleClass vclass = vehicle->getVClass();
     271      5709365 :         return (myCombinedPermissions & vclass) != vclass || (checkRestrictions && restricts(vehicle));
     272              :     }
     273              : 
     274              :     inline SVCPermissions getPermissions() const {
     275       237223 :         return myCombinedPermissions;
     276              :     }
     277              : 
     278              :     /** @brief Returns whether this edge has restriction parameters forbidding the given vehicle to pass it
     279              :      * @param[in] vehicle The vehicle for which the information has to be returned
     280              :      * @return Whether the vehicle must not enter this edge
     281              :      */
     282              :     inline bool restricts(const ROVehicle* const vehicle) const {
     283              :         const std::vector<double>& vTypeRestrictions = vehicle->getType()->paramRestrictions;
     284              :         assert(vTypeRestrictions.size() == myParamRestrictions.size());
     285          322 :         for (int i = 0; i < (int)vTypeRestrictions.size(); i++) {
     286          166 :             if (vTypeRestrictions[i] > myParamRestrictions[i]) {
     287              :                 return true;
     288              :             }
     289              :         }
     290              :         return false;
     291              :     }
     292              : 
     293              : 
     294              :     /** @brief Returns whether this edge succeeding edges prohibit the given vehicle to pass them
     295              :      * @param[in] vehicle The vehicle for which the information has to be returned
     296              :      * @return Whether the vehicle may continue its route on any of the following edges
     297              :      */
     298              :     bool allFollowersProhibit(const ROVehicle* const vehicle) const;
     299              :     //@}
     300              : 
     301              : 
     302              : 
     303              :     /// @name Methods for getting/setting travel time and cost information
     304              :     //@{
     305              : 
     306              :     /** @brief Adds a weight value
     307              :      *
     308              :      * @param[in] value The value to add
     309              :      * @param[in] timeBegin The begin time of the interval the given value is valid for [s]
     310              :      * @param[in] timeEnd The end time of the interval the given value is valid for [s]
     311              :      */
     312              :     void addEffort(double value, double timeBegin, double timeEnd);
     313              : 
     314              : 
     315              :     /** @brief Adds a travel time value
     316              :      *
     317              :      * @param[in] value The value to add
     318              :      * @param[in] timeBegin The begin time of the interval the given value is valid for [s]
     319              :      * @param[in] timeEnd The end time of the interval the given value is valid for [s]
     320              :      */
     321              :     void addTravelTime(double value, double timeBegin, double timeEnd);
     322              : 
     323              : 
     324              :     /** @brief Returns the number of edges this edge is connected to
     325              :      *
     326              :      * If this edge's type is set to "sink", 0 is returned, otherwise
     327              :      *  the number of edges stored in "myFollowingEdges".
     328              :      *
     329              :      * @return The number of edges following this edge
     330              :      */
     331              :     int getNumSuccessors() const;
     332              : 
     333              : 
     334              :     /** @brief Returns the following edges, restricted by vClass
     335              :     * @param[in] vClass The vClass for which to restrict the successors
     336              :     * @return The eligible following edges
     337              :     */
     338              :     const ROEdgeVector& getSuccessors(SUMOVehicleClass vClass = SVC_IGNORING) const;
     339              : 
     340              :     /** @brief Returns the following edges including vias, restricted by vClass
     341              :     * @param[in] vClass The vClass for which to restrict the successors
     342              :     * @return The eligible following edges
     343              :     */
     344              :     const ROConstEdgePairVector& getViaSuccessors(SUMOVehicleClass vClass = SVC_IGNORING, bool ignoreTransientPermissions = false) const;
     345              : 
     346              :     /// @brief reset after lane permissions changes
     347            8 :     void resetSuccessors() {
     348              :         myClassesSuccessorMap.clear();
     349              :         myClassesViaSuccessorMap.clear();
     350            8 :     }
     351              : 
     352              :     /** @brief Returns the number of edges connected to this edge
     353              :      *
     354              :      * If this edge's type is set to "source", 0 is returned, otherwise
     355              :      *  the number of edges stored in "myApproachingEdges".
     356              :      *
     357              :      * @return The number of edges reaching into this edge
     358              :      */
     359              :     int getNumPredecessors() const;
     360              : 
     361              : 
     362              :     /** @brief Returns the edge at the given position from the list of incoming edges
     363              :      * @param[in] pos The position of the list within the list of incoming
     364              :      * @return The incoming edge, stored at position pos
     365              :      */
     366              :     const ROEdgeVector& getPredecessors() const {
     367              :         return myApproachingEdges;
     368              :     }
     369              : 
     370              :     /// @brief if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
     371              :     const ROEdge* getNormalBefore() const;
     372              : 
     373              :     /// @brief if this edge is an internal edge, return its first normal successor, otherwise the edge itself
     374              :     const ROEdge* getNormalAfter() const;
     375              : 
     376              :     /** @brief Returns the effort for this edge
     377              :      *
     378              :      * @param[in] veh The vehicle for which the effort on this edge shall be retrieved
     379              :      * @param[in] time The tim for which the effort shall be returned [s]
     380              :      * @return The effort needed by the given vehicle to pass the edge at the given time
     381              :      * @todo Recheck whether the vehicle's maximum speed is considered
     382              :      */
     383              :     double getEffort(const ROVehicle* const veh, double time) const;
     384              : 
     385              : 
     386              :     /** @brief Returns whether a travel time for this edge was loaded
     387              :      *
     388              :      * @param[in] time The time for which the travel time shall be returned [s]
     389              :      * @return whether a value was loaded
     390              :      */
     391              :     bool hasLoadedTravelTime(double time) const;
     392              : 
     393              : 
     394              :     /** @brief Returns the travel time for this edge
     395              :      *
     396              :      * @param[in] veh The vehicle for which the travel time on this edge shall be retrieved
     397              :      * @param[in] time The time for which the travel time shall be returned [s]
     398              :      * @return The travel time needed by the given vehicle to pass the edge at the given time
     399              :      */
     400              :     double getTravelTime(const ROVehicle* const veh, double time) const;
     401              : 
     402              : 
     403              :     /** @brief Returns the effort for the given edge
     404              :      *
     405              :      * @param[in] edge The edge for which the effort shall be retrieved
     406              :      * @param[in] veh The vehicle for which the effort on this edge shall be retrieved
     407              :      * @param[in] time The time for which the effort shall be returned [s]
     408              :      * @return The effort needed by the given vehicle to pass the edge at the given time
     409              :      * @todo Recheck whether the vehicle's maximum speed is considered
     410              :      */
     411              :     static inline double getEffortStatic(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     412              :         return edge->getEffort(veh, time);
     413              :     }
     414              : 
     415              : 
     416              :     /** @brief Returns the travel time for the given edge
     417              :      *
     418              :      * @param[in] edge The edge for which the travel time shall be retrieved
     419              :      * @param[in] veh The vehicle for which the travel time on this edge shall be retrieved
     420              :      * @param[in] time The time for which the travel time shall be returned [s]
     421              :      * @return The traveltime needed by the given vehicle to pass the edge at the given time
     422              :      */
     423     10962490 :     static inline double getTravelTimeStatic(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     424     10962490 :         return edge->getTravelTime(veh, time) * getRoutingFactor(edge, veh);
     425              :     }
     426              : 
     427         6984 :     static inline double getTravelTimeStaticRandomized(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     428         6984 :         return edge->getTravelTime(veh, time)
     429         6984 :                * (1 + RandHelper::randHash(veh->getRandomSeed() ^ edge->getNumericalID()) * (gWeightsRandomFactor - 1))
     430         6984 :                * getRoutingFactor(edge, veh);
     431              :     }
     432              : 
     433              :     /// @brief Alias for getTravelTimeStatic (there is no routing device to provide aggregated travel times)
     434            0 :     static inline double getTravelTimeAggregated(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     435            0 :         return edge->getTravelTime(veh, time) * getRoutingFactor(edge, veh);
     436              :     }
     437              : 
     438              :     /// @brief Return traveltime weighted by edge priority (scaled penalty for low-priority edges)
     439           25 :     static inline double getTravelTimeStaticPriorityFactor(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     440           25 :         double result = edge->getTravelTime(veh, time);
     441              :         // lower priority should result in higher effort (and the edge with
     442              :         // minimum priority receives a factor of myPriorityFactor
     443           25 :         const double relativeInversePrio = 1 - ((edge->getPriority() - myMinEdgePriority) / myEdgePriorityRange);
     444           25 :         result *= 1 + relativeInversePrio * myPriorityFactor;
     445           25 :         return result * getRoutingFactor(edge, veh);
     446              :     }
     447              : 
     448              :     static inline double getRoutingFactor(const ROEdge* const edge, const ROVehicle* const veh) {
     449     10969474 :         return gRoutingPreferences ?  1 / edge->getPreference(veh->getVTypeParameter()) : 1;
     450              :     }
     451              : 
     452              : 
     453              :     /** @brief Returns a lower bound for the travel time on this edge without using any stored timeLine
     454              :      *
     455              :      * @param[in] veh The vehicle for which the effort on this edge shall be retrieved
     456              :      * @param[in] time The time for which the effort shall be returned [s]
     457              :      */
     458      4322080 :     inline double getMinimumTravelTime(const ROVehicle* const veh) const {
     459      4324220 :         if (isTazConnector()) {
     460              :             return 0;
     461      4244541 :         } else if (veh != 0) {
     462      4244541 :             return myLength / getMaxSpeed(veh);
     463              :         } else {
     464         2136 :             return myLength / mySpeed;
     465              :         }
     466              :     }
     467              : 
     468     13237943 :     inline double getMaxSpeed(const RORoutable* const veh) const {
     469     13237943 :         return MIN2(veh->getMaxSpeed(), veh->getChosenSpeedFactor() * getVClassMaxSpeed(veh->getVClass()));
     470              :     }
     471              : 
     472              :     /** @brief Returns the lane's maximum speed, given a vehicle's speed limit adaptation
     473              :      * @param[in] The vehicle to return the adapted speed limit for
     474              :      * @return This lane's resulting max. speed
     475              :      */
     476     13239747 :     inline double getVClassMaxSpeed(SUMOVehicleClass vclass) const {
     477     13239747 :         if (mySpeedRestrictions != 0) {
     478              :             std::map<SUMOVehicleClass, double>::const_iterator r = mySpeedRestrictions->find(vclass);
     479           57 :             if (r != mySpeedRestrictions->end()) {
     480           48 :                 return r->second;
     481              :             }
     482              :         }
     483     13239699 :         return mySpeed;
     484              :     }
     485              : 
     486              :     template<PollutantsInterface::EmissionType ET>
     487          262 :     static double getEmissionEffort(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     488          262 :         double ret = 0;
     489          262 :         if (!edge->getStoredEffort(time, ret)) {
     490              :             const SUMOVTypeParameter* const type = veh->getType();
     491           90 :             const double vMax = edge->getMaxSpeed(veh);
     492           90 :             const double accel = type->getCFParam(SUMO_ATTR_ACCEL, SUMOVTypeParameter::getDefaultAccel(type->vehicleClass)) * type->getCFParam(SUMO_ATTR_SIGMA, SUMOVTypeParameter::getDefaultImperfection(type->vehicleClass)) / 2.;
     493           90 :             ret = PollutantsInterface::computeDefault(type->emissionClass, ET, vMax, accel, 0, edge->getTravelTime(veh, time), nullptr); // @todo: give correct slope
     494              :         }
     495          262 :         return ret;
     496              :     }
     497              : 
     498              : 
     499              :     static double getNoiseEffort(const ROEdge* const edge, const ROVehicle* const veh, double time);
     500              : 
     501         1404 :     static double getStoredEffort(const ROEdge* const edge, const ROVehicle* const /*veh*/, double time) {
     502         1404 :         double ret = 0;
     503         1404 :         edge->getStoredEffort(time, ret);
     504         1404 :         return ret;
     505              :     }
     506              :     //@}
     507              : 
     508              : 
     509              :     /// @brief optimistic distance heuristic for use in routing
     510              :     double getDistanceTo(const ROEdge* other, const bool doBoundaryEstimate = false) const;
     511              : 
     512              : 
     513              :     /** @brief Returns all ROEdges */
     514              :     static const ROEdgeVector& getAllEdges();
     515              : 
     516              :     static void setGlobalOptions(const bool interpolate) {
     517         3507 :         myInterpolate = interpolate;
     518              :     }
     519              : 
     520              :     static void disableTimelineWarning() {
     521          164 :         myHaveTTWarned = true;
     522          164 :     }
     523              : 
     524              :     /// @brief return the coordinates of the center of the given stop
     525              :     static const Position getStopPosition(const SUMOVehicleParameter::Stop& stop);
     526              : 
     527              :     /// @brief return loaded edge preference based on routingType
     528         1286 :     inline double getPreference(const SUMOVTypeParameter& pars) const {
     529         2572 :         return RONet::getInstance()->getPreference(getRoutingType(), pars);
     530              :     }
     531              : 
     532              :     /// @brief get edge priority (road class)
     533              :     int getPriority() const {
     534       323290 :         return myPriority;
     535              :     }
     536              : 
     537              :     /// @brief get edge type
     538              :     const std::string& getType() const {
     539           66 :         return myType;
     540              :     }
     541              : 
     542              :     const std::string& getRoutingType() const {
     543         1286 :         return myRoutingType.empty() ? myType : myRoutingType;
     544              :     }
     545              : 
     546              :     const RONode* getFromJunction() const {
     547       416800 :         return myFromJunction;
     548              :     }
     549              : 
     550              :     const RONode* getToJunction() const {
     551       478171 :         return myToJunction;
     552              :     }
     553              : 
     554              :     /** @brief Returns this edge's lanes
     555              :      *
     556              :      * @return This edge's lanes
     557              :      */
     558              :     const std::vector<ROLane*>& getLanes() const {
     559              :         return myLanes;
     560              :     }
     561              : 
     562              :     /// @brief return opposite superposable/congruent edge, if it exist and 0 else
     563              :     inline const ROEdge* getBidiEdge() const {
     564         4120 :         return myBidiEdge;
     565              :     }
     566              : 
     567              :     /// @brief set opposite superposable/congruent edge
     568              :     inline void setBidiEdge(const ROEdge* bidiEdge) {
     569        12028 :         myBidiEdge = bidiEdge;
     570              :     }
     571              : 
     572       114848 :     ReversedEdge<ROEdge, ROVehicle>* getReversedRoutingEdge() const {
     573       114848 :         if (myReversedRoutingEdge == nullptr) {
     574        33544 :             myReversedRoutingEdge = new ReversedEdge<ROEdge, ROVehicle>(this);
     575              :         }
     576       114848 :         return myReversedRoutingEdge;
     577              :     }
     578              : 
     579              :     /// @brief Returns the flipped routing edge
     580              :     // @note If not called before, the flipped routing edge is created
     581            0 :     FlippedEdge<ROEdge, RONode, ROVehicle>* getFlippedRoutingEdge() const {
     582            0 :         if (myFlippedRoutingEdge == nullptr) {
     583            0 :             myFlippedRoutingEdge = new FlippedEdge<ROEdge, RONode, ROVehicle>(this);
     584              :         }
     585            0 :         return myFlippedRoutingEdge;
     586              :     }
     587              : 
     588       196064 :     RailEdge<ROEdge, ROVehicle>* getRailwayRoutingEdge() const {
     589       196064 :         if (myRailwayRoutingEdge == nullptr) {
     590       191382 :             myRailwayRoutingEdge = new RailEdge<ROEdge, ROVehicle>(this);
     591              :         }
     592       196064 :         return myRailwayRoutingEdge;
     593              :     }
     594              : 
     595              :     /// @brief whether effort data was loaded for this edge
     596              :     bool hasStoredEffort() const {
     597           35 :         return myUsingETimeLine;
     598              :     }
     599              : 
     600              :     /// @brief initialize priority factor range
     601              :     static bool initPriorityFactor(double priorityFactor);
     602              : 
     603              : protected:
     604              :     /** @brief Retrieves the stored effort
     605              :      *
     606              :      * @param[in] veh The vehicle for which the effort on this edge shall be retrieved
     607              :      * @param[in] time The tim for which the effort shall be returned
     608              :      * @return Whether the effort is given
     609              :      */
     610              :     bool getStoredEffort(double time, double& ret) const;
     611              : 
     612              : protected:
     613              :     /// @brief the junctions for this edge
     614              :     RONode* myFromJunction;
     615              :     RONode* myToJunction;
     616              : 
     617              :     /// @brief The index (numeric id) of the edge
     618              :     const int myIndex;
     619              : 
     620              :     /// @brief The edge priority (road class)
     621              :     const int myPriority;
     622              : 
     623              :     /// @brief the type of this edge
     624              :     const std::string myType;
     625              : 
     626              :     /// @brief the routing type of the edge (used to look up vType and vClass specific routing preferences)
     627              :     const std::string myRoutingType;
     628              : 
     629              :     /// @brief The maximum speed allowed on this edge
     630              :     double mySpeed;
     631              : 
     632              :     /// @brief The length of the edge
     633              :     double myLength;
     634              : 
     635              :     /// @brief whether the edge is a source or a sink
     636              :     bool myAmSink, myAmSource;
     637              :     /// @brief Container storing passing time varying over time for the edge
     638              :     mutable ValueTimeLine<double> myTravelTimes;
     639              :     /// @brief Information whether the time line shall be used instead of the length value
     640              :     bool myUsingTTTimeLine;
     641              : 
     642              :     /// @brief Container storing passing time varying over time for the edge
     643              :     mutable ValueTimeLine<double> myEfforts;
     644              :     /// @brief Information whether the time line shall be used instead of the length value
     645              :     bool myUsingETimeLine;
     646              : 
     647              :     /// @brief Information whether to interpolate at interval boundaries
     648              :     static bool myInterpolate;
     649              : 
     650              :     /// @brief Information whether the edge has reported missing weights
     651              :     static bool myHaveEWarned;
     652              :     /// @brief Information whether the edge has reported missing weights
     653              :     static bool myHaveTTWarned;
     654              : 
     655              :     /// @brief List of edges that may be approached from this edge
     656              :     ROEdgeVector myFollowingEdges;
     657              : 
     658              :     ROConstEdgePairVector myFollowingViaEdges;
     659              : 
     660              :     /// @brief List of edges that approached this edge
     661              :     ROEdgeVector myApproachingEdges;
     662              : 
     663              :     /// @brief The function of the edge
     664              :     SumoXMLEdgeFunc myFunction;
     665              : 
     666              :     /// The vClass speed restrictions for this edge
     667              :     const std::map<SUMOVehicleClass, double>* mySpeedRestrictions;
     668              : 
     669              :     /// @brief This edge's lanes
     670              :     std::vector<ROLane*> myLanes;
     671              : 
     672              :     /// @brief The list of allowed vehicle classes combined across lanes
     673              :     SVCPermissions myCombinedPermissions;
     674              : 
     675              :     /// @brief the other taz-connector if this edge isTazConnector, otherwise nullptr
     676              :     const ROEdge* myOtherTazConnector;
     677              : 
     678              :     /// @brief the bidirectional rail edge or nullpr
     679              :     const ROEdge* myBidiEdge;
     680              : 
     681              :     /// @brief The bounding rectangle of end nodes incoming or outgoing edges for taz connectors or of my own start and end node for normal edges
     682              :     Boundary myBoundary;
     683              : 
     684              :     /// @brief flat penalty when computing traveltime
     685              :     double myTimePenalty;
     686              : 
     687              :     /// @brief cached value of parameters which may restrict access
     688              :     std::vector<double> myParamRestrictions;
     689              : 
     690              :     static ROEdgeVector myEdges;
     691              : 
     692              :     /// @brief Coefficient for factoring edge priority into routing weight
     693              :     static double myPriorityFactor;
     694              :     /// @brief Minimum priority for all edges
     695              :     static double myMinEdgePriority;
     696              :     /// @brief the difference between maximum and minimum priority for all edges
     697              :     static double myEdgePriorityRange;
     698              : 
     699              :     /// @brief The successors available for a given vClass
     700              :     mutable std::map<SUMOVehicleClass, ROEdgeVector> myClassesSuccessorMap;
     701              : 
     702              :     /// @brief The successors with vias available for a given vClass
     703              :     mutable std::map<SUMOVehicleClass, ROConstEdgePairVector> myClassesViaSuccessorMap;
     704              : 
     705              :     /// @brief a reversed version for backward routing
     706              :     mutable ReversedEdge<ROEdge, ROVehicle>* myReversedRoutingEdge = nullptr;
     707              :     /// @brief An extended version of the reversed edge for backward routing (used for the arc flag router)
     708              :     mutable FlippedEdge<ROEdge, RONode, ROVehicle>* myFlippedRoutingEdge = nullptr;
     709              :     mutable RailEdge<ROEdge, ROVehicle>* myRailwayRoutingEdge = nullptr;
     710              : 
     711              : #ifdef HAVE_FOX
     712              :     /// The mutex used to avoid concurrent updates of myClassesSuccessorMap
     713              :     mutable FXMutex myLock;
     714              : #endif
     715              : 
     716              : private:
     717              :     /// @brief Invalidated copy constructor
     718              :     ROEdge(const ROEdge& src);
     719              : 
     720              :     /// @brief Invalidated assignment operator
     721              :     ROEdge& operator=(const ROEdge& src);
     722              : 
     723              : };
        

Generated by: LCOV version 2.0-1