Menge Plugin Examples
A Collection of Example Plugins for the Menge Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Helbing::AgentContext Class Reference

The context for displaying the computational aspects of the Zanlungo model (see Agents::Helbing::Agent). More...

#include <HelbingAgentContext.h>

Inheritance diagram for Helbing::AgentContext:
Menge::BaseAgentContext Menge::SceneGraph::SelectContext Menge::SceneGraph::Context

Public Member Functions

 AgentContext (VisAgent **agents, unsigned int agtCount)
 Constructor. More...
 
virtual std::string contextName () const
 Returns the name of the context for display. More...
 
virtual SceneGraph::ContextResult handleKeyboard (SDL_Event &e)
 Give the context the opportunity to respond to a keyboard event. More...
 
virtual void update ()
 Allow the context to update any time-dependent state it might have to the given global time.
 
- Public Member Functions inherited from Menge::SceneGraph::SelectContext
virtual bool selectGL (const GLScene *scene, const GLCamera &camera, int vWidth, int vHeight, int *selectPoint)
 

Protected Member Functions

virtual void draw3DGL (bool select=false)
 Draw context elements into the 3D world. More...
 
virtual std::string agentText (const Agents::BaseAgent *agent) const
 Creates a formatted string to be printed in the context for a particular agent. More...
 
void drawForce (const Agent *agt)
 Function for drawing the force vectors acting on agt. More...
 
void singleAgentForce (const Agent *agt, const Agent *other, float thresh=0.5f)
 Draw the force vector from srcAgent acting on agt. More...
 
void singleObstacleForce (const Agent *agt, const Agents::Obstacle *obst, float thresh=0.5f)
 Draw the force vector from an obstacle acting on agt. More...
 
void drawForce (const Agent *agt, const Vector2 &force, const std::string &label)
 Draws the given force on the given agent It assumes the force color has already been set. More...
 
- Protected Member Functions inherited from Menge::BaseAgentContext
virtual std::string agentText (const Agents::BaseAgent *agent) const
 

Protected Attributes

bool _showForce
 Determines if the force vectors are drawn.
 
int _forceObject
 The id of the forceObject to display. If zero, all agents, if positive, a single agent if negative, an obstacle.
 

Detailed Description

The context for displaying the computational aspects of the Zanlungo model (see Agents::Helbing::Agent).

Constructor & Destructor Documentation

Helbing::AgentContext::AgentContext ( VisAgent **  agents,
unsigned int  agtCount 
)

Constructor.

Parameters
agentsAn array of pointers to VisAgent instances for Helbing agents.
agtCountThe number of agents contained in the array.

Member Function Documentation

std::string Helbing::AgentContext::agentText ( const Agents::BaseAgent *  agent) const
protectedvirtual

Creates a formatted string to be printed in the context for a particular agent.

Parameters
agentThe agent whose data is to be displayed.
Returns
A formatted string for display in the context's 2D gui.
virtual std::string Helbing::AgentContext::contextName ( ) const
inlinevirtual

Returns the name of the context for display.

Returns
The name of this context.

Reimplemented from Menge::BaseAgentContext.

void Helbing::AgentContext::draw3DGL ( bool  select = false)
protectedvirtual

Draw context elements into the 3D world.

Parameters
selectDefines if the drawing is being done for selection purposes (true) or visualization (false).

Reimplemented from Menge::BaseAgentContext.

void Helbing::AgentContext::drawForce ( const Agent agt)
protected

Function for drawing the force vectors acting on agt.

Parameters
agtThe agent whose forces are displayed.
void Helbing::AgentContext::drawForce ( const Agent agt,
const Vector2 &  force,
const std::string &  label 
)
protected

Draws the given force on the given agent It assumes the force color has already been set.

Parameters
agtA pointer to the agent on which the force is acting
forceThe force vector to draw
labelThe label to apply to the force.
SceneGraph::ContextResult Helbing::AgentContext::handleKeyboard ( SDL_Event e)
virtual

Give the context the opportunity to respond to a keyboard event.

Parameters
eThe SDL event with the keyboard event data.
Returns
A ContextResult instance reporting if the event was handled and if redrawing is necessary.

Reimplemented from Menge::BaseAgentContext.

void Helbing::AgentContext::singleAgentForce ( const Agent agt,
const Agent other,
float  thresh = 0.5f 
)
protected

Draw the force vector from srcAgent acting on agt.

Parameters
agtThe agent on which the force is acting
otherThe agent imparting the force
threshThe minimum force magnitude required to draw
void Helbing::AgentContext::singleObstacleForce ( const Agent agt,
const Agents::Obstacle *  obst,
float  thresh = 0.5f 
)
protected

Draw the force vector from an obstacle acting on agt.

Parameters
agtThe agent on which the force is acting
obstThe obstacle imparting the force
threshThe minimum force magnitude required to draw

The documentation for this class was generated from the following files: