uk.me.parabola.mkgmap.reader.overview
Class OverviewMapDataSource

java.lang.Object
  extended by uk.me.parabola.mkgmap.reader.MapperBasedMapDataSource
      extended by uk.me.parabola.mkgmap.reader.overview.OverviewMapDataSource
All Implemented Interfaces:
OverviewMap, LoadableMapDataSource, MapCollector, MapDataSource, Configurable

public class OverviewMapDataSource
extends MapperBasedMapDataSource
implements OverviewMap

Class for creating an overview map. Nothing is actually read in from a file, we just save some detail from the other img files that are going into the map set.

Author:
Steve Ratcliffe

Field Summary
 
Fields inherited from class uk.me.parabola.mkgmap.reader.MapperBasedMapDataSource
mapper
 
Constructor Summary
OverviewMapDataSource()
           
 
Method Summary
 void addCopyright(java.lang.String cw)
          Add a copyright string to the map.
 void addLine(MapLine line)
          Add a line to the map.
 void addPoint(MapPoint point)
          Add a point to the map.
 void addRestriction(CoordNode fromNode, CoordNode toNode, CoordNode viaNode, byte exceptMask)
          Add a routing restriction to the map.
 void addRoad(MapRoad road)
          For adding a road.
 void addShape(MapShape shape)
          Add the given shape (polygon) to the map.
 void addThroughRoute(long junctionNodeId, long roadIdA, long roadIdB)
          Add a through route to the map.
 void addToBounds(Coord p)
          Add the given point to the total bounds for the map.
 java.lang.String[] copyrightMessages()
          All the copyright messages that were found in the input files are returned here.
 int getShift()
          Get the 'shift' value of the overview map.
 boolean isFileSupported(java.lang.String name)
          This is a fake source of data and is not read from a file, so always return false here.
 void load(java.lang.String name)
          Load map by name.
 LevelInfo[] mapLevels()
          Get the map levels for this map.
 
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

OverviewMapDataSource

public OverviewMapDataSource()
Method Detail

isFileSupported

public boolean isFileSupported(java.lang.String name)
This is a fake source of data and is not read from a file, so always return false here.

Specified by:
isFileSupported in interface LoadableMapDataSource
Parameters:
name - The filename, ignored.
Returns:
Always false.

load

public void load(java.lang.String name)
          throws java.io.FileNotFoundException,
                 FormatException
Description copied from interface: LoadableMapDataSource
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.

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

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.

addCopyright

public void addCopyright(java.lang.String cw)
Add a copyright string to the map.

Specified by:
addCopyright in interface OverviewMap
Parameters:
cw - The string to add.

copyrightMessages

public java.lang.String[] copyrightMessages()
All the copyright messages that were found in the input files are returned here.

Specified by:
copyrightMessages in interface LoadableMapDataSource
Returns:
An array of copyright messages.

addToBounds

public void addToBounds(Coord p)
Add the given point to the total bounds for the map.

Specified by:
addToBounds in interface MapCollector
Parameters:
p - The coordinates of the point to add. The type here will change to Node.

addPoint

public void addPoint(MapPoint point)
Add a point to the map.

Specified by:
addPoint in interface MapCollector
Parameters:
point - The point to add.

addLine

public void addLine(MapLine line)
Add a line to the map.

Specified by:
addLine in interface MapCollector
Parameters:
line - The line information.

addShape

public void addShape(MapShape shape)
Add the given shape (polygon) to the map. A shape is very similar to a line but they are separate because they need to be put in different sections in the output map.

Specified by:
addShape in interface MapCollector
Parameters:
shape - The polygon to add.

addRoad

public void addRoad(MapRoad road)
Description copied from interface: MapCollector
For adding a road. Although a road is a kind of line, it is treated differently so that we can join up roads that are split into several segments and to do routing etc.

Specified by:
addRoad in interface MapCollector

addRestriction

public void addRestriction(CoordNode fromNode,
                           CoordNode toNode,
                           CoordNode viaNode,
                           byte exceptMask)
Description copied from interface: MapCollector
Add a routing restriction to the map. This is something such as no left turn.

Specified by:
addRestriction in interface MapCollector
exceptMask - For exceptions eg. no-left-turn except for buses.

addThroughRoute

public void addThroughRoute(long junctionNodeId,
                            long roadIdA,
                            long roadIdB)
Description copied from interface: MapCollector
Add a through route to the map.

Specified by:
addThroughRoute in interface MapCollector

getShift

public int getShift()
Description copied from interface: OverviewMap
Get the 'shift' value of the overview map. This is used for rounding coordinates of objects that are added to the map.

Specified by:
getShift in interface OverviewMap
Returns:
An integer shift value, that is 24-bits.