SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NamedRTree Class Reference

A RT-tree for efficient storing of SUMO's Named objects. More...

#include <NamedRTree.h>

Inheritance diagram for NamedRTree:
RTree< Named *, Named, float, 2, Named::StoringVisitor >

Public Member Functions

void Insert (const float a_min[2], const float a_max[2], Named *a_data)
 Insert entry. More...
 
 NamedRTree ()
 Constructor. More...
 
void Remove (const float a_min[2], const float a_max[2], Named *a_data)
 Remove entry. More...
 
void RemoveAll ()
 Remove all enrties. More...
 
int Search (const float a_min[2], const float a_max[2], const Named::StoringVisitor &c) const
 Find all within search rectangle. More...
 
 ~NamedRTree ()
 Destructor. More...
 

Private Types

enum  
 
typedef void(Named::* Operation )(const Named::StoringVisitor &) const
 

Private Member Functions

bool AddBranch (Branch *a_branch, Node *a_node, Node **a_newNode)
 
ListNode * AllocListNode ()
 
Node * AllocNode ()
 
float CalcRectVolume (Rect *a_rect)
 
void ChoosePartition (PartitionVars *a_parVars, int a_minFill)
 
void Classify (int a_index, int a_group, PartitionVars *a_parVars)
 
Rect CombineRect (Rect *a_rectA, Rect *a_rectB)
 
int Count ()
 Count the data elements in this container. This is slow as no internal counter is maintained. More...
 
void CountRec (Node *a_node, int &a_count)
 
void DisconnectBranch (Node *a_node, int a_index)
 
void FreeListNode (ListNode *a_listNode)
 
void FreeNode (Node *a_node)
 
Named *& GetAt (Iterator &a_it)
 Get object at iterator position. More...
 
void GetBranches (Node *a_node, Branch *a_branch, PartitionVars *a_parVars)
 
void GetFirst (Iterator &a_it)
 Get 'first' for iteration. More...
 
void GetNext (Iterator &a_it)
 Get Next for iteration. More...
 
void InitNode (Node *a_node)
 
void InitParVars (PartitionVars *a_parVars, int a_maxRects, int a_minFill)
 
void InitRect (Rect *a_rect)
 
virtual void Insert (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const Named *&a_dataId)
 
bool InsertRect (Rect *a_rect, const Named *&a_id, Node **a_root, int a_level)
 
bool InsertRectRec (Rect *a_rect, const Named *&a_id, Node *a_node, Node **a_newNode, int a_level)
 
bool IsNull (Iterator &a_it)
 Is iterator NULL, or at end? More...
 
void LoadNodes (Node *a_nodeA, Node *a_nodeB, PartitionVars *a_parVars)
 
Rect NodeCover (Node *a_node)
 
bool Overlap (Rect *a_rectA, Rect *a_rectB) const
 
int PickBranch (Rect *a_rect, Node *a_node)
 
void PickSeeds (PartitionVars *a_parVars)
 
float RectSphericalVolume (Rect *a_rect)
 
float RectVolume (Rect *a_rect)
 
void ReInsert (Node *a_node, ListNode **a_listNode)
 
virtual void Remove (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const Named *&a_dataId)
 
void RemoveAllRec (Node *a_node)
 
bool RemoveRect (Rect *a_rect, const Named *&a_id, Node **a_root)
 
bool RemoveRectRec (Rect *a_rect, const Named *&a_id, Node *a_node, ListNode **a_listNode)
 
void Reset ()
 
virtual int Search (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const Named::StoringVisitor &c) const
 DK 15.10.2008 - begin. More...
 
bool Search (Node *a_node, Rect *a_rect, int &a_foundCount, const Named::StoringVisitor &c) const
 
void SplitNode (Node *a_node, Branch *a_branch, Node **a_newNode)
 

Private Attributes

Node * m_root
 Root of tree. More...
 
float m_unitSphereVolume
 Unit sphere constant for required number of dimensions. More...
 
Operation myOperation
 

Detailed Description

A RT-tree for efficient storing of SUMO's Named objects.

This class specialises the used RT-tree implementation from "rttree.h". It stores names of "Named"-objects.

See Also
Named

Definition at line 60 of file NamedRTree.h.

Member Typedef Documentation

typedef void(Named ::* RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::Operation)(const Named::StoringVisitor &) const
inherited

Definition at line 79 of file RTree.h.

Member Enumeration Documentation

anonymous enum
inherited

Definition at line 71 of file RTree.h.

Constructor & Destructor Documentation

NamedRTree::NamedRTree ( )
inline

Constructor.

Definition at line 63 of file NamedRTree.h.

NamedRTree::~NamedRTree ( )
inline

Destructor.

Definition at line 69 of file NamedRTree.h.

Member Function Documentation

bool RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::AddBranch ( Branch *  a_branch,
Node *  a_node,
Node **  a_newNode 
)
protectedinherited
ListNode* RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::AllocListNode ( )
protectedinherited
Node* RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::AllocNode ( )
protectedinherited
float RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::CalcRectVolume ( Rect *  a_rect)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::ChoosePartition ( PartitionVars *  a_parVars,
int  a_minFill 
)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::Classify ( int  a_index,
int  a_group,
PartitionVars *  a_parVars 
)
protectedinherited
Rect RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::CombineRect ( Rect *  a_rectA,
Rect *  a_rectB 
)
protectedinherited
int RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::Count ( )
inherited

Count the data elements in this container. This is slow as no internal counter is maintained.

void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::CountRec ( Node *  a_node,
int a_count 
)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::DisconnectBranch ( Node *  a_node,
int  a_index 
)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::FreeListNode ( ListNode *  a_listNode)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::FreeNode ( Node *  a_node)
protectedinherited
Named * & RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::GetAt ( Iterator &  a_it)
inlineinherited

Get object at iterator position.

Definition at line 263 of file RTree.h.

void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::GetBranches ( Node *  a_node,
Branch *  a_branch,
PartitionVars *  a_parVars 
)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::GetFirst ( Iterator &  a_it)
inlineinherited

Get 'first' for iteration.

Definition at line 246 of file RTree.h.

void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::GetNext ( Iterator &  a_it)
inlineinherited

Get Next for iteration.

Definition at line 257 of file RTree.h.

void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::InitNode ( Node *  a_node)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::InitParVars ( PartitionVars *  a_parVars,
int  a_maxRects,
int  a_minFill 
)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::InitRect ( Rect *  a_rect)
protectedinherited
void NamedRTree::Insert ( const float  a_min[2],
const float  a_max[2],
Named a_data 
)
inline

Insert entry.

Parameters
a_minMin of bounding rect
a_maxMax of bounding rect
a_dataThe instance of a Named-object to add (the ID is added)
See Also
RTree::Insert

Definition at line 79 of file NamedRTree.h.

References RTree< DATATYPE, DATATYPENP, ELEMTYPE, NUMDIMS, CONTEXT, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Insert().

Referenced by MSDevice_BTreceiver::BTreceiverUpdate::execute(), TraCIServerAPI_InductionLoop::getTree(), TraCIServerAPI_Junction::getTree(), TraCIServerAPI_POI::getTree(), and TraCIServerAPI_Polygon::getTree().

virtual void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::Insert ( const float  a_min[NUMDIMS],
const float  a_max[NUMDIMS],
const Named * &  a_dataId 
)
virtualinherited

Insert entry

Parameters
a_minMin of bounding rect
a_maxMax of bounding rect
a_dataIdPositive Id of data. Maybe zero, but negative numbers not allowed.
bool RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::InsertRect ( Rect *  a_rect,
const Named * &  a_id,
Node **  a_root,
int  a_level 
)
protectedinherited
bool RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::InsertRectRec ( Rect *  a_rect,
const Named * &  a_id,
Node *  a_node,
Node **  a_newNode,
int  a_level 
)
protectedinherited
bool RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::IsNull ( Iterator &  a_it)
inlineinherited

Is iterator NULL, or at end?

Definition at line 260 of file RTree.h.

void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::LoadNodes ( Node *  a_nodeA,
Node *  a_nodeB,
PartitionVars *  a_parVars 
)
protectedinherited
Rect RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::NodeCover ( Node *  a_node)
protectedinherited
bool RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::Overlap ( Rect *  a_rectA,
Rect *  a_rectB 
) const
protectedinherited
int RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::PickBranch ( Rect *  a_rect,
Node *  a_node 
)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::PickSeeds ( PartitionVars *  a_parVars)
protectedinherited
float RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::RectSphericalVolume ( Rect *  a_rect)
protectedinherited
float RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::RectVolume ( Rect *  a_rect)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::ReInsert ( Node *  a_node,
ListNode **  a_listNode 
)
protectedinherited
void NamedRTree::Remove ( const float  a_min[2],
const float  a_max[2],
Named a_data 
)
inline

Remove entry.

Parameters
a_minMin of bounding rect
a_maxMax of bounding rect
a_dataThe instance of a Named-object to remove
See Also
RTree::Remove

Definition at line 90 of file NamedRTree.h.

References RTree< DATATYPE, DATATYPENP, ELEMTYPE, NUMDIMS, CONTEXT, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Remove().

virtual void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::Remove ( const float  a_min[NUMDIMS],
const float  a_max[NUMDIMS],
const Named * &  a_dataId 
)
virtualinherited

Remove entry

Parameters
a_minMin of bounding rect
a_maxMax of bounding rect
a_dataIdPositive Id of data. Maybe zero, but negative numbers not allowed.
void NamedRTree::RemoveAll ( )
inline
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::RemoveAllRec ( Node *  a_node)
protectedinherited
bool RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::RemoveRect ( Rect *  a_rect,
const Named * &  a_id,
Node **  a_root 
)
protectedinherited
bool RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::RemoveRectRec ( Rect *  a_rect,
const Named * &  a_id,
Node *  a_node,
ListNode **  a_listNode 
)
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::Reset ( )
protectedinherited
virtual int RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::Search ( const float  a_min[NUMDIMS],
const float  a_max[NUMDIMS],
const Named::StoringVisitor c 
) const
virtualinherited

DK 15.10.2008 - begin.

Find all within search rectangle

Parameters
a_minMin of search bounding rect
a_maxMax of search bounding rect
a_searchResultSearch result array. Caller should set grow size. Function will reset, not append to array.
a_resultCallbackCallback function to return result. Callback should return 'true' to continue searching
a_contextUser context to pass as parameter to a_resultCallback
Returns
Returns the number of entries found
int NamedRTree::Search ( const float  a_min[2],
const float  a_max[2],
const Named::StoringVisitor c 
) const
inline

Find all within search rectangle.

Parameters
a_minMin of search bounding rect
a_maxMax of search bounding rect
a_searchResultSearch result array. Caller should set grow size. Function will reset, not append to array.
a_resultCallbackCallback function to return result. Callback should return 'true' to continue searching
a_contextUser context to pass as parameter to a_resultCallback
Returns
Returns the number of entries found
See Also
RTree::Search

Definition at line 112 of file NamedRTree.h.

References RTree< DATATYPE, DATATYPENP, ELEMTYPE, NUMDIMS, CONTEXT, ELEMTYPEREAL, TMAXNODES, TMINNODES >::Search().

Referenced by MSDevice_BTreceiver::BTreceiverUpdate::execute().

bool RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::Search ( Node *  a_node,
Rect *  a_rect,
int a_foundCount,
const Named::StoringVisitor c 
) const
protectedinherited
void RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::SplitNode ( Node *  a_node,
Branch *  a_branch,
Node **  a_newNode 
)
protectedinherited

Field Documentation

Node* RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::m_root
protectedinherited

Root of tree.

Definition at line 359 of file RTree.h.

float RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::m_unitSphereVolume
protectedinherited

Unit sphere constant for required number of dimensions.

Definition at line 360 of file RTree.h.

Operation RTree< Named * , Named , float , NUMDIMS, Named::StoringVisitor , float , 8 , 8 / 2 >::myOperation
protectedinherited

Definition at line 361 of file RTree.h.


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