55 for (std::vector<PlanItem*>::const_iterator it =
myPlan.begin(); it !=
myPlan.end(); ++it) {
63 const std::string& vTypes,
const double departPos,
const double arrivalPos,
const std::string& busStop,
double walkFactor) {
64 PersonTrip* trip =
new PersonTrip(from, to, modeSet, departPos, arrivalPos, busStop, walkFactor);
77 if (type ==
nullptr) {
105 myPlan.back()->addTripItem(
new Ride(from, to, lines, -1., arrivalPos, destStop));
114 myPlan.back()->addTripItem(
new Walk(edges, -1., duration, speed, departPos, arrivalPos, busStop));
120 myPlan.push_back(
new Stop(stopPar, stopEdge));
127 std::string comment =
"";
128 if (extended && cost >= 0.) {
131 if (from !=
nullptr) {
137 if (destStop !=
"") {
141 comment =
" <!-- " + name +
" -->";
145 if (intended !=
"" && intended != lines) {
158 std::string comment =
"";
159 if (extended && cost >= 0.) {
172 if (arr != 0. && destStop ==
"") {
175 if (destStop !=
"") {
179 comment =
" <!-- " + name +
" -->";
188 for (
auto* item : myTripItems) {
196 for (std::vector<ROVehicle*>::const_iterator it = myVehicles.begin(); it != myVehicles.end(); ++it) {
197 (*it)->saveAsXML(os, typeos, asAlternatives, options);
206 Position fromPos = from->getLanes()[0]->getShape().positionAtOffset2D(getDepartPos());
219 Position toPos = to->getLanes()[0]->getShape().positionAtOffset2D(
MIN2(getArrivalPos(), to->getLanes()[0]->getShape().length2D()));
231 std::vector<std::string> allowedModes;
233 allowedModes.push_back(
"public");
236 allowedModes.push_back(
"car");
239 allowedModes.push_back(
"bicycle");
241 if (allowedModes.size() > 0) {
245 if (dep != 0 && dep != std::numeric_limits<double>::infinity()) {
248 if (arr != 0 && arr != std::numeric_limits<double>::infinity()) {
252 if (getStopDest() !=
"") {
255 if (walkFactor != 1) {
260 for (std::vector<TripItem*>::const_iterator it = myTripItems.begin(); it != myTripItems.end(); ++it) {
261 (*it)->saveAsXML(os, extended);
269 for (
TripItem* tItem : myTripItems) {
270 result += tItem->getDuration();
278 std::vector<ROIntermodalRouter::TripItem> result;
281 bool carUsed =
false;
282 for (std::vector<ROIntermodalRouter::TripItem>::const_iterator it = result.begin(); it != result.end(); ++it) {
283 if (!it->edges.empty()) {
284 if (it->line ==
"") {
285 if (it + 1 == result.end() && trip->
getStopDest() ==
"") {
290 }
else if (veh !=
nullptr && it->line == veh->
getID()) {
299 if (result.empty()) {
300 errorHandler->
inform(
"No route for trip in person '" +
getID() +
"'.");
312 for (std::vector<PlanItem*>::iterator it =
myPlan.begin(); it !=
myPlan.end(); ++it) {
313 if ((*it)->needsRouting()) {
315 std::vector<ROVehicle*>& vehicles = trip->
getVehicles();
316 if (vehicles.empty()) {
319 for (std::vector<ROVehicle*>::iterator v = vehicles.begin(); v != vehicles.end();) {
321 v = vehicles.erase(v);
328 time += (*it)->getDuration();
336 const bool writeTrip = options.
exists(
"write-trips") && options.
getBool(
"write-trips");
337 const bool writeGeoTrip = writeTrip && options.
getBool(
"write-trips.geo");
339 for (std::vector<PlanItem*>::const_iterator it =
myPlan.begin(); it !=
myPlan.end(); ++it) {
340 (*it)->saveVehicles(os, typeos, asAlternatives, options);
344 if (typeos !=
nullptr &&
getType() !=
nullptr && !
getType()->saved) {
356 for (std::vector<PlanItem*>::const_iterator it =
myPlan.begin(); it !=
myPlan.end(); ++it) {
357 (*it)->saveAsXML(os, asAlternatives, writeTrip, writeGeoTrip);
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.
int gPrecision
the precision for floating point outputs
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.
bool usingGeoProjection() const
Returns whether a transformation from geo to metric coordinates will be performed.
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color) ...
std::string time2string(SUMOTime t)
void saveAsXML(OutputDevice &os, const bool extended, const bool asTrip, const bool writeGeoTrip) const
void setPrecision(int precision=gPrecision)
Sets the precison or resets it to default.
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 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.
bool hasNext()
returns the information whether further substrings exist
const std::string DEFAULT_VTYPE_ID
Every person has a plan comprising of multiple planItems.
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
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
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
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
std::vector< PlanItem * > myPlan
The plan of the person.
A point in 2D or 3D with translation and scaling methods.
void addStop(const SUMOVehicleParameter::Stop &stopPar, const ROEdge *const stopEdge)
bool exists(const std::string &name) const
Returns the information whether the named option is known.
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.
A TripItem is part of a trip, e.g., go from here to here by car.
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
std::vector< TripItem * > myTripItems
the fully specified trips
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)
Definition of vehicle stop (position and duration)
ROPerson(const SUMOVehicleParameter &pars, const SUMOVTypeParameter *type)
Constructor.
void saveAsXML(OutputDevice &os, const bool extended) const
double getWalkFactor() const
double departPos
(optional) The position the vehicle shall depart from
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)
virtual 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.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
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 int VEHPARS_DEPARTPOS_SET
SUMOTime getDuration() const
return duration sum of all trip items
bool computeIntermodal(SUMOTime time, const RORouterProvider &provider, PersonTrip *const trip, const ROVehicle *const veh, MsgHandler *const errorHandler)
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