LCOV - code coverage report
Current view: top level - src/router - ROEdge.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 97.3 % 73 71
Test Date: 2024-11-21 15:56:26 Functions: 93.3 % 15 14

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

Generated by: LCOV version 2.0-1