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

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

public class RelationDao
extends java.lang.Object
implements Releasable

Performs all relation-specific db operations.

Author:
Brett Henderson

Constructor Summary
RelationDao(DatabaseContext dbCtx)
          Creates a new instance.
 
Method Summary
 Relation getRelation(long relationId)
          Loads the specified relation from the database.
 ReleasableIterator<Relation> iterate()
          Returns an iterator providing access to all nodes in the database.
 ReleasableIterator<Relation> iterateBoundingBox(double left, double right, double top, double bottom, boolean completeRelations)
          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

RelationDao

public RelationDao(DatabaseContext dbCtx)
Creates a new instance.

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

getRelation

public Relation getRelation(long relationId)
Loads the specified relation from the database.

Parameters:
relationId - The unique identifier of the relation.
Returns:
The loaded relation.

iterate

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

Returns:
The node iterator.

iterateBoundingBox

public ReleasableIterator<Relation> iterateBoundingBox(double left,
                                                       double right,
                                                       double top,
                                                       double bottom,
                                                       boolean completeRelations)
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.
completeRelations - If true, all relations within the relations 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