LCOV - code coverage report
Current view: top level - src/router - ROEdge.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 91.9 % 86 79
Test Date: 2025-12-06 15:35:27 Functions: 84.2 % 19 16

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2002-2025 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       327236 :         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       157376 :         myTimePenalty = value;
     148       157376 :     }
     149              : 
     150              :     inline double getTimePenalty() const {
     151       477369 :         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     12812960 :         return myFunction == SumoXMLEdgeFunc::INTERNAL;
     162              :     }
     163              : 
     164              :     /// @brief return whether this edge is a pedestrian crossing
     165              :     inline bool isCrossing() const {
     166      4536577 :         return myFunction == SumoXMLEdgeFunc::CROSSING;
     167              :     }
     168              : 
     169              :     /// @brief return whether this edge is walking area
     170              :     inline bool isWalkingArea() const {
     171      1469866 :         return myFunction == SumoXMLEdgeFunc::WALKINGAREA;
     172              :     }
     173              : 
     174              :     inline bool isTazConnector() const {
     175      4163058 :         return myFunction == SumoXMLEdgeFunc::CONNECTOR;
     176              :     }
     177              : 
     178              :     void setOtherTazConnector(const ROEdge* edge) {
     179         3251 :         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       378325 :         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       331307 :         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      6431860 :         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     16521054 :         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       339372 :         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 lane's maximum speed, given a vehicle's speed limit adaptation
     249              :      * @param[in] The vehicle to return the adapted speed limit for
     250              :      * @return This lane's resulting max. speed
     251              :      */
     252     13268457 :     inline double getVClassMaxSpeed(SUMOVehicleClass vclass) const {
     253     13268457 :         if (mySpeedRestrictions != 0) {
     254              :             std::map<SUMOVehicleClass, double>::const_iterator r = mySpeedRestrictions->find(vclass);
     255           57 :             if (r != mySpeedRestrictions->end()) {
     256           48 :                 return r->second;
     257              :             }
     258              :         }
     259     13268409 :         return mySpeed;
     260              :     }
     261              : 
     262              : 
     263              :     /** @brief Returns the number of lanes this edge has
     264              :      * @return This edge's number of lanes
     265              :      */
     266              :     int getNumLanes() const {
     267       326101 :         return (int) myLanes.size();
     268              :     }
     269              : 
     270              : 
     271              :     /** @brief returns the information whether this edge is directly connected to the given
     272              :      *
     273              :      * @param[in] e The edge which may be connected
     274              :      * @param[in] vClass The vehicle class for which the connectivity is checked
     275              :      * @return Whether the given edge is a direct successor to this one
     276              :      */
     277              :     bool isConnectedTo(const ROEdge& e, const SUMOVehicleClass vClass, bool ignoreTransientPermissions = false) const;
     278              : 
     279              : 
     280              :     /** @brief Returns whether this edge prohibits the given vehicle to pass it
     281              :      * @param[in] vehicle The vehicle for which the information has to be returned
     282              :      * @return Whether the vehicle must not enter this edge
     283              :      */
     284      5724990 :     inline bool prohibits(const ROVehicle* const vehicle, bool checkRestrictions = false) const {
     285              :         const SUMOVehicleClass vclass = vehicle->getVClass();
     286      5724990 :         return (myCombinedPermissions & vclass) != vclass || (checkRestrictions && restricts(vehicle));
     287              :     }
     288              : 
     289              :     inline SVCPermissions getPermissions() const {
     290       233909 :         return myCombinedPermissions;
     291              :     }
     292              : 
     293              :     /** @brief Returns whether this edge has restriction parameters forbidding the given vehicle to pass it
     294              :      * @param[in] vehicle The vehicle for which the information has to be returned
     295              :      * @return Whether the vehicle must not enter this edge
     296              :      */
     297              :     inline bool restricts(const ROVehicle* const vehicle) const {
     298              :         const std::vector<double>& vTypeRestrictions = vehicle->getType()->paramRestrictions;
     299              :         assert(vTypeRestrictions.size() == myParamRestrictions.size());
     300          322 :         for (int i = 0; i < (int)vTypeRestrictions.size(); i++) {
     301          166 :             if (vTypeRestrictions[i] > myParamRestrictions[i]) {
     302              :                 return true;
     303              :             }
     304              :         }
     305              :         return false;
     306              :     }
     307              : 
     308              : 
     309              :     /** @brief Returns whether this edge succeeding edges prohibit the given vehicle to pass them
     310              :      * @param[in] vehicle The vehicle for which the information has to be returned
     311              :      * @return Whether the vehicle may continue its route on any of the following edges
     312              :      */
     313              :     bool allFollowersProhibit(const ROVehicle* const vehicle) const;
     314              :     //@}
     315              : 
     316              : 
     317              : 
     318              :     /// @name Methods for getting/setting travel time and cost information
     319              :     //@{
     320              : 
     321              :     /** @brief Adds a weight value
     322              :      *
     323              :      * @param[in] value The value to add
     324              :      * @param[in] timeBegin The begin time of the interval the given value is valid for [s]
     325              :      * @param[in] timeEnd The end time of the interval the given value is valid for [s]
     326              :      */
     327              :     void addEffort(double value, double timeBegin, double timeEnd);
     328              : 
     329              : 
     330              :     /** @brief Adds a travel time value
     331              :      *
     332              :      * @param[in] value The value to add
     333              :      * @param[in] timeBegin The begin time of the interval the given value is valid for [s]
     334              :      * @param[in] timeEnd The end time of the interval the given value is valid for [s]
     335              :      */
     336              :     void addTravelTime(double value, double timeBegin, double timeEnd);
     337              : 
     338              : 
     339              :     /** @brief Returns the number of edges this edge is connected to
     340              :      *
     341              :      * If this edge's type is set to "sink", 0 is returned, otherwise
     342              :      *  the number of edges stored in "myFollowingEdges".
     343              :      *
     344              :      * @return The number of edges following this edge
     345              :      */
     346              :     int getNumSuccessors() const;
     347              : 
     348              : 
     349              :     /** @brief Returns the following edges, restricted by vClass
     350              :     * @param[in] vClass The vClass for which to restrict the successors
     351              :     * @return The eligible following edges
     352              :     */
     353              :     const ROEdgeVector& getSuccessors(SUMOVehicleClass vClass = SVC_IGNORING) const;
     354              : 
     355              :     /** @brief Returns the following edges including vias, restricted by vClass
     356              :     * @param[in] vClass The vClass for which to restrict the successors
     357              :     * @return The eligible following edges
     358              :     */
     359              :     const ROConstEdgePairVector& getViaSuccessors(SUMOVehicleClass vClass = SVC_IGNORING, bool ignoreTransientPermissions = false) const;
     360              : 
     361              : 
     362              :     /** @brief Returns the number of edges connected to this edge
     363              :      *
     364              :      * If this edge's type is set to "source", 0 is returned, otherwise
     365              :      *  the number of edges stored in "myApproachingEdges".
     366              :      *
     367              :      * @return The number of edges reaching into this edge
     368              :      */
     369              :     int getNumPredecessors() const;
     370              : 
     371              : 
     372              :     /** @brief Returns the edge at the given position from the list of incoming edges
     373              :      * @param[in] pos The position of the list within the list of incoming
     374              :      * @return The incoming edge, stored at position pos
     375              :      */
     376              :     const ROEdgeVector& getPredecessors() const {
     377              :         return myApproachingEdges;
     378              :     }
     379              : 
     380              :     /// @brief if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
     381              :     const ROEdge* getNormalBefore() const;
     382              : 
     383              :     /// @brief if this edge is an internal edge, return its first normal successor, otherwise the edge itself
     384              :     const ROEdge* getNormalAfter() const;
     385              : 
     386              :     /** @brief Returns the effort for this edge
     387              :      *
     388              :      * @param[in] veh The vehicle for which the effort on this edge shall be retrieved
     389              :      * @param[in] time The tim for which the effort shall be returned [s]
     390              :      * @return The effort needed by the given vehicle to pass the edge at the given time
     391              :      * @todo Recheck whether the vehicle's maximum speed is considered
     392              :      */
     393              :     double getEffort(const ROVehicle* const veh, double time) const;
     394              : 
     395              : 
     396              :     /** @brief Returns whether a travel time for this edge was loaded
     397              :      *
     398              :      * @param[in] time The time for which the travel time shall be returned [s]
     399              :      * @return whether a value was loaded
     400              :      */
     401              :     bool hasLoadedTravelTime(double time) const;
     402              : 
     403              : 
     404              :     /** @brief Returns the travel time for this edge
     405              :      *
     406              :      * @param[in] veh The vehicle for which the travel time on this edge shall be retrieved
     407              :      * @param[in] time The time for which the travel time shall be returned [s]
     408              :      * @return The travel time needed by the given vehicle to pass the edge at the given time
     409              :      */
     410              :     double getTravelTime(const ROVehicle* const veh, double time) const;
     411              : 
     412              : 
     413              :     /** @brief Returns the effort for the given edge
     414              :      *
     415              :      * @param[in] edge The edge for which the effort shall be retrieved
     416              :      * @param[in] veh The vehicle for which the effort on this edge shall be retrieved
     417              :      * @param[in] time The time for which the effort shall be returned [s]
     418              :      * @return The effort needed by the given vehicle to pass the edge at the given time
     419              :      * @todo Recheck whether the vehicle's maximum speed is considered
     420              :      */
     421              :     static inline double getEffortStatic(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     422              :         return edge->getEffort(veh, time);
     423              :     }
     424              : 
     425              : 
     426              :     /** @brief Returns the travel time for the given edge
     427              :      *
     428              :      * @param[in] edge The edge for which the travel time shall be retrieved
     429              :      * @param[in] veh The vehicle for which the travel time on this edge shall be retrieved
     430              :      * @param[in] time The time for which the travel time shall be returned [s]
     431              :      * @return The traveltime needed by the given vehicle to pass the edge at the given time
     432              :      */
     433     10991194 :     static inline double getTravelTimeStatic(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     434     10991194 :         return edge->getTravelTime(veh, time) * getRoutingFactor(edge, veh);
     435              :     }
     436              : 
     437         6984 :     static inline double getTravelTimeStaticRandomized(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     438         6984 :         return edge->getTravelTime(veh, time)
     439         6984 :             * (1 + RandHelper::randHash(veh->getRandomSeed() ^ edge->getNumericalID()) * (gWeightsRandomFactor - 1))
     440         6984 :             * getRoutingFactor(edge, veh);
     441              :     }
     442              : 
     443              :     /// @brief Alias for getTravelTimeStatic (there is no routing device to provide aggregated travel times)
     444            0 :     static inline double getTravelTimeAggregated(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     445            0 :         return edge->getTravelTime(veh, time) * getRoutingFactor(edge, veh);
     446              :     }
     447              : 
     448              :     /// @brief Return traveltime weighted by edge priority (scaled penalty for low-priority edges)
     449           25 :     static inline double getTravelTimeStaticPriorityFactor(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     450           25 :         double result = edge->getTravelTime(veh, time);
     451              :         // lower priority should result in higher effort (and the edge with
     452              :         // minimum priority receives a factor of myPriorityFactor
     453           25 :         const double relativeInversePrio = 1 - ((edge->getPriority() - myMinEdgePriority) / myEdgePriorityRange);
     454           25 :         result *= 1 + relativeInversePrio * myPriorityFactor;
     455           25 :         return result * getRoutingFactor(edge, veh);
     456              :     }
     457              : 
     458              :     static inline double getRoutingFactor(const ROEdge* const edge, const ROVehicle* const veh) {
     459     10998178 :         return gRoutingPreferences ?  1 / edge->getPreference(veh->getVTypeParameter()) : 1;
     460              :     }
     461              : 
     462              : 
     463              :     /** @brief Returns a lower bound for the travel time on this edge without using any stored timeLine
     464              :      *
     465              :      * @param[in] veh The vehicle for which the effort on this edge shall be retrieved
     466              :      * @param[in] time The time for which the effort shall be returned [s]
     467              :      */
     468      4321794 :     inline double getMinimumTravelTime(const ROVehicle* const veh) const {
     469      4323934 :         if (isTazConnector()) {
     470              :             return 0;
     471      4244255 :         } else if (veh != 0) {
     472     12713766 :             return myLength / MIN2(veh->getType()->maxSpeed, veh->getChosenSpeedFactor() * getVClassMaxSpeed(veh->getVClass()));
     473              :         } else {
     474         2136 :             return myLength / mySpeed;
     475              :         }
     476              :     }
     477              : 
     478              : 
     479              :     template<PollutantsInterface::EmissionType ET>
     480          262 :     static double getEmissionEffort(const ROEdge* const edge, const ROVehicle* const veh, double time) {
     481          262 :         double ret = 0;
     482          262 :         if (!edge->getStoredEffort(time, ret)) {
     483              :             const SUMOVTypeParameter* const type = veh->getType();
     484           90 :             const double vMax = MIN2(type->maxSpeed, edge->getVClassMaxSpeed(veh->getVClass()));
     485           90 :             const double accel = type->getCFParam(SUMO_ATTR_ACCEL, SUMOVTypeParameter::getDefaultAccel(type->vehicleClass)) * type->getCFParam(SUMO_ATTR_SIGMA, SUMOVTypeParameter::getDefaultImperfection(type->vehicleClass)) / 2.;
     486           90 :             ret = PollutantsInterface::computeDefault(type->emissionClass, ET, vMax, accel, 0, edge->getTravelTime(veh, time), nullptr); // @todo: give correct slope
     487              :         }
     488          262 :         return ret;
     489              :     }
     490              : 
     491              : 
     492              :     static double getNoiseEffort(const ROEdge* const edge, const ROVehicle* const veh, double time);
     493              : 
     494         1404 :     static double getStoredEffort(const ROEdge* const edge, const ROVehicle* const /*veh*/, double time) {
     495         1404 :         double ret = 0;
     496         1404 :         edge->getStoredEffort(time, ret);
     497         1404 :         return ret;
     498              :     }
     499              :     //@}
     500              : 
     501              : 
     502              :     /// @brief optimistic distance heuristic for use in routing
     503              :     double getDistanceTo(const ROEdge* other, const bool doBoundaryEstimate = false) const;
     504              : 
     505              : 
     506              :     /** @brief Returns all ROEdges */
     507              :     static const ROEdgeVector& getAllEdges();
     508              : 
     509              :     static void setGlobalOptions(const bool interpolate) {
     510         3445 :         myInterpolate = interpolate;
     511              :     }
     512              : 
     513              :     static void disableTimelineWarning() {
     514          158 :         myHaveTTWarned = true;
     515          158 :     }
     516              : 
     517              :     /// @brief return the coordinates of the center of the given stop
     518              :     static const Position getStopPosition(const SUMOVehicleParameter::Stop& stop);
     519              : 
     520              :     /// @brief return loaded edge preference based on routingType
     521         1286 :     inline double getPreference(const SUMOVTypeParameter& pars) const {
     522         2572 :         return RONet::getInstance()->getPreference(getRoutingType(), pars);
     523              :     }
     524              : 
     525              :     /// @brief get edge priority (road class)
     526              :     int getPriority() const {
     527       322490 :         return myPriority;
     528              :     }
     529              : 
     530              :     /// @brief get edge type
     531              :     const std::string& getType() const {
     532           66 :         return myType;
     533              :     }
     534              : 
     535              :     const std::string& getRoutingType() const {
     536         1286 :         return myRoutingType.empty() ? myType : myRoutingType;
     537              :     }
     538              : 
     539              :     const RONode* getFromJunction() const {
     540       414351 :         return myFromJunction;
     541              :     }
     542              : 
     543              :     const RONode* getToJunction() const {
     544       475884 :         return myToJunction;
     545              :     }
     546              : 
     547              :     /** @brief Returns this edge's lanes
     548              :      *
     549              :      * @return This edge's lanes
     550              :      */
     551              :     const std::vector<ROLane*>& getLanes() const {
     552              :         return myLanes;
     553              :     }
     554              : 
     555              :     /// @brief return opposite superposable/congruent edge, if it exist and 0 else
     556              :     inline const ROEdge* getBidiEdge() const {
     557         4120 :         return myBidiEdge;
     558              :     }
     559              : 
     560              :     /// @brief set opposite superposable/congruent edge
     561              :     inline void setBidiEdge(const ROEdge* bidiEdge) {
     562        12084 :         myBidiEdge = bidiEdge;
     563              :     }
     564              : 
     565       114848 :     ReversedEdge<ROEdge, ROVehicle>* getReversedRoutingEdge() const {
     566       114848 :         if (myReversedRoutingEdge == nullptr) {
     567        33544 :             myReversedRoutingEdge = new ReversedEdge<ROEdge, ROVehicle>(this);
     568              :         }
     569       114848 :         return myReversedRoutingEdge;
     570              :     }
     571              : 
     572              :     /// @brief Returns the flipped routing edge
     573              :     // @note If not called before, the flipped routing edge is created
     574            0 :     FlippedEdge<ROEdge, RONode, ROVehicle>* getFlippedRoutingEdge() const {
     575            0 :         if (myFlippedRoutingEdge == nullptr) {
     576            0 :             myFlippedRoutingEdge = new FlippedEdge<ROEdge, RONode, ROVehicle>(this);
     577              :         }
     578            0 :         return myFlippedRoutingEdge;
     579              :     }
     580              : 
     581       196260 :     RailEdge<ROEdge, ROVehicle>* getRailwayRoutingEdge() const {
     582       196260 :         if (myRailwayRoutingEdge == nullptr) {
     583       191578 :             myRailwayRoutingEdge = new RailEdge<ROEdge, ROVehicle>(this);
     584              :         }
     585       196260 :         return myRailwayRoutingEdge;
     586              :     }
     587              : 
     588              :     /// @brief whether effort data was loaded for this edge
     589              :     bool hasStoredEffort() const {
     590           35 :         return myUsingETimeLine;
     591              :     }
     592              : 
     593              :     /// @brief initialize priority factor range
     594              :     static bool initPriorityFactor(double priorityFactor);
     595              : 
     596              : protected:
     597              :     /** @brief Retrieves the stored effort
     598              :      *
     599              :      * @param[in] veh The vehicle for which the effort on this edge shall be retrieved
     600              :      * @param[in] time The tim for which the effort shall be returned
     601              :      * @return Whether the effort is given
     602              :      */
     603              :     bool getStoredEffort(double time, double& ret) const;
     604              : 
     605              : 
     606              : 
     607              : protected:
     608              :     /// @brief the junctions for this edge
     609              :     RONode* myFromJunction;
     610              :     RONode* myToJunction;
     611              : 
     612              :     /// @brief The index (numeric id) of the edge
     613              :     const int myIndex;
     614              : 
     615              :     /// @brief The edge priority (road class)
     616              :     const int myPriority;
     617              : 
     618              :     /// @brief the type of this edge
     619              :     const std::string myType;
     620              : 
     621              :     /// @brief the routing type of the edge (used to look up vType and vClass specific routing preferences)
     622              :     const std::string myRoutingType;
     623              : 
     624              :     /// @brief The maximum speed allowed on this edge
     625              :     double mySpeed;
     626              : 
     627              :     /// @brief The length of the edge
     628              :     double myLength;
     629              : 
     630              :     /// @brief whether the edge is a source or a sink
     631              :     bool myAmSink, myAmSource;
     632              :     /// @brief Container storing passing time varying over time for the edge
     633              :     mutable ValueTimeLine<double> myTravelTimes;
     634              :     /// @brief Information whether the time line shall be used instead of the length value
     635              :     bool myUsingTTTimeLine;
     636              : 
     637              :     /// @brief Container storing passing time varying over time for the edge
     638              :     mutable ValueTimeLine<double> myEfforts;
     639              :     /// @brief Information whether the time line shall be used instead of the length value
     640              :     bool myUsingETimeLine;
     641              : 
     642              :     /// @brief Information whether to interpolate at interval boundaries
     643              :     static bool myInterpolate;
     644              : 
     645              :     /// @brief Information whether the edge has reported missing weights
     646              :     static bool myHaveEWarned;
     647              :     /// @brief Information whether the edge has reported missing weights
     648              :     static bool myHaveTTWarned;
     649              : 
     650              :     /// @brief List of edges that may be approached from this edge
     651              :     ROEdgeVector myFollowingEdges;
     652              : 
     653              :     ROConstEdgePairVector myFollowingViaEdges;
     654              : 
     655              :     /// @brief List of edges that approached this edge
     656              :     ROEdgeVector myApproachingEdges;
     657              : 
     658              :     /// @brief The function of the edge
     659              :     SumoXMLEdgeFunc myFunction;
     660              : 
     661              :     /// The vClass speed restrictions for this edge
     662              :     const std::map<SUMOVehicleClass, double>* mySpeedRestrictions;
     663              : 
     664              :     /// @brief This edge's lanes
     665              :     std::vector<ROLane*> myLanes;
     666              : 
     667              :     /// @brief The list of allowed vehicle classes combined across lanes
     668              :     SVCPermissions myCombinedPermissions;
     669              : 
     670              :     /// @brief the other taz-connector if this edge isTazConnector, otherwise nullptr
     671              :     const ROEdge* myOtherTazConnector;
     672              : 
     673              :     /// @brief the bidirectional rail edge or nullpr
     674              :     const ROEdge* myBidiEdge;
     675              : 
     676              :     /// @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
     677              :     Boundary myBoundary;
     678              : 
     679              :     /// @brief flat penalty when computing traveltime
     680              :     double myTimePenalty;
     681              : 
     682              :     /// @brief cached value of parameters which may restrict access
     683              :     std::vector<double> myParamRestrictions;
     684              : 
     685              :     static ROEdgeVector myEdges;
     686              : 
     687              :     /// @brief Coefficient for factoring edge priority into routing weight
     688              :     static double myPriorityFactor;
     689              :     /// @brief Minimum priority for all edges
     690              :     static double myMinEdgePriority;
     691              :     /// @brief the difference between maximum and minimum priority for all edges
     692              :     static double myEdgePriorityRange;
     693              : 
     694              :     /// @brief The successors available for a given vClass
     695              :     mutable std::map<SUMOVehicleClass, ROEdgeVector> myClassesSuccessorMap;
     696              : 
     697              :     /// @brief The successors with vias available for a given vClass
     698              :     mutable std::map<SUMOVehicleClass, ROConstEdgePairVector> myClassesViaSuccessorMap;
     699              : 
     700              :     /// @brief a reversed version for backward routing
     701              :     mutable ReversedEdge<ROEdge, ROVehicle>* myReversedRoutingEdge = nullptr;
     702              :     /// @brief An extended version of the reversed edge for backward routing (used for the arc flag router)
     703              :     mutable FlippedEdge<ROEdge, RONode, ROVehicle>* myFlippedRoutingEdge = nullptr;
     704              :     mutable RailEdge<ROEdge, ROVehicle>* myRailwayRoutingEdge = nullptr;
     705              : 
     706              : #ifdef HAVE_FOX
     707              :     /// The mutex used to avoid concurrent updates of myClassesSuccessorMap
     708              :     mutable FXMutex myLock;
     709              : #endif
     710              : 
     711              : private:
     712              :     /// @brief Invalidated copy constructor
     713              :     ROEdge(const ROEdge& src);
     714              : 
     715              :     /// @brief Invalidated assignment operator
     716              :     ROEdge& operator=(const ROEdge& src);
     717              : 
     718              : };
        

Generated by: LCOV version 2.0-1