uk.me.parabola.mkgmap.reader.osm
Class SeaGenerator

java.lang.Object
  extended by uk.me.parabola.mkgmap.reader.osm.OsmReadingHooksAdaptor
      extended by uk.me.parabola.mkgmap.reader.osm.SeaGenerator
All Implemented Interfaces:
OsmReadingHooks

public class SeaGenerator
extends OsmReadingHooksAdaptor

Code to generate sea polygons from the coastline ways. Currently there are a number of different options. Should pick one that works well and make it the default.


Constructor Summary
SeaGenerator()
           
 
Method Summary
 void end()
          All done, process the saved shoreline information and construct the polygons.
 java.util.Set<java.lang.String> getUsedTags()
          Retrieves the tags that are used by this hook.
 boolean init(ElementSaver saver, EnhancedProperties props)
          Sort out options from the command line.
static java.util.ArrayList<Way> joinWays(java.util.Collection<Way> segments)
          Joins the given segments to closed ways as good as possible.
 void onAddWay(Way way)
          Test to see if the way is part of the shoreline and if it is we save it.
 
Methods inherited from class uk.me.parabola.mkgmap.reader.osm.OsmReadingHooksAdaptor
onAddNode, onCoordAddedToWay
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SeaGenerator

public SeaGenerator()
Method Detail

init

public boolean init(ElementSaver saver,
                    EnhancedProperties props)
Sort out options from the command line. Returns true only if the option to generate the sea is active, so that the whole thing is omitted if not used.

Specified by:
init in interface OsmReadingHooks
Overrides:
init in class OsmReadingHooksAdaptor
Parameters:
saver - This is where all the elements are being collected. You can access previously added elements from here by their id. You can also add generated elements. You must not add the element that is being passed in as it will be added automatically.
props - The command line options.
Returns:
If you return false then this set of hooks will not be used. So if they are not needed based on the options supplied you can disable it.

getUsedTags

public java.util.Set<java.lang.String> getUsedTags()
Description copied from interface: OsmReadingHooks
Retrieves the tags that are used by this hook. Tags that are used only if they are referenced in the style file should not be added to this list.

Specified by:
getUsedTags in interface OsmReadingHooks
Overrides:
getUsedTags in class OsmReadingHooksAdaptor
Returns:
the tag names used by this hook

onAddWay

public void onAddWay(Way way)
Test to see if the way is part of the shoreline and if it is we save it.

Specified by:
onAddWay in interface OsmReadingHooks
Overrides:
onAddWay in class OsmReadingHooksAdaptor
Parameters:
way - The way to test.

joinWays

public static java.util.ArrayList<Way> joinWays(java.util.Collection<Way> segments)
Joins the given segments to closed ways as good as possible.

Parameters:
segments - a list of closed and unclosed ways
Returns:
a list of ways completely joined

end

public void end()
All done, process the saved shoreline information and construct the polygons.

Specified by:
end in interface OsmReadingHooks
Overrides:
end in class OsmReadingHooksAdaptor