SUMO - Simulation of Urban MObility
SUMORTree Class Reference

#include <SUMORTree.h>

Inheritance diagram for SUMORTree:
RTree< GUIGlObject *, GUIGlObject, float, 2, GUIVisualizationSettings > Boundary AbstractPoly

Public Types

enum  
typedef void(GUIGlObject::* Operation )(const GUIVisualizationSettings &) const

Public Member Functions

void add (SUMOReal x, SUMOReal y)
 Makes the boundary include the given coordinate.
void add (const Position &p)
 Makes the boundary include the given coordinate.
void add (const Boundary &p)
 Makes the boundary include the given boundary.
void addAdditionalGLObject (GUIGlObject *o)
 Adds an additional object (detector/shape/trigger) for visualisation.
bool around (const Position &p, SUMOReal offset=0) const
 Returns whether the boundary contains the given coordinate.
int Count ()
 Count the data elements in this container. This is slow as no internal counter is maintained.
bool crosses (const Position &p1, const Position &p2) const
 Returns whether the boundary crosses the given line.
void flipY ()
 flips ymin and ymax
GUIGlObject *& GetAt (Iterator &a_it)
 Get object at iterator position.
Position getCenter () const
 Returns the center of the boundary.
void GetFirst (Iterator &a_it)
 Get 'first' for iteration.
SUMOReal getHeight () const
 Returns the height of the boundary.
void GetNext (Iterator &a_it)
 Get Next for iteration.
SUMOReal getWidth () const
 Returns the width of the boudary.
Boundarygrow (SUMOReal by)
 extends the boundary by the given amount
void growHeight (SUMOReal by)
void growWidth (SUMOReal by)
void Insert (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const GUIGlObject *&a_dataId)
bool IsNull (Iterator &a_it)
 Is iterator NULL, or at end?
void moveby (SUMOReal x, SUMOReal y)
 Moves the boundary by the given amount.
bool overlapsWith (const AbstractPoly &poly, SUMOReal offset=0) const
 Returns whether the boundary overlaps with the given polygon.
bool partialWithin (const AbstractPoly &poly, SUMOReal offset=0) const
 Returns whether the boundary is partially within the given polygon.
void Remove (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const GUIGlObject *&a_dataId)
void removeAdditionalGLObject (GUIGlObject *o)
 Removes an additional object (detector/shape/trigger) from being visualised.
void RemoveAll ()
 DK 15.10.2008 - end.
void reset ()
 Resets the boundary.
int Search (const floata_min[NUMDIMS], const floata_max[NUMDIMS], const GUIVisualizationSettings &c)
 DK 15.10.2008 - begin.
void set (SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax)
 Sets the boundary to the given values.
 SUMORTree ()
SUMOReal xmax () const
 Returns maximum x-coordinate.
SUMOReal xmin () const
 Returns minimum x-coordinate.
SUMOReal ymax () const
 Returns maximum y-coordinate.
SUMOReal ymin () const
 Returns minimum y-coordinate.
 ~SUMORTree ()

Protected 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)
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)
void GetBranches (Node *a_node, Branch *a_branch, PartitionVars *a_parVars)
void InitNode (Node *a_node)
void InitParVars (PartitionVars *a_parVars, int a_maxRects, int a_minFill)
void InitRect (Rect *a_rect)
bool InsertRect (Rect *a_rect, const GUIGlObject *&a_id, Node **a_root, int a_level)
bool InsertRectRec (Rect *a_rect, const GUIGlObject *&a_id, Node *a_node, Node **a_newNode, int a_level)
void LoadNodes (Node *a_nodeA, Node *a_nodeB, PartitionVars *a_parVars)
Rect NodeCover (Node *a_node)
bool Overlap (Rect *a_rectA, Rect *a_rectB)
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)
void RemoveAllRec (Node *a_node)
bool RemoveRect (Rect *a_rect, const GUIGlObject *&a_id, Node **a_root)
bool RemoveRectRec (Rect *a_rect, const GUIGlObject *&a_id, Node *a_node, ListNode **a_listNode)
void Reset ()
bool Search (Node *a_node, Rect *a_rect, int &a_foundCount, const GUIVisualizationSettings &c)
void SplitNode (Node *a_node, Branch *a_branch, Node **a_newNode)

Protected Attributes

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

Friends

std::ostream & operator<< (std::ostream &os, const Boundary &b)
 Output operator.

Detailed Description

Definition at line 54 of file SUMORTree.h.


Member Typedef Documentation

typedef void(GUIGlObject ::* RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::Operation)(const GUIVisualizationSettings &) 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

SUMORTree::SUMORTree ( ) [inline]

Definition at line 57 of file SUMORTree.h.

SUMORTree::~SUMORTree ( ) [inline]

Definition at line 61 of file SUMORTree.h.


Member Function Documentation

void Boundary::add ( const Position p) [inherited]

Makes the boundary include the given coordinate.

Definition at line 93 of file Boundary.cpp.

References Boundary::add(), Position::x(), and Position::y().

void Boundary::add ( const Boundary p) [inherited]

Makes the boundary include the given boundary.

Definition at line 99 of file Boundary.cpp.

References Boundary::add(), Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().

bool RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::AddBranch ( Branch *  a_branch,
Node *  a_node,
Node **  a_newNode 
) [protected, inherited]
ListNode* RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::AllocListNode ( ) [protected, inherited]
Node* RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::AllocNode ( ) [protected, inherited]
bool Boundary::around ( const Position p,
SUMOReal  offset = 0 
) const [virtual, inherited]

Returns whether the boundary contains the given coordinate.

Implements AbstractPoly.

Definition at line 148 of file Boundary.cpp.

References Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, Boundary::myYmin, Position::x(), and Position::y().

Referenced by NIVissimConnectionCluster::around(), PCPolyContainer::insert(), and NIVissimConnectionCluster::recheckEdges().

float RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::CalcRectVolume ( Rect *  a_rect) [protected, inherited]
void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::ChoosePartition ( PartitionVars *  a_parVars,
int  a_minFill 
) [protected, inherited]
void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::Classify ( int  a_index,
int  a_group,
PartitionVars *  a_parVars 
) [protected, inherited]
Rect RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::CombineRect ( Rect *  a_rectA,
Rect *  a_rectB 
) [protected, inherited]
int RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::Count ( ) [inherited]

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

void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::CountRec ( Node *  a_node,
int a_count 
) [protected, inherited]
bool Boundary::crosses ( const Position p1,
const Position p2 
) const [virtual, inherited]

Returns whether the boundary crosses the given line.

Implements AbstractPoly.

Definition at line 177 of file Boundary.cpp.

References GeomHelper::intersects(), Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.

void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::DisconnectBranch ( Node *  a_node,
int  a_index 
) [protected, inherited]
void Boundary::flipY ( ) [inherited]

flips ymin and ymax

Definition at line 222 of file Boundary.cpp.

References Boundary::myYmax, Boundary::myYmin, and SUMOReal.

void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::FreeListNode ( ListNode *  a_listNode) [protected, inherited]
void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::FreeNode ( Node *  a_node) [protected, inherited]
GUIGlObject * & RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::GetAt ( Iterator &  a_it) [inline, inherited]

Get object at iterator position.

Definition at line 263 of file RTree.h.

void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::GetBranches ( Node *  a_node,
Branch *  a_branch,
PartitionVars *  a_parVars 
) [protected, inherited]
void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::GetNext ( Iterator &  a_it) [inline, inherited]

Get Next for iteration.

Definition at line 257 of file RTree.h.

void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::InitNode ( Node *  a_node) [protected, inherited]
void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::InitParVars ( PartitionVars *  a_parVars,
int  a_maxRects,
int  a_minFill 
) [protected, inherited]
void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::InitRect ( Rect *  a_rect) [protected, inherited]
void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::Insert ( const float  a_min[NUMDIMS],
const float  a_max[NUMDIMS],
const GUIGlObject * &  a_dataId 
) [inherited]

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.

Referenced by addAdditionalGLObject().

bool RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::InsertRect ( Rect *  a_rect,
const GUIGlObject * &  a_id,
Node **  a_root,
int  a_level 
) [protected, inherited]
bool RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::InsertRectRec ( Rect *  a_rect,
const GUIGlObject * &  a_id,
Node *  a_node,
Node **  a_newNode,
int  a_level 
) [protected, inherited]
bool RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::IsNull ( Iterator &  a_it) [inline, inherited]

Is iterator NULL, or at end?

Definition at line 260 of file RTree.h.

void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::LoadNodes ( Node *  a_nodeA,
Node *  a_nodeB,
PartitionVars *  a_parVars 
) [protected, inherited]
void Boundary::moveby ( SUMOReal  x,
SUMOReal  y 
) [inherited]
Rect RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::NodeCover ( Node *  a_node) [protected, inherited]
bool RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::Overlap ( Rect *  a_rectA,
Rect *  a_rectB 
) [protected, inherited]
bool Boundary::partialWithin ( const AbstractPoly poly,
SUMOReal  offset = 0 
) const [virtual, inherited]

Returns whether the boundary is partially within the given polygon.

Implements AbstractPoly.

Definition at line 190 of file Boundary.cpp.

References AbstractPoly::around(), Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.

Referenced by PCPolyContainer::insert(), and Boundary::overlapsWith().

int RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::PickBranch ( Rect *  a_rect,
Node *  a_node 
) [protected, inherited]
void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::PickSeeds ( PartitionVars *  a_parVars) [protected, inherited]
float RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::RectSphericalVolume ( Rect *  a_rect) [protected, inherited]
float RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::RectVolume ( Rect *  a_rect) [protected, inherited]
void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::ReInsert ( Node *  a_node,
ListNode **  a_listNode 
) [protected, inherited]
void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::Remove ( const float  a_min[NUMDIMS],
const float  a_max[NUMDIMS],
const GUIGlObject * &  a_dataId 
) [inherited]

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.

Referenced by removeAdditionalGLObject().

void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::RemoveAll ( ) [inherited]

DK 15.10.2008 - end.

Remove all entries from tree

void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::RemoveAllRec ( Node *  a_node) [protected, inherited]
bool RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::RemoveRect ( Rect *  a_rect,
const GUIGlObject * &  a_id,
Node **  a_root 
) [protected, inherited]
bool RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::RemoveRectRec ( Rect *  a_rect,
const GUIGlObject * &  a_id,
Node *  a_node,
ListNode **  a_listNode 
) [protected, inherited]
void Boundary::reset ( ) [inherited]

Resets the boundary.

Definition at line 66 of file Boundary.cpp.

References Boundary::myWasInitialised, Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, and Boundary::myYmin.

void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::Reset ( ) [protected, inherited]
int RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::Search ( const float  a_min[NUMDIMS],
const float  a_max[NUMDIMS],
const GUIVisualizationSettings c 
) [inherited]

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
bool RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::Search ( Node *  a_node,
Rect *  a_rect,
int a_foundCount,
const GUIVisualizationSettings c 
) [protected, inherited]
void Boundary::set ( SUMOReal  xmin,
SUMOReal  ymin,
SUMOReal  xmax,
SUMOReal  ymax 
) [inherited]

Sets the boundary to the given values.

Definition at line 240 of file Boundary.cpp.

References Boundary::myXmax, Boundary::myXmin, Boundary::myYmax, Boundary::myYmin, Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().

void RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::SplitNode ( Node *  a_node,
Branch *  a_branch,
Node **  a_newNode 
) [protected, inherited]

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Boundary b 
) [friend, inherited]

Output operator.

Definition at line 233 of file Boundary.cpp.


Field Documentation

Node* RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::m_root [protected, inherited]

Root of tree.

Definition at line 359 of file RTree.h.

float RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::m_unitSphereVolume [protected, inherited]

Unit sphere constant for required number of dimensions.

Definition at line 360 of file RTree.h.

Operation RTree< GUIGlObject * , GUIGlObject , float , NUMDIMS, GUIVisualizationSettings , float , 8 , 8 / 2 >::myOperation [protected, inherited]

Definition at line 361 of file RTree.h.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines