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
Zanlungo::AgentContext Class Reference

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

#include <ZanlungoAgentContext.h>

Inheritance diagram for Zanlungo::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...
 
- Public Member Functions inherited from Menge::BaseAgentContext
virtual void update ()
 
- 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 drawTTI (const Agent *agt)
 Function for illustrating time to interaction computation. 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 TTI)
 Draw the force vector from srcAgent acting on agt. More...
 
void drawOrientationFan (const Agent *agt)
 Draws the orientation of the agent. More...
 
- Protected Member Functions inherited from Menge::BaseAgentContext
virtual std::string agentText (const Agents::BaseAgent *agent) const
 

Protected Attributes

bool _showTTI
 Determines whether the time to interaction is displayed.
 
int _ttiObject
 The id of the time to interaction structure shown. If zero, all agents, if positive, a single agent if negative, an obstacle.
 
bool _showForce
 Determines if the force vectors are drawn.
 

Detailed Description

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

Constructor & Destructor Documentation

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

Constructor.

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

Member Function Documentation

std::string Zanlungo::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 Zanlungo::AgentContext::contextName ( ) const
inlinevirtual

Returns the name of the context for display.

Returns
The name of this context.

Reimplemented from Menge::BaseAgentContext.

void Zanlungo::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 Zanlungo::AgentContext::drawForce ( const Agent agt)
protected

Function for drawing the force vectors acting on agt.

Parameters
agtThe agent whose forces are displayed.
void Zanlungo::AgentContext::drawOrientationFan ( const Agent agt)
protected

Draws the orientation of the agent.

Parameters
agtThe agent whose orientation displayed.
void Zanlungo::AgentContext::drawTTI ( const Agent agt)
protected

Function for illustrating time to interaction computation.

Parameters
agtThe agent whose time to interaction is displayed.
SceneGraph::ContextResult Zanlungo::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 Zanlungo::AgentContext::singleAgentForce ( const Agent agt,
const Agent other,
float  TTI 
)
protected

Draw the force vector from srcAgent acting on agt.

Parameters
agtThe agent on which the force is acting
otherThe agent imparting the force
TTITime to interaction

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