55 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator s = pars.
stops.begin(); s != pars.
stops.end(); ++s) {
58 if (pars.
via.size() != 0) {
62 for (std::vector<std::string>::const_iterator it = pars.
via.begin(); it != pars.
via.end(); ++it) {
73 assert(stopEdge != 0);
75 if (errorHandler !=
nullptr) {
76 errorHandler->
inform(
"Stop edge '" + stopEdge->
getID() +
"' does not allow vehicle '" +
getID() +
"'.");
81 std::vector<SUMOVehicleParameter::Stop>::iterator iter =
getParameter().
stops.begin();
82 ConstROEdgeVector::iterator edgeIter =
myStopEdges.begin();
91 ConstROEdgeVector::const_iterator stopEdgeIt = std::find(edges.begin(), edges.end(), stopEdge);
92 if (stopEdgeIt == edges.end()) {
97 if (edgeIter > stopEdgeIt || (edgeIter == stopEdgeIt && iter->endPos >= stopPar.
endPos)) {
105 iter += stopPar.
index;
106 edgeIter += stopPar.
index;
125 const bool removeLoops,
MsgHandler* errorHandler) {
127 std::string noRouteMsg =
"The vehicle '" +
getID() +
"' has no valid route.";
130 if (routeDef ==
nullptr) {
131 errorHandler->
inform(noRouteMsg);
136 if (current ==
nullptr || current->
size() == 0) {
138 errorHandler->
inform(noRouteMsg);
150 if (current->
size() == 0) {
152 errorHandler->
inform(noRouteMsg +
" (after removing loops)");
167 mandatory.push_back(requiredStart);
170 if (e->isInternal()) {
174 if (mandatory.size() == 0 || after != mandatory.back()) {
175 mandatory.push_back(before);
176 mandatory.push_back(after);
179 if (mandatory.size() == 0 || e != mandatory.back()) {
180 mandatory.push_back(e);
185 if (mandatory.size() < 2 || mandatory.back() != requiredEnd) {
186 mandatory.push_back(requiredEnd);
195 if (typeos !=
nullptr &&
getType() !=
nullptr && !
getType()->saved) {
OutputDevice & writeXMLDefinition(OutputDevice &dev, const ROVehicle *const veh, bool asAlternatives, bool withExitTimes) const
Saves the built route / route alternatives.
ROEdge * getEdgeForLaneID(const std::string &laneID) const
Retrieves an edge from the network when the lane id is given.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
Structure representing possible vehicle parameter.
const SUMOVehicleParameter & getParameter() const
Returns the definition of the vehicle / person parameter.
bool saved
Information whether this type was already saved (needed by routers)
void addAlternative(SUMOAbstractRouter< ROEdge, ROVehicle > &router, const ROVehicle *const, RORoute *current, SUMOTime begin)
Adds an alternative to the list of routes.
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
const RORoute * getFirstRoute() const
bool prohibits(const ROVehicle *const vehicle) const
Returns whether this edge prohibits the given vehicle to pass it.
const ROEdge * getFirst() const
Returns the first edge in the route.
std::vector< const ROEdge * > ConstROEdgeVector
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
bool myRoutingSuccess
Whether the last routing was successful.
const std::string & getID() const
Returns the id.
The arrival position is given.
ROVehicle(const SUMOVehicleParameter &pars, RORouteDef *route, const SUMOVTypeParameter *type, const RONet *net, MsgHandler *errorHandler=0)
Constructor.
RORouteDef *const myRoute
The route the vehicle takes.
std::vector< Stop > stops
List of the stops the vehicle will make, TraCI may add entries here.
RORoute * buildCurrentRoute(SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime begin, const ROVehicle &veh) const
Triggers building of the complete route (via preComputeCurrentRoute) or returns precomputed route...
void addStop(const SUMOVehicleParameter::Stop &stopPar, const RONet *net, MsgHandler *errorHandler)
Adds a stop to this vehicle.
A routable thing such as a vehicle or person.
const ROEdge * getDepartEdge() const
Returns the first edge the vehicle takes.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
const ROEdge * getNormalAfter() const
if this edge is an internal edge, return its first normal successor, otherwise the edge itself ...
ConstROEdgeVector getMandatoryEdges(const ROEdge *requiredStart, const ROEdge *requiredEnd) const
compute mandatory edges
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the list of stops this route contains.
void write(OutputDevice &dev, const OptionsCont &oc, const SumoXMLTag tag=SUMO_TAG_VEHICLE, const std::string &typeID="") const
Writes the parameters as a beginning element.
const ConstROEdgeVector & getStopEdges() const
double endPos
The stopping position end.
const std::string & getID() const
Returns the id of the routable.
SUMOTime getDepartureTime() const
Returns the time the vehicle starts at, 0 for triggered vehicles.
A basic edge for routing applications.
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string lane
The lane to stop at.
std::vector< std::string > via
List of the via-edges the vehicle must visit.
SUMOAbstractRouter< E, V > & getVehicleRouter() const
int size() const
Returns the number of edges in this route.
void write(OutputDevice &dev) const
Writes the vtype.
The router's network representation.
Structure representing possible vehicle parameter.
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
ConstROEdgeVector myStopEdges
The edges where the vehicle stops.
Definition of vehicle stop (position and duration)
const ConstROEdgeVector & getEdgeVector() const
Returns the list of edges this route consists of.
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
int index
at which position in the stops list
The arrival lane is given.
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
Base class for a vehicle's route definition.
void recheckForLoops(const ConstROEdgeVector &mandatory)
Checks whether this route contains loops and removes such.
Static storage of an output device and its base (abstract) implementation.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
const ROEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself ...
ROEdge * getEdge(const std::string &name) const
Retrieves an edge from the network.
virtual ~ROVehicle()
Destructor.
void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Saves the complete vehicle description.
A complete router's route.
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.