|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectus.zuercher.gpx2map.source.AbstractCachedMapSource
us.zuercher.gpx2map.source.AbstractTiledUrlMapSource
public abstract class AbstractTiledUrlMapSource
AbstractTilesUrlMapSource extends AbstractCachedMapSource
to
provide a MapSource
base class that provides map tile downloading
and stitching facilities.
For the purposes of stitchTiles(File, ProgressMeter)
, map tiles
are assumed to be gzipped PPM files. Individual tiles file names are
retrieve from the cache via the abstract method getTile(int, int)
.
The column and row information passed in that method are derived from the
return values of the abstract methods getColumnCount()
and
getRowCount()
.
Constructor Summary | |
---|---|
AbstractTiledUrlMapSource()
|
Method Summary | |
---|---|
protected void |
download(URL url,
File target)
Downloads, converts and compresses an image from the given source URL to the given target file. |
protected void |
download(URL url,
File target,
boolean convertAndCompress)
Downloads, converts and compresses an image from the given source URL to the given target file. |
protected abstract int |
getColumnCount()
Returns the number of tile columns for the current map. |
protected String |
getCompressedCacheFileExtension()
Returns the extension that should be used for downloaded files. |
protected abstract int |
getRowCount()
Returns the number of tile rows for the current map. |
protected abstract File |
getTile(int column,
int row)
Returns the File object for the tile at the given coordinates. |
void |
stitchTiles(File outputFile,
ProgressMeter meter)
Stitches together tiles files obtained from the concrete base class. |
Methods inherited from class us.zuercher.gpx2map.source.AbstractCachedMapSource |
---|
getCacheDir, setCacheDir |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface us.zuercher.gpx2map.source.MapSource |
---|
downloadTiles, getImageSize, getMapScale, getProperties, mapLocationToPixel, setBoundingBox, setCacheDir, setProperty |
Constructor Detail |
---|
public AbstractTiledUrlMapSource()
Method Detail |
---|
public void stitchTiles(File outputFile, ProgressMeter meter) throws IOException
getTile(int, int)
,
getColumnCount()
, and getRowCount()
.
stitchTiles
in interface MapSource
outputFile
- the output file, a gzipped PPM filemeter
- a progress meter
IOException
- if there's an error reading the input files, or
writing to the output file.MapSource.stitchTiles(File, ProgressMeter)
protected abstract int getColumnCount()
protected abstract int getRowCount()
protected abstract File getTile(int column, int row)
column
- 0-based column indexrow
- 0-based row index
protected void download(URL url, File target, boolean convertAndCompress) throws IOException
url
- image source URLtarget
- image target file.convertAndCompress
- if true, attempts to convert the file to PPM
format and apply gzip compression.
IOException
- if there's an error downloading the fileMapSource.downloadTiles(ProgressMeter)
,
JavaDownloader
,
JavaConverter
protected void download(URL url, File target) throws IOException
download(url, target, true)
.
url
- image source URLtarget
- image target file.
IOException
- if there's an error downloading the fileMapSource.downloadTiles(ProgressMeter)
,
JavaDownloader
,
JavaConverter
protected String getCompressedCacheFileExtension()
JavaConverter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |