48 myNumActivePedestrians(0) {
85 dynamic_cast<PState*
>(state)->getCommand()->abortWalk();
120 myLastEntryTime = currentTime;
124 if (prev ==
nullptr) {
131 if (next ==
nullptr) {
145 if ((myCurrentDuration %
DELTA_T) > 0) {
148 return myCurrentDuration;
155 return myCurrentBeginPos + (myCurrentEndPos - myCurrentBeginPos) / (
double)myCurrentDuration * (double)(now - myLastEntryTime);
160 if (myCurrentBeginPos == myCurrentEndPos) {
170 const MSLane* lane = getSidewalk<MSEdge, MSLane>(stage.
getEdge());
171 if (lane ==
nullptr) {
188 double angle = stage.
getEdgeAngle(stage.
getEdge(), getEdgePos(now)) + (myCurrentEndPos < myCurrentBeginPos ?
M_PI : 0);
198 return stage.
getMaxSpeed(myCommand->getTransportable());
210 out <<
" " << myLastEntryTime <<
" " << myCurrentDuration;
223 const double dist = myCurrentBeginPosition.
distanceTo2D(myCurrentEndPosition);
231 double angle = stage.
getEdgeAngle(stage.
getEdge(), getEdgePos(now)) + (myCurrentEndPos < myCurrentBeginPos ? 1.5 *
M_PI : 0.5 *
M_PI);
241 myLastEntryTime = currentTime;
247 myCurrentBeginPosition = stage.
getLanePosition(fromLane, myCurrentBeginPos, LATERAL_OFFSET);
248 const MSLane* toLane = stage.
getEdges().back()->getLanes().front();
249 myCurrentEndPosition = stage.
getLanePosition(toLane, myCurrentEndPos, LATERAL_OFFSET);
252 return myCurrentDuration;
@ SVC_PEDESTRIAN
pedestrian
#define UNUSED_PARAMETER(x)
A road/street connecting two junctions.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
const MSJunction * getToJunction() const
double getLength() const
return the length of the edge
const MSJunction * getFromJunction() const
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static bool gLefthand
Whether lefthand-drive is being simulated.
Representation of a lane in the micro simulation.
bool allowsVehicleClass(SUMOVehicleClass vclass) const
The simulated network and simulation perfomer.
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
Position getPosition(const MSStageMoving &stage, SUMOTime now) const
return the network coordinate of the container
double getAngle(const MSStageMoving &stage, SUMOTime now) const
return the direction in which the container heading to
SUMOTime computeDuration(const MSEdge *prev, const MSStageMoving &stage, SUMOTime currentTime)
compute tranship time on edge and update state members
static const double LATERAL_OFFSET
the offset for computing container positions when being transhiped
CState(MoveToNextEdge *cmd, std::istringstream *in=nullptr)
MSTransportable * myTransportable
MSPModel_NonInteracting * myModel
SUMOTime execute(SUMOTime currentTime)
Executes the command.
implementation of callbacks to retrieve various state information from the model
SUMOTime getEventTime() const
const MSEdge * getNextEdge(const MSStageMoving &stage) const
return the list of internal edges if the transportable is on an intersection
int getDirection() const
return the walking direction (FORWARD, BACKWARD, UNDEFINED_DIRECTION)
SUMOTime myCurrentDuration
double getEdgePos(SUMOTime now) const
abstract methods inherited from PedestrianState
virtual double getAngle(const MSStageMoving &stage, SUMOTime now) const
return the direction in which the transportable faces in degrees
double getSpeed(const MSStageMoving &stage) const
return the current speed of the transportable
virtual Position getPosition(const MSStageMoving &stage, SUMOTime now) const
return the network coordinate of the transportable
virtual SUMOTime computeDuration(const MSEdge *prev, const MSStageMoving &stage, SUMOTime currentTime)
compute walking time on edge and update state members
PState(MoveToNextEdge *cmd, std::istringstream *in=nullptr)
void saveState(std::ostringstream &out)
Saves the current state into the given stream.
MSTransportableStateAdapter * add(MSTransportable *transportable, MSStageMoving *stage, SUMOTime now)
register the given transportable
MSPModel_NonInteracting(const OptionsCont &oc, MSNet *net)
Constructor (it should not be necessary to construct more than one instance)
void remove(MSTransportableStateAdapter *state)
remove the specified person from the pedestrian simulation
~MSPModel_NonInteracting()
void clearState()
Resets pedestrians when quick-loading state.
MSTransportableStateAdapter * loadState(MSTransportable *transportable, MSStageMoving *stage, std::istringstream &in)
load the state of the given transportable
int myNumActivePedestrians
the total number of active pedestrians
MSNet * myNet
the net to which to issue moveToNextEdge commands
static const int BACKWARD
static const double SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk
static const int UNDEFINED_DIRECTION
virtual double getArrivalPos() const
Position getLanePosition(const MSLane *lane, double at, double offset) const
get position on lane at length at with orthogonal offset
double getEdgeAngle(const MSEdge *e, double at) const
get angle of the edge at a certain position
virtual const MSEdge * getNextRouteEdge() const =0
virtual void activateEntryReminders(MSTransportable *person, const bool isDepart=false)
add the move reminders for the current lane on entry
ConstMSEdgeVector getEdges() const
the edges of the current stage
const MSEdge * getEdge() const
Returns the current edge.
MSTransportableStateAdapter * getPState() const
double getDepartPos() const
const MSEdge * getFromEdge() const
Returns first edge of the containers route.
virtual bool moveToNextEdge(MSTransportable *transportable, SUMOTime currentTime, int prevDir, MSEdge *nextInternal=nullptr, const bool isReplay=false)=0
move forward and return whether the transportable arrived
virtual double getMaxSpeed(const MSTransportable *const transportable=nullptr) const =0
the maximum speed of the transportable
bool isPerson() const
Whether it is a person.
abstract base class for managing callbacks to retrieve various state information from the model
virtual int getDirection() const =0
return the walking direction (FORWARD, BACKWARD, UNDEFINED_DIRECTION)
A storage for options typed value containers)
A point in 2D or 3D with translation and scaling methods.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.