Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Arak::Grid< ItemType >::Cell Class Reference

#include <grid.hpp>

Collaboration diagram for Arak::Grid< ItemType >::Cell:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class ItemType>
class Arak::Grid< ItemType >::Cell

A cell is a rectangular subregion of the window.

The window is partitioned into a grid of cells. Each cell includes its bottom and left boundaries, and cells against the top and/or right boundaries of the region also include these edges. In this way each point in the region is assigned to exactly one grid cell.

Definition at line 30 of file grid.hpp.

Public Types

typedef std::list< ItemType > ItemList
 A list of the items associated with this cell.


Public Member Functions

 Cell (const Geometry::Rectangle &r, int row, int col)
 Constructor.

Entry add (const ItemType &e)
 Adds an item to this cell's list of items.

const ItemListgetItemList () const
 Returns a const reference to this cell's list of items.

ItemListgetItemList ()
 Returns a mutable reference to this cell's list of items.

int row () const
 Returns the row index of this cell.

int col () const
 Returns the column index of this cell.

bool operator== (const Cell &other) const
 Equality operations.

bool operator!= (const Cell &other) const
Geometry::Point center () const
 Returns the point at the center of this cell.


Protected Types

typedef ItemList::iterator ItemIterator
 An iterator for an interior edge list.


Protected Attributes

int r
 The row index of this cell.

int c
 The column index of this cell.

ItemList items
 A list of items associated with this cell.

ItemList unused
 A list of unused items.

Cellup
 A pointer to the cell that is immediately above this cell.

Celldown
 A pointer to the cell that is immediately below this cell.

Cellright
 A pointer to the cell that is immediately to the right of this cell.

Cellleft
 A pointer to the cell that is immediately to the left of this cell.


Friends

class Grid
class Grid::LineCellIterator
class Grid::ConstLineCellIterator
class Grid::RectangleCellIterator
class Grid::ConstRectangleCellIterator
class Grid::TriangleCellIterator
class Grid::ConstTriangleCellIterator
class Grid::ConvexPolygonCellIterator
class Grid::ConstConvexPolygonCellIterator


Member Typedef Documentation

template<class ItemType>
typedef ItemList::iterator Arak::Grid< ItemType >::Cell::ItemIterator [protected]
 

An iterator for an interior edge list.

Definition at line 54 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::Cell::add(), and Arak::Grid< ItemType >::Cell::Entry::Entry().

template<class ItemType>
typedef std::list<ItemType> Arak::Grid< ItemType >::Cell::ItemList
 

A list of the items associated with this cell.

Definition at line 47 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::Cell::getItemList().


Constructor & Destructor Documentation

template<class ItemType>
Arak::Grid< ItemType >::Cell::Cell const Geometry::Rectangle r,
int  row,
int  col
[inline]
 

Constructor.

Parameters:
r the boundary of the cell
row the row index of the cell
col the column index of the cell

Definition at line 164 of file grid.hpp.

References Arak::Grid< ItemType >::Cell::down, Arak::Grid< ItemType >::Cell::items, Arak::Grid< ItemType >::Cell::left, Arak::Geometry::Rectangle, and Arak::Grid< ItemType >::Cell::right.


Member Function Documentation

template<class ItemType>
Entry Arak::Grid< ItemType >::Cell::add const ItemType &  e  )  [inline]
 

Adds an item to this cell's list of items.

The entry in which the item is stored is returned.

Parameters:
e the item to be inserted
Returns:
the entry in which the item was inserted

Definition at line 175 of file grid.hpp.

References Arak::Grid< ItemType >::Cell::ItemIterator, and Arak::Grid< ItemType >::Cell::items.

template<class ItemType>
Geometry::Point Arak::Grid< ItemType >::Cell::center  )  const [inline]
 

Returns the point at the center of this cell.

Definition at line 221 of file grid.hpp.

References Arak::Geometry::Point.

template<class ItemType>
int Arak::Grid< ItemType >::Cell::col  )  const [inline]
 

Returns the column index of this cell.

Definition at line 210 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::ConvexPolygonCellIteratorBase< GridType, CellType >::ConvexPolygonCellIteratorBase(), and Arak::Grid< ItemType >::TriangleCellIteratorBase< GridType, CellType >::TriangleCellIteratorBase().

template<class ItemType>
ItemList& Arak::Grid< ItemType >::Cell::getItemList  )  [inline]
 

Returns a mutable reference to this cell's list of items.

Definition at line 198 of file grid.hpp.

References Arak::Grid< ItemType >::Cell::ItemList, and Arak::Grid< ItemType >::Cell::items.

template<class ItemType>
const ItemList& Arak::Grid< ItemType >::Cell::getItemList  )  const [inline]
 

Returns a const reference to this cell's list of items.

Definition at line 191 of file grid.hpp.

References Arak::Grid< ItemType >::Cell::ItemList, and Arak::Grid< ItemType >::Cell::items.

template<class ItemType>
bool Arak::Grid< ItemType >::Cell::operator!= const Cell other  )  const [inline]
 

Definition at line 216 of file grid.hpp.

template<class ItemType>
bool Arak::Grid< ItemType >::Cell::operator== const Cell other  )  const [inline]
 

Equality operations.

Definition at line 215 of file grid.hpp.

template<class ItemType>
int Arak::Grid< ItemType >::Cell::row  )  const [inline]
 

Returns the row index of this cell.

Definition at line 205 of file grid.hpp.

References Arak::Grid< ItemType >::Cell::r.

Referenced by Arak::Grid< ItemType >::ConvexPolygonCellIteratorBase< GridType, CellType >::ConvexPolygonCellIteratorBase(), and Arak::Grid< ItemType >::TriangleCellIteratorBase< GridType, CellType >::TriangleCellIteratorBase().


Friends And Related Function Documentation

template<class ItemType>
friend class Grid [friend]
 

Definition at line 32 of file grid.hpp.

template<class ItemType>
friend class Grid::ConstConvexPolygonCellIterator [friend]
 

Definition at line 40 of file grid.hpp.

template<class ItemType>
friend class Grid::ConstLineCellIterator [friend]
 

Definition at line 34 of file grid.hpp.

template<class ItemType>
friend class Grid::ConstRectangleCellIterator [friend]
 

Definition at line 36 of file grid.hpp.

template<class ItemType>
friend class Grid::ConstTriangleCellIterator [friend]
 

Definition at line 38 of file grid.hpp.

template<class ItemType>
friend class Grid::ConvexPolygonCellIterator [friend]
 

Definition at line 39 of file grid.hpp.

template<class ItemType>
friend class Grid::LineCellIterator [friend]
 

Definition at line 33 of file grid.hpp.

template<class ItemType>
friend class Grid::RectangleCellIterator [friend]
 

Definition at line 35 of file grid.hpp.

template<class ItemType>
friend class Grid::TriangleCellIterator [friend]
 

Definition at line 37 of file grid.hpp.


Member Data Documentation

template<class ItemType>
int Arak::Grid< ItemType >::Cell::c [protected]
 

The column index of this cell.

Definition at line 64 of file grid.hpp.

template<class ItemType>
Cell* Arak::Grid< ItemType >::Cell::down [protected]
 

A pointer to the cell that is immediately below this cell.

If there is no such cell, this is NULL.

Definition at line 87 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::Cell::Cell().

template<class ItemType>
ItemList Arak::Grid< ItemType >::Cell::items [protected]
 

A list of items associated with this cell.

Definition at line 69 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::Cell::add(), Arak::Grid< ItemType >::Cell::Cell(), Arak::Grid< ItemType >::Cell::getItemList(), and Arak::Grid< ItemType >::Cell::Entry::remove().

template<class ItemType>
Cell* Arak::Grid< ItemType >::Cell::left [protected]
 

A pointer to the cell that is immediately to the left of this cell.

If there is no such cell, this is NULL.

Definition at line 99 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::Cell::Cell().

template<class ItemType>
int Arak::Grid< ItemType >::Cell::r [protected]
 

The row index of this cell.

Definition at line 59 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::Cell::row().

template<class ItemType>
Cell* Arak::Grid< ItemType >::Cell::right [protected]
 

A pointer to the cell that is immediately to the right of this cell.

If there is no such cell, this is NULL.

Definition at line 93 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::Cell::Cell().

template<class ItemType>
ItemList Arak::Grid< ItemType >::Cell::unused [protected]
 

A list of unused items.

This list is used to avoid memory allocation overhead associated with adding items to items.

Definition at line 75 of file grid.hpp.

Referenced by Arak::Grid< ItemType >::Cell::Entry::remove().

template<class ItemType>
Cell* Arak::Grid< ItemType >::Cell::up [protected]
 

A pointer to the cell that is immediately above this cell.

If there is no such cell, this is NULL.

Definition at line 81 of file grid.hpp.


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:41:16 2005 for Arak by doxygen 1.3.6