Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ORCATypeAgentContext< Agent > Class Template Reference

Context class for displaying various aspects of the ORCA-type agent computation. More...

#include <ORCATypeAgentContext.h>

Inheritance diagram for ORCATypeAgentContext< Agent >:
Menge::BaseAgentContext Menge::SceneGraph::SelectContext Menge::SceneGraph::Context

Public Member Functions

 ORCATypeAgentContext (Menge::VisAgent **agents, unsigned int agtCount)
 Construtor. More...
 
virtual std::string contextName () const
 Returns the name of the context for display. More...
 
virtual
Menge::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.
 
template<>
std::string contextName () const
 Returns the name of the context for display. More...
 
template<>
std::string contextName () const
 Returns the name of the context for display. More...
 
- Public Member Functions inherited from Menge::BaseAgentContext
 BaseAgentContext (VisAgent **agents, size_t agtCount, BFSM::FsmContext *fsmCtx=0x0)
 Construtor. More...
 
virtual ~BaseAgentContext ()
 Virtual destructor.
 
void setFSMContext (BFSM::FsmContext *ctx)
 Sets the fsm context. More...
 
virtual void drawGL (int vWidth, int vHeight)
 The draw function for the context. More...
 
virtual bool selectGL (const SceneGraph::GLScene *scene, const SceneGraph::GLCamera &camera, int vWidth, int vHeight, int *selectPoint)
 Performs selection based on a click on screen space. Uses the OpenGL selection mechanism. More...
 
virtual void activate ()
 Called when the context is activated.
 
- Public Member Functions inherited from Menge::SceneGraph::Context
 Context ()
 Constructor.
 
virtual ~Context ()
 Virtual destructor.
 
virtual ContextResult handleMouse (SDL_Event &e)
 Give the context the opportunity to respond to a mouse event. More...
 
virtual void newGLContext ()
 Callback for when the OpenGL context is changed.
 
virtual void deactivate ()
 Called when the context is deactivated.
 

Protected Member Functions

virtual void draw3DGL (bool select=false)
 Draw context elements into the 3D world. More...
 
void drawHalfPlane (const Menge::Math::Line &line, const Vector2 &pos, float r, float g, float b, float Y) const
 Helper function for drawing a halfplane. More...
 
void drawORCALine (const Agent *agent, const Menge::Math::Line &line, bool isAgent) const
 Draws the given ORCA line for the given agent. More...
 
void drawOptVelocity (Agent *agent) const
 Draw the optimized velocity for the current set of orca lines. More...
 
virtual std::string agentText (const Menge::Agents::BaseAgent *agent) const
 Creates a formatted string to be printed in the context for a particular agent. More...
 
void drawORCALines (const Agent *agt) const
 Function for drawing the ORCA lines acting on agt. More...
 
void visORCA (const Agent *agt) const
 The function that draws the visualization of the orca construction. More...
 
template<>
void drawOptVelocity (PedVO::Agent *agent) const
 
template<>
void drawORCALine (const PedVO::Agent *agent, const Menge::Math::Line &line, bool isAgent) const
 
- Protected Member Functions inherited from Menge::BaseAgentContext
virtual void drawUIGL (int vWidth, int vHeight, bool select=false)
 Draw UI elements into the context. More...
 
void drawNbrRadius (const Agents::BaseAgent *agt)
 Function for drawing neighbor radius.
 
void drawNeighbors (const Agents::BaseAgent *agt)
 Function for drawing neighbor distances.
 
void drawMaxSpeed (const Agents::BaseAgent *agt)
 Function for drawing neighbor distances.
 
void drawVelocity (const Agents::BaseAgent *agt)
 Function for drawing current velocity.
 
void drawPrefVelocity (const Agents::BaseAgent *agt)
 Function for drawing the preferred velocity.
 
void drawOrientation (const Agents::BaseAgent *agt)
 Function for drawing current orientation.
 
void beginIDTyping ()
 Begins the agent typing state.
 
void finishIDTyping ()
 Finish agent typing state.
 
void cancelIDTyping ()
 Cancels the agent typing state.
 
void drawIDTyping ()
 Draws the id typing state.
 
void addIDDigit (const char digit)
 Adds a digit to the typed value.
 
- Protected Member Functions inherited from Menge::SceneGraph::Context
void uiSetup (int vWidth, int vHeight)
 UI setup - handles the configuration of the opengl context for orthographic rendering. More...
 
void uiShutdown ()
 Cleans up the OpenGL state after having drawn the UI elements of the context.
 
void getOpenGLView ()
 Updates the various view matrices: modelview, projection, and view.
 
void writeText (const std::string &txt, const Vector2 &pos, bool currColor=false) const
 Writes the given text at the given location. More...
 
void writeText (const std::string &txt, const Vector3 &pos, bool currColor=false) const
 Writes the given text at the given 3D location. More...
 
void writeTextRadially (const std::string &txt, const Vector2 &pos, const Vector2 &dir, bool currColor=false) const
 Writes the given text at the given location, but anchored based on the radial direction given. More...
 
void writeAlignedText (const std::string &txt, const Vector2 &pos, TextWriter::Alignment align, bool currColor=false) const
 Writes the given text aligned to the given location. More...
 
void writeToScreen (const std::string &txt, TextWriter::Alignment align, int fontSize, float hPad=0.f, float vPad=0.f, bool currColor=false, bool trans=true) const
 Writes the given text to the screen based on the given alignment. More...
 

Protected Attributes

bool _showOrcaLines
 Determines if the ORCA lines are drawn.
 
bool _visualizeORCA
 Determines if the ORCA line construction is visualized.
 
size_t _visNbrID
 The agent to visualize.
 
- Protected Attributes inherited from Menge::BaseAgentContext
VisAgent_selected
 The currently selected visualization agent.
 
BACState _state
 The state of the context.
 
bool _showNbrRadius
 Determines if the neighbor distance is rendered.
 
bool _showNbr
 Determines if the neighbors are indicated in the view.
 
bool _showMaxSpd
 Determines if the circle of maximum speed is displayed.
 
bool _showVel
 Determines if the current velocity is displayed.
 
bool _showPrefVel
 Determines if the preferred velocity is displayed.
 
bool _showOrient
 Determines if the orientation of the agent is displayed.
 
VisAgent ** _visAgents
 A pointer to the agents in the scene.
 
size_t _agtCount
 The number of agents in the scene.
 
char _digits [MAX_TYPE_DIGITS+1]
 The character array for typing numbers into.
 
unsigned int _digitCount
 Number of typed digits.
 
BFSM::FsmContext_fsmCtx
 An optional finite state machine context to visualize the computation of agent behavior.
 
- Protected Attributes inherited from Menge::SceneGraph::Context
double _modViewMat [16]
 The current model view matrix.
 
double _projMat [16]
 The current projection matrix.
 
int _viewMat [4]
 The current viewport parameters.
 

Additional Inherited Members

- Public Types inherited from Menge::BaseAgentContext
enum  BACState { DEFAULT_ST, TYPE_AGENT_ID_ST }
 Definition of the state of the context. More...
 
- Static Protected Attributes inherited from Menge::BaseAgentContext
static const float Y = 0.01f
 The drawing depth for the 3D elements.
 
static const unsigned int MAX_TYPE_DIGITS = 10
 The maximum number of digits for typing.
 

Detailed Description

template<class Agent>
class ORCATypeAgentContext< Agent >

Context class for displaying various aspects of the ORCA-type agent computation.

Constructor & Destructor Documentation

template<class Agent >
ORCATypeAgentContext< Agent >::ORCATypeAgentContext ( Menge::VisAgent **  agents,
unsigned int  agtCount 
)

Construtor.

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

Member Function Documentation

template<class Agent >
std::string ORCATypeAgentContext< Agent >::agentText ( const Menge::Agents::BaseAgent agent) const
protectedvirtual

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

Parameters
agentA pointer to the agent for which the information is displayed.
Returns
A formatted string for display in the context's 2D gui.

Reimplemented from Menge::BaseAgentContext.

template<>
std::string ORCATypeAgentContext< ORCA::Agent >::contextName ( ) const
inlinevirtual

Returns the name of the context for display.

Returns
The name of this context.

Reimplemented from Menge::BaseAgentContext.

template<>
std::string ORCATypeAgentContext< PedVO::Agent >::contextName ( ) const
virtual

Returns the name of the context for display.

Returns
The name of this context.

Reimplemented from Menge::BaseAgentContext.

template<class Agent >
virtual std::string ORCATypeAgentContext< Agent >::contextName ( ) const
inlinevirtual

Returns the name of the context for display.

Returns
The name of this context.

Reimplemented from Menge::BaseAgentContext.

template<class Agent >
void ORCATypeAgentContext< Agent >::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.

template<class Agent >
void ORCATypeAgentContext< Agent >::drawHalfPlane ( const Menge::Math::Line line,
const Vector2 pos,
float  r,
float  g,
float  b,
float  Y 
) const
protected

Helper function for drawing a halfplane.

Parameters
lineThe line object which defines the half plane
posThe relative position to draw the plane Typically the position of the agent on which the half-plane is applied.
rThe red component of the half plane color
gThe green component of the half plane color
bThe blue component of the half plane color
YValue, on the y-axis (in world coordinates), of the plane on which to draw the half plane
template<>
void ORCATypeAgentContext< PedVO::Agent >::drawOptVelocity ( PedVO::Agent agent) const
inlineprotected
Parameters
agentA pointer to the agent for which the velocity is drawn computeNewVelocity will be called on the agent
template<class Agent >
void ORCATypeAgentContext< Agent >::drawOptVelocity ( Agent *  agent) const
protected

Draw the optimized velocity for the current set of orca lines.

Parameters
agentA pointer to the agent for which the velocity is drawn computeNewVelocity will be called on the agent
template<>
void ORCATypeAgentContext< PedVO::Agent >::drawORCALine ( const PedVO::Agent agent,
const Menge::Math::Line line,
bool  isAgent 
) const
protected
Parameters
agentA pointer to the agent to whom this line applies
lineThe actual line
isAgentA boolean reporting if the orca line comes from an agent. true –> agent, false –> obstacle
template<class Agent >
void ORCATypeAgentContext< Agent >::drawORCALine ( const Agent *  agent,
const Menge::Math::Line line,
bool  isAgent 
) const
protected

Draws the given ORCA line for the given agent.

Parameters
agentA pointer to the agent to whom this line applies
lineThe actual line
isAgentA boolean reporting if the orca line comes from an agent. true –> agent, false –> obstacle
template<class Agent >
void ORCATypeAgentContext< Agent >::drawORCALines ( const Agent *  agt) const
protected

Function for drawing the ORCA lines acting on agt.

Parameters
agtA pointer to the agent whose ORCA lines will be drawn.
template<class Agent >
Menge::SceneGraph::ContextResult ORCATypeAgentContext< Agent >::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.

template<class Agent >
void ORCATypeAgentContext< Agent >::visORCA ( const Agent *  agt) const
protected

The function that draws the visualization of the orca construction.

Parameters
agtA pointer to the agent for whom the computation of a single ORCA line is illustrated.

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