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
Menge::VisAgent Class Reference

The basic agent visualization class: a selectable cylinder. More...

#include <VisAgent.h>

Inheritance diagram for Menge::VisAgent:
Menge::SceneGraph::GLNode Menge::SceneGraph::Selectable

Public Member Functions

 VisAgent (Agents::BaseAgent *agent)
 Constructor. More...
 
virtual void drawGL (bool select=false)
 Draw the agent into the 3D world. More...
 
Agents::BaseAgentgetAgent ()
 Returns a Agents::BaseAgent pointer of the associated simulation agent. More...
 
void setPosition (float x, float y, float z)
 Set the 3D position of the visual agent. More...
 
- Public Member Functions inherited from Menge::SceneGraph::GLNode
 GLNode (GLDagNode *parent=0x0)
 Constructor. More...
 
virtual ~GLNode ()
 Virtual destructor.
 
void setVisible (bool state)
 Sets the visible state of the node. More...
 
virtual void newContext ()
 Allows the node to recreate any unique OpenGL objects based on the acquisition of a new OpenGL context. More...
 
GLDagNodegetParent ()
 Returns a pointer to the node's parent (possibly NULL). More...
 
- Public Member Functions inherited from Menge::SceneGraph::Selectable
 Selectable ()
 Constructor.
 
void loadSelectName () const
 Performs the OpenGL task to make this object selectable.
 
unsigned int getID () const
 Returns this object's globally unique selection id. More...
 
virtual void dummy ()
 A dummy function that makes Selectable polymorphic. It enables the use of dynamic_cast. Otherwise, it is a no-op.
 

Protected Member Functions

void getColor (float &r, float &g, float &b)
 Defines the color of the cylinder. More...
 
- Protected Member Functions inherited from Menge::SceneGraph::GLNode
void setParent (GLDagNode *p)
 Assigns this node to a parent GLDagNode. More...
 

Protected Attributes

Agents::BaseAgent_agent
 The logical agent being visualized.
 
Vector3 _pos
 The position in R3 of the logical agent.
 
- Protected Attributes inherited from Menge::SceneGraph::GLNode
GLDagNode_parent
 The GLDagNode that serves as this node's parent.
 
bool _visible
 The visibility state of this node. If visible (true) the node and its children will be drawn into the scene, if invisible (false) it will not be drawn.
 
- Protected Attributes inherited from Menge::SceneGraph::Selectable
unsigned int _id
 Globally unique OpenGL name for selection.
 
bool _selected
 Reports if this node is selcted. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Menge::SceneGraph::Selectable
static SelectablegetSelectedObject ()
 Retrives a pointer to the currently selected node. More...
 
static unsigned int getSelectedName ()
 Returns the "name" of the currently selected object. More...
 
static void clearSelectedObject ()
 Clears the current selection.
 
static void setSelectedObject (Selectable *obj)
 Forces an arbitrary selectable to be selected. More...
 
static void selectStart ()
 The selection set up. More...
 
static bool selectEnd ()
 The selection take down. More...
 
static unsigned int nextSelectName ()
 Reports the next available selection name.
 

Detailed Description

The basic agent visualization class: a selectable cylinder.

This is the basic visualization of simulation agents in the visualization context. The agents are drawn as 3D cylinders by default. This class can be sub-classed adn the drawGL method can be overridden to provide a different visualization mechanism.

Constructor & Destructor Documentation

Menge::VisAgent::VisAgent ( Agents::BaseAgent agent)

Constructor.

Parameters
agentThe agent to be visualized.

Member Function Documentation

void Menge::VisAgent::drawGL ( bool  select = false)
virtual

Draw the agent into the 3D world.

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

Implements Menge::SceneGraph::GLNode.

Agents::BaseAgent* Menge::VisAgent::getAgent ( )
inline

Returns a Agents::BaseAgent pointer of the associated simulation agent.

Returns
A pointer to the visualization agent's simulation agent.
void Menge::VisAgent::getColor ( float &  r,
float &  g,
float &  b 
)
protected

Defines the color of the cylinder.

The color is computed and returned via the three floats passed in as parameters.

Parameters
rThe red component of the cylinder.
gThe green component of the cylinder.
bThe blue component of the cylinder.
void Menge::VisAgent::setPosition ( float  x,
float  y,
float  z 
)
inline

Set the 3D position of the visual agent.

Parameters
xThe x-position of the agent (in world coordinates).
yThe y-position of the agent (in world coordinates).
zThe z-position of the agent (in world coordinates).

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