|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jscience.computing.ai.util.StandardMap2D
org.jscience.computing.ai.AStarMap
public class AStarMap
AStarMap
is simply derived from StandardMap2D
to provide further functionality to visualize the A algorithm. It displays
the map, start/goal positions, the best route as well as open and closed
lists.
Field Summary | |
---|---|
protected AStarPathfinder |
aStar
The pathfinder (used for drawing the routes). |
protected Gradient |
closedGradient
The closed list gradient (blue). |
protected int |
gx
Goal x-position. |
protected int |
gy
Goal y-position. |
protected Gradient |
openGradient
The open list gradient (red). |
protected int |
sx
Start x-position. |
protected int |
sy
Start y-position. |
Fields inherited from class org.jscience.computing.ai.util.StandardMap2D |
---|
height, mapValues, renderSize, width |
Constructor Summary | |
---|---|
AStarMap()
Creates a new instance of AStarMap |
|
AStarMap(java.awt.image.BufferedImage img)
Creates a new instance from a BufferedImage. |
|
AStarMap(int width,
int height)
Creates a new instance with dimensional information. |
Method Summary | |
---|---|
AStarPathfinder |
getPathfinder()
Return the pathfinder being used. |
void |
render(java.awt.Graphics g,
int ww,
int hh)
Render the map. |
void |
setPathfinder(AStarPathfinder as)
Set the pathfinder to display. |
Methods inherited from class org.jscience.computing.ai.util.StandardMap2D |
---|
createNodeID, getCost, getDistance, getHeight, getRenderSize, getWidth, isValid, isValid, setMapAt, setRenderSize, writeImage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int sx
protected int sy
protected int gx
protected int gy
protected Gradient openGradient
protected Gradient closedGradient
protected AStarPathfinder aStar
Constructor Detail |
---|
public AStarMap()
public AStarMap(int width, int height)
width
- the width of the map.height
- the height of the map.public AStarMap(java.awt.image.BufferedImage img)
img
- the image to be used as the map values.Method Detail |
---|
public void setPathfinder(AStarPathfinder as)
as
- the pathfinder to display.public AStarPathfinder getPathfinder()
public void render(java.awt.Graphics g, int ww, int hh)
render
in interface Visualizable
render
in class StandardMap2D
g
- the graphics context.ww
- the content width.hh
- the context height.StandardMap2D.render(java.awt.Graphics,
int,int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |