public final class TileViewer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
TileViewer.SortableImage |
Modifier and Type | Field and Description |
---|---|
private java.awt.geom.GeneralPath |
fog |
private FreeColClient |
freeColClient |
private int |
halfHeight |
private int |
halfWidth |
private ImageLibrary |
lib |
private static java.util.logging.Logger |
logger |
private RoadPainter |
rp |
(package private) static int |
STATE_OFFSET_X |
(package private) static int |
STATE_OFFSET_Y |
private int |
tileHeight |
private int |
tileWidth |
Constructor and Description |
---|
TileViewer(FreeColClient freeColClient)
The constructor to use.
|
Modifier and Type | Method and Description |
---|---|
(package private) java.awt.image.BufferedImage |
createColonyTileImage(Tile tile,
Colony colony)
Create a
BufferedImage and draw a Tile on it. |
(package private) java.awt.image.BufferedImage |
createTileImage(Tile tile)
Create a
BufferedImage and draw a Tile on it. |
(package private) java.awt.image.BufferedImage |
createTileImageWithBeachBorderAndItems(Tile tile)
Create a
BufferedImage and draw a Tile on it. |
(package private) static java.awt.image.BufferedImage |
createTileImageWithOverlayAndForest(TileType type,
java.awt.Dimension size)
Returns the scaled terrain-image for a terrain type (and position 0, 0).
|
(package private) void |
displayCenteredImage(java.awt.Graphics2D g,
java.awt.image.BufferedImage image)
Centers the given Image on the tile.
|
private void |
displayColonyTile(java.awt.Graphics2D g,
Tile tile,
Colony colony,
java.awt.image.BufferedImage overlayImage)
Displays the given colony tile.
|
(package private) void |
displayColonyTiles(java.awt.Graphics2D g,
Tile[][] tiles,
Colony colony)
Displays the 3x3 tiles for the TilesPanel in ColonyPanel.
|
(package private) void |
displayFogOfWar(java.awt.Graphics2D g,
Tile tile)
Displays the given Tile onto the given Graphics2D object at the
location specified by the coordinates.
|
(package private) void |
displayLargeCenteredImage(java.awt.Graphics2D g,
java.awt.image.BufferedImage image)
Centers the given Image on the tile, ensuring it is not drawing
over tiles south of it.
|
private void |
displayLostCityRumour(java.awt.Graphics2D g) |
(package private) void |
displayOptionalTileText(java.awt.Graphics2D g,
Tile tile)
Displays the Tile text for a Tile.
|
private void |
displayResourceTileItem(java.awt.Graphics2D g,
Resource item) |
(package private) void |
displaySettlementWithChipsOrPopulationNumber(java.awt.Graphics2D g,
Tile tile,
boolean withNumber)
Displays the given Tile onto the given Graphics2D object at the
location specified by the coordinates.
|
private void |
displayTile(java.awt.Graphics2D g,
Tile tile,
java.awt.image.BufferedImage overlayImage)
Displays the given
Tile . |
private void |
displayTileImprovement(java.awt.Graphics2D g,
Tile tile,
TileImprovement ti) |
private void |
displayTileItem(java.awt.Graphics2D g,
Tile tile,
TileItem item)
Draws the given TileItem on the given Tile.
|
(package private) void |
displayTileItems(java.awt.Graphics2D g,
Tile tile,
java.awt.image.BufferedImage overlayImage)
Displays the given tile's items onto the given Graphics2D object.
|
(package private) void |
displayTileWithBeachAndBorder(java.awt.Graphics2D g,
Tile tile)
Displays the given Tile onto the given Graphics2D object at the
location specified by the coordinates.
|
(package private) void |
displayUnknownTileBorder(java.awt.Graphics2D g,
Tile tile) |
(package private) ImageLibrary |
getImageLibrary()
Gets the contained
ImageLibrary . |
(package private) void |
setImageLibraryAndUpdateData(ImageLibrary lib)
Sets the ImageLibrary and calculates various items that depend
on tile size.
|
private static final java.util.logging.Logger logger
private final FreeColClient freeColClient
private ImageLibrary lib
private RoadPainter rp
private int tileHeight
private int tileWidth
private int halfHeight
private int halfWidth
static final int STATE_OFFSET_X
static final int STATE_OFFSET_Y
private final java.awt.geom.GeneralPath fog
TileViewer(FreeColClient freeColClient)
freeColClient
- The FreeColClient
for the game.ImageLibrary getImageLibrary()
ImageLibrary
.static java.awt.image.BufferedImage createTileImageWithOverlayAndForest(TileType type, java.awt.Dimension size)
type
- The type of the terrain-image to return.size
- The maximum size of the terrain image to return.java.awt.image.BufferedImage createTileImageWithBeachBorderAndItems(Tile tile)
BufferedImage
and draw a Tile
on it.
Draws the terrain and improvements.tile
- The Tile to draw.java.awt.image.BufferedImage createTileImage(Tile tile)
BufferedImage
and draw a Tile
on it.tile
- The Tile
to draw.java.awt.image.BufferedImage createColonyTileImage(Tile tile, Colony colony)
BufferedImage
and draw a Tile
on it.
The visualization of the Tile
also includes information
from the corresponding ColonyTile
of the given
Colony
.tile
- The Tile
to draw.colony
- The Colony
to create the visualization
of the Tile
for. This object is also used to
get the ColonyTile
for the given Tile
.void displayColonyTiles(java.awt.Graphics2D g, Tile[][] tiles, Colony colony)
g
- The Graphics2D
object on which to draw
the Tile
.tiles
- The array containing the Tile
objects to draw.colony
- The Colony
to create the visualization
of the Tile
objects for.private void displayColonyTile(java.awt.Graphics2D g, Tile tile, Colony colony, java.awt.image.BufferedImage overlayImage)
Tile
also includes information
from the corresponding ColonyTile
from the given
Colony
.g
- The Graphics2D
on which to draw.tile
- The Tile
to draw.colony
- The Colony
to create the visualization
of the Tile
for. This object is also used to
get the ColonyTile
for the given Tile
.overlayImage
- The BufferedImage of the tile overlay.private void displayTile(java.awt.Graphics2D g, Tile tile, java.awt.image.BufferedImage overlayImage)
Tile
.g
- The Graphics2D on which to draw the Tile
.tile
- The Tile
to draw.overlayImage
- The BufferedImage for the tile overlay.void setImageLibraryAndUpdateData(ImageLibrary lib)
lib
- an ImageLibrary
valuevoid displayCenteredImage(java.awt.Graphics2D g, java.awt.image.BufferedImage image)
g
- a Graphics2D
image
- the BufferedImagevoid displayLargeCenteredImage(java.awt.Graphics2D g, java.awt.image.BufferedImage image)
g
- a Graphics2D
image
- the BufferedImagevoid displayTileWithBeachAndBorder(java.awt.Graphics2D g, Tile tile)
g
- The Graphics2D object on which to draw the Tile.tile
- The Tile to draw.void displayUnknownTileBorder(java.awt.Graphics2D g, Tile tile)
void displayFogOfWar(java.awt.Graphics2D g, Tile tile)
g
- The Graphics2D
object on which to draw
the Tile
.tile
- The Tile
to draw.void displayOptionalTileText(java.awt.Graphics2D g, Tile tile)
g
- The Graphics2D object on which the text gets drawn.tile
- The Tile to draw the text on.void displaySettlementWithChipsOrPopulationNumber(java.awt.Graphics2D g, Tile tile, boolean withNumber)
g
- The Graphics2D object on which to draw the Tile.tile
- The Tile to draw.withNumber
- Whether to display the number of units present.void displayTileItems(java.awt.Graphics2D g, Tile tile, java.awt.image.BufferedImage overlayImage)
g
- The Graphics2D object on which to draw the Tile.tile
- The Tile to draw.overlayImage
- The BufferedImage for the tile overlay.private void displayTileItem(java.awt.Graphics2D g, Tile tile, TileItem item)
private void displayResourceTileItem(java.awt.Graphics2D g, Resource item)
private void displayLostCityRumour(java.awt.Graphics2D g)
private void displayTileImprovement(java.awt.Graphics2D g, Tile tile, TileImprovement ti)