#include <CSWMap.h>
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< CSWMapElement > | findElements (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) |
Public Member Functions inherited from CodeSubWars::CSWEquipment | |
bool | isMoving () const |
Public Member Functions inherited from CodeSubWars::CSWObject | |
const std::string & | getName () const |
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.
The level of danger of objects in the map.
void CodeSubWars::CSWMap::clear | ( | ) |
Clears the map.
CSWMapElement CodeSubWars::CSWMap::findElementByID | ( | unsigned long | nID | ) |
Finds the element in the map which has the given id.
nID | The id of the element which should be found. |
std::vector< CSWMapElement > CodeSubWars::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.
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. |
CSWMapElement CodeSubWars::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.
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. |
unsigned long CodeSubWars::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.
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 |
unsigned long CodeSubWars::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.
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 |
bool CodeSubWars::CSWMap::isEmpty | ( | ) | const |
Returns true if the map contains nothing.
int CodeSubWars::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.
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. |
int CodeSubWars::CSWMap::removeElements | ( | unsigned long | nLevel, |
unsigned long | nNotLevel = 0 |
||
) |
Removes elements in the map with the given danger level.
nLevel | The danger level that must full fill the deleted elements. |
nNotLevel | The danger level that must not full fill the deleted element. |