uk.me.parabola.mkgmap.main
Class StyleTester

java.lang.Object
  extended by uk.me.parabola.mkgmap.main.StyleTester
All Implemented Interfaces:
OsmConverter

public class StyleTester
extends java.lang.Object
implements OsmConverter

Test style rules by converting to a text format, rather than a .img file. In addition you can specify a .osm file and a style file separately.

Single test file

The format of the file is as follows
 WAY 42
 highway=primary
 oneway=reverse

 <<>>
 highway=primary [0x3 road_class=2 road_speed=2]
 power=line [0x29 resolution 20]
 
You can have any number of ways, each must end with a blank line. A way will be created with two points (1,1),(2,2) (so you can see the action of oneway=reverse) and the tags that you specify. If you give a number after WAY it will be printed on output so that if you have more than one you can tell which is which. If the number is omitted it will default to 1. You can have as many rules as you like after the <<>> and you can include any other style files such as <<>> or <<>> if you like.

osm file mode

Takes two arguments, first the style file and then the osm file. You can give a --reference flag and it will run style file in reference mode, that is each rule will be applied to the element without any attempt at optimisation. This acts as an independent check of the main style code which may have more optimisations.

Author:
Steve Ratcliffe

Method Summary
 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)
          Takes a relation and applies rules that affect the garmin types of its contained elements.
 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.
static void forceUseOfGiven(boolean force)
           
static void main(java.lang.String[] args)
           
static void runSimpleTest(java.lang.String filename)
          Run a simple test with a combined test file.
 void setBoundingBox(Area bbox)
          Set the bounding box for this map.
static void setOut(java.io.PrintStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException

setOut

public static void setOut(java.io.PrintStream out)

runSimpleTest

public static void runSimpleTest(java.lang.String filename)
Run a simple test with a combined test file.

Parameters:
filename - The test file contains text way definitions and a style file all in one.

convertWay

public void convertWay(Way way)
Description copied from interface: OsmConverter
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)
Description copied from interface: OsmConverter
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.

convertRelation

public void convertRelation(Relation relation)
Description copied from interface: OsmConverter
Takes a relation and applies rules that affect the garmin types of its contained elements. The relation rules are run first. A relation contains references to a number of nodes, ways and even other relations, as well as its own set of tags. They have many purposes some of which are not relevant to styling.

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

setBoundingBox

public void setBoundingBox(Area bbox)
Description copied from interface: OsmConverter
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.

end

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

Specified by:
end in interface OsmConverter

forceUseOfGiven

public static void forceUseOfGiven(boolean force)