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());
123 if (!roe->isInternal() && !roe->isTazConnector()) {
124 tempRoute.push_back(roe);
133 const bool withCosts,
134 const bool asAlternatives,
135 const bool withExitTimes,
136 const bool withLength,
137 const std::string&
id)
const {
145 if (asAlternatives) {
155 std::vector<double> exitTimes;
158 time += roe->getTravelTime(veh, time);
159 if (!roe->isInternal() && !roe->isTazConnector()) {
160 exitTimes.push_back(time);
168 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 & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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 hasPermissions() const
bool hasRestrictions() 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.
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.
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.