|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface MapSource
MapSource represents a map source. MapSource instances are obtained from
SourceFactory
.
Once you have an instance of MapSource, you must take the following steps:
getProperties()
and
provide values
for at least
the required properties.setCacheDir(File)
to set a cache directory.setBoundingBox(LatLon, LatLon)
to set the map's
boundaries.downloadTiles(ProgressMeter)
to download the map's
tiles.stitchTiles(File, ProgressMeter)
to stitch the
downloaded tiles together into a map.After that, mapLocationToPixel(LatLon)
and
getImageSize()
, can be used to manipulate the map.
Multiple concurrently existing maps can be achieved by creating multiple MapSource instances.
WARNING: MapSources are not guaranteed to be thread safe. In particular, multiple concurrently downloading MapSources may cause the cache to be corrupted. External synchronization is therefore necessary.
Method Summary | |
---|---|
void |
downloadTiles(ProgressMeter meter)
Downloads the necessary map data. |
Dimension |
getImageSize()
|
double |
getMapScale()
Returns the map's scale in meters per pixel. |
List<MapSourcePropertyDescriptor> |
getProperties()
Retrieve a list of MapSourcePropertyDescriptors for
this map source. |
Point |
mapLocationToPixel(LatLon location)
Compute the pixel coordinates of the given location in the output file generated by stitchTiles(File, ProgressMeter) . |
void |
setBoundingBox(LatLon northWest,
LatLon southEast)
Configures the bounding box of latitude and longitude upon which map data will be drawn. |
void |
setCacheDir(File cacheDir)
Configures the directory where this map source should place its cached data. |
void |
setProperty(String name,
String value)
Set the value of the given property. |
void |
stitchTiles(File outputFile,
ProgressMeter meter)
Stitch tiles together and write them as a PPM file to the given abstract file name. |
Method Detail |
---|
List<MapSourcePropertyDescriptor> getProperties()
MapSourcePropertyDescriptors
for
this map source.
MapSourcePropertyDescriptors
for this map source or an empty list if no properties exist.void setProperty(String name, String value)
MapSourcePropertyDescriptor.set(MapSource, String)
.
name
- property namevalue
- property valuevoid setCacheDir(File cacheDir)
cacheDir
- map cache directory.double getMapScale()
void setBoundingBox(LatLon northWest, LatLon southEast)
northWest
- northwest corner of the mapsouthEast
- sourtheast corner of the mapvoid downloadTiles(ProgressMeter meter) throws IOException
Implementations should cache map tiles in the cache directory.
meter
- progress meter for indicating download progress
IOException
- if there's an error downloading map datavoid stitchTiles(File outputFile, ProgressMeter meter) throws IOException
outputFile
- name of output file.meter
- a progress meter
IOException
- on file errorWritablePpmImage
Point mapLocationToPixel(LatLon location)
stitchTiles(File, ProgressMeter)
. Locations are
from upper-left corner of the file, which is (0, 0).
location
- location to compute
Dimension getImageSize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |