Menge
Modular Pedestrian Simulation Framework for Research and Development
|
Context class for displaying various aspects of the ORCA-type agent computation. More...
#include <ORCATypeAgentContext.h>
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. | |
Context class for displaying various aspects of the ORCA-type agent computation.
ORCATypeAgentContext< Agent >::ORCATypeAgentContext | ( | Menge::VisAgent ** | agents, |
unsigned int | agtCount | ||
) |
Construtor.
agents | An array of pointers to VisAgent instances. |
agtCount | The number of agents contained in the array. |
|
protectedvirtual |
Creates a formatted string to be printed in the context for a particular agent.
agent | A pointer to the agent for which the information is displayed. |
Reimplemented from Menge::BaseAgentContext.
|
inlinevirtual |
Returns the name of the context for display.
Reimplemented from Menge::BaseAgentContext.
|
virtual |
Returns the name of the context for display.
Reimplemented from Menge::BaseAgentContext.
|
inlinevirtual |
Returns the name of the context for display.
Reimplemented from Menge::BaseAgentContext.
|
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::BaseAgentContext.
|
protected |
Helper function for drawing a halfplane.
line | The line object which defines the half plane |
pos | The relative position to draw the plane Typically the position of the agent on which the half-plane is applied. |
r | The red component of the half plane color |
g | The green component of the half plane color |
b | The blue component of the half plane color |
Y | Value, on the y-axis (in world coordinates), of the plane on which to draw the half plane |
|
inlineprotected |
agent | A pointer to the agent for which the velocity is drawn computeNewVelocity will be called on the agent |
|
protected |
Draw the optimized velocity for the current set of orca lines.
agent | A pointer to the agent for which the velocity is drawn computeNewVelocity will be called on the agent |
|
protected |
agent | A pointer to the agent to whom this line applies |
line | The actual line |
isAgent | A boolean reporting if the orca line comes from an agent. true –> agent, false –> obstacle |
|
protected |
Draws the given ORCA line for the given agent.
agent | A pointer to the agent to whom this line applies |
line | The actual line |
isAgent | A boolean reporting if the orca line comes from an agent. true –> agent, false –> obstacle |
|
protected |
|
virtual |
Give the context the opportunity to respond to a keyboard event.
e | The SDL event with the keyboard event data. |
Reimplemented from Menge::BaseAgentContext.
|
protected |
The function that draws the visualization of the orca construction.
agt | A pointer to the agent for whom the computation of a single ORCA line is illustrated. |