43 myProbability(prop), myRoute(route), myColor(color), myStops(stops) {}
47 myProbability(0.0), myRoute(route), myColor(nullptr), myStops() {}
50 :
Named(src.myID), myCosts(src.myCosts),
51 myProbability(src.myProbability), myRoute(src.myRoute), myColor(nullptr) {
85 for (ConstROEdgeVector::const_iterator i =
myRoute.begin() + 1; i !=
myRoute.end(); ++i) {
86 const ROEdge* prev = *(i - 1);
89 mh->
informf(
"Edge '%' not connected to edge '%' for vehicle '%'.", prev->
getID(), cur->
getID(), veh.
getID());
101 if (hasRestrictions || hasPermissions) {
103 if ((hasPermissions && e->prohibits(veh)) || (hasRestrictions && e->restricts(veh))) {
104 mh->
informf(
"Vehicle '%' is not permitted on Edge '%'", veh->
getID(), e->getID());
120 for (StopParVector::iterator stop =
myStops.begin(); stop !=
myStops.end(); ++stop) {
121 if (stop->until >= 0) {
122 stop->until += offset;
124 if (stop->arrival >= 0) {
125 stop->arrival += offset;
135 if (!roe->isInternal() && !roe->isTazConnector()) {
136 tempRoute.push_back(roe);
145 const bool withCosts,
146 const bool asAlternatives,
147 const bool withExitTimes,
148 const bool withLength,
149 const std::string&
id)
const {
157 if (asAlternatives) {
167 std::vector<double> exitTimes;
170 time += roe->getTravelTime(veh, time);
171 if (!roe->isInternal() && !roe->isTazConnector()) {
172 exitTimes.push_back(time);
180 length += roe->getLength();
std::vector< const ROEdge * > ConstROEdgeVector
std::vector< const ROEdge * > ConstROEdgeVector
std::vector< SUMOVehicleParameter::Stop > StopParVector
@ SUMO_TAG_ROUTE
description of a route
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_COLOR
A color information.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
void informf(const std::string &format, T value, Targs... Fargs)
adds a new formatted message
Base class for objects which have an id.
const std::string & getID() const
Returns the id.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
A basic edge for routing applications.
bool isConnectedTo(const ROEdge &e, const SUMOVehicleClass vClass, bool ignoreTransientPermissions=false) const
returns the information whether this edge is directly connected to the given
static RONet * getInstance()
Returns the pointer to the unique instance of RONet (singleton).
bool hasParamRestrictions() const
bool hasPermissions() const
SUMOVehicleClass getVClass() const
const std::string & getID() const
Returns the id of the routable.
A complete router's route.
RORoute(const std::string &id, double costs, double prob, const ConstROEdgeVector &route, const RGBColor *const color, const StopParVector &stops)
Constructor.
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, const bool withCosts, const bool asAlternatives, const bool withExitTimes, const bool withLength, const std::string &id="") const
bool isValid(const ROVehicle &veh, bool ignoreErrors, MsgHandler *mh=nullptr) const
check whether the route is connected for the given vehicle
ConstROEdgeVector myRoute
The edges the route consists of.
StopParVector myStops
List of the stops on the parsed route.
double myCosts
The costs of the route.
void setProbability(double prob)
Sets the probability of the route.
double myProbability
The probability the driver will take this route with.
void addStopOffset(const SUMOTime offset)
Adapts the until and arrival time of all stops by the given offset.
bool isPermitted(const ROVehicle *veh, MsgHandler *mh) const
check whether the route is permitted for the given vehicle
void addProbability(double prob)
add additional vehicles/probability
const RGBColor * myColor
The color of the route.
ConstROEdgeVector getNormalEdges() const
return edges that shall be written in the route definition
void recheckForLoops(const ConstROEdgeVector &mandatory)
Checks whether this route contains loops and removes such.
void setCosts(double costs)
Sets the costs of the route.
A vehicle as used by router.
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
Some static methods for string processing.
void recheckForLoops(ConstROEdgeVector &edges, const ConstROEdgeVector &mandatory)
Checks whether the given edge list contains loops and removes them.