de.fhpotsdam.unfolding.tiles
Class TileLoader

java.lang.Object
  extended by de.fhpotsdam.unfolding.tiles.TileLoader
All Implemented Interfaces:
java.lang.Runnable

public class TileLoader
extends java.lang.Object
implements java.lang.Runnable

Loads tiles from the MapProvider. Will be used in a background thread. Two kinds of MapProviders are supported:

Tile organization is handled in AbstractMapDisplay (caching) and Java2DMapDisplay (rendering).


Field Summary
protected  Coordinate coordinate
          The actual coordinates of the tile to load.
protected  TileLoaderListener listener
          The listener to call method after tile has been loaded.
protected  processing.core.PApplet p
          The parent applet.
protected  AbstractMapProvider provider
          The tile provider.
 boolean showDebugBorder
          Shows coordinate information for tile, i.e.
 boolean showTileCoordinates
           
 
Constructor Summary
TileLoader(processing.core.PApplet p, AbstractMapProvider provider, TileLoaderListener listener, Coordinate coordinate)
           
 
Method Summary
protected  processing.core.PImage getTileFromUrl(java.lang.String[] urls)
          Loads tile from URL(s) by using Processing's loadImage function.
 void run()
          Gets tile from provider, and calls TileLoaderListener.tileLoaded(Coordinate, Object) afterwards.
 void showDebugBorder()
           
 void showTileCoordinates()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

showDebugBorder

public boolean showDebugBorder
Shows coordinate information for tile, i.e. placed atop original tile image.


showTileCoordinates

public boolean showTileCoordinates

p

protected processing.core.PApplet p
The parent applet.


provider

protected AbstractMapProvider provider
The tile provider.


listener

protected TileLoaderListener listener
The listener to call method after tile has been loaded.


coordinate

protected Coordinate coordinate
The actual coordinates of the tile to load.

Constructor Detail

TileLoader

public TileLoader(processing.core.PApplet p,
                  AbstractMapProvider provider,
                  TileLoaderListener listener,
                  Coordinate coordinate)
Method Detail

run

public void run()
Gets tile from provider, and calls TileLoaderListener.tileLoaded(Coordinate, Object) afterwards.

Specified by:
run in interface java.lang.Runnable

getTileFromUrl

protected processing.core.PImage getTileFromUrl(java.lang.String[] urls)
Loads tile from URL(s) by using Processing's loadImage function. If multiple URLs are provided, all tile images are blended into each other.

Parameters:
urls - The URLs (local or remote) to load the tiles from.
Returns:
The tile image.

showDebugBorder

public void showDebugBorder()

showTileCoordinates

public void showTileCoordinates()