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

java.lang.Object
  extended by uk.me.parabola.mkgmap.reader.osm.OsmReadingHooksAdaptor
All Implemented Interfaces:
OsmReadingHooks
Direct Known Subclasses:
HighwayHooks, SeaGenerator

public class OsmReadingHooksAdaptor
extends java.lang.Object
implements OsmReadingHooks

Provides empty implementation of all methods so that subclass that only need a few can just implement the ones they want.

Author:
Steve Ratcliffe

Constructor Summary
OsmReadingHooksAdaptor()
           
 
Method Summary
 void end()
          Called after the file has been read.
 java.util.Set<java.lang.String> getUsedTags()
          Retrieves the tags that are used by this hook.
 boolean init(ElementSaver saver, EnhancedProperties props)
          Passes in the element saver and the command line options.
 void onAddNode(Node node)
          Called on adding a node to the saver and just before it is added.
 void onAddWay(Way way)
          Add the given way.
 void onCoordAddedToWay(Way way, long coordId, Coord co)
          This is called whenever a node is added to a way.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OsmReadingHooksAdaptor

public OsmReadingHooksAdaptor()
Method Detail

init

public boolean init(ElementSaver saver,
                    EnhancedProperties props)
Description copied from interface: OsmReadingHooks
Passes in the element saver and the command line options. The hook code can use the options to set itself up if needed. The saver gives access to the previously saved nodes/ways/relations and also allows you to add extra ways.

Specified by:
init in interface OsmReadingHooks
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
Returns:
the tag names used by this hook

onAddNode

public void onAddNode(Node node)
Description copied from interface: OsmReadingHooks
Called on adding a node to the saver and just before it is added. You can modify it, create new nodes etc.

Specified by:
onAddNode in interface OsmReadingHooks
Parameters:
node - The node to be added.

onAddWay

public void onAddWay(Way way)
Description copied from interface: OsmReadingHooks
Add the given way. The way must be complete, call after the end tag is seen for the XML format.

Specified by:
onAddWay in interface OsmReadingHooks
Parameters:
way - The osm way.

onCoordAddedToWay

public void onCoordAddedToWay(Way way,
                              long coordId,
                              Coord co)
Description copied from interface: OsmReadingHooks
This is called whenever a node is added to a way. A node is something with tags, not just a Coord. The way will not have been added via addWay() yet. The node is the node that

Specified by:
onCoordAddedToWay in interface OsmReadingHooks
Parameters:
way - The incomplete way.
coordId - The coordinate id of the node that is being added.
co - The coordinate.

end

public void end()
Description copied from interface: OsmReadingHooks
Called after the file has been read. Can be used to add more elements to the saver based on information stored up.

Specified by:
end in interface OsmReadingHooks