uk.me.parabola.mkgmap.osmstyle
Class StyledConverter

java.lang.Object
  extended by uk.me.parabola.mkgmap.osmstyle.StyledConverter
All Implemented Interfaces:
OsmConverter

public class StyledConverter
extends java.lang.Object
implements OsmConverter

Convert from OSM to the mkgmap intermediate format using a style. A style is a collection of files that describe the mappings to be used when converting.

Author:
Steve Ratcliffe

Constructor Summary
StyledConverter(Style style, MapCollector collector, java.util.Properties props)
           
 
Method Summary
protected  boolean accessExplicitlyAllowed(java.lang.String val)
           
protected  boolean accessExplicitlyDenied(java.lang.String val)
           
 void convertNode(Node node)
          Takes a node (that has its own identity) and converts it from the OSM type to the Garmin map type.
 void convertRelation(Relation relation)
          Run the rules for this relation.
 void convertWay(Way way)
          This takes the way and works out what kind of map feature it is and makes the relevant call to the mapper callback.
 void end()
          Called when all conversion has been done.
 void setBoundingBox(Area bbox)
          Set the bounding box for this map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyledConverter

public StyledConverter(Style style,
                       MapCollector collector,
                       java.util.Properties props)
Method Detail

convertWay

public void convertWay(Way way)
This takes the way and works out what kind of map feature it is and makes the relevant call to the mapper callback.

As a few examples we might want to check for the 'highway' tag, work out if it is an area of a park etc.

Specified by:
convertWay in interface OsmConverter
Parameters:
way - The OSM way.

convertNode

public void convertNode(Node node)
Takes a node (that has its own identity) and converts it from the OSM type to the Garmin map type.

Specified by:
convertNode in interface OsmConverter
Parameters:
node - The node to convert.

setBoundingBox

public void setBoundingBox(Area bbox)
Set the bounding box for this map. This should be set before any other elements are converted if you want to use it. All elements that are added are clipped to this box, new points are added as needed at the boundary. If a node or a way falls completely outside the boundary then it would be omitted. This would not normally happen in the way this option is typically used however.

Specified by:
setBoundingBox in interface OsmConverter
Parameters:
bbox - The bounding area, must not be null.

end

public void end()
Description copied from interface: OsmConverter
Called when all conversion has been done.

Specified by:
end in interface OsmConverter

convertRelation

public void convertRelation(Relation relation)
Run the rules for this relation. As this is not an end object, then the only useful rules are action rules that set tags on the contained ways or nodes. Every rule should probably start with 'type=".."'.

Specified by:
convertRelation in interface OsmConverter
Parameters:
relation - The relation to convert.

accessExplicitlyAllowed

protected boolean accessExplicitlyAllowed(java.lang.String val)

accessExplicitlyDenied

protected boolean accessExplicitlyDenied(java.lang.String val)