All Packages Class Hierarchy This Package Previous Next Index
Class gpsys.cos.TerrainViewer
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Canvas
|
+----gpsys.cos.TerrainViewer
- public class TerrainViewer
- extends Canvas
- implements TerrainObserver
Provides a view of the terrain and terrain robot on the terrain.
- Author:
- Emmanuel PIERRE
DEA IARFA,
- See Also:
- Cos, TerrainObserver
-
robot1X
- The current X-coordinate of the terrainrobot.
-
robot1Y
- The current Y-coordinate of the terrainrobot.
-
terrain
- The terrain being monitored.
-
txt
-
-
txtA
-
-
TerrainViewer(Terrain)
- Create a new TerrainViewer Object which provides a view of the specified
Terrain.
-
init()
- Initialise the position of the robot on the terrain.
-
paint(Graphics)
- Override the Canvas paint() method so that the terrain and terrain robot
is drawn on the Canvas.
-
printInfo(String)
-
-
printTxt(String)
-
-
robotMoved(int, int)
- Update the terrain view when a square on the terrain is being cut.
-
terrainInit()
- Update the terrain view when the terrain regrows.
-
update(Graphics)
- Override the Canvas update() method so that the Canvas is not cleared
before it is redrawn.
terrain
Terrain terrain
- The terrain being monitored.
robot1X
int robot1X
- The current X-coordinate of the terrainrobot.
robot1Y
int robot1Y
- The current Y-coordinate of the terrainrobot.
txt
TextField txt
txtA
TextArea txtA
TerrainViewer
public TerrainViewer(Terrain terrain)
- Create a new TerrainViewer Object which provides a view of the specified
Terrain.
- Parameters:
- terrain - The Terrain being viewed.
printTxt
public void printTxt(String str)
printInfo
public void printInfo(String str)
init
public void init()
- Initialise the position of the robot on the terrain.
update
public void update(Graphics g)
- Override the Canvas update() method so that the Canvas is not cleared
before it is redrawn.
- Parameters:
- g - The graphics Object associated with the Canvas.
- Overrides:
- update in class Component
paint
public void paint(Graphics g)
- Override the Canvas paint() method so that the terrain and terrain robot
is drawn on the Canvas.
- Parameters:
- g - The graphics Object associated with the Canvas.
- Overrides:
- paint in class Canvas
terrainInit
public void terrainInit()
- Update the terrain view when the terrain regrows.
robotMoved
public void robotMoved(int x,
int y)
- Update the terrain view when a square on the terrain is being cut.
- Parameters:
- x - The X-coordinate of the square being cut.
- y - The Y-coordinate of the square being cut.
All Packages Class Hierarchy This Package Previous Next Index