org.molwind.view
Class Tiles

java.lang.Object
  extended by org.molwind.view.Tiles

public class Tiles
extends java.lang.Object

Tiles generates and manages the image tiles served to the client.

Version:
1.0
Author:
Oliver Karch

Method Summary
 void addTile(LayeredPosition position, Tile tile)
          Adds a tile to the tile cache.
static Tiles getInstance(java.lang.String worldName)
          Returns an instance to the tiles storage which has been associated to the given world.
 Tile getTile(LayeredPosition position)
          Returns a tile from the tile cache for the given position.
 MolwindWorld getWorld()
          Get the World value.
 java.lang.String getWorldName()
          Get the WorldName value.
 void setWorld(MolwindWorld newWorld)
          Set the World value.
 void setWorldName(java.lang.String newWorldName)
          Set the WorldName value.
 void writeTile(LayeredPosition position, java.io.OutputStream output)
          Writes the image of a tile for the given position to an output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Tiles getInstance(java.lang.String worldName)
                         throws java.io.IOException
Returns an instance to the tiles storage which has been associated to the given world.

Parameters:
worldName - the name of the world
Returns:
a tiles manager
Throws:
java.io.IOException - is thrown upon i/o error

getWorldName

public java.lang.String getWorldName()
Get the WorldName value.

Returns:
the WorldName value

setWorldName

public void setWorldName(java.lang.String newWorldName)
Set the WorldName value.

Parameters:
newWorldName - the new WorldName value

getWorld

public MolwindWorld getWorld()
Get the World value.

Returns:
the World value

setWorld

public void setWorld(MolwindWorld newWorld)
Set the World value.

Parameters:
newWorld - the new World value

getTile

public Tile getTile(LayeredPosition position)
Returns a tile from the tile cache for the given position.

Parameters:
position - the layered position (X,Y,L)
Returns:
if present in the cache the tile is returned, otherwise null

addTile

public void addTile(LayeredPosition position,
                    Tile tile)
Adds a tile to the tile cache.

Parameters:
position - the layered position (X,Y,L)
tile - the tile to be stored

writeTile

public void writeTile(LayeredPosition position,
                      java.io.OutputStream output)
               throws java.io.IOException
Writes the image of a tile for the given position to an output stream.

Parameters:
position - the position (X,Y,L)
output - the output stream
Throws:
java.io.IOException - is thrown upon i/o error


Copyright © 2008-2010. All Rights Reserved.