55 : myDestination(destination), myDestinationStop(toStop), myArrivalPos(arrivalPos), myDeparted(-1), myArrived(-1), myType(type) {}
94 return e->
getLanes()[0]->getShape().rotationAtOffset(at);
103 const bool initial) :
107 myWaitingDuration(duration),
108 myWaitingUntil(until),
157 if (dynamic_cast<MSPerson*>(transportable) != 0) {
241 MSStoppingPlace* toStop,
const double arrivalPos,
const std::vector<std::string>& lines) :
243 myLines(lines.begin(), lines.end()),
305 return myLines.count(line) > 0;
402 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
426 (*myStep)->setDeparted(now);
451 return (*myStep)->getSpeed();
462 return (
int)
myPlan->size();
472 if (stepIndex + next > (
int)
myPlan->size()) {
475 myPlan->insert(
myPlan->begin() + stepIndex + next, stage);
483 assert(
myStep + next < myPlan->end());
496 (*myStep)->abort(
this);
504 for (MSTransportablePlan::const_iterator i =
myPlan->begin(); i !=
myPlan->end(); ++i) {
505 (*i)->setSpeed(speed);
536 const Position back = p +
Position(-cos(angle) * length, -sin(angle) * length);
537 centerLine.push_back(p);
538 centerLine.push_back(back);
void setArrived(SUMOTime now)
marks arrival time and records driven distance
void abortWaiting(MSTransportable *t)
aborts waiting stage of transportable
virtual void proceed(MSNet *net, MSTransportable *transportable, SUMOTime now, Stage *previous)
proceeds to the next step
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
virtual void setArrived(SUMOTime now)
logs end of the step
void abort(MSTransportable *)
abort this stage (TraCI)
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
std::string getWaitingDescription() const
Return where the person waits and for what.
std::string myActType
The type of activity.
double getAngle(SUMOTime now) const
returns the angle of the transportable
double getAngle() const
Returns the vehicle's direction in radians.
void append(const PositionVector &v, double sameThreshold=2.0)
const MSEdge * getEdge() const
Returns the current edge.
virtual const MSRoute & getRoute() const =0
Returns the current route.
A lane area vehicles can halt at.
void setSpeed(double speed)
sets the walking speed (ignored in other stages)
virtual double getEdgePos() const
Return the position on the edge.
PositionVector getBoundingBox() const
return the bounding box of the person
virtual bool isWaitingFor(const std::string &line) const
Whether the transportable waits for a vehicle of the line specified.
virtual const MSEdge * getEdge() const =0
Returns the current edge.
void abort(MSTransportable *)
abort this stage (TraCI)
const MSEdge * getEdge() const
Returns the current edge.
virtual void beginEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
std::string time2string(SUMOTime t)
void setWaitEnd(SUMOTime time, MSTransportable *transportable)
sets the arrival time for a waiting transportable
const MSEdge * getFromEdge() const
ConstMSEdgeVector getEdges() const
the edges of the current stage
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
Stage_Waiting(const MSEdge &destination, SUMOTime duration, SUMOTime until, double pos, const std::string &actType, const bool initial)
constructor
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const PositionVector & getShape() const
Returns this lane's shape.
const std::set< std::string > myLines
the lines to choose from
double getSpeed() const
the speed of the transportable
PositionVector reverse() const
reverse position vector
virtual void beginEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output.
std::vector< const MSEdge * > ConstMSEdgeVector
virtual bool proceed(MSNet *net, SUMOTime time)=0
const std::string & getID() const
Returns the id.
Position getLanePosition(const MSLane *lane, double at, double offset) const
get position on lane at length at with orthogonal offset
virtual double getSpeed() const
the current speed of the transportable
SUMOTime getUntil() const
MSTransportablePlan::iterator myStep
the iterator over the route
double getEdgePos(SUMOTime now) const
double getLength() const
return the length of the edge
const MSEdge * getFromEdge() const
int getNumRemainingStages() const
Return the number of remaining stages (including the current)
double getEdgePos(SUMOTime now) const
const MSEdge * getEdge() const
Returns the current edge.
std::string myVehicleLine
The simulated network and simulation perfomer.
The car-following model and parameter.
bool isVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
virtual MSTransportableControl & getContainerControl()
Returns the container control.
const SUMOVehicleParameter * myParameter
the plan of the transportable
void removeStage(int next)
removes the nth next stage
bool isWaiting4Vehicle() const
Whether the person waits for a vehicle.
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
A road/street connecting two junctions.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
virtual SUMOVehicleClass getVClass() const =0
Returns the vehicle's access class.
MSVehicleType * myVType
This transportable's type. (mainly used for drawing related information Note sure if it is really nec...
SUMOTime myArrived
the time at which this stage ended
double getSpeed() const
the speed of the transportable
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SUMOTime myDeparted
the time at which this stage started
void setDeparted(SUMOTime now)
logs depart time of the current stage
Representation of a vehicle.
MSStoppingPlace *const myDestinationStop
the stop to reach by getting transported (if any)
MSVehicleType * buildSingularType(const std::string &id) const
Duplicates the microsim vehicle type giving the newly created type the given id, marking it as vehicl...
virtual MSTransportableControl & getPersonControl()
Returns the person control.
ConstMSEdgeVector getEdges() const
the edges of the current stage
A point in 2D or 3D with translation and scaling methods.
SUMOTime getDesiredDepart() const
Returns the desired departure time.
Position getPosition(SUMOTime now) const
returns the position of the transportable
void setVehicle(SUMOVehicle *v)
virtual double getAngle() const
return the current angle of the transportable
virtual void addPerson(MSTransportable *p) const
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
void removeVType(const MSVehicleType *vehType)
virtual ~MSTransportable()
destructor
SUMOTime getWaitingTime(SUMOTime now) const
time spent waiting for a ride
SUMOTime depart
The vehicle's departure time.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
std::string myVehicleID
cached vehicle data for output after the vehicle has been removed
const std::string & getID() const
returns the id of the transportable
virtual ~Stage_Driving()
destructor
SUMOTime myWaitingUntil
the time until the person is waiting
SUMOVehicle * myVehicle
The taken vehicle.
SUMOVehicleClass myVehicleVClass
Position getPosition(SUMOTime now) const
returns the position of the transportable
virtual void endEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
Stage_Driving(const MSEdge &destination, MSStoppingPlace *toStop, const double arrivalPos, const std::vector< std::string > &lines)
constructor
bool lefthand() const
return whether the network was built for lefthand traffic
void move2side(double amount)
move position vector to side using certain ammount
std::string line
The vehicle's line (mainly for public transport)
Position getEdgePosition(const MSEdge *e, double at, double offset) const
get position on edge e at length at with orthogonal offset
virtual void endEventOutput(const MSTransportable &p, SUMOTime t, OutputDevice &os) const
Called for writing the events output (end of an action)
virtual void tripInfoOutput(OutputDevice &os, MSTransportable *transportable) const
Called on writing tripinfo output.
void appendStage(Stage *stage, int next=-1)
Appends the given stage to the current plan.
virtual double getDepartPos() const =0
Returns this vehicle's real departure position.
double getAngle(SUMOTime now) const
returns the angle of the transportable
StageType myType
The type of this stage.
Structure representing possible vehicle parameter.
MSTransportable(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportablePlan *plan)
constructor
virtual void addContainer(MSTransportable *container) const
Add a container to myContainers.
virtual Position getPosition() const
Return the Network coordinate of the transportable.
virtual double getPositionOnLane() const =0
Get the vehicle's position along the lane.
virtual const SUMOVehicleParameter & getParameter() const =0
Returns the vehicle's parameter (including departure definition)
virtual void routeOutput(OutputDevice &os) const
Called on writing vehroute output.
double interpolateLanePosToGeometryPos(double lanePos) const
const std::string & getID() const
Returns the name of the vehicle type.
static const double ROADSIDE_OFFSET
the offset for computing positions when standing at an edge
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
virtual Position getPosition(const double offset=0) const =0
Return current position (x/y, cartesian)
double getLength() const
Get vehicle's length [m].
SUMOTime getWaitingTime(SUMOTime now) const
the time this transportable spent waiting
const MSEdge & getDestination() const
returns the destination edge
double getEdgeAngle(const MSEdge *e, double at) const
get angle of the edge at a certain position
const MSVehicleType & getVehicleType() const
virtual double getWaitingSeconds() const
the time this transportable spent waiting in seconds
Static storage of an output device and its base (abstract) implementation.
void setDeparted(SUMOTime now)
logs end of the step
bool closeTag()
Closes the most recently opened tag.
MSTransportablePlan * myPlan
the plan of the transportable
virtual ~Stage_Waiting()
destructor
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
const MSEdge * myWaitingEdge
virtual ~Stage()
destructor
Stage(const MSEdge &destination, MSStoppingPlace *toStop, const double arrivalPos, StageType type)
constructor
virtual const ConstMSEdgeVector::const_iterator & getCurrentRouteEdge() const =0
Returns an iterator pointing to the current edge in this vehicles route.
bool isWaitingFor(const std::string &line) const
Whether the person waits for a vehicle of the line specified.
const MSEdge & myDestination
the next edge to reach by getting transported
virtual double getSpeed() const =0
Returns the vehicle's current speed.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
Representation of a lane in the micro simulation.
virtual const std::string & getID() const =0
Get the vehicle's ID.
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
SUMOTime myWaitingDuration
the time the person is waiting
int getNumStages() const
Return the total number stages in this persons plan.
std::string id
The vehicle's id.
static const Position INVALID
used to indicate that a position is valid
double myArrivalPos
the position at which we want to arrive