path
Class SearchGrid

java.lang.Object
  extended by path.SearchGrid
All Implemented Interfaces:
java.io.Serializable

public class SearchGrid
extends java.lang.Object
implements java.io.Serializable

This class represents the grid that contains the walkable area of a game location

Author:
Frank Bruns
See Also:
Serialized Form

Constructor Summary
SearchGrid(java.awt.image.BufferedImage imgWalkable, java.util.ArrayList<Item> items, java.util.ArrayList<InteractiveHotspot> ihs, int gridNodeSize)
          Creates a new search grid out of the specified walkable area image
 
Method Summary
 GridNode getGridNode(double x, double y)
          Returns the grid node at the specified coordinates
 GridNode[][] getGridNodes()
          Returns the 2 dimensional array of grid nodes representing the search grid.
 int getGridNodeSize()
          Returns the size of a grid node square
 java.awt.image.BufferedImage getImageWalkable()
          Returns the image containing the walkable area of the search grid
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchGrid

public SearchGrid(java.awt.image.BufferedImage imgWalkable,
                  java.util.ArrayList<Item> items,
                  java.util.ArrayList<InteractiveHotspot> ihs,
                  int gridNodeSize)
Creates a new search grid out of the specified walkable area image

Parameters:
imgWalkable - image containing the walkable area
gridNodeSize - width and height for the square of a grid node, this must be a power of 2
Method Detail

getGridNodeSize

public int getGridNodeSize()
Returns the size of a grid node square

Returns:
size of a grid node square

getGridNodes

public GridNode[][] getGridNodes()
Returns the 2 dimensional array of grid nodes representing the search grid. The first dimension is the y dimension and the second one is the x dimension

Returns:
search grid nodes [y][x]

getImageWalkable

public java.awt.image.BufferedImage getImageWalkable()
Returns the image containing the walkable area of the search grid

Returns:
image containing the walkable area

getGridNode

public GridNode getGridNode(double x,
                            double y)
Returns the grid node at the specified coordinates

Parameters:
x - x coordinate
y - y coordinate
Returns:
grid node at the specified coordinates