CSWMap Class Reference

Inheritance diagram for CSWMap:

Inheritance graph
[legend]
List of all members.

Public Types

enum  DangerLevel {
  UNKNOWN = 0, NONE = 1, LOW = 2,
  MEDIUM = 4, HIGH = 8
}

Public Member Functions

unsigned long insertElement (const Vector3D &vecPosition, unsigned long nLevel, unsigned long nBitMask=0xffffffff)
unsigned long insertElement (const CSWMapElement &element, unsigned long nBitMask=0xffffffff)
bool isEmpty () const
void clear ()
CSWMapElement findElementByID (unsigned long nID)
CSWMapElement findNearestElement (const Vector3D &vecPosition, double fRadius, unsigned long nLevel, unsigned long nNotLevel=0)
std::vector< CSWMapElementfindElements (const Vector3D &vecPosition, double fRadius, unsigned long nLevel, unsigned long nNotLevel=0)
int removeElements (unsigned long nLevel, unsigned long nNotLevel=0)
int removeElements (const Vector3D &vecPosition, double fRadius, unsigned long nLevel, unsigned long nNotLevel=0)

Detailed Description

This class encapsulates functionality of a dynamic map. This is the central for object management e.g. gives base information for routing decisions. Object positions from object detectors were reported to the map. Positions with regarding information can also be stored or manipulated manually. Once a position is inserted it will exist for 20 seconds if no redetection is done. This completely works in world coordinate system.


Member Enumeration Documentation

enum CSWMap::DangerLevel

The level of danger of objects in the map.

Enumerator:
UNKNOWN  Unknown level (object was not identified).
NONE  No danger (object that was identified as friend).
LOW  Low level (object that was identified as harmless like stupid rocks).
MEDIUM  Medium level (object identified as submarine).
HIGH  High level (object identified as weapon).


Member Function Documentation

unsigned long CSWMap::insertElement ( const Vector3D &  vecPosition,
unsigned long  nLevel,
unsigned long  nBitMask = 0xffffffff 
)

Inserts an element with the given position and danger level to the map. That means an element is inserted or replacing an existing near element.

Parameters:
vecPosition The position of the element in world coordinate system that should be inserted.
nLevel The danger level regarding to the element.
nBitMask The bitmask that is ANDed to the found elements level before ORing the given new nLevel.
foundElement.nLevel' = (foundElement.nLevel & nBitMask) | nLevel
Returns:
The id of the inserted element. If 0 is returned the insertion failed.

unsigned long CSWMap::insertElement ( const CSWMapElement element,
unsigned long  nBitMask = 0xffffffff 
)

Inserts an element to the map. That means an element is inserted or replacing an existing near element. The set velocity of the given element is ignored.

Parameters:
element The element that should be inserted.
nBitMask The bitmask that is ANDed to the found elements level before ORing the given new nLevel.
foundElement.nLevel' = (foundElement.nLevel & nBitMask) | element.nLevel
Returns:
The id of the inserted element. If 0 is returned the insertion failed.

bool CSWMap::isEmpty (  )  const

Returns true if the map contains nothing.

Returns:
Returns true if the map contains nothing.

void CSWMap::clear (  ) 

Clears the map.

Postcondition:
isEmpty() is true.

CSWMapElement CSWMap::findElementByID ( unsigned long  nID  ) 

Finds the element in the map which has the given id.

Parameters:
nID The id of the element which should be found.
Returns:
Returns the found element. If nothing was found the returned element is invalid.

CSWMapElement CSWMap::findNearestElement ( const Vector3D &  vecPosition,
double  fRadius,
unsigned long  nLevel,
unsigned long  nNotLevel = 0 
)

Finds the nearest element in the map that is in radius to the given position and with the given danger level.

Parameters:
vecPosition The position to which the nearest element should be found.
fRadius The radius around the given position that should be checked.
nLevel The danger level that must full fill the found element.
nNotLevel The danger level that must not full fill the found element.
Returns:
Returns the found element. If nothing was found the returned element is invalid.

std::vector< CSWMapElement > CSWMap::findElements ( const Vector3D &  vecPosition,
double  fRadius,
unsigned long  nLevel,
unsigned long  nNotLevel = 0 
)

Finds the elements in the map that are in radius to the given position and with the given danger level.

Parameters:
vecPosition The position to which the elements should be found.
fRadius The radius around the given position that should be checked.
nLevel The danger level that must full fill the found elements.
nNotLevel The danger level that must not full fill the found element.
Returns:
Returns the found elements. If nothing was found the container is empty.

int CSWMap::removeElements ( unsigned long  nLevel,
unsigned long  nNotLevel = 0 
)

Removes elements in the map with the given danger level.

Parameters:
nLevel The danger level that must full fill the deleted elements.
nNotLevel The danger level that must not full fill the deleted element.
Returns:
Returns the number of deleted elements.

int CSWMap::removeElements ( const Vector3D &  vecPosition,
double  fRadius,
unsigned long  nLevel,
unsigned long  nNotLevel = 0 
)

Removes elements in the map that are in radius to the given position and with the given danger level.

Parameters:
vecPosition The position to which the elements should be deleted.
fRadius The radius around the given position that should be checked.
nLevel The danger level that must full fill the deleted elements.
nNotLevel The danger level that must not full fill the deleted element.
Returns:
Returns the number of deleted elements.


Generated at 2 Jan 2007 for project CodeSubWars. www.codesubwars.org