Class Grid.Cell
raft.kilavuz.grid
java.lang.Object
  raft.kilavuz.grid.Grid.Cell
All Implemented Interfaces:
Enclosing class:

public class Grid.Cell
extends Object
implements Serializable
a cell in grid. cells are the atomic pieces of raw pathfinding information. later they're collapsed into rectangular freely traversable regions called sectors and portals between sectors.

Field Summary
int
id
id of this cell, assigned during creation
int
x
x coordinate in grid space
int
z
z coordinate in grid space
Method Summary
getAction(Direction d)
returns action to take to reach the neighbour at given direction
float
getElevation()
returns elevation of this cell
getGrid()
returns enclosing grid instance
getLocation()
return location (bottom center) of cell in world space
getNeighbour(Direction d)
returns neighbour cell at given direction
getSector()
returns the sector this cells belong to
getTransitions()
returns a map of transitions from this cell.
boolean
intersects(Grid.Cell other)
checks if two cells intersect.
void
remove()
removes this cell from grid.
toString()
returns a string representation of this cell
Field Detail
id
public final int id
id of this cell, assigned during creation

x
public final int x
x coordinate in grid space

z
public final int z
z coordinate in grid space
Method Detail
getElevation
public float getElevation()
returns elevation of this cell

getNeighbour
public Grid.Cell getNeighbour(Direction d)
returns neighbour cell at given direction
Returns:
neighbour or null if no neighbour at that direction or neighbour isnt reachable from this cell

getTransitions
public Map<Short,List<Grid.Cell>> getTransitions()
returns a map of transitions from this cell. keys are actions and values are list of cells. note this method does not return the regular adjacent (neighbour) cells. this type of transitions are either created by remote jumps during floodfill or by the method Grid.createPortal(Cell, Cell, short).
See Also:

getAction
public Short getAction(Direction d)
returns action to take to reach the neighbour at given direction
Returns:
action or null if no neighbour at that direction or neighbour isnt reachable from this cell

getSector
public Grid.Sector getSector()
returns the sector this cells belong to
Throws:
IllegalStateException - if hasnt assigned to a sector yet

getLocation
public Vector3 getLocation()
return location (bottom center) of cell in world space

getGrid
public Grid getGrid()
returns enclosing grid instance

remove
public void remove()
removes this cell from grid. this can be used for manually correcting some part of grid.
Throws:
IllegalStateException - if cell is assigned to a sector
Since:
0.91
See Also:

intersects
public boolean intersects(Grid.Cell other)
checks if two cells intersect.

toString
public String toString()
returns a string representation of this cell
Overrides:
toString in class Object
Java API documentation generated with DocFlex/Doclet v1.5.2
DocFlex/Doclet is both a multi-format Javadoc doclet and a free edition of DocFlex/Javadoc. If you need to customize your Javadoc without writing a full-blown doclet from scratch, DocFlex/Javadoc may be the only tool able to help you! Find out more at www.docflex.com