org.openstreetmap.osmosis.core.pgsql.v0_6.impl
Class WayGeometryBuilder

java.lang.Object
  extended by org.openstreetmap.osmosis.core.pgsql.v0_6.impl.WayGeometryBuilder
All Implemented Interfaces:
Releasable

public class WayGeometryBuilder
extends java.lang.Object
implements Releasable

Caches a set of node latitudes and longitudes and uses these to calculate the geometries for ways.

Author:
Brett Henderson

Field Summary
protected  NodeLocationStore locationStore
          Stores the locations of nodes so that they can be used to build the way geometries.
 
Constructor Summary
WayGeometryBuilder(NodeLocationStoreType storeType)
          Creates a new instance.
 
Method Summary
 void addNodeLocation(Node node)
          Adds the location of the node to the internal store.
protected  org.postgis.LineString createLinestring(java.util.List<org.postgis.Point> points)
          Creates a linestring from a list of points.
 org.postgis.Polygon createWayBbox(Way way)
          Builds a bounding box geometry object from the node references in the specified way.
 org.postgis.LineString createWayLinestring(Way way)
          Builds a linestring geometry object from the node references in the specified way.
 void release()
          Performs resource cleanup tasks such as closing files, or database connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

locationStore

protected NodeLocationStore locationStore
Stores the locations of nodes so that they can be used to build the way geometries.

Constructor Detail

WayGeometryBuilder

public WayGeometryBuilder(NodeLocationStoreType storeType)
Creates a new instance.

Parameters:
storeType - The type of storage to use for holding node locations.
Method Detail

addNodeLocation

public void addNodeLocation(Node node)
Adds the location of the node to the internal store.

Parameters:
node - The node to add.

createLinestring

protected org.postgis.LineString createLinestring(java.util.List<org.postgis.Point> points)
Creates a linestring from a list of points.

Parameters:
points - The points making up the line.
Returns:
The linestring.

createWayBbox

public org.postgis.Polygon createWayBbox(Way way)
Builds a bounding box geometry object from the node references in the specified way. Unknown nodes will be ignored.

Parameters:
way - The way to create the bounding box for.
Returns:
The bounding box surrounding the way.

createWayLinestring

public org.postgis.LineString createWayLinestring(Way way)
Builds a linestring geometry object from the node references in the specified way. Unknown nodes will be ignored.

Parameters:
way - The way to create the linestring for.
Returns:
The linestring representing the way.

release

public void release()
Performs resource cleanup tasks such as closing files, or database connections. This must be called after all processing is complete and may be called multiple times. Implementations must call release on any nested Releasable objects. It should be called within a finally block to ensure it is called in exception scenarios.

Specified by:
release in interface Releasable