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 350391 : 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 80 : mySpeedRestrictions = restrictions;
144 : }
145 :
146 : inline void setTimePenalty(double value) {
147 165722 : myTimePenalty = value;
148 165722 : }
149 :
150 : inline double getTimePenalty() const {
151 494527 : return myTimePenalty;
152 : }
153 :
154 : /// @brief return whether this edge is a normal edge
155 : inline bool isNormal() const {
156 13465 : return myFunction == SumoXMLEdgeFunc::NORMAL;
157 : }
158 :
159 : /// @brief return whether this edge is an internal edge
160 : inline bool isInternal() const {
161 13543816 : return myFunction == SumoXMLEdgeFunc::INTERNAL;
162 : }
163 :
164 : /// @brief return whether this edge is a pedestrian crossing
165 : inline bool isCrossing() const {
166 4645251 : return myFunction == SumoXMLEdgeFunc::CROSSING;
167 : }
168 :
169 : /// @brief return whether this edge is walking area
170 : inline bool isWalkingArea() const {
171 2127868 : return myFunction == SumoXMLEdgeFunc::WALKINGAREA;
172 : }
173 :
174 : inline bool isTazConnector() const {
175 4912118 : return myFunction == SumoXMLEdgeFunc::CONNECTOR;
176 : }
177 :
178 : void setOtherTazConnector(const ROEdge* edge) {
179 3941 : myOtherTazConnector = edge;
180 : }
181 :
182 : const ROEdge* getOtherTazConnector() const {
183 7375 : 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 727194 : 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 7135711 : 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 24189704 : 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 368993 : 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 329355 : 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 5771506 : inline bool prohibits(const ROVehicle* const vehicle, bool checkRestrictions = false) const {
270 : const SUMOVehicleClass vclass = vehicle->getVClass();
271 5771506 : return (myCombinedPermissions & vclass) != vclass || (checkRestrictions && restricts(vehicle));
272 : }
273 :
274 : inline SVCPermissions getPermissions() const {
275 396559 : 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 429 : for (int i = 0; i < (int)vTypeRestrictions.size(); i++) {
286 222 : 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 6 : void resetSuccessors() {
348 : myClassesSuccessorMap.clear();
349 : myClassesViaSuccessorMap.clear();
350 6 : }
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 11037657 : static inline double getTravelTimeStatic(const ROEdge* const edge, const ROVehicle* const veh, double time) {
424 11037657 : return edge->getTravelTime(veh, time) * getRoutingFactor(edge, veh);
425 : }
426 :
427 8240 : static inline double getTravelTimeStaticRandomized(const ROEdge* const edge, const ROVehicle* const veh, double time) {
428 8240 : return edge->getTravelTime(veh, time)
429 8240 : * (1 + RandHelper::randHash(veh->getRandomSeed() ^ edge->getNumericalID()) * (gWeightsRandomFactor - 1))
430 8240 : * 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 0 : static inline double getTravelTimeStaticPriorityFactor(const ROEdge* const edge, const ROVehicle* const veh, double time) {
440 0 : 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 0 : const double relativeInversePrio = 1 - ((edge->getPriority() - myMinEdgePriority) / myEdgePriorityRange);
444 0 : result *= 1 + relativeInversePrio * myPriorityFactor;
445 0 : return result * getRoutingFactor(edge, veh);
446 : }
447 :
448 : /// @brief Return traveltime weighted by edge priority (scaled penalty for low-priority edges)
449 60 : static inline double getTravelTimeStaticPriorityFactorRandomized(const ROEdge* const edge, const ROVehicle* const veh, double time) {
450 60 : 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 60 : const double relativeInversePrio = 1 - ((edge->getPriority() - myMinEdgePriority) / myEdgePriorityRange);
454 60 : result *= 1 + relativeInversePrio * myPriorityFactor;
455 60 : result *= (1 + RandHelper::randHash(veh->getRandomSeed() ^ edge->getNumericalID()) * (gWeightsRandomFactor - 1));
456 60 : return result * getRoutingFactor(edge, veh);
457 : }
458 :
459 : static inline double getRoutingFactor(const ROEdge* const edge, const ROVehicle* const veh) {
460 11045957 : return gRoutingPreferences ? 1 / edge->getPreference(veh->getVTypeParameter()) : 1;
461 : }
462 :
463 :
464 : /** @brief Returns a lower bound for the travel time on this edge without using any stored timeLine
465 : *
466 : * @param[in] veh The vehicle for which the effort on this edge shall be retrieved
467 : * @param[in] time The time for which the effort shall be returned [s]
468 : */
469 4335138 : inline double getMinimumTravelTime(const ROVehicle* const veh) const {
470 4337278 : if (isTazConnector()) {
471 : return 0;
472 4257073 : } else if (veh != 0) {
473 4257073 : return myLength / getMaxSpeed(veh);
474 : } else {
475 2136 : return myLength / mySpeed;
476 : }
477 : }
478 :
479 13321143 : inline double getMaxSpeed(const RORoutable* const veh) const {
480 13321143 : return MIN2(veh->getMaxSpeed(), veh->getChosenSpeedFactor() * getVClassMaxSpeed(veh->getVClass()));
481 : }
482 :
483 : /** @brief Returns the lane's maximum speed, given a vehicle's speed limit adaptation
484 : * @param[in] The vehicle to return the adapted speed limit for
485 : * @return This lane's resulting max. speed
486 : */
487 13322947 : inline double getVClassMaxSpeed(SUMOVehicleClass vclass) const {
488 13322947 : if (mySpeedRestrictions != 0) {
489 : std::map<SUMOVehicleClass, double>::const_iterator r = mySpeedRestrictions->find(vclass);
490 75 : if (r != mySpeedRestrictions->end()) {
491 66 : return r->second;
492 : }
493 : }
494 13322881 : return mySpeed;
495 : }
496 :
497 : template<PollutantsInterface::EmissionType ET>
498 262 : static double getEmissionEffort(const ROEdge* const edge, const ROVehicle* const veh, double time) {
499 262 : double ret = 0;
500 262 : if (!edge->getStoredEffort(time, ret)) {
501 : const SUMOVTypeParameter* const type = veh->getType();
502 90 : const double vMax = edge->getMaxSpeed(veh);
503 90 : const double accel = type->getCFParam(SUMO_ATTR_ACCEL, SUMOVTypeParameter::getDefaultAccel(type->vehicleClass)) * type->getCFParam(SUMO_ATTR_SIGMA, SUMOVTypeParameter::getDefaultImperfection(type->vehicleClass)) / 2.;
504 90 : ret = PollutantsInterface::computeDefault(type->emissionClass, ET, vMax, accel, 0, edge->getTravelTime(veh, time), nullptr); // @todo: give correct slope
505 : }
506 262 : return ret;
507 : }
508 :
509 :
510 : static double getNoiseEffort(const ROEdge* const edge, const ROVehicle* const veh, double time);
511 :
512 1404 : static double getStoredEffort(const ROEdge* const edge, const ROVehicle* const /*veh*/, double time) {
513 1404 : double ret = 0;
514 1404 : edge->getStoredEffort(time, ret);
515 1404 : return ret;
516 : }
517 : //@}
518 :
519 :
520 : /// @brief optimistic distance heuristic for use in routing
521 : double getDistanceTo(const ROEdge* other, const bool doBoundaryEstimate = false) const;
522 :
523 :
524 : /** @brief Returns all ROEdges */
525 : static const ROEdgeVector& getAllEdges();
526 :
527 : static void setGlobalOptions(const bool interpolate) {
528 4244 : myInterpolate = interpolate;
529 : }
530 :
531 : static void disableTimelineWarning() {
532 166 : myHaveTTWarned = true;
533 166 : }
534 :
535 : /// @brief return the coordinates of the center of the given stop
536 : static const Position getStopPosition(const SUMOVehicleParameter::Stop& stop);
537 :
538 : /// @brief return loaded edge preference based on routingType
539 1680 : inline double getPreference(const SUMOVTypeParameter& pars) const {
540 3360 : return RONet::getInstance()->getPreference(getRoutingType(), pars);
541 : }
542 :
543 : /// @brief get edge priority (road class)
544 : int getPriority() const {
545 325833 : return myPriority;
546 : }
547 :
548 : /// @brief get edge type
549 : const std::string& getType() const {
550 80 : return myType;
551 : }
552 :
553 : const std::string& getRoutingType() const {
554 1680 : return myRoutingType.empty() ? myType : myRoutingType;
555 : }
556 :
557 : const RONode* getFromJunction() const {
558 550858 : return myFromJunction;
559 : }
560 :
561 : const RONode* getToJunction() const {
562 734045 : return myToJunction;
563 : }
564 :
565 : /** @brief Returns this edge's lanes
566 : *
567 : * @return This edge's lanes
568 : */
569 : const std::vector<ROLane*>& getLanes() const {
570 : return myLanes;
571 : }
572 :
573 : /// @brief return opposite superposable/congruent edge, if it exist and 0 else
574 : inline const ROEdge* getBidiEdge() const {
575 6172 : return myBidiEdge;
576 : }
577 :
578 : /// @brief set opposite superposable/congruent edge
579 : inline void setBidiEdge(const ROEdge* bidiEdge) {
580 13148 : myBidiEdge = bidiEdge;
581 : }
582 :
583 114848 : ReversedEdge<ROEdge, ROVehicle>* getReversedRoutingEdge() const {
584 114848 : if (myReversedRoutingEdge == nullptr) {
585 33544 : myReversedRoutingEdge = new ReversedEdge<ROEdge, ROVehicle>(this);
586 : }
587 114848 : return myReversedRoutingEdge;
588 : }
589 :
590 : /// @brief Returns the flipped routing edge
591 : // @note If not called before, the flipped routing edge is created
592 0 : FlippedEdge<ROEdge, RONode, ROVehicle>* getFlippedRoutingEdge() const {
593 0 : if (myFlippedRoutingEdge == nullptr) {
594 0 : myFlippedRoutingEdge = new FlippedEdge<ROEdge, RONode, ROVehicle>(this);
595 : }
596 0 : return myFlippedRoutingEdge;
597 : }
598 :
599 200486 : RailEdge<ROEdge, ROVehicle>* getRailwayRoutingEdge() const {
600 200486 : if (myRailwayRoutingEdge == nullptr) {
601 193497 : myRailwayRoutingEdge = new RailEdge<ROEdge, ROVehicle>(this);
602 : }
603 200486 : return myRailwayRoutingEdge;
604 : }
605 :
606 : /// @brief whether effort data was loaded for this edge
607 : bool hasStoredEffort() const {
608 35 : return myUsingETimeLine;
609 : }
610 :
611 : /// @brief initialize priority factor range
612 : static bool initPriorityFactor(double priorityFactor);
613 :
614 : protected:
615 : /** @brief Retrieves the stored effort
616 : *
617 : * @param[in] veh The vehicle for which the effort on this edge shall be retrieved
618 : * @param[in] time The tim for which the effort shall be returned
619 : * @return Whether the effort is given
620 : */
621 : bool getStoredEffort(double time, double& ret) const;
622 :
623 : protected:
624 : /// @brief the junctions for this edge
625 : RONode* myFromJunction;
626 : RONode* myToJunction;
627 :
628 : /// @brief The index (numeric id) of the edge
629 : const int myIndex;
630 :
631 : /// @brief The edge priority (road class)
632 : const int myPriority;
633 :
634 : /// @brief the type of this edge
635 : const std::string myType;
636 :
637 : /// @brief the routing type of the edge (used to look up vType and vClass specific routing preferences)
638 : const std::string myRoutingType;
639 :
640 : /// @brief The maximum speed allowed on this edge
641 : double mySpeed;
642 :
643 : /// @brief The length of the edge
644 : double myLength;
645 :
646 : /// @brief whether the edge is a source or a sink
647 : bool myAmSink, myAmSource;
648 : /// @brief Container storing passing time varying over time for the edge
649 : mutable ValueTimeLine<double> myTravelTimes;
650 : /// @brief Information whether the time line shall be used instead of the length value
651 : bool myUsingTTTimeLine;
652 :
653 : /// @brief Container storing passing time varying over time for the edge
654 : mutable ValueTimeLine<double> myEfforts;
655 : /// @brief Information whether the time line shall be used instead of the length value
656 : bool myUsingETimeLine;
657 :
658 : /// @brief Information whether to interpolate at interval boundaries
659 : static bool myInterpolate;
660 :
661 : /// @brief Information whether the edge has reported missing weights
662 : static bool myHaveEWarned;
663 : /// @brief Information whether the edge has reported missing weights
664 : static bool myHaveTTWarned;
665 :
666 : /// @brief List of edges that may be approached from this edge
667 : ROEdgeVector myFollowingEdges;
668 :
669 : ROConstEdgePairVector myFollowingViaEdges;
670 :
671 : /// @brief List of edges that approached this edge
672 : ROEdgeVector myApproachingEdges;
673 :
674 : /// @brief The function of the edge
675 : SumoXMLEdgeFunc myFunction;
676 :
677 : /// The vClass speed restrictions for this edge
678 : const std::map<SUMOVehicleClass, double>* mySpeedRestrictions;
679 :
680 : /// @brief This edge's lanes
681 : std::vector<ROLane*> myLanes;
682 :
683 : /// @brief The list of allowed vehicle classes combined across lanes
684 : SVCPermissions myCombinedPermissions;
685 :
686 : /// @brief the other taz-connector if this edge isTazConnector, otherwise nullptr
687 : const ROEdge* myOtherTazConnector;
688 :
689 : /// @brief the bidirectional rail edge or nullpr
690 : const ROEdge* myBidiEdge;
691 :
692 : /// @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
693 : Boundary myBoundary;
694 :
695 : /// @brief flat penalty when computing traveltime
696 : double myTimePenalty;
697 :
698 : /// @brief cached value of parameters which may restrict access
699 : std::vector<double> myParamRestrictions;
700 :
701 : static ROEdgeVector myEdges;
702 :
703 : /// @brief Coefficient for factoring edge priority into routing weight
704 : static double myPriorityFactor;
705 : /// @brief Minimum priority for all edges
706 : static double myMinEdgePriority;
707 : /// @brief the difference between maximum and minimum priority for all edges
708 : static double myEdgePriorityRange;
709 :
710 : /// @brief The successors available for a given vClass
711 : mutable std::map<SUMOVehicleClass, ROEdgeVector> myClassesSuccessorMap;
712 :
713 : /// @brief The successors with vias available for a given vClass
714 : mutable std::map<SUMOVehicleClass, ROConstEdgePairVector> myClassesViaSuccessorMap;
715 :
716 : /// @brief a reversed version for backward routing
717 : mutable ReversedEdge<ROEdge, ROVehicle>* myReversedRoutingEdge = nullptr;
718 : /// @brief An extended version of the reversed edge for backward routing (used for the arc flag router)
719 : mutable FlippedEdge<ROEdge, RONode, ROVehicle>* myFlippedRoutingEdge = nullptr;
720 : mutable RailEdge<ROEdge, ROVehicle>* myRailwayRoutingEdge = nullptr;
721 :
722 : #ifdef HAVE_FOX
723 : /// The mutex used to avoid concurrent updates of myClassesSuccessorMap
724 : mutable FXMutex myLock;
725 : #endif
726 :
727 : private:
728 : /// @brief Invalidated copy constructor
729 : ROEdge(const ROEdge& src);
730 :
731 : /// @brief Invalidated assignment operator
732 : ROEdge& operator=(const ROEdge& src);
733 :
734 : };
|