Menge
Modular Pedestrian Simulation Framework for Research and Development
|
The base class for modifying preferred velocities. More...
#include <VelModifier.h>
Public Member Functions | |
VelModifier () | |
Default constructor. | |
virtual void | adaptPrefVelocity (const Agents::BaseAgent *agent, Agents::PrefVelocity &pVel)=0 |
Modifies the input preferred velocity in place. More... | |
virtual void | registerAgent (const Agents::BaseAgent *agent) |
Registers an agent for use with the VelModifier. More... | |
virtual void | unregisterAgent (const Agents::BaseAgent *agent) |
Unregisters a registed agent. More... | |
void | onEnter (const Agents::BaseAgent *agent) |
Called when an agent enters the state with this velocity modifier. More... | |
void | onLeave (const Agents::BaseAgent *agent) |
Called when an agent exits the state with this velocity modifier. More... | |
virtual VelModifier * | copy () const =0 |
Creates a copy of this velocity modifier. More... | |
virtual VelModContext * | getContext () |
Provides a display context for interacting with this velocity modifier. More... | |
Public Member Functions inherited from Menge::Element | |
void | destroy () |
This supplants the destructor. More... | |
virtual BFSM::Task * | getTask () |
Return an optional task associated with this element. More... | |
virtual SceneGraph::GLNode * | getSGNode () |
Returns an optional visualization element associated with the element. More... | |
Protected Member Functions | |
virtual | ~VelModifier () |
Virtual destructor. | |
Friends | |
class | ElementFactory< VelModifier > |
The base class for modifying preferred velocities.
Each velocity modifier is allowed to change the input preferred velocity without limit based on arbitrary criteria. They have an order, which defines which order in which they are executed. Modifiers are chained so that the input of each modifier is the output of the previous, making order very important.
|
pure virtual |
Modifies the input preferred velocity in place.
The main function of the velocity modifier. Applies its own algorithms to the input preferred velocity, transforming it into a new transform, in place. All VelModifier sub-classes must implement this function.
agent | The agent for which a preferred velocity is adapted. |
pVel | The instance of Agents::PrefVelocity to set. |
Implemented in Menge::BFSM::ScaleVelModifier.
|
pure virtual |
Creates a copy of this velocity modifier.
Implemented in Menge::BFSM::ScaleVelModifier.
|
virtual |
Provides a display context for interacting with this velocity modifier.
It is the responsibility of the caller to delete the provided context.
Reimplemented in Menge::BFSM::ScaleVelModifier.
void Menge::BFSM::VelModifier::onEnter | ( | const Agents::BaseAgent * | agent | ) |
Called when an agent enters the state with this velocity modifier.
This function calls registerAgent. Entering a state which has one or more velocity modifiers assigned to it, causes the velocity modifiers to be temporarily assigned to the agent.
agent | The agent entering the state |
void Menge::BFSM::VelModifier::onLeave | ( | const Agents::BaseAgent * | agent | ) |
Called when an agent exits the state with this velocity modifier.
The dual of onEnter. This function calls unregisterAgent. Agents departing a state with one or more velocity modifiers will be unregistered.
agent | The agent entering the state |
|
inlinevirtual |
Registers an agent for use with the VelModifier.
When a velocity modifier is assigned to the agent, the agent is "registered" to it. If the velocity modifier needs to maintain per-agent data, this is the time to instantiate that data. Default implementation does nothing.
agent | The agent to be registered |
|
inlinevirtual |
Unregisters a registed agent.
If an velocity modifier is removed from an agent, this allows the velocity modifier to destroy any agent-specific data. Default implementation does nothing.
agent | The agent to be unregistered |