Menge
Modular Pedestrian Simulation Framework for Research and Development
|
Context class for displaying various characteristics of the Agents::BaseAgent class. More...
#include <BaseAgentContext.h>
Public Types | |
enum | BACState { DEFAULT_ST, TYPE_AGENT_ID_ST } |
Definition of the state of the context. More... | |
Public Member Functions | |
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 SceneGraph::ContextResult | handleKeyboard (SDL_Event &e) |
Give the context the opportunity to respond to a keyboard event. 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 | update () |
Allow the context to update any time-dependent state it might have to the given global time. | |
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 | drawUIGL (int vWidth, int vHeight, bool select=false) |
Draw UI elements into the context. More... | |
virtual void | draw3DGL (bool select=false) |
Draw context elements into the 3D world. More... | |
virtual std::string | contextName () const |
Returns the name of the context for display. 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 | 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 | |
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. | |
Static Protected Attributes | |
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. | |
Context class for displaying various characteristics of the Agents::BaseAgent class.
Menge::BaseAgentContext::BaseAgentContext | ( | VisAgent ** | agents, |
size_t | agtCount, | ||
BFSM::FsmContext * | fsmCtx = 0x0 |
||
) |
|
protectedvirtual |
Creates a formatted string to be printed in the context for a particular agent.
agent | The agent whose data is to be displayed. |
Reimplemented in ORCATypeAgentContext< Agent >.
|
inlineprotectedvirtual |
Returns the name of the context for display.
Reimplemented in ORCATypeAgentContext< Agent >, ORCATypeAgentContext< Agent >, and ORCATypeAgentContext< Agent >.
|
protectedvirtual |
Draw context elements into the 3D world.
select | Defines if the drawing is being done for selection purposes (true) or visualization (false). |
Reimplemented from Menge::SceneGraph::Context.
Reimplemented in ORCATypeAgentContext< Agent >.
|
virtual |
The draw function for the context.
vWidth | The width of the viewport (in pixels). |
vHeight | The height of the viewport (in pixels). |
Reimplemented from Menge::SceneGraph::Context.
|
protectedvirtual |
Draw UI elements into the context.
vWidth | The width of the viewport (in pixels). |
vHeight | The height of the viewport (in pixels). |
select | Defines if the drawing is being done for selection purposes (true) or visualization (false). |
Reimplemented from Menge::SceneGraph::Context.
|
virtual |
Give the context the opportunity to respond to a keyboard event.
e | The SDL event with the keyboard event data. |
Reimplemented from Menge::SceneGraph::Context.
Reimplemented in ORCATypeAgentContext< Agent >.
|
virtual |
Performs selection based on a click on screen space. Uses the OpenGL selection mechanism.
scene | The scene to select in. |
camera | The camera. |
vWidth | The width of the viewport. |
vHeight | The height of the viewport. |
selectPoint | The point (in screen space) at which object selection should take place. |
Reimplemented from Menge::SceneGraph::SelectContext.
|
inline |
Sets the fsm context.
ctx | The context for the finite state machine. |