uk.me.parabola.mkgmap.reader.polish
Class PolishMapDataSource

java.lang.Object
  extended by uk.me.parabola.mkgmap.reader.MapperBasedMapDataSource
      extended by uk.me.parabola.mkgmap.reader.polish.PolishMapDataSource
All Implemented Interfaces:
LoadableMapDataSource, MapDataSource, Configurable

public class PolishMapDataSource
extends MapperBasedMapDataSource
implements LoadableMapDataSource

Read an data file in Polish format. This is the format used by a number of other garmin map making programs notably cGPSmapper.

As the input format is designed for garmin maps, it is fairly easy to read into mkgmap. Not every feature of the format is read yet, but it shouldn't be too difficult to add them in as needed.

Now will place elements at the level specified in the file and not at the automatic level that is used in eg. the OSM reader.

Author:
Steve Ratcliffe

Field Summary
 
Fields inherited from class uk.me.parabola.mkgmap.reader.MapperBasedMapDataSource
mapper
 
Constructor Summary
PolishMapDataSource()
           
 
Method Summary
 java.lang.String[] copyrightMessages()
          Get the copyright message.
 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 the .osm file and produce the intermediate format.
 LevelInfo[] mapLevels()
          Get the map levels for this map.
static java.lang.String unescape(java.lang.String s)
          Deal with the polish map escape codes of the form ~[0x##].
 
Methods inherited from class uk.me.parabola.mkgmap.reader.MapperBasedMapDataSource
addBackground, addBackground, addBoundaryLine, config, getBounds, getConfig, getLines, getMapper, getOverviews, getPoints, getRoadNetwork, getShapes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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
 

Constructor Detail

PolishMapDataSource

public PolishMapDataSource()
Method Detail

isFileSupported

public boolean isFileSupported(java.lang.String name)
Description copied from interface: LoadableMapDataSource
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.

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

load

public void load(java.lang.String name)
          throws java.io.FileNotFoundException,
                 FormatException
Load the .osm file and produce the intermediate format.

Specified by:
load in interface LoadableMapDataSource
Parameters:
name - The filename to read.
Throws:
java.io.FileNotFoundException - If the file does not exist.
FormatException - For any kind of malformed input.

mapLevels

public LevelInfo[] mapLevels()
Description copied from interface: LoadableMapDataSource
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.

Specified by:
mapLevels in interface LoadableMapDataSource
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

public java.lang.String[] copyrightMessages()
Get the copyright message. We use whatever was specified inside the MPF itself.

Specified by:
copyrightMessages in interface LoadableMapDataSource
Returns:
A string description of the copyright.

unescape

public static java.lang.String unescape(java.lang.String s)
Deal with the polish map escape codes of the form ~[0x##]. These stand for a single character and is usually used for highway symbols, name separators etc. The code ~[0x05] stands for the character \005 for example.

Parameters:
s - The original string that may contain codes.
Returns:
A string with the escape codes replaced by the single character.