Direction Class Reference

A class representing a direction in a road. More...

#include <Direction.h>

Collaboration diagram for Direction:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void setOutputDetector (Detector *OutputDet)
 Sets the direction's output detector.
DetectorgetOutputDetector ()
 Gets the direction's output detector.
LanegetLane (int i)
 Gets a specific lane.
int getNoLanes ()
 Gets the number of lanes.
M2D getVehiclesM2D ()
 Gets all the vehicles on the road.
M2D getGlobalPos ()
 Updates all the vehicle positions to take account of direction.
void createLanes (int length, int nLanes, std::vector< Detector * > detectors)
 Creates all the lanes running in a particular direction.
void init (bool DirPos, Detector *OutDet, bool AllowLaneChange)
 Initialises the direction.
 Direction ()
 Default constructor.
virtual ~Direction ()
 Default destructor.
bool update (double step)
 Handles the updating of all the lanes in the direction.

Private Attributes

bool m_AllowLaneChanging
double flow
double len
bool m_DirPos
int m_NoLanes
std::vector< Lanem_vLanes
Detectorm_OutputDetector


Detailed Description

A class representing a direction in a road.

Constructor & Destructor Documentation

Direction::Direction (  ) 

Default constructor.

Direction::~Direction (  )  [virtual]

Default destructor.


Member Function Documentation

void Direction::setOutputDetector ( Detector OutputDet  ) 

Sets the direction's output detector.

Parameters:
OutputDet The direction's output detector

Detector * Direction::getOutputDetector (  ) 

Gets the direction's output detector.

Returns:
The direction's output detector

Lane & Direction::getLane ( int  i  ) 

Gets a specific lane.

Parameters:
i The lane to choose
Returns:
The chosen lane

int Direction::getNoLanes (  ) 

Gets the number of lanes.

Returns:
The number of lanes

M2D Direction::getVehiclesM2D (  ) 

Gets all the vehicles on the road.

Returns:
All the vehicles on the road

M2D Direction::getGlobalPos (  ) 

Updates all the vehicle positions to take account of direction.

Returns:
All adjusted vehicle positions
This function updates the position that a vehicle should have on screen

void Direction::createLanes ( int  RoadLength,
int  nLanes,
std::vector< Detector * >  detectors 
)

Creates all the lanes running in a particular direction.

Parameters:
RoadLength The length of the road
nLanes The number of lanes
detectors The detectors in the direction
This function handles the creating of lanes that are running in a certain direction and sets up the links between a lane and its two adjacent lanes

void Direction::init ( bool  DirPos,
Detector OutDet,
bool  AllowLaneChange 
)

Initialises the direction.

Parameters:
DirPos Whether or not the direction is in a positive direction
OutDet The direction's output detector
AllowLaneChange Whether or not lane changing is allowed

bool Direction::update ( double  step  ) 

Handles the updating of all the lanes in the direction.

Parameters:
step The timestep
Returns:
Whether or not the direction is empty
This function updates all the lanes that are running in a particular direction


Member Data Documentation

double Direction::flow [private]

double Direction::len [private]

bool Direction::m_DirPos [private]

int Direction::m_NoLanes [private]

std::vector<Lane> Direction::m_vLanes [private]


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

Generated on Fri Jul 25 16:11:16 2008 for EvolveTraffic by  doxygen 1.5.6