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

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

public class HighwayHooks
extends OsmReadingHooksAdaptor

Operations mostly on highways that have to be performed during reading the OSM input file. Some of this would be much better done in a style file or by extending the style system.


Constructor Summary
HighwayHooks()
           
 
Method Summary
 void end()
          Called after the file has been read.
 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 id, Coord co)
          This is called whenever a node is added to a way.
 
Methods inherited from class uk.me.parabola.mkgmap.reader.osm.OsmReadingHooksAdaptor
getUsedTags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HighwayHooks

public HighwayHooks()
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
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.

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
Overrides:
onAddNode in class OsmReadingHooksAdaptor
Parameters:
node - The node to be added.

onCoordAddedToWay

public void onCoordAddedToWay(Way way,
                              long id,
                              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
Overrides:
onCoordAddedToWay in class OsmReadingHooksAdaptor
Parameters:
way - The incomplete way.
id - The coordinate id of the node that is being added.
co - The coordinate.

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
Overrides:
onAddWay in class OsmReadingHooksAdaptor
Parameters:
way - The osm way.

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
Overrides:
end in class OsmReadingHooksAdaptor