001// License: GPL. For details, see Readme.txt file.
002package org.openstreetmap.gui.jmapviewer.interfaces;
003
004import org.openstreetmap.gui.jmapviewer.Tile;
005
006/**
007 * Interface for implementing a tile loader. Tiles are usually loaded via HTTP
008 * or from a file.
009 *
010 * @author Jan Peter Stotz
011 */
012public interface TileLoader {
013
014    /**
015     * A typical implementation of this function should create and return a
016     * new {@link TileJob} instance that performs the load action.
017     *
018     * @param tile the tile to be loaded
019     * @return {@link TileJob} implementation that performs the desired load
020     *          action.
021     */
022    TileJob createTileLoaderJob(Tile tile);
023
024    /**
025     * cancels all outstanding tasks in the queue. This should rollback the state of the tiles in the queue
026     * to loading = false / loaded = false
027     */
028    void cancelOutstandingTasks();
029}