uk.me.parabola.mkgmap.general
Interface LoadableMapDataSource

All Superinterfaces:
Configurable, MapDataSource
All Known Subinterfaces:
OverviewMap
All Known Implementing Classes:
ElementTestDataSource, Osm5CoastDataSource, Osm5MapDataSource, OsmBinCoastDataSource, OsmBinMapDataSource, OsmMapDataSource, OverviewMapDataSource, PolishMapDataSource

public interface LoadableMapDataSource
extends MapDataSource, Configurable

A source of map information in a standard format. The OSM reader presents this interface to the main map making program. OSM concepts are converted into Garmin map based structures such as MapLine. Note that it does not reference anything from the imgfmt package that relies on subdivisions. In other words it does not directly reference Point or Polyline as they depend on the subdivision they are in. It can refer to Coord and Overview however as they have global meaning.

Author:
Steve Ratcliffe

Method Summary
 java.lang.String[] copyrightMessages()
          Get a suitable copyright message for this map source.
 boolean isFileSupported(java.lang.String name)
          Determines if the file (or other resource) is supported by this map data source.
 void load(java.lang.String name)
          Load map by name.
 LevelInfo[] mapLevels()
          Get the map levels for this map.
 
Methods inherited from interface uk.me.parabola.mkgmap.general.MapDataSource
getBounds, getLines, getOverviews, getPoints, getRoadNetwork, getShapes
 
Methods inherited from interface uk.me.parabola.util.Configurable
config
 

Method Detail

isFileSupported

boolean isFileSupported(java.lang.String name)
Determines if the file (or other resource) is supported by this map data source. The implementation may do this however it likes, eg by extension or by opening up the file and reading part of it.

Parameters:
name - The file (or other resource) to check.
Returns:
True if the loadable map data source supports that file.

load

void load(java.lang.String name)
          throws java.io.FileNotFoundException,
                 FormatException
Load map by name. The name is in a suitable form to be recognised by the particular map source. It could be a file name or a URI. You would implement this interface to read mapping data in an other format.

Parameters:
name - The name of the resource to be loaded.
Throws:
java.io.FileNotFoundException - When the file or resource is not found.
FormatException - For any kind of malformed input.

mapLevels

LevelInfo[] mapLevels()
Get the map levels for this map. This is an array of @{link LevelInfo} structures that map a level to a resolution. Some map data sources may actually have the concept of map layers that can be used to construct this information. Others may just have to provide a default that is useful with the map source. In the latter case it would be important to be able to configure the levels separately while creating the map.

Note that it does not include the top empty level as we will always generate that in the main program automatically.

Returns:
Array of structures that map the level to the resolution. Never returns null. Some kind of default should always be returned and this must include at least one level.

copyrightMessages

java.lang.String[] copyrightMessages()
Get a suitable copyright message for this map source. You can get this information from the input file, if the file has such information or as in the case of OSM the data has a well known copyright, so we can return fixed strings referring to it.

Returns:
An array of strings with copyright information. If there are none then return a zero length array.