public class Tile

  1. Object
  2. Tile

Known subtypesProxyHttpTile

This class represents a single tile on a map. a map is been constructed from a few tiles that are been tiled on next to the other.

Constructors

public Tile(Dimension dimension, BoundingBox boundingBox, Image image)Creates a new Tile.

Methods

public static void setPaintLoading(boolean toPaint)This flag indicates if the Tile should paint a Loading image or Text or simply not do any painting if a map image is not ready for painting
public static void setTileLoadingImage(Image tileLoadingImage)Sets a static image that will be drawn on the map if the tile image is not available yet.
public static void setTileLoadingText(String tileLoadingText)Sets a static text to paint.
public Point pointPosition(Coord point)Returns the x, y point of the given coordinate relative to this tile
public Coord position(int posX, int posY)Returns the Coordinate of the given x, y position on the tile
public Dimension dimension()Gets the tile dimension
public BoundingBox getBoundingBox()Gets the tile bounding box.
public boolean paint(Graphics g)Paints the tile on the Graphics Object
public void paint(Graphics g, int x, int y)Paints the tile on the Graphics Object translated to the given x, y, This method paints the tile image if available or will call paintTileLoading
public void paintTileLoading(Graphics g)This method paints a “tile loading” on the Graphics if boolean paint(Graphics g) returned false.
public void setsTileReadyListener(ActionListener listener)Sets a Listener to be notified when the tile is fireReady to be painted
protected void fireReady()inform the TileReadyListener that this tile is ready to be painted
public String toString()Returns a string representation of the object.

Inherited methods

Constructor details

Tile

public Tile(Dimension dimension, BoundingBox boundingBox, Image image)
Creates a new Tile.

Parameters

dimension Dimension
the tile Dimensions (usually 256x256)
boundingBox BoundingBox
Not documented.
image Image
the map image or null.

Method details

setPaintLoading

public static void setPaintLoading(boolean toPaint)
This flag indicates if the Tile should paint a Loading image or Text or simply not do any painting if a map image is not ready for painting

setTileLoadingImage

public static void setTileLoadingImage(Image tileLoadingImage)
Sets a static image that will be drawn on the map if the tile image is not available yet.

setTileLoadingText

public static void setTileLoadingText(String tileLoadingText)
Sets a static text to paint. This will be used if the map if the tile image is not available yet and the tileLoadingImage is null

pointPosition

public Point pointPosition(Coord point)
Returns the x, y point of the given coordinate relative to this tile

Parameters

point Coord
a coordinate to translate to x, y

Returns

a Point object relative to this tile

position

public Coord position(int posX, int posY)
Returns the Coordinate of the given x, y position on the tile

Returns

a Coordinate that was created from the given x, y position

dimension

public Dimension dimension()
Gets the tile dimension

Returns

the tile dimension

getBoundingBox

public BoundingBox getBoundingBox()
Gets the tile bounding box.

Returns

the tile bounding box.

paint

public boolean paint(Graphics g)
Paints the tile on the Graphics Object

Parameters

g Graphics
Graphics object to paint on.

Returns

true if painting succeeded.

paint

public void paint(Graphics g, int x, int y)
Paints the tile on the Graphics Object translated to the given x, y, This method paints the tile image if available or will call paintTileLoading

Parameters

g Graphics
Graphics object to paint on.
x int
translate to x before painting
y int
translate to y before painting

paintTileLoading

public void paintTileLoading(Graphics g)
This method paints a “tile loading” on the Graphics if boolean paint(Graphics g) returned false.

Parameters

g Graphics
Graphics object to paint on.

setsTileReadyListener

public void setsTileReadyListener(ActionListener listener)
Sets a Listener to be notified when the tile is fireReady to be painted

fireReady

protected void fireReady()
inform the TileReadyListener that this tile is ready to be painted

toString

public String toString()
Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + ‘@’ + Integer.toHexString(hashCode())