rails.ui.swing.hexmap
Class GUITile

java.lang.Object
  extended by rails.ui.swing.hexmap.GUITile

public class GUITile
extends java.lang.Object

This class represents the GUI version of a tile.


Field Summary
protected  java.awt.geom.AffineTransform af
           
protected  double baseRotation
           
static double DEG60
           
protected  GUIHex guiHex
           
protected  MapHex hex
           
protected static ImageLoader imageLoader
           
protected static org.apache.log4j.Logger log
           
protected  int picId
           
protected  int rotation
           
static double SVG_X_CENTER_LOC
           
static double SVG_Y_CENTER_LOC
           
protected  TileI tile
           
protected  int tileId
           
protected  java.awt.image.BufferedImage tileImage
           
protected  double tileScale
           
protected  java.lang.String tileType
           
 
Constructor Summary
GUITile(int tileId, GUIHex guiHex)
           
 
Method Summary
 int getRotation()
           
 TileI getTile()
           
 int getTileId()
           
 void paintTile(java.awt.Graphics2D g2, int x, int y)
           
 boolean rotate(int initial, GUITile previousGUITile, boolean mustConnect)
          Rotate right (clockwise) until a valid orientation is found.
 void setRotation(int rotation)
           
 void setScale(double scale)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tileId

protected int tileId

tile

protected TileI tile

tileType

protected java.lang.String tileType

picId

protected int picId

tileImage

protected java.awt.image.BufferedImage tileImage

rotation

protected int rotation

tileScale

protected double tileScale

baseRotation

protected double baseRotation

hex

protected MapHex hex

guiHex

protected GUIHex guiHex

imageLoader

protected static ImageLoader imageLoader

af

protected java.awt.geom.AffineTransform af

DEG60

public static final double DEG60
See Also:
Constant Field Values

SVG_X_CENTER_LOC

public static final double SVG_X_CENTER_LOC
See Also:
Constant Field Values

SVG_Y_CENTER_LOC

public static final double SVG_Y_CENTER_LOC
See Also:
Constant Field Values

log

protected static org.apache.log4j.Logger log
Constructor Detail

GUITile

public GUITile(int tileId,
               GUIHex guiHex)
Method Detail

setRotation

public void setRotation(int rotation)

rotate

public boolean rotate(int initial,
                      GUITile previousGUITile,
                      boolean mustConnect)
Rotate right (clockwise) until a valid orientation is found.

Parameters:
initial: - First rotation to try. Should be 0 for the initial tile drop, and 1 at subsequent rotation attempts.
Returns:
false if no valid rotation exists (i.e. the tile cannot be laid).

getRotation

public int getRotation()

setScale

public void setScale(double scale)

paintTile

public void paintTile(java.awt.Graphics2D g2,
                      int x,
                      int y)

getTile

public TileI getTile()

getTileId

public int getTileId()