53 for (std::vector<PlanItem*>::const_iterator it =
myPlan.begin(); it !=
myPlan.end(); ++it) {
61 const std::string& vTypes,
const double departPos,
const double arrivalPos,
const std::string& busStop,
double walkFactor) {
62 PersonTrip* trip =
new PersonTrip(from, to, modeSet, departPos, arrivalPos, busStop, walkFactor);
71 if (type ==
nullptr) {
99 myPlan.back()->addTripItem(
new Ride(from, to, lines, -1., arrivalPos, destStop));
108 myPlan.back()->addTripItem(
new Walk(edges, -1., duration, speed, departPos, arrivalPos, busStop));
114 myPlan.push_back(
new Stop(stopPar, stopEdge));
121 std::string comment =
"";
122 if (extended && cost >= 0.) {
125 if (from !=
nullptr) {
131 if (destStop !=
"") {
135 comment =
" <!-- " + name +
" -->";
139 if (intended !=
"" && intended != lines) {
152 std::string comment =
"";
153 if (extended && cost >= 0.) {
169 if (destStop !=
"") {
173 comment =
" <!-- " + name +
" -->";
182 for (std::vector<ROVehicle*>::const_iterator it = myVehicles.begin(); it != myVehicles.end(); ++it) {
183 (*it)->saveAsXML(os, typeos, asAlternatives, options);
190 std::vector<ROIntermodalRouter::TripItem> result;
193 bool carUsed =
false;
194 for (std::vector<ROIntermodalRouter::TripItem>::const_iterator it = result.begin(); it != result.end(); ++it) {
195 if (!it->edges.empty()) {
196 if (it->line ==
"") {
197 if (it + 1 == result.end() && trip->
getStopDest() ==
"") {
202 }
else if (veh !=
nullptr && it->line == veh->
getID()) {
211 if (result.empty()) {
212 errorHandler->
inform(
"No route for trip in person '" +
getID() +
"'.");
223 for (std::vector<PlanItem*>::iterator it =
myPlan.begin(); it !=
myPlan.end(); ++it) {
224 if ((*it)->needsRouting()) {
226 std::vector<ROVehicle*>& vehicles = trip->
getVehicles();
227 if (vehicles.empty()) {
230 for (std::vector<ROVehicle*>::iterator v = vehicles.begin(); v != vehicles.end();) {
232 v = vehicles.erase(v);
246 for (std::vector<PlanItem*>::const_iterator it =
myPlan.begin(); it !=
myPlan.end(); ++it) {
247 (*it)->saveVehicles(os, typeos, asAlternatives, options);
250 if (typeos !=
nullptr &&
getType() !=
nullptr && !
getType()->saved) {
262 for (std::vector<PlanItem*>::const_iterator it =
myPlan.begin(); it !=
myPlan.end(); ++it) {
263 (*it)->saveAsXML(os, asAlternatives);
The departure is person triggered.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
IntermodalRouter< E, L, N, V > & getIntermodalRouter() const
SVCPermissions getModes() const
std::string vtypeid
The vehicle's type id.
void addVehicle(ROVehicle *veh)
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)
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
A planItem can be a Stop.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
std::string time2string(SUMOTime t)
bool computeIntermodal(const RORouterProvider &provider, PersonTrip *const trip, const ROVehicle *const veh, MsgHandler *const errorHandler)
void saveAsXML(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
Saves the complete person description.
const std::string DEFAULT_BIKETYPE_ID
std::vector< const ROEdge * > ConstROEdgeVector
bool myRoutingSuccess
Whether the last routing was successful.
const std::string DEFAULT_VTYPE_ID
A planItem can be a Trip which contains multiple tripItems.
static RONet * getInstance()
Returns the pointer to the unique instance of RONet (singleton).
void saveAsXML(OutputDevice &os, const bool extended) const
A routable thing such as a vehicle or person.
A ride is part of a trip, e.g., go from here to here by car or bus.
A vehicle as used by router.
double maxSpeed
The vehicle type's maximum speed [m/s].
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void saveVehicles(OutputDevice &os, OutputDevice *const typeos, bool asAlternatives, OptionsCont &options) const
std::vector< PlanItem * > myPlan
The plan of the person.
void addStop(const SUMOVehicleParameter::Stop &stopPar, const ROEdge *const stopEdge)
SUMOTime depart
The vehicle's departure time.
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
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 std::string & getID() const
Returns the id of the routable.
vehicle is a passenger car (a "normal" car)
A walk is part of a trip, e.g., go from here to here by foot.
A basic edge for routing applications.
RORouteDef * getRouteDefinition() const
Returns the definition of the route the vehicle takes.
const std::string & getStopDest() const
virtual ~ROPerson()
Destructor.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
void addTrip(const ROEdge *const from, const ROEdge *const to, const SVCPermissions modeSet, const std::string &vTypes, const double departPos, const double arrivalPos, const std::string &busStop, double walkFactor)
ROPerson(const SUMOVehicleParameter &pars, const SUMOVTypeParameter *type)
Constructor.
void saveAsXML(OutputDevice &os, const bool extended) const
double getWalkFactor() const
void write(OutputDevice &dev) const
Writes the vtype.
void computeRoute(const RORouterProvider &provider, const bool removeLoops, MsgHandler *errorHandler)
The router's network representation.
Structure representing possible vehicle parameter.
const SUMOVTypeParameter * getType() const
Returns the type of the routable.
double getArrivalPos(bool replaceDefault=true) const
void addWalk(const ConstROEdgeVector &edges, const double duration, const double speed, const double departPos, const double arrivalPos, const std::string &busStop)
Definition of vehicle stop (position and duration)
void inform(std::string msg, bool addType=true)
adds a new error to the list
A storage for options typed value containers)
Base class for a vehicle's route definition.
const std::string getStoppingPlaceName(const std::string &id) const
return the name for the given stopping place id
void addLoadedAlternative(RORoute *alternative)
Adds a single alternative loaded from the file An alternative may also be generated during DUA...
double getDepartPos(bool replaceDefault=true) const
void addRide(const ROEdge *const from, const ROEdge *const to, const std::string &lines, double arrivalPos, const std::string &destStop)
const int VEHPARS_VTYPE_SET
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.
std::vector< ROVehicle * > & getVehicles()
virtual void addTripItem(TripItem *tripIt)
SUMOVTypeParameter * getVehicleTypeSecure(const std::string &id)
Retrieves the named vehicle type.
const ROEdge * getOrigin() const
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
A complete router's route.
std::string id
The vehicle's id.
const ROEdge * getDestination() const