OverSim
groupRoaming Class Reference

groupRoaming class More...

#include <groupRoaming.h>

Inheritance diagram for groupRoaming:
MovementGenerator

Public Member Functions

 groupRoaming (double areaDimension, double speed, NeighborMap *Neighbors, GlobalCoordinator *coordinator, CollisionList *CollisionRect, int groupSize)
virtual ~groupRoaming ()
virtual void move ()
 Defined in subclasses only.
- Public Member Functions inherited from MovementGenerator
 MovementGenerator (double areaDimension, double speed, NeighborMap *Neighbors, GlobalCoordinator *coordinator, CollisionList *CollisionRect)
 Initialize the generator with the movement area dimensions and node movement speed.
virtual ~MovementGenerator ()
Vector2D getPosition ()
 Get the nodes current position.

Protected Attributes

int groupNr
- Protected Attributes inherited from MovementGenerator
double areaDimension
double speed
Vector2D direction
Vector2D position
Vector2D target
NeighborMapNeighbors
NeighborMap::iterator itNeighbors
GlobalCoordinatorcoordinator
CollisionListCollisionRect

Additional Inherited Members

- Protected Member Functions inherited from MovementGenerator
bool testBounds ()
 Prevents the node from leaving the defined area and checks for obstacle hits.
void flock ()
 Simple flocking algorithm.
void generateScenery (unsigned int seed)
 Generates scenery objects.

Detailed Description

groupRoaming class

Simulates nodes roaming the area in groups.

Definition at line 34 of file groupRoaming.h.

Constructor & Destructor Documentation

groupRoaming::groupRoaming ( double  areaDimension,
double  speed,
NeighborMap Neighbors,
GlobalCoordinator coordinator,
CollisionList CollisionRect,
int  groupSize 
)

Definition at line 26 of file groupRoaming.cc.

{
groupNr = coordinator->getPeerCount() / groupSize;
if((coordinator->getPeerCount() % groupSize) == 0) {
target.x = uniform(0.0, areaDimension);
target.y = uniform(0.0, areaDimension);
coordinator->increasePositionSize();
coordinator->setPosition(groupNr, target);
}
else {
target = coordinator->getPosition(groupNr);
}
coordinator->increasePeerCount();
}
virtual groupRoaming::~groupRoaming ( )
inlinevirtual

Definition at line 38 of file groupRoaming.h.

{}

Member Function Documentation

void groupRoaming::move ( )
virtual

Defined in subclasses only.

Implements MovementGenerator.

Definition at line 45 of file groupRoaming.cc.

Member Data Documentation

int groupRoaming::groupNr
protected

Definition at line 42 of file groupRoaming.h.

Referenced by groupRoaming(), and move().


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