org.openstreetmap.osmosis.core.pgsql.v0_5.impl
Class WayDao

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

public class WayDao
extends java.lang.Object
implements Releasable

Performs all way-specific db operations.

Author:
Brett Henderson

Constructor Summary
WayDao(DatabaseContext dbCtx)
          Creates a new instance.
 
Method Summary
 Way getWay(long wayId)
          Loads the specified way from the database.
 ReleasableIterator<Way> iterate()
          Returns an iterator providing access to all ways in the database.
 ReleasableIterator<Way> iterateBoundingBox(double left, double right, double top, double bottom, boolean completeWays)
          Allows all data within a bounding box to be iterated across.
 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
 

Constructor Detail

WayDao

public WayDao(DatabaseContext dbCtx)
Creates a new instance.

Parameters:
dbCtx - The database context to use for accessing the database.
Method Detail

getWay

public Way getWay(long wayId)
Loads the specified way from the database.

Parameters:
wayId - The unique identifier of the way.
Returns:
The loaded way.

iterate

public ReleasableIterator<Way> iterate()
Returns an iterator providing access to all ways in the database.

Returns:
The way iterator.

iterateBoundingBox

public ReleasableIterator<Way> iterateBoundingBox(double left,
                                                  double right,
                                                  double top,
                                                  double bottom,
                                                  boolean completeWays)
Allows all data within a bounding box to be iterated across.

Parameters:
left - The longitude marking the left edge of the bounding box.
right - The longitude marking the right edge of the bounding box.
top - The latitude marking the top edge of the bounding box.
bottom - The latitude marking the bottom edge of the bounding box.
completeWays - If true, all ways within the ways will be returned even if they lie outside the box.
Returns:
An iterator pointing to the start of the result data.

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